Using a dialog box as a subwindow is a very common technique, which simplifies the interface design and makes it easier to modify.
Simply put, the key to this technology is to create a modeless dialog box and specifyChild style and borderless style,.
Next, useCDialog and message ing. Use the following code to create a subwindow:
Int CMy59_s1View: OnCreate (maid)
{
If (CView: OnCreate (lpCreateStruct) =-1)
Return-1;
// Create a subwindow
M_dlgChild.Create (IDD_CHILD_DLG, this );
// Locate again
M_dlgChild.MoveWindow (0, 0, 400,200 );
// Display window
M_dlgChild.ShowWindow (SW_SHOW );
Return 0;
}
In addition, a similar technology is used.The CFormView derived class is used as a subwindow. When editing dialog box resources, you must specify the Child style and borderless style. Then, use ClassWizard to generate a derived class based on the CFormView class. However, since the member functions of this class are protected, you need to modify the generated header file as follows:
Class CTestForm: public CFormView
{
// Change the constructor and destructor to a common function.
Public:
CTestForm ();
Virtual ~ CTestForm ();
DECLARE_DYNCREATE (CTestForm)