INPROC.CPP
资源名称:MSDN_VC98.zip [点击查看]
上传用户:bangxh
上传日期:2007-01-31
资源大小:42235k
文件大小:3k
源码类别:
Windows编程
开发平台:
Visual C++
- // inproc.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 "inproc.h"
- #ifdef _DEBUG
- #undef THIS_FILE
- static char BASED_CODE THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CInProcApp
- BEGIN_MESSAGE_MAP(CInProcApp, CWinApp)
- //{{AFX_MSG_MAP(CInProcApp)
- // NOTE - the ClassWizard will add and remove mapping macros here.
- // DO NOT EDIT what you see in these blocks of generated code!
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CInProcApp construction
- CInProcApp::CInProcApp()
- {
- // TODO: add construction code here,
- // Place all significant initialization in InitInstance
- }
- /////////////////////////////////////////////////////////////////////////////
- // The one and only CInProcApp object
- CInProcApp NEAR theApp;
- /////////////////////////////////////////////////////////////////////////////
- // CInProcApp initialization
- BOOL CInProcApp::InitInstance()
- {
- #ifndef _USRDLL
- if (!RunEmbedded() && !RunAutomated())
- {
- Enable3dControls();
- COleObjectFactory::UpdateRegistryAll();
- AfxMessageBox(IDP_CANT_RUN_STANDALONE);
- return FALSE;
- }
- // Initialize OLE libraries
- if (!AfxOleInit())
- {
- Enable3dControls();
- AfxMessageBox(IDP_OLE_INIT_FAILED);
- return FALSE;
- }
- #endif
- // Register all OLE server (factories) as running. This enables the
- // OLE libraries to create objects from other applications.
- COleObjectFactory::RegisterAll();
- return TRUE;
- }
- /////////////////////////////////////////////////////////////////////////////
- // Special entry points required for inproc servers
- #ifdef _USRDLL
- STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
- {
- AFX_MANAGE_STATE(AfxGetStaticModuleState());
- return AfxDllGetClassObject(rclsid, riid, ppv);
- }
- STDAPI DllCanUnloadNow(void)
- {
- AFX_MANAGE_STATE(AfxGetStaticModuleState());
- return AfxDllCanUnloadNow();
- }
- // by exporting DllRegisterServer, you can use regsvr.exe
- STDAPI DllRegisterServer(void)
- {
- AFX_MANAGE_STATE(AfxGetStaticModuleState());
- COleObjectFactory::UpdateRegistryAll();
- return S_OK;
- }
- #endif //_USRDLL
- /////////////////////////////////////////////////////////////////////////////
- // CInProcApp commands