简体   繁体   中英

How to call a dialog box from another (Win32 application)

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM