1 ////////////////////////////////////////////////////
\r
5 #include "resource.h"
\r
9 // Definitions for the CMainFrame class
\r
10 CMainFrame::CMainFrame()
\r
12 // Constructor for CMainFrame. Its called after CFrame's constructor
\r
14 //Set m_View as the view window of the frame
\r
17 // Set the registry key name, and load the initial window position
\r
18 // Use a registry key name like "CompanyName\\Application"
\r
19 LoadRegistrySettings(_T("Win32++\\Frame"));
\r
22 CMainFrame::~CMainFrame()
\r
24 // Destructor for CMainFrame.
\r
27 BOOL CMainFrame::OnCommand(WPARAM wParam, LPARAM lParam)
\r
29 // OnCommand responds to menu and and toolbar input
\r
31 UNREFERENCED_PARAMETER(lParam);
\r
33 switch(LOWORD(wParam))
\r
36 // Refer to the tutorial for an example of OnFileOpen
\r
40 // Refer to the tutorial for an example of OnFileSave
\r
43 case IDM_FILE_SAVEAS:
\r
44 // Refer to the tutorial for an example of OnFileSaveAs
\r
47 case IDM_FILE_PRINT:
\r
51 // End the application
\r
52 ::PostMessage(m_hWnd, WM_CLOSE, 0, 0);
\r
54 case IDW_VIEW_STATUSBAR:
\r
57 case IDW_VIEW_TOOLBAR:
\r
60 case IDM_HELP_ABOUT:
\r
61 // Display the help dialog
\r
69 void CMainFrame::OnCreate()
\r
71 // OnCreate controls the way the frame is created.
\r
72 // Overriding CFrame::Oncreate is optional.
\r
73 // The default for the following variables is TRUE
\r
75 // m_bShowIndicatorStatus = FALSE; // Don't show statusbar indicators
\r
76 // m_bShowMenuStatus = FALSE; // Don't show toolbar or menu status
\r
77 // m_bUseReBar = FALSE; // Don't use rebars
\r
78 // m_bUseThemes = FALSE; // Don't use themes
\r
79 // m_bUseToolBar = FALSE; // Don't use a toolbar
\r
80 // m_bUseCustomDraw = FALSE; // Don't use custom draw for menu items
\r
82 // call the base class function
\r
86 void CMainFrame::OnInitialUpdate()
\r
88 // The frame is now created.
\r
89 // Place any additional startup code here.
\r
91 TRACE(_T("Frame created\n"));
\r
94 void CMainFrame::OnFileOpen()
\r
96 // Bring up the file open dialog
\r
98 CString str = File.OpenFileDialog(0, 0, 0, 0);
\r
101 // Add your own code here. Refer to the tutorial for additional information
\r
104 void CMainFrame::OnFileSave()
\r
106 // Bring up the file save dialog.
\r
108 CString str = File.SaveFileDialog(0, 0, 0, 0, 0);
\r
111 // Add your own code here. Refer to the tutorial for additional information
\r
114 void CMainFrame::OnFilePrint()
\r
116 // Bring up a dialog to choose the printer
\r
118 pd.lStructSize = sizeof( pd );
\r
119 pd.Flags = PD_RETURNDC;
\r
120 pd.hwndOwner = m_hWnd;
\r
122 // Retrieve the printer DC
\r
126 // Add your own code here. Refer to the tutorial for additional information
\r
129 LRESULT CMainFrame::OnNotify(WPARAM wParam, LPARAM lParam)
\r
131 // Process notification messages sent by child windows
\r
132 // switch(((LPNMHDR)lParam)->code)
\r
134 //Add case statments for each notification message here
\r
137 // Some notifications should return a value when handled
\r
138 return CFrame::OnNotify(wParam, lParam);
\r
141 void CMainFrame::SetupToolBar()
\r
143 // Set the Resource IDs for the toolbar buttons
\r
144 AddToolBarButton( IDM_FILE_NEW );
\r
145 AddToolBarButton( IDM_FILE_OPEN );
\r
146 AddToolBarButton( IDM_FILE_SAVE );
\r
148 AddToolBarButton( 0 ); // Separator
\r
149 AddToolBarButton( IDM_EDIT_CUT, FALSE ); // disabled button
\r
150 AddToolBarButton( IDM_EDIT_COPY, FALSE ); // disabled button
\r
151 AddToolBarButton( IDM_EDIT_PASTE, FALSE ); // disabled button
\r
153 AddToolBarButton( 0 ); // Separator
\r
154 AddToolBarButton( IDM_FILE_PRINT );
\r
156 AddToolBarButton( 0 ); // Separator
\r
157 AddToolBarButton( IDM_HELP_ABOUT );
\r
160 LRESULT CMainFrame::WndProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
\r
164 // Add case statements for each messages to be handled here
\r
167 // pass unhandled messages on for default processing
\r
168 return WndProcDefault(uMsg, wParam, lParam);
\r