1 ///////////////////////////////
\r
5 #include "resource.h"
\r
8 // Definitions for the CView class
\r
9 void CView::OnCreate()
\r
11 // OnCreate is called automatically during window creation when a
\r
12 // WM_CREATE message received.
\r
14 // Tasks such as setting the icon, creating child windows, or anything
\r
15 // associated with creating windows are normally performed here.
\r
17 // Set the window's icon
\r
18 SetIconSmall(IDW_MAIN);
\r
19 SetIconLarge(IDW_MAIN);
\r
21 // Set the window title
\r
22 SetWindowText(LoadString(IDW_MAIN));
\r
24 TRACE(_T("OnCreate\n"));
\r
27 void CView::OnDestroy()
\r
29 // End the application when the window is destroyed
\r
30 ::PostQuitMessage(0);
\r
33 void CView::OnDraw(CDC* pDC)
\r
35 // OnPaint is called automatically whenever a part of the
\r
36 // window needs to be repainted.
\r
38 // Centre some text in our view window
\r
39 CRect rc = GetClientRect();
\r
40 CString cs = LoadString(IDW_MAIN);
\r
41 pDC->DrawText(cs, cs.GetLength(), rc, DT_CENTER|DT_VCENTER|DT_SINGLELINE);
\r
44 void CView::OnInitialUpdate()
\r
46 // OnInitialUpdate is called after the window is created.
\r
47 // Tasks which are to be done after the window is created go here.
\r
49 TRACE(_T("OnInitialUpdate\n"));
\r
52 void CView::OnSize()
\r
54 // Force the window to be repainted during resizing
\r
58 void CView::PreCreate(CREATESTRUCT& cs)
\r
60 // This function will be called automatically by Create. It provides an
\r
61 // opportunity to set various window parameters prior to window creation.
\r
62 // You are not required to set these parameters, any paramters which
\r
63 // aren't specified are set to reasonable defaults.
\r
65 // Set some optional parameters for the window
\r
66 cs.dwExStyle = WS_EX_CLIENTEDGE; // Extended style
\r
67 cs.lpszClass = _T("View Window"); // Window Class
\r
70 cs.cx = 400; // width
\r
71 cs.cy = 300; // height
\r
74 LRESULT CView::WndProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
\r
76 // This function is our message procedure. We process the messages for
\r
77 // the view window here. Unprocessed messages are passed on for
\r
78 // default processing.
\r
84 return 0; // return a value. No default processing
\r
88 break; // and also do default processing for this message
\r
91 // pass unhandled messages on for default processing
\r
92 return WndProcDefault(uMsg, wParam, lParam);
\r