DRAWCLI.CPP
上传用户:sesekoo
上传日期:2020-07-18
资源大小:21543k
文件大小:5k
- // drawcli.cpp : Defines the class behaviors for the application.
- //
- // This is a part of the Microsoft Foundation Classes C++ library.
- // Copyright (C) 1992-1998 Microsoft Corporation
- // All rights reserved.
- //
- // This source code is only intended as a supplement to the
- // Microsoft Foundation Classes Reference and related
- // electronic documentation provided with the library.
- // See these sources for detailed information regarding the
- // Microsoft Foundation Classes product.
- #include "stdafx.h"
- #include "drawcli.h"
- #include "mainfrm.h"
- #include "drawobj.h"
- #include "drawdoc.h"
- #include "drawvw.h"
- #include "splitfrm.h"
- #ifdef _DEBUG
- #undef THIS_FILE
- static char BASED_CODE THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CDrawApp
- BEGIN_MESSAGE_MAP(CDrawApp, CWinApp)
- //{{AFX_MSG_MAP(CDrawApp)
- ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
- //}}AFX_MSG_MAP
- // Standard file based document commands
- ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
- ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
- // Standard print setup command
- ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CDrawApp construction
- CDrawApp::CDrawApp()
- {
- // TODO: add construction code here,
- // Place all significant initialization in InitInstance
- }
- /////////////////////////////////////////////////////////////////////////////
- // The one and only CDrawApp object
- CDrawApp theApp;
- // {EF6D747C-3A72-4971-80AC-1466C977CFC9}
- static const CLSID clsid =
- { 0xef6d747c, 0x3a72, 0x4971, { 0x80, 0xac, 0x14, 0x66, 0xc9, 0x77, 0xcf, 0xc9 } };
- /////////////////////////////////////////////////////////////////////////////
- // CDrawApp initialization
- BOOL CDrawApp::InitInstance()
- {
- InitCommonControls();
- SetRegistryKey( _T("Foss") );
- // Initialize OLE libraries
- if (!AfxOleInit())
- {
- AfxMessageBox(IDP_OLE_INIT_FAILED);
- return FALSE;
- }
- // Standard initialization
- // If you are not using these features and wish to reduce the size
- // of your final executable, you should remove from the following
- // the specific initialization routines you do not need.
- #if _MFC_VER < 0x700
- #ifdef _AFXDLL
- Enable3dControls(); // Call this when using MFC in a shared DLL
- #else
- Enable3dControlsStatic(); // Call this when linking to MFC statically
- #endif
- #endif
- LoadStdProfileSettings(); // Load standard INI file options (including MRU)
- // Register the application's document templates. Document templates
- // serve as the connection between documents, frame windows and views.
- #if (!defined __EXT_MFC_NO_SHELL_DIALOG_FILE)
- // make CDocManager using CExtShellDialogFile instead of CFileDialog
- ASSERT( m_pDocManager == NULL );
- m_pDocManager = new CExtDMFP < CDocManager >;
- #endif // (!defined __EXT_MFC_NO_SHELL_DIALOG_FILE)
- CMultiDocTemplate* pDocTemplate;
- pDocTemplate = new CMultiDocTemplate(
- IDR_DRAWCLTYPE,
- RUNTIME_CLASS(CDrawDoc),
- RUNTIME_CLASS(CSplitFrame),
- RUNTIME_CLASS(CDrawView));
- pDocTemplate->SetContainerInfo(IDR_DRAWCLTYPE_CNTR_IP);
-
- pDocTemplate->SetServerInfo(
- IDR_DRAWCLTYPE_SRVR_EMB, IDR_DRAWCLTYPE_SRVR_IP,
- RUNTIME_CLASS(CDrawInPlaceFrame)
- );
- AddDocTemplate(pDocTemplate);
- m_server.ConnectTemplate(clsid, pDocTemplate, FALSE);
- COleTemplateServer::RegisterAll();
- // create main MDI Frame window
- CMainFrame* pMainFrame = new CMainFrame;
- m_pMainWnd = pMainFrame;
- if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
- {
- m_pMainWnd=NULL;
- return FALSE;
- }
- // Enable DDE Execute open
- EnableShellOpen();
- RegisterShellFileTypes(TRUE);
- // Parse command line for standard shell commands, DDE, file open
- CCommandLineInfo cmdInfo;
- ParseCommandLine(cmdInfo);
- if (cmdInfo.m_bRunEmbedded || cmdInfo.m_bRunAutomated)
- return TRUE;
- // When a server application is launched stand-alone, it is a good idea
- // to update the system registry in case it has been damaged.
- m_server.UpdateRegistry(OAT_INPLACE_SERVER);
- // Dispatch commands specified on the command line
- if (!ProcessShellCommand(cmdInfo))
- return FALSE;
- // Enable drag/drop open
- m_pMainWnd->DragAcceptFiles();
- // The main window has been initialized, so show and update it.
- //pMainFrame->ShowWindow(m_nCmdShow);
- //pMainFrame->UpdateWindow();
- pMainFrame->ActivateFrame( m_nCmdShow );
- // pMainFrame->SetActiveWindow();
- return TRUE;
- }
- // App command to run the dialog
- void CDrawApp::OnAppAbout()
- {
- #ifndef __EXT_MFC_NO_PROF_UIS_ABOUT_DIALOG
- VERIFY( ProfUISAbout() );
- #endif // #ifndef __EXT_MFC_NO_PROF_UIS_ABOUT_DIALOG
- }
- /////////////////////////////////////////////////////////////////////////////
- // CDrawApp commands
- void CDrawApp::DoContextHelp()
- {
- CWinApp::OnContextHelp();
- }