Jump to content
  • Advertisement
Sign in to follow this  
fathom88

Question On Creating PopUp Dialog Window

This topic is 4819 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

I have a silly question on creating a pop up dialog window. I'm trying to have a new dialog window pop up a window on a button press. Inside my OnButtonPress function, I wrote CMyDialogWin *NewWindow = new CMyDialogWin; NewWindow->Create(ID_POP_WIN); NewWindow->ShowWindow(SW_SHOW); This seems to work fine. However, I think the memory allocated by new is still present. The pop up window exits on its own via the OnOK/OnClose button press. I changed the code to CMyDialogWin NewWindow; NewWindow.Create(ID_POP_WIN); NewWindow.ShowWindow(SW_SHOW); This would remove the memory problem, but the window does not pop up correctly. It appears for a quick moment and goes away. What is the correct way to create a pop up window? Thanks.

Share this post


Link to post
Share on other sites
Advertisement
Assuming you're using MFC and this is a CWnd derivative, you can simply do delete this; in an override of CWnd::PostNcDestroy (). The other way to do this would be to call CWnd::DestroyWindow () when you need the window and class object destroyed.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!