Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Evil Bill

Modeless Dialogs and MFC - How?

This topic is 5763 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

How do you create a modelss dialog with MFC? I know you can use CDialog::DoModal() to create a modal one, but the MSDN says to use CDialog::Create(). If i use that, i need to use new to create the dialog, otherwise it goes out of scope and closes. The problem is that OnDestroy() isn''t ever called, and i get a message in the debug output saying:
quote:
Warning: calling DestroyWindow in CDialog::~CDialog -- OnDestroy or PostNcDestroy in derived class will not be called.
Has anyone ever managed to get modelss dialogs working? Cheers, Steve Steve
DirectX Programmer
Soon to be the new Bill Gates

Share this post


Link to post
Share on other sites
Advertisement
A search on google for "modeless dialog mfc" turns up several links, including several msdn pages...

Among the results was:

http://www.codeproject.com/dialog/modelesssibling.asp

Also, for MFC stuff generally try www.codeguru.com, they usually have some good stuff, for example, http://codeguru.earthweb.com/propertysheet/modeless_wizard.shtml

Alan

Share this post


Link to post
Share on other sites
Thanks, I''ll take a look at the code project link. I actually had a look at CodeGuru.com, and didn''t see anything of much use.

Cheers,
Steve

Steve
DirectX Programmer
Soon to be the new Bill Gates

Share this post


Link to post
Share on other sites
May be able to answer your Q:
[from the MSDN CDialog front page]

When you implement a modeless dialog box, always override the OnCancel member function and call DestroyWindow from within it. Don''t call the base class CDialog::OnCancel, because it calls EndDialog, which will make the dialog box invisible but will not destroy it. You should also override PostNcDestroy for modeless dialog boxes in order to delete this, since modeless dialog boxes are usually allocated with new. Modal dialog boxes are usually constructed on the frame and do not need PostNcDestroy cleanup.

[/from the MSDN CDialog front page]

I would like to know (on a related yet selfishly thread hijacking matter) how to communicate between the main prog and the modeless box. For example in a drawing program which requires properties of a graphics object; the dialog box for example has an x and y edit box... How do i update the main prog on manipulation of the box values?

Share this post


Link to post
Share on other sites
quote:
Original post by TheHermit
I would like to know (on a related yet selfishly thread hijacking matter) how to communicate between the main prog and the modeless box. ...How do i update the main prog on manipulation of the box values?

TN026: DDX and DDV Routines

Alternatively, define a user message and use that (along with PostMessage) to pass data between the dialog and the main window.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!