VC6 simultaneous display of two dialog boxes: retinyl ago

zhaozj2021-02-08  260

For VC beginners, you may encounter such a problem: a Dialog-based MFC AppWizard application, insert a dialog, how to display these two dialogs at the same time?

---- In fact, this problem is very simple, you want to display two dialogs on the screen, and both dialogs can be activated, then at least the second dialog should be a non-modular dialog. The method of starting the Non-Modular Dialog box is the same as the step of starting a normal window, that is, the CREATE () function that calls the window class first creates a window object, and use showWindow () to display it (worth noting that : The object of the second dialog cannot be partial variables, otherwise the object is automatically turned off when exiting OnInitDialog, causing the second window to close). For example, the following code demonstrates how to launch another non-modular dialog in the OnInitDialog () of the main dialog.

CDIALOG2 DLG2; // Note that DLG2 cannot be

Local variable of OnInitDialog.

Bool cdialog1 :: oninitdialog ()

{

CDIALOG :: OnInitdialog ();

Dlg2.create (IDD_DIALOG2, THIS);

DLG2.SHOWINDOW (SW_SHOW);

}

---- Compile and run, how, is it ok?

Reprinted from the Chinese programmer website

转载请注明原文地址:https://www.9cbs.com/read-1470.html

New Post(0)