GetDlgItemThe Button1 button in the Calculator window executes the call to a Mycalc class window.
void Ccalculatordlg::onbnclickedbutton1 ()
{
TODO: Add control notification Handler code here
Mycalc *mycalc_dlg = new Mycalc;
Mycalc_dlg->create (Idd_dialog1,null);
Mycalc_dlg->showwindow (Sw_show);
Non-modal
}
Several functions: 1.GetdlgItem:
DLG--A dialog window, a control.
returns a pointer to the object of the dialog window or control, based on the ID of a dialog window or a control.
For example, IDC_EDIT1 is the ID
of the control cedit* Pboxone;
Pboxone = (cedit*) GetDlgItem (idc_edit1);
With GetDlgItem (IDC_EDIT1); Returns a pointer to this control, cedit*, into Pboxone.
Next, you can use it, for example:
Gotodlgctrl (Pboxone);
2.create () in vs2010 two different forms:
Virtual BOOL Create (
lpctstr lpsztemplatename,
cwnd* pparentwnd = NULL
);
Virtual BOOL Create (
UINT nidtemplate,
cwnd* pparentwnd = NULL
);
Lpsztemplatename
Contains a string that is the name of a dialog template resource that is null-terminated. pParentWnd
A pointer to the parent window object (type CWnd) dialog object belongs to. If NULL, the parent window of the dialog object is set as the main application window. nIDTemplate
Contains the ID number of the dialog template resource.
If the dialog box is created and initialized successfully, both forms return non 0; otherwise 0.
3.ShowWindow () CWnd::ShowWindow
BOOL ShowWindow (int ncmdshow);
Return value: Returns a value other than 0 if the window was originally visible, or 0 if the CWnd was originally hidden.
Parameters:
nCmdShow |
Specifies how CWnd should be displayed. It must be one of the following values:
Sw_hide |
Hides the window and passes the active state to the other window. |
Sw_minimize |
Minimizes the window and activates the top-level window in the System list. |
Sw_restore |
Activates and displays the window. If the window is minimized or maximized, Windows recovers its original size and position. |
Sw_show |
Activates the window and displays it at its current size and position. |
Sw_showmaximized |
Activates the window and displays it as a maximized window. |
Sw_showminimized |
Activates the window and displays it as an icon. |
Sw_showminnoactive |
Displays the window as an icon. The currently active window remains active. |
Sw_showna |
Displays the window in the current state. The currently active window remains active. |
Sw_shownoactivate |
Displays the nearest size and position of the window. The currently active window remains active. |
Sw_shownormal |
Activates and displays the window. If the window is minimized or maximized, Windows recovers its original size and position. |
|
Description
This function sets the visual state of the window.
Each application applies only cwinapp::m_ncmdshow to the primary window and calls once ShowWindow. Later calls to ShowWindow should be replaced with the values listed above
Cwinapp::m_ncmdshowThe specified value.