mfc >> Two Dialog Resources, one dialog object?

by sm_sharp » Mon, 26 Apr 2004 21:19:55 GMT

Can someone please tell me if it is possible to have two dialogs in my
resource view that link to the same dialog object? or will I have to
implement a 'dialog functionality' object that is called from my event
methods?

I want to allow my users to choose from two different sized dialogs
(one large, one small) depending on their registry settings. The
dialogs would essentially be the same, with identical controls, just
different layouts.

Alternatively, is there any way to dynamically 'scale up' my dialog
whilst still allowing it to be edited in resource view?

I am using Visual Studio .NET

Thanks in advance,
Steph

P.S. Sorry for accidentally posting this to microsoft.public.vc

mfc >> Two Dialog Resources, one dialog object?

by Scott McPhillips [MVP] » Tue, 27 Apr 2004 02:13:11 GMT



The dialog resource is passed to the CDialog constructor. You could
modify your constructor to accept the desired resource ID as a parameter.

It is also possible to resize and rearrange your dialog dynamically.
You can do this by calling SetWindowPos for the dialog and for every
control.

--
Scott McPhillips [VC++ MVP]

Similar Threads

1. Moving dialog resources from one project into another

I am using the .net IDE. I have a project that has dialog box resources that
I would like to use in another project. Is there a convenient way to move
them into the new project without having to redo them.

Thank you in advance for any help you can provide

-Jon


2. Moving dialog resources from one project to another - Microsoft Visual C++/VC++

3. how to manually create dialog based on dialog resource

How do I manually create a dialog based on a dialog resource?
I have a window based class, that I want to manually create based on a
dialog resource.


4. Display one dialog image in another dialog Picture control

5. com objects (CAPICOM), modal dialog and one thread

Hi,

 My application calls objects and methods from capicom.dll after user
choose (press) controls on dialog box.

 Here is sample code:
    IStorePtr	store (__uuidof( Store ));	// otwz obiekt Store
    DWORD	dwRetValue;

    ICertificates2Ptr certificates;
    if(store==NULL){
	this->dwErrorCode = SCC_CAPICOM_ERROR_INITIALIZATION;
	return false;
    } // ificates2Ptr certificates;if(store==NULL)

    try{
	store->Open( CAPICOM_CURRENT_USER_STORE,
		CAPICOM_MY_STORE,
		CAPICOM_STORE_OPEN_READ_ONLY);
	}catch(...){
		this->dwErrorCode = SCC_CAPICOM_ERROR_STORE_OPEN;
		return false;
	}

  And here is the problem:
  1. user press button 'Select certificate' (in my apps)
  +------------------------+
  | Application Window     |
  |                        |
  |  <Select certificate>  |
  +------------------------|

  2. there is message fired -> button pressed (or something like that)
and is event procedure i call many objects from capicom (one of the
methods displays 'Select' dialog box that interacts with user)

  +------------------------+
  | Application Window     |
  |                        |
  |  <Select certificate>  |     +------------------------+
  +------------------------|     | Select dialog box      |
                                 |        <OK>            |
                                 +------------------------+


  3. meanwhile user can once again press button 'Select certificate'
because dialog box that is displayed in step 2 isn't modal (and as far
as I know is in another thread).


  +------------------------+
  | Application Window     |
  |                        |
  |  <Select certificate>  |     +------------------------+
  +------------------------|     | Select dialog box      |
                                 |        <OK>            |
                       +------------------------+---------+
                       | Select dialog box      |
  another -->          |        <OK>            |
  select               +------------------------+
  dialog      


  and the question is: how to prevent such situation? do I have to put
some semaphores/critical sections to 'manually' prevent step 3, or is
it possible to somehow tell com objects that it must be runned in the
same thread and that while it's running no other messages are queued
in message queue.


   looking for help,
   andrzeJ

6. Why is my DLL not able to contain any resource (dialog resource)

7. Confused One Object and Two or more Objects

	There are repeated discussions in newsgroups and websites about
namespace and singleton.  The programmers who struggle to make their
decision to choose either namespace or singleton.  They always think
ne Objectand wo or more Objects
	One object is like a disk drive.  The programmers choose to use
namespace, but they are unable to use encapsulation if they don use
class.  They place global variables and global functions in the
namespace.  They are visible to all multiple source codes.
	The programmers decide to use this method because they want critical
performance for one object as disk drive.  Global variables increase
performance because they can be accessed directly by any function and
the overhead of passing data to functions is eliminated.  It is
explained in the page 1292 of Deitel How to program C++ 6th edition
book.
	Why do they choose namespace if they design to have only one file
scope?  Why not they do not use class?  They should use singleton.
All member variables and member functions are declared static inside
singleton class while they are treated like true global variables and
global functions.
	The programmers choose to create same two or more objects.  Two or
more objects is like a car.  They should use car class with member
variables and member functions because car class has its own one copy
for each object with good encapsulation.
	They can put them on the screen.  The car objects are moving around
the screen like game programming.  They don need critical
performance, but memory cache may be good.
	Why do they claim that namespace is perfect for critical
performance?  Why not they claim singleton with or without static for
good memory cache?

8. One menu resource, two icons