--- /dev/null
+////////////////////////////////////////////////////\r
+// MainMDIfrm.cpp - definitions for the CMainMDIFrame class\r
+\r
+#include "stdafx.h"\r
+#include "mainMDIfrm.h"\r
+#include "SimpleMDIChild.h"\r
+#include "resource.h"\r
+\r
+\r
+CMainMDIFrame::CMainMDIFrame()\r
+{\r
+ // Set the registry key name, and load the initial window position\r
+ // Use a registry key name like "CompanyName\\Application"\r
+ LoadRegistrySettings(_T("Win32++\\MDI Frame"));\r
+}\r
+\r
+CMainMDIFrame::~CMainMDIFrame()\r
+{\r
+}\r
+\r
+void CMainMDIFrame::OnFileOpen()\r
+{\r
+ // Bring up the file open dialog\r
+ CFile File;\r
+ CString str = File.OpenFileDialog(0, 0, 0, 0);\r
+\r
+ // TODO:\r
+ // Add your own code here. Refer to the tutorial for additional information \r
+}\r
+\r
+void CMainMDIFrame::OnFileSave()\r
+{\r
+ // Bring up the file save dialog.\r
+ CFile File;\r
+ CString str = File.SaveFileDialog(0, 0, 0, 0, 0);\r
+\r
+ // TODO:\r
+ // Add your own code here. Refer to the tutorial for additional information \r
+}\r
+\r
+void CMainMDIFrame::OnFilePrint()\r
+{\r
+ // Bring up a dialog to choose the printer\r
+ PRINTDLG pd = {0};\r
+ pd.lStructSize = sizeof( pd );\r
+ pd.Flags = PD_RETURNDC;\r
+ pd.hwndOwner = m_hWnd;\r
+\r
+ // Retrieve the printer DC\r
+ PrintDlg( &pd );\r
+ \r
+ // TODO:\r
+ // Add your own code here. Refer to the tutorial for additional information \r
+}\r
+\r
+\r
+void CMainMDIFrame::OnInitialUpdate()\r
+{\r
+ TRACE(_T("MDI Frame started \n"));\r
+ //The frame is now created.\r
+ //Place any additional startup code here.\r
+}\r
+\r
+BOOL CMainMDIFrame::OnCommand(WPARAM wParam, LPARAM lParam)\r
+{\r
+ switch (LOWORD(wParam))\r
+ {\r
+ case IDM_FILE_NEW:\r
+ AddMDIChild(new CSimpleMDIChild); // CMDIFrame::RemoveMDIChild deletes this pointer\r
+ return TRUE;\r
+ case IDM_FILE_CLOSE: // Close the active MDI window\r
+ GetActiveMDIChild()->SendMessage(WM_CLOSE, 0, 0);\r
+ return TRUE;\r
+ case IDM_FILE_OPEN:\r
+ OnFileOpen();\r
+ return TRUE;\r
+ case IDM_FILE_SAVE:\r
+ // Refer to the tutorial for an example of OnFileSave()\r
+ return TRUE;\r
+ case IDM_FILE_SAVEAS:\r
+ // Refer to the tutorial for an example of OnFileSaveAs()\r
+ return TRUE;\r
+ case IDM_FILE_PRINT:\r
+ OnFilePrint();\r
+ return TRUE;\r
+ case IDW_VIEW_STATUSBAR:\r
+ OnViewStatusBar();\r
+\r
+ break;\r
+ case IDW_VIEW_TOOLBAR:\r
+ OnViewToolBar();\r
+ break;\r
+ case IDW_MDI_ARRANGE:\r
+ MDIIconArrange();\r
+ break;\r
+ case IDW_MDI_CASCADE:\r
+ MDICascade();\r
+ break;\r
+ case IDW_MDI_CLOSEALL:\r
+ RemoveAllMDIChildren();\r
+ break;\r
+ case IDW_MDI_TILE:\r
+ MDITile();\r
+ break;\r
+ default: // Pass to active child...\r
+ {\r
+ if (GetActiveMDIChild())\r
+ GetActiveMDIChild()->SendMessage(WM_COMMAND, wParam, lParam);\r
+ }\r
+ break ;\r
+ case IDM_FILE_EXIT:\r
+ ::PostMessage(m_hWnd, WM_CLOSE, 0, 0);\r
+ return TRUE;\r
+ case IDM_HELP_ABOUT:\r
+ OnHelp();\r
+ return TRUE;\r
+ }\r
+ return FALSE;\r
+}\r
+\r
+void CMainMDIFrame::OnCreate()\r
+{\r
+ // OnCreate controls the way the frame is created.\r
+ // Overriding CFrame::Oncreate is optional.\r
+ // The default for the following variables is TRUE\r
+\r
+ // m_bShowIndicatorStatus = FALSE; // Don't show statusbar indicators\r
+ // m_bShowMenuStatus = FALSE; // Don't show toolbar or menu status\r
+ // m_bUseReBar = FALSE; // Don't use rebars\r
+ // m_bUseThemes = FALSE; // Don't use themes\r
+ // m_bUseToolBar = FALSE; // Don't use a toolbar\r
+ // m_bUseCustomDraw = FALSE; // Don't use custom draw for menu items\r
+\r
+ // call the base class function\r
+ CMDIFrame::OnCreate();\r
+}\r
+\r
+void CMainMDIFrame::SetupToolBar()\r
+{\r
+ // Define the resource IDs for the toolbar\r
+ AddToolBarButton( IDM_FILE_NEW );\r
+ AddToolBarButton( IDM_FILE_OPEN );\r
+ AddToolBarButton( IDM_FILE_SAVE );\r
+ AddToolBarButton( 0 ); // Separator\r
+ AddToolBarButton( IDM_EDIT_CUT );\r
+ AddToolBarButton( IDM_EDIT_COPY );\r
+ AddToolBarButton( IDM_EDIT_PASTE );\r
+ AddToolBarButton( 0 ); // Separator\r
+ AddToolBarButton( IDM_FILE_PRINT );\r
+ AddToolBarButton( 0 ); // Separator\r
+ AddToolBarButton( IDM_HELP_ABOUT );\r
+}\r
+\r
+LRESULT CMainMDIFrame::WndProc(UINT uMsg, WPARAM wParam, LPARAM lParam)\r
+{\r
+// switch (uMsg)\r
+// {\r
+// Add case statements for each messages to be handled here\r
+// }\r
+\r
+// pass unhandled messages on for default processing\r
+ return WndProcDefault(uMsg, wParam, lParam);\r
+}\r
+\r