// [!output APP_IMPL] : ÀÀ¿ë ÇÁ·Î±×·¥¿¡ ´ëÇÑ Å¬·¡½º µ¿ÀÛÀ» Á¤ÀÇÇÕ´Ï´Ù. // #include "stdafx.h" #include "[!output APP_HEADER]" #include "[!output MAIN_FRAME_HEADER]" [!if DOCVIEW] #include "[!output DOC_HEADER]" #include "[!output VIEW_HEADER]" [!endif] #ifdef _DEBUG #define new DEBUG_NEW #endif // [!output APP_CLASS] BEGIN_MESSAGE_MAP([!output APP_CLASS], [!output APP_BASE_CLASS]) [!if !MULTIPLE_PLATFORM] [!if !SMARTPHONE2003_UI_MODEL] ON_COMMAND(ID_APP_ABOUT, &[!output APP_CLASS]::OnAppAbout) [!endif] [!else] [!if SMARTPHONE2003_UI_MODEL] #ifndef WIN32_PLATFORM_WFSP [!endif] ON_COMMAND(ID_APP_ABOUT, &[!output APP_CLASS]::OnAppAbout) [!if SMARTPHONE2003_UI_MODEL] #endif // !WIN32_PLATFORM_WFSP [!endif] [!endif] [!if PRINTING && DOCVIEW] // Ç¥ÁØ Àμ⠼³Á¤ ¸í·ÉÀÔ´Ï´Ù. ON_COMMAND(ID_FILE_PRINT_SETUP, &[!output APP_BASE_CLASS]::OnFilePrintSetup) [!endif] [!if DOCVIEW] ON_COMMAND(ID_FILE_NEW, &[!output APP_BASE_CLASS]::OnFileNew) ON_COMMAND(ID_FILE_OPEN, &[!output APP_BASE_CLASS]::OnFileOpen) [!endif] END_MESSAGE_MAP() // [!output APP_CLASS] »ý¼º [!if HELPSTYLE_WINHELP] [!output APP_CLASS]::[!output APP_CLASS](LPCTSTR lpszHelpName) : [!output APP_BASE_CLASS](lpszHelpName) [!else] [!output APP_CLASS]::[!output APP_CLASS]() : [!output APP_BASE_CLASS]() [!endif] { // TODO: ¿©±â¿¡ »ý¼º Äڵ带 Ãß°¡ÇÕ´Ï´Ù. // InitInstance¿¡ ¸ðµç Áß¿äÇÑ ÃʱâÈ­ ÀÛ¾÷À» ¹èÄ¡ÇÕ´Ï´Ù. } [!if ATL_SUPPORT] // ATL Module °³Ã¼ CComModule _Module; [!endif] // À¯ÀÏÇÑ [!output APP_CLASS] °³Ã¼ÀÔ´Ï´Ù. [!if HELPSTYLE_WINHELP] [!output APP_CLASS] theApp(_T("HELP_NAME")); [!else] [!output APP_CLASS] theApp; [!endif] // [!output APP_CLASS] ÃʱâÈ­ BOOL [!output APP_CLASS]::InitInstance() { [!if !MULTIPLE_PLATFORM] [!if POCKETPC2003_UI_MODEL || SMARTPHONE2003_UI_MODEL] // CAPEDIT ¹× SIPPREF¿Í °°Àº ¸ðµç Windows Mobile °ü·Ã ÄÁÆ®·ÑÀ» ÃʱâÈ­Çϱâ À§ÇØ // ÀÀ¿ë ÇÁ·Î±×·¥À» ÃʱâÈ­ÇÏ´Â µ¿¾È SHInitExtraControls¸¦ ÇÑ ¹ø È£ÃâÇØ¾ß ÇÕ´Ï´Ù. SHInitExtraControls(); [!endif] [!else] [!if POCKETPC2003_UI_MODEL || SMARTPHONE2003_UI_MODEL] #if defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP) // CAPEDIT ¹× SIPPREF¿Í °°Àº ¸ðµç Windows Mobile °ü·Ã ÄÁÆ®·ÑÀ» ÃʱâÈ­Çϱâ À§ÇØ // ÀÀ¿ë ÇÁ·Î±×·¥À» ÃʱâÈ­ÇÏ´Â µ¿¾È SHInitExtraControls¸¦ ÇÑ ¹ø È£ÃâÇØ¾ß ÇÕ´Ï´Ù. SHInitExtraControls(); #endif // WIN32_PLATFORM_PSPC || WIN32_PLATFORM_WFSP [!endif] [!endif] [!if SOCKETS] if (!AfxSocketInit()) { AfxMessageBox(IDP_SOCKETS_INIT_FAILED); return FALSE; } [!endif] [!if ACTIVEX_CONTROLS] AfxEnableControlContainer(); [!endif] // Ç¥ÁØ ÃʱâÈ­ // ÀÌµé ±â´ÉÀ» »ç¿ëÇÏÁö ¾Ê°í ÃÖÁ¾ ½ÇÇà ÆÄÀÏÀÇ Å©±â¸¦ ÁÙÀÌ·Á¸é // ¾Æ·¡¿¡¼­ ÇÊ¿ä ¾ø´Â ƯÁ¤ ÃʱâÈ­ // ·çƾÀ» Á¦°ÅÇØ¾ß ÇÕ´Ï´Ù. // ÇØ´ç ¼³Á¤ÀÌ ÀúÀåµÈ ·¹Áö½ºÆ®¸® ۸¦ º¯°æÇϽʽÿÀ. // TODO: ÀÌ ¹®ÀÚ¿­À» ȸ»ç ¶Ç´Â Á¶Á÷ÀÇ À̸§°ú °°Àº // ÀûÀýÇÑ ³»¿ëÀ¸·Î ¼öÁ¤ÇØ¾ß ÇÕ´Ï´Ù. SetRegistryKey(_T("·ÎÄà ÀÀ¿ë ÇÁ·Î±×·¥ ¸¶¹ý»ç¿¡¼­ »ý¼ºµÈ ÀÀ¿ë ÇÁ·Î±×·¥")); [!if !DOCVIEW] // ÁÖ Ã¢À» ¸¸µé±â À§ÇØ ÀÌ Äڵ忡¼­´Â »õ ÇÁ·¹ÀÓ Ã¢ °³Ã¼¸¦ // ¸¸µç ´ÙÀ½ À̸¦ ÀÀ¿ë ÇÁ·Î±×·¥ÀÇ ÁÖ Ã¢ °³Ã¼·Î ¼³Á¤ÇÕ´Ï´Ù. CMainFrame* pFrame = new [!output MAIN_FRAME_CLASS]; if (!pFrame) return FALSE; m_pMainWnd = pFrame; [!if APP_TYPE_SDI || APP_TYPE_SDI_DOCLIST] // ÇÁ·¹ÀÓÀ» ¸¸µé¾î ¸®¼Ò½º¿Í ÇÔ²² ·ÎµåÇÕ´Ï´Ù. pFrame->LoadFrame(IDR_MAINFRAME, WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, NULL, NULL); [!endif] [!else] [!if APP_TYPE_SDI_DOCLIST] [!if !MULTIPLE_PLATFORM] [!if POCKETPC2003_UI_MODEL] CDocListDocTemplate* pDocTemplate; pDocTemplate = new CDocListDocTemplate( IDR_MAINFRAME, RUNTIME_CLASS([!output DOC_CLASS]), RUNTIME_CLASS([!output MAIN_FRAME_CLASS]), // ÁÖ SDI ÇÁ·¹ÀÓ Ã¢ÀÔ´Ï´Ù. RUNTIME_CLASS([!output VIEW_CLASS])); AddDocTemplate(pDocTemplate); // Ç¥ÁØ ¼Ð ¸í·É, DDE, ÆÄÀÏ ¿­±â¿¡ ´ëÇÑ ¸í·ÉÁÙÀ» ±¸¹® ºÐ¼®ÇÕ´Ï´Ù. CCommandLineInfo cmdInfo; cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing; ParseCommandLine(cmdInfo); pDocTemplate->ShowDocList(); // ¹®¼­ ¸ñ·Ï¿¡ ÆÄÀÏÀÌ ¾øÀ¸¸é »õ ÆÄÀÏÀ» ¸¸µì´Ï´Ù. CDocList* pDocList = pDocTemplate->m_pWndDocList; if (pDocList->GetItemCount() == 0) { pDocList->OnClose(); OnFileNew(); } [!else] CSingleDocTemplate* pDocTemplate; pDocTemplate = new CSingleDocTemplate( IDR_MAINFRAME, RUNTIME_CLASS([!output DOC_CLASS]), RUNTIME_CLASS([!output MAIN_FRAME_CLASS]), // ÁÖ SDI ÇÁ·¹ÀÓ Ã¢ÀÔ´Ï´Ù. RUNTIME_CLASS([!output VIEW_CLASS])); if (!pDocTemplate) return FALSE; AddDocTemplate(pDocTemplate); [!endif] [!else] #ifdef WIN32_PLATFORM_PSPC CDocListDocTemplate* pDocTemplate; pDocTemplate = new CDocListDocTemplate( IDR_MAINFRAME, RUNTIME_CLASS([!output DOC_CLASS]), RUNTIME_CLASS([!output MAIN_FRAME_CLASS]), // ÁÖ SDI ÇÁ·¹ÀÓ Ã¢ÀÔ´Ï´Ù. RUNTIME_CLASS([!output VIEW_CLASS])); AddDocTemplate(pDocTemplate); // Ç¥ÁØ ¼Ð ¸í·É, DDE, ÆÄÀÏ ¿­±â¿¡ ´ëÇÑ ¸í·ÉÁÙÀ» ±¸¹® ºÐ¼®ÇÕ´Ï´Ù. CCommandLineInfo cmdInfo; cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing; ParseCommandLine(cmdInfo); pDocTemplate->ShowDocList(); // ¹®¼­ ¸ñ·Ï¿¡ ÆÄÀÏÀÌ ¾øÀ¸¸é »õ ÆÄÀÏÀ» ¸¸µì´Ï´Ù. CDocList* pDocList = pDocTemplate->m_pWndDocList; if (pDocList->GetItemCount() == 0) { pDocList->OnClose(); OnFileNew(); } #else CSingleDocTemplate* pDocTemplate; pDocTemplate = new CSingleDocTemplate( IDR_MAINFRAME, RUNTIME_CLASS([!output DOC_CLASS]), RUNTIME_CLASS([!output MAIN_FRAME_CLASS]), // ÁÖ SDI ÇÁ·¹ÀÓ Ã¢ÀÔ´Ï´Ù. RUNTIME_CLASS([!output VIEW_CLASS])); if (!pDocTemplate) return FALSE; AddDocTemplate(pDocTemplate); #endif // WIN32_PLATFORM_PSPC [!endif] [!else] CSingleDocTemplate* pDocTemplate; pDocTemplate = new CSingleDocTemplate( IDR_MAINFRAME, RUNTIME_CLASS([!output DOC_CLASS]), RUNTIME_CLASS([!output MAIN_FRAME_CLASS]), // ÁÖ SDI ÇÁ·¹ÀÓ Ã¢ÀÔ´Ï´Ù. RUNTIME_CLASS([!output VIEW_CLASS])); if (!pDocTemplate) return FALSE; AddDocTemplate(pDocTemplate); [!endif] [!endif] [!if DOCVIEW] [!if APP_TYPE_SDI_DOCLIST] [!if !MULTIPLE_PLATFORM] [!if !POCKETPC2003_UI_MODEL] // Ç¥ÁØ ¼Ð ¸í·É, DDE, ÆÄÀÏ ¿­±â¿¡ ´ëÇÑ ¸í·ÉÁÙÀ» ±¸¹® ºÐ¼®ÇÕ´Ï´Ù. CCommandLineInfo cmdInfo; ParseCommandLine(cmdInfo); // ¸í·ÉÁÙ¿¡ ÁöÁ¤µÈ ¸í·ÉÀ» µð½ºÆÐÄ¡ÇÕ´Ï´Ù. // ÀÀ¿ë ÇÁ·Î±×·¥ÀÌ /RegServer, /Register, /Unregserver ¶Ç´Â /Unregister·Î ½ÃÀÛµÈ °æ¿ì FALSE¸¦ ¹ÝȯÇÕ´Ï´Ù. if (!ProcessShellCommand(cmdInfo)) return FALSE; [!endif] [!else] #ifndef WIN32_PLATFORM_PSPC // Ç¥ÁØ ¼Ð ¸í·É, DDE, ÆÄÀÏ ¿­±â¿¡ ´ëÇÑ ¸í·ÉÁÙÀ» ±¸¹® ºÐ¼®ÇÕ´Ï´Ù. CCommandLineInfo cmdInfo; ParseCommandLine(cmdInfo); // ¸í·ÉÁÙ¿¡ ÁöÁ¤µÈ ¸í·ÉÀ» µð½ºÆÐÄ¡ÇÕ´Ï´Ù. // ÀÀ¿ë ÇÁ·Î±×·¥ÀÌ /RegServer, /Register, /Unregserver ¶Ç´Â /Unregister·Î ½ÃÀÛµÈ °æ¿ì FALSE¸¦ ¹ÝȯÇÕ´Ï´Ù. if (!ProcessShellCommand(cmdInfo)) return FALSE; #endif // !WIN32_PLATFORM_PSPC [!endif] [!else] // Ç¥ÁØ ¼Ð ¸í·É, DDE, ÆÄÀÏ ¿­±â¿¡ ´ëÇÑ ¸í·ÉÁÙÀ» ±¸¹® ºÐ¼®ÇÕ´Ï´Ù. CCommandLineInfo cmdInfo; ParseCommandLine(cmdInfo); // ¸í·ÉÁÙ¿¡ ÁöÁ¤µÈ ¸í·ÉÀ» µð½ºÆÐÄ¡ÇÕ´Ï´Ù. // ÀÀ¿ë ÇÁ·Î±×·¥ÀÌ /RegServer, /Register, /Unregserver ¶Ç´Â /Unregister·Î ½ÃÀÛµÈ °æ¿ì FALSE¸¦ ¹ÝȯÇÕ´Ï´Ù. if (!ProcessShellCommand(cmdInfo)) return FALSE; [!endif] [!endif] [!if APP_TYPE_SDI_DOCLIST] [!if !MULTIPLE_PLATFORM] [!if !POCKETPC2003_UI_MODEL] // â Çϳª¸¸ ÃʱâÈ­µÇ¾úÀ¸¹Ç·Î À̸¦ Ç¥½ÃÇÏ°í ¾÷µ¥ÀÌÆ®ÇÕ´Ï´Ù. [!if DOCVIEW] m_pMainWnd->ShowWindow(SW_SHOW); m_pMainWnd->UpdateWindow(); [!else] pFrame->ShowWindow(SW_SHOW); pFrame->UpdateWindow(); [!endif] [!endif] [!else] #ifndef WIN32_PLATFORM_PSPC // â Çϳª¸¸ ÃʱâÈ­µÇ¾úÀ¸¹Ç·Î À̸¦ Ç¥½ÃÇÏ°í ¾÷µ¥ÀÌÆ®ÇÕ´Ï´Ù. [!if DOCVIEW] m_pMainWnd->ShowWindow(SW_SHOW); m_pMainWnd->UpdateWindow(); [!else] pFrame->ShowWindow(SW_SHOW); pFrame->UpdateWindow(); [!endif] #endif // !WIN32_PLATFORM_PSPC [!endif] [!else] [!if APP_TYPE_SDI] // â Çϳª¸¸ ÃʱâÈ­µÇ¾úÀ¸¹Ç·Î À̸¦ Ç¥½ÃÇÏ°í ¾÷µ¥ÀÌÆ®ÇÕ´Ï´Ù. [!if DOCVIEW] m_pMainWnd->ShowWindow(SW_SHOW); m_pMainWnd->UpdateWindow(); [!else] pFrame->ShowWindow(SW_SHOW); pFrame->UpdateWindow(); [!endif] [!endif] [!endif] return TRUE; } [!if !DOCVIEW] // [!output APP_CLASS] ¸Þ½ÃÁö 󸮱â [!if DOCVIEW] void [!output APP_CLASS]::OnFileNew() { [!if APP_TYPE_SDI || APP_TYPE_SDI_DOCLIST] CString strUntitled; CFrameWnd* pFrameWnd = DYNAMIC_DOWNCAST(CFrameWnd, m_pMainWnd); if (pFrameWnd != NULL) { //TODO: ¸Þ¸ð¸®¿¡¼­ °¡Á®¿Â ÆÄÀÏ¿¡ °üÇÑ µ¥ÀÌÅ͸¦ ´Ý°í ¼Ò¸ê½Ãŵ´Ï´Ù. // ÀÏ´Ü ÀÌ ÀÛ¾÷ÀÌ ¼öÇàµÇ¸é ´ÙÀ½ if ¹®À» ½ÇÇàÇÏ¿© ÇÁ·¹ÀÓ Ã¢ÀÇ Á¦¸ñÀ» // ¿ø·¡´ë·Î ¼³Á¤ÇÕ´Ï´Ù. if (strUntitled.LoadString(AFX_IDS_UNTITLED)) pFrameWnd->UpdateFrameTitleForDocument(strUntitled); else pFrameWnd->UpdateFrameTitleForDocument(NULL); } [!else] [!output MAIN_FRAME_CLASS]* pFrame = STATIC_DOWNCAST([!output MAIN_FRAME_CLASS], m_pMainWnd); // »õ MDI ÀÚ½Ä Ã¢À» ¸¸µì´Ï´Ù. pFrame->CreateNewChild( RUNTIME_CLASS(CChildFrame), IDR_[!output SAFE_DOC_TYPE_NAME]TYPE, m_hMDIMenu, m_hMDIAccel); [!endif] } [!endif] [!endif] [!if !MULTIPLE_PLATFORM] [!if !SMARTPHONE2003_UI_MODEL] // ÀÀ¿ë ÇÁ·Î±×·¥ Á¤º¸¿¡ »ç¿ëµÇ´Â CAboutDlg ´ëÈ­ »óÀÚÀÔ´Ï´Ù. class CAboutDlg : public CDialog { public: CAboutDlg(); // ´ëÈ­ »óÀÚ µ¥ÀÌÅÍÀÔ´Ï´Ù. enum { IDD = IDD_ABOUTBOX }; protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV Áö¿øÀÔ´Ï´Ù. // ±¸ÇöÀÔ´Ï´Ù. protected: [!if POCKETPC2003_UI_MODEL] #ifdef _DEVICE_RESOLUTION_AWARE afx_msg void OnSize(UINT /*nType*/, int /*cx*/, int /*cy*/); #endif [!endif] virtual BOOL OnInitDialog(); DECLARE_MESSAGE_MAP() }; CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD) { } void CAboutDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); } BOOL CAboutDlg::OnInitDialog() { CDialog::OnInitDialog(); return TRUE; // Æ÷Ä¿½º¸¦ ÄÁÆ®·Ñ¿¡ ¼³Á¤ÇÏÁö ¾ÊÀ¸¸é TRUE¸¦ ¹ÝȯÇÕ´Ï´Ù. // ¿¹¿Ü: OCX ¼Ó¼º ÆäÀÌÁö´Â FALSE¸¦ ¹ÝÈ¯ÇØ¾ß ÇÕ´Ï´Ù. } BEGIN_MESSAGE_MAP(CAboutDlg, CDialog) [!if POCKETPC2003_UI_MODEL] #ifdef _DEVICE_RESOLUTION_AWARE ON_WM_SIZE() #endif [!endif] END_MESSAGE_MAP() [!if POCKETPC2003_UI_MODEL] #ifdef _DEVICE_RESOLUTION_AWARE void CAboutDlg::OnSize(UINT /*nType*/, int /*cx*/, int /*cy*/) { if (AfxIsDRAEnabled()) { DRA::RelayoutDialog( AfxGetResourceHandle(), this->m_hWnd, DRA::GetDisplayMode() != DRA::Portrait ? MAKEINTRESOURCE(IDD_ABOUTBOX_WIDE) : MAKEINTRESOURCE(IDD_ABOUTBOX)); } } #endif [!endif] // ´ëÈ­ »óÀÚ¸¦ ½ÇÇàÇϱâ À§ÇÑ ÀÀ¿ë ÇÁ·Î±×·¥ ¸í·ÉÀÔ´Ï´Ù. void [!output APP_CLASS]::OnAppAbout() { CAboutDlg aboutDlg; aboutDlg.DoModal(); } [!endif] [!else] [!if SMARTPHONE2003_UI_MODEL] #ifndef WIN32_PLATFORM_WFSP [!endif] // ÀÀ¿ë ÇÁ·Î±×·¥ Á¤º¸¿¡ »ç¿ëµÇ´Â CAboutDlg ´ëÈ­ »óÀÚÀÔ´Ï´Ù. class CAboutDlg : public CDialog { public: CAboutDlg(); // ´ëÈ­ »óÀÚ µ¥ÀÌÅÍÀÔ´Ï´Ù. enum { IDD = IDD_ABOUTBOX }; protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV Áö¿øÀÔ´Ï´Ù. // ±¸ÇöÀÔ´Ï´Ù. protected: #ifdef _DEVICE_RESOLUTION_AWARE afx_msg void OnSize(UINT /*nType*/, int /*cx*/, int /*cy*/); #endif virtual BOOL OnInitDialog(); DECLARE_MESSAGE_MAP() }; CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD) { } void CAboutDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); } BOOL CAboutDlg::OnInitDialog() { CDialog::OnInitDialog(); return TRUE; // Æ÷Ä¿½º¸¦ ÄÁÆ®·Ñ¿¡ ¼³Á¤ÇÏÁö ¾ÊÀ¸¸é TRUE¸¦ ¹ÝȯÇÕ´Ï´Ù. // ¿¹¿Ü: OCX ¼Ó¼º ÆäÀÌÁö´Â FALSE¸¦ ¹ÝÈ¯ÇØ¾ß ÇÕ´Ï´Ù. } BEGIN_MESSAGE_MAP(CAboutDlg, CDialog) #ifdef _DEVICE_RESOLUTION_AWARE ON_WM_SIZE() #endif END_MESSAGE_MAP() #ifdef _DEVICE_RESOLUTION_AWARE void CAboutDlg::OnSize(UINT /*nType*/, int /*cx*/, int /*cy*/) { if (AfxIsDRAEnabled()) { DRA::RelayoutDialog( AfxGetResourceHandle(), this->m_hWnd, DRA::GetDisplayMode() != DRA::Portrait ? MAKEINTRESOURCE(IDD_ABOUTBOX_WIDE) : MAKEINTRESOURCE(IDD_ABOUTBOX)); } } #endif // ´ëÈ­ »óÀÚ¸¦ ½ÇÇàÇϱâ À§ÇÑ ÀÀ¿ë ÇÁ·Î±×·¥ ¸í·ÉÀÔ´Ï´Ù. void [!output APP_CLASS]::OnAppAbout() { CAboutDlg aboutDlg; aboutDlg.DoModal(); } [!if SMARTPHONE2003_UI_MODEL] #endif // !WIN32_PLATFORM_WFSP [!endif] [!endif]