home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 2001 July / VPR0107B.BIN / DRIVER / CANOPUS / MVR32 / mvr32.exe / data1.cab / Development_Kit / Vc / Samples / MvrCtrl / MvrCtrl.cpp < prev    next >
C/C++ Source or Header  |  2001-02-09  |  4KB  |  123 lines

  1. //======================================================================
  2. // -- MvrCtrl.cpp --                                                     
  3. //                                                                      
  4. //  MVR-D2000                                                           
  5. //                                  ActiveX    サンプルプログラム      
  6. //                                  ActiveX    sample program          
  7. //                                                                      
  8. // Copyright (C) 2000 Canopus Co., Ltd. All rights reserved.            
  9. //======================================================================
  10. //                                                                      
  11. // -- サンプルプログラムをご使用になる前に ---                          
  12. // -- Before use this sample program... --                              
  13. //                                                                      
  14. // このサンプルプログラムは、カノープス製品を使うためにご使用ください。 
  15. //  Please use this sample progeam to use products of canopus.          
  16. //                                                                      
  17. //======================================================================
  18. // MvrCtrl.cpp : CMvrCtrlApp クラスのインプリメンテーションおよび DLL の登録を行います。
  19.  
  20. #include "stdafx.h"
  21. #include "MvrCtrl.h"
  22.  
  23. #include "cathelp.h"    // Microsoft sampleより
  24.  
  25. #ifdef _DEBUG
  26. #define new DEBUG_NEW
  27. #undef THIS_FILE
  28. static char THIS_FILE[] = __FILE__;
  29. #endif
  30.  
  31.  
  32. CMvrCtrlApp NEAR theApp;
  33.  
  34. const GUID CDECL BASED_CODE _tlid =
  35.         { 0x6d3f3522, 0xe4e0, 0x11d3, { 0xa0, 0x5e, 0, 0xa0, 0xc9, 0xaf, 0xee, 0x48 } };
  36. const WORD _wVerMajor = 1;
  37. const WORD _wVerMinor = 0;
  38.  
  39.  
  40. const CATID CATID_SafeForScripting = {0x7dd95801,0x9882,0x11cf,{0x9f,0xa9,0x00,0xaa,0x00,0x6c,0x42,0xc4}};
  41. const CATID CATID_SafeForInitializing = {0x7dd95802,0x9882,0x11cf,{0x9f,0xa9,0x00,0xaa,0x00,0x6c,0x42,0xc4}};
  42. const GUID CDECL BASED_CODE _clsid =
  43.         { 0x6d3f3525, 0xe4e0, 0x11d3, { 0xa0, 0x5e, 0, 0xa0, 0xc9, 0xaf, 0xee, 0x48 } };
  44.  
  45.  
  46. ////////////////////////////////////////////////////////////////////////////
  47. // CMvrCtrlApp::InitInstance - DLL の初期化
  48. CMvrCtrlApp::CMvrCtrlApp()
  49. {
  50.     m_pControlWnd    = NULL;
  51.     m_DecID    = 0;
  52. }
  53.  
  54. BOOL CMvrCtrlApp::InitInstance()
  55. {
  56.     BOOL bInit = COleControlModule::InitInstance();
  57.  
  58.     if (bInit)
  59.     {
  60.         // TODO: この位置にモジュールの初期化処理コードを追加してください。
  61.     }
  62.  
  63.     return bInit;
  64. }
  65.  
  66.  
  67. ////////////////////////////////////////////////////////////////////////////
  68. // CMvrCtrlApp::ExitInstance - DLL の終了
  69.  
  70. int CMvrCtrlApp::ExitInstance()
  71. {
  72.     // TODO: この位置にモジュールの終了処理を追加してください。
  73.  
  74.     return COleControlModule::ExitInstance();
  75. }
  76.  
  77.  
  78. /////////////////////////////////////////////////////////////////////////////
  79. // DllRegisterServer - システム レジストリのエントリを追加
  80.  
  81. STDAPI DllRegisterServer(void)
  82. {
  83.     AFX_MANAGE_STATE(_afxModuleAddrThis);
  84.  
  85.     if (!AfxOleRegisterTypeLib(AfxGetInstanceHandle(), _tlid))
  86.         return ResultFromScode(SELFREG_E_TYPELIB);
  87.  
  88.     if (!COleObjectFactoryEx::UpdateRegistryAll(TRUE))
  89.         return ResultFromScode(SELFREG_E_CLASS);
  90.  
  91.     // スクリプトを実行しても安全であるマークをつける
  92.     CreateComponentCategory(CATID_SafeForScripting, L"Controls that are safely scriptable");
  93.     RegisterCLSIDInCategory(_clsid, CATID_SafeForScripting);
  94.  
  95.     CreateComponentCategory(CATID_SafeForInitializing, L"Controls safely initializable from persistent data");
  96.     RegisterCLSIDInCategory(_clsid, CATID_SafeForInitializing);
  97.     //
  98.  
  99.     return NOERROR;
  100. }
  101.  
  102.  
  103. /////////////////////////////////////////////////////////////////////////////
  104. // DllUnregisterServer - システム レジストリからのエントリを削除
  105.  
  106. STDAPI DllUnregisterServer(void)
  107. {
  108.     AFX_MANAGE_STATE(_afxModuleAddrThis);
  109.  
  110.     // スクリプトを実行しても安全であるマークをのける
  111.     UnRegisterCLSIDInCategory(_clsid, CATID_SafeForScripting);
  112.     UnRegisterCLSIDInCategory(_clsid, CATID_SafeForInitializing);
  113.     //
  114.  
  115.     if (!AfxOleUnregisterTypeLib(_tlid, _wVerMajor, _wVerMinor))
  116.         return ResultFromScode(SELFREG_E_TYPELIB);
  117.  
  118.     if (!COleObjectFactoryEx::UpdateRegistryAll(FALSE))
  119.         return ResultFromScode(SELFREG_E_CLASS);
  120.  
  121.     return NOERROR;
  122. }
  123.