HexShell.cpp
上传用户:aiweisk
上传日期:2007-05-01
资源大小:85k
文件大小:3k
源码类别:

编辑器/阅读器

开发平台:

DOS

  1. //-------------------------------------------------------------------------------------
  2. // Quick Hex Shell extension
  3. // Copyright (c) 2000 by Shanker.C
  4. // All rights reserved
  5. // Author's consent required if this program is to be used for commercial purposes
  6. // No warranty of any kind, expressed or implied, is included with this
  7. // software; use at your own risk, responsibility for damages (if any) to
  8. // anyone resulting from the use of this software rests entirely with the user.
  9. // Please send comments/suggestions/criticisms to: Shanker@xlprint.com
  10. // March 7, 2000
  11. //---------------------------------------------------------------------------------------
  12. // HexShell.cpp : Implementation of DLL Exports.
  13. // Note: Proxy/Stub Information
  14. //      To build a separate proxy/stub DLL, 
  15. //      run nmake -f HexShellps.mk in the project directory.
  16. #include "stdafx.h"
  17. #include "resource.h"
  18. #include <initguid.h>
  19. #include "HexShell.h"
  20. #include "HexShell_i.c"
  21. #include "HexShellMenu.h"
  22. //---------------------------------------------------------------------------------------
  23. CComModule _Module;
  24. BEGIN_OBJECT_MAP(ObjectMap)
  25. OBJECT_ENTRY(CLSID_HexShellMenu, CHexShellMenu)
  26. END_OBJECT_MAP()
  27. //---------------------------------------------------------------------------------------
  28. class CHexShellApp : public CWinApp
  29. {
  30. public:
  31. // Overrides
  32. // ClassWizard generated virtual function overrides
  33. //{{AFX_VIRTUAL(CHexShellApp)
  34. public:
  35.     virtual BOOL InitInstance();
  36.     virtual int ExitInstance();
  37. //}}AFX_VIRTUAL
  38. //{{AFX_MSG(CHexShellApp)
  39. // NOTE - the ClassWizard will add and remove member functions here.
  40. //    DO NOT EDIT what you see in these blocks of generated code !
  41. //}}AFX_MSG
  42. DECLARE_MESSAGE_MAP()
  43. };
  44. BEGIN_MESSAGE_MAP(CHexShellApp, CWinApp)
  45. //{{AFX_MSG_MAP(CHexShellApp)
  46. // NOTE - the ClassWizard will add and remove mapping macros here.
  47. //    DO NOT EDIT what you see in these blocks of generated code!
  48. //}}AFX_MSG_MAP
  49. END_MESSAGE_MAP()
  50. CHexShellApp theApp;
  51. BOOL CHexShellApp::InitInstance()
  52. {
  53.     _Module.Init(ObjectMap, m_hInstance, &LIBID_HEXSHELLLib);
  54.     return CWinApp::InitInstance();
  55. }
  56. int CHexShellApp::ExitInstance()
  57. {
  58.     _Module.Term();
  59.     return CWinApp::ExitInstance();
  60. }
  61. /////////////////////////////////////////////////////////////////////////////
  62. // Used to determine whether the DLL can be unloaded by OLE
  63. STDAPI DllCanUnloadNow(void)
  64. {
  65.     AFX_MANAGE_STATE(AfxGetStaticModuleState());
  66.     return (AfxDllCanUnloadNow()==S_OK && _Module.GetLockCount()==0) ? S_OK : S_FALSE;
  67. }
  68. /////////////////////////////////////////////////////////////////////////////
  69. // Returns a class factory to create an object of the requested type
  70. STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
  71. {
  72.     return _Module.GetClassObject(rclsid, riid, ppv);
  73. }
  74. /////////////////////////////////////////////////////////////////////////////
  75. // DllRegisterServer - Adds entries to the system registry
  76. STDAPI DllRegisterServer(void)
  77. {
  78.     // registers object, typelib and all interfaces in typelib
  79.     return _Module.RegisterServer(TRUE);
  80. }
  81. /////////////////////////////////////////////////////////////////////////////
  82. // DllUnregisterServer - Removes entries from the system registry
  83. STDAPI DllUnregisterServer(void)
  84. {
  85.     return _Module.UnregisterServer(TRUE);
  86. }