Question

I implemented a dialog-based Win32 Visual C++ application (Visual Studio Ultimate 2012) by following this article.

What is the way to call another dialog box (by clicking on a button) from the one I already created?

Était-ce utile?

La solution

Add a button to the dialog in the dialog resource view. Just drag a button from the toolbar onto the dialog template. When the button is clicked you will get a WM_COMMAND message containing the button ID and the BN_CLICKED notification code.

http://msdn.microsoft.com/en-us/library/windows/desktop/bb761825(v=vs.85).aspx

Add a case in your DialogProc to detect the click. When you get it, create a new dialog by calling the DialogBox API.

http://msdn.microsoft.com/en-us/library/windows/desktop/ms645452(v=vs.85).aspx

This second dialog will need you to write a new DialogProc2, just like the first DialogProc, to handle messages from the second dialog.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top