the problem is that when i run application the modeless dialog box open a screen after clicking on ok button of fiest dialog box
but when i cancel the modeless dialog and again click on ok button of first dialog box then it will give an assertion error and does not create modeless dialog box again
plz sovle this one
After exiting DoModal, the attached window of CDialog object is destroyed and detached, so there is no problem to call DoModal again.
For a modeless dialog (made with CDialog::Create), unless the CDialog object goes out-of scope or DestroyWindow was called, the window is not destroyed, not even the user pushes OK/Cancel/close button.
So you have to test if the dialog was created before call CDialog::Create.
If yes, then simply show it:
void CFoo::ShowModelessDialog(CDialog& dlg, UINT nResID)
if(!::IsWindow(dlg.m_hWnd)) // thest attached window handle
// create only if not yet created
// ... somewhere ...
// ... and no problem to show again
NOTE: You can test m_hWnd against NULL instead of calling ::IsWindow, as well.
In you use this code
this is not safe, because the dlg object is created in Stack and it will get destroyed
as soon as the function is out of scope.
Create ModeLess Dialogs in Heap or Make Sure that the Object is not out of scope by making is
static or Global/Top Clsss Variale Like.
One Way of Doing It is:
static CMy * Dlg =NULL;
Dlg= new CMy();
Hey, hey, dear Indian Idol!
To be clear.
I didn't suggest to declare a CDialog object locally in a function. Did you see that in may example?
If you pay a little bit more attention, can observe that I prefixed with m_ which suggest that m_dlg is a member of class CFoo.
And your static CMy *Dlg locally declared in OnSomeFunction() smells a C.
And by the way... where you think it's possible to delete *Dlg in order to get rid of memory leaks?
Working on a wizard type dilaog application and taken the idea of creating wizard from the below link
Here having one problem:
what I am doing is that Suppose right now on property page number 3 and performing some operaion, after finishing operation want to jump on the next page (number 4) automatically, without clicking on the Next Button.
For this using SetActivePage(int i) function. but this function throws exception.
One more thing that when I jump from Page 3 to Page 2 it jumps successfully, problem is with the pages ahead.
So Please tell me that how to jump over the next page in the wizard automatically
Last Visit: 31-Dec-99 18:00 Last Update: 18-Jun-21 15:12