home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2002 March / PCWMAR02.iso / software / turbocad / v8trial / TurboCADv8ProfessionalNoReg.exe / Data.Cab / F39405_PrintCAD.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2001-10-16  |  3.1 KB  |  108 lines

  1. /******************************************************************/
  2. /*                                                                */
  3. /*                      TurboCAD for Windows                      */
  4. /*                   Copyright (c) 1993 - 2001                    */
  5. /*             International Microcomputer Software, Inc.         */
  6. /*                            (IMSI)                              */
  7. /*                      All rights reserved.                      */
  8. /*                                                                */
  9. /******************************************************************/
  10.  
  11. // PrintCAD.cpp : Implementation of DLL Exports.
  12.  
  13.  
  14. // Note: Proxy/Stub Information
  15. //      To build a separate proxy/stub DLL, 
  16. //      run nmake -f PrintCADps.mk in the project directory.
  17.  
  18. #include "stdafx.h"
  19. #include "resource.h"
  20. #include <initguid.h>
  21. #include "PrintCAD.h"
  22.  
  23. #include "PrintCAD_i.c"
  24. #include "PrintDr.h"
  25.  
  26.  
  27. CComModule _Module;
  28.  
  29. BEGIN_OBJECT_MAP(ObjectMap)
  30. OBJECT_ENTRY(CLSID_PrintDr, CPrintDr)
  31. END_OBJECT_MAP()
  32.  
  33. class CPrintCADApp : public CWinApp
  34. {
  35. public:
  36.  
  37. // Overrides
  38.     // ClassWizard generated virtual function overrides
  39.     //{{AFX_VIRTUAL(CPrintCADApp)
  40.     public:
  41.     virtual BOOL InitInstance();
  42.     virtual int ExitInstance();
  43.     //}}AFX_VIRTUAL
  44.  
  45.     //{{AFX_MSG(CPrintCADApp)
  46.         // NOTE - the ClassWizard will add and remove member functions here.
  47.         //    DO NOT EDIT what you see in these blocks of generated code !
  48.     //}}AFX_MSG
  49.     DECLARE_MESSAGE_MAP()
  50. };
  51.  
  52. BEGIN_MESSAGE_MAP(CPrintCADApp, CWinApp)
  53.     //{{AFX_MSG_MAP(CPrintCADApp)
  54.         // NOTE - the ClassWizard will add and remove mapping macros here.
  55.         //    DO NOT EDIT what you see in these blocks of generated code!
  56.     //}}AFX_MSG_MAP
  57. END_MESSAGE_MAP()
  58.  
  59. CPrintCADApp theApp;
  60.  
  61. BOOL CPrintCADApp::InitInstance()
  62. {
  63.     _Module.Init(ObjectMap, m_hInstance, &LIBID_PRINTCADLib);
  64.     return CWinApp::InitInstance();
  65. }
  66.  
  67. int CPrintCADApp::ExitInstance()
  68. {
  69.     _Module.Term();
  70.     return CWinApp::ExitInstance();
  71. }
  72.  
  73. /////////////////////////////////////////////////////////////////////////////
  74. // Used to determine whether the DLL can be unloaded by OLE
  75.  
  76. STDAPI DllCanUnloadNow(void)
  77. {
  78.     AFX_MANAGE_STATE(AfxGetStaticModuleState());
  79.     return (AfxDllCanUnloadNow()==S_OK && _Module.GetLockCount()==0) ? S_OK : S_FALSE;
  80. }
  81.  
  82. /////////////////////////////////////////////////////////////////////////////
  83. // Returns a class factory to create an object of the requested type
  84.  
  85. STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
  86. {
  87.     return _Module.GetClassObject(rclsid, riid, ppv);
  88. }
  89.  
  90. /////////////////////////////////////////////////////////////////////////////
  91. // DllRegisterServer - Adds entries to the system registry
  92.  
  93. STDAPI DllRegisterServer(void)
  94. {
  95.     // registers object, typelib and all interfaces in typelib
  96.     return _Module.RegisterServer(TRUE);
  97. }
  98.  
  99. /////////////////////////////////////////////////////////////////////////////
  100. // DllUnregisterServer - Removes entries from the system registry
  101.  
  102. STDAPI DllUnregisterServer(void)
  103. {
  104.     return _Module.UnregisterServer(TRUE);
  105. }
  106.  
  107.  
  108.