I. IntroductionDialog Technology
---- The following describes how to introduce the mode-based dialog box technology when creating ActiveX controls. The procedure is as follows:
Create a newThe MFC ActiveX ControlWizard project named Hello. Use the default options for other items;
InAdd a dialog box resource on the ResourceView page named IDD_HELLODIALOG.
Put your own controls on the box;
Resources for the dialog boxIDD_HELLODIALOG create a new class CHelloDialog, inherited from CDialog;
Confirm inThe statement # include "HelloDialog. h" has been added to HelloCtrl. h, which is the CHelloCtrl class.
Add member variablesCHelloDialog m_helloDialog;
UseClassWizard adds a method void DoHello () for CHelloCtrl on the Automation page.
The Department name is alsoDoHello;
Void CHelloCtrl: DoHello ()
{
// Display dialog box
M_helloDialog.DoModal ();
}
---- ActiveX Control Test Container can be used to Test the DoHello method of Hello Control.
---- The following describes how to introduce the mode-free dialog box technology when creating ActiveX controls. The procedure is as follows:
Based on the above work, useClassWizard adds the WM_CREATE handler for CHelloCtrl
OnCreate, create a mode-free dialog box here;
ModifyDoHello code. The dialog box is displayed here;
Int CHelloCtrl: OnCreate
(Maid)
{
If (COleControl: OnCreate (lpCreateStruct) =-1)
Return-1;
// Create dialog box
M_helloDialog.Create (IDD_HELLODIALOG );
Return 0;
}
Void CHelloCtrl: DoHello ()
{
// Display dialog box
M_helloDialog.ShowWindow (SW_SHOW );
}
---- The following describes the ActiveX control technology used to create a dialog box. The procedure is as follows:
On the basis of the above work, set the dialog box ResourcesThe Style page of The IDD_HELLODIALOG attribute is
Style: Child, Border: Dialog Frame, Title Bar: unchecked; set More Style
Page isVisible: checked; Control: checked; set the Extended Styles page
Static Edge: checked;
In