Bool a: createview (lpctstr lpszlabel, cruntimeclass * pviewclass, ccreatecontext * pcontext)
{
Crect rect, client;
Assert (pviewclass & pcontext );
// Cwnd * pparent = NULL;
Cwnd * pwnd = NULL;
Int dwstyle = 0;
Pwnd = (cwnd *) pviewclass-> Createobject ();
If (! Pwnd) return false;
//
Assert (pwnd );
If (! Pwnd-> Create (null, null, dwstyle, rect, this, 13576 + m_viewlist.getcount ()))
{
Trace0 ("Warning: couldn't create client area for Tab View \ n ");
// Pwnd will be cleaned up by postncdestroy
Return false;
}
.............
}
Bool cwnd: Create (lpctstr lpszclassname,
Lpctstr lpszwindowname, DWORD dwstyle,
Const rect & rect,
Cwnd * pparentwnd, uint NID,
Ccreatecontext * pcontext)
{
// Can't use for desktop or pop-up windows (use createex instead)
Assert (pparentwnd! = NULL );
Assert (dwstyle & ws_popup) = 0 );
Return
Createex (0, lpszclassname, lpszwindowname,
Dwstyle | ws_child,
Rect. Left, rect. Top,
Rect. Right-rect. Left, rect. Bottom-rect. Top,
Pparentwnd-> getsafehwnd (), (hmenu) (uint_ptr) NID, (lpvoid) pcontext );
}
Bool cwnd: createex (DWORD dwexstyle, lpctstr lpszclassname,
Lpctstr lpszwindowname, DWORD dwstyle,
Int X, int y, int nwidth, int nheight,
Hwnd hwndparent, hmenu nidorhmenu, lpvoid lpparam)
{
Assert (lpszclassname = NULL | afxisvalidstring (lpszclassname) |
Afxisvalidatom (lpszclassname ));
Ensure_arg (lpszwindowname = NULL | afxisvalidstring (lpszwindowname ));
// Allow modification of several common create parameters
Createstruct Cs;
CS. dwexstyle = dwexstyle;
CS. lpszclass = lpszclassname;
CS. lpszname = lpszwindowname;
CS. Style = dwstyle;
CS. x = X;
CS. Y = y;
CS. Cx = nwidth;
CS. Cy = nheight;
CS. hwndparent = hwndparent;
CS. hmenu = nidorhmenu;
CS. hinstance = AfxGetInstanceHandle ();
CS. lpcreateparams = lpparam;
If (! Precreatewindow (CS ))
{
Postncdestroy ();
Return false;
}
Afxhookwindowcreate (this );
Hwnd =: afxctxcreateappswex (CS. dwexstyle, CS. lpszclass,
CS. lpszname, CS. style, CS. X, CS. Y, CS. CX, CS. Cy,
CS. hwndparent, CS. hmenu, CS. hinstance, CS. lpcreateparams );
# Ifdef _ debug
If (hwnd = NULL)
{
Trace (traceappmsg, 0, "Warning: window creation failed: getlasterror returns 0x % 8.8x \ n ",
Getlasterror ());
}
# Endif
If (! Afxunhookwindowcreate ())
Postncdestroy (); // cleanup if createmediawex fails too soon
If (hwnd = NULL)
Return false;
Assert (hwnd = m_hwnd); // shold have been set in send MSG hook
Return true;
}
Bool cview: precreatewindow (createstruct & CS)
{
Assert (CS. Style & ws_child );
If (CS. lpszclass = NULL)
{
Verify (afxdeferregisterclass (afx_wndframeorview_reg ));
CS. lpszclass = _ afxwndframeorview; // color_window background
}
If (CS. Style & ws_border)
{
CS. dwexstyle | = ws_ex_clientedge;
CS. Style & = ~ Ws_border;
}
Return true;
}