使用soui开发的mbc,只支持windows版本
w1146869587
2022-01-24 4905e2e7537d507f218e8e9595485e09d9f3a2b4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
// mbEasySend.cpp : Defines the initialization routines for the DLL.
//
 
#include "stdafx.h"
#include "mbEasySend.h"
#include <initguid.h>
#include "mbEasySend_i.c"
 
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
 
//
//TODO: If this DLL is dynamically linked against the MFC DLLs,
//        any functions exported from this DLL which call into
//        MFC must have the AFX_MANAGE_STATE macro added at the
//        very beginning of the function.
//
//        For example:
//
//        extern "C" BOOL PASCAL EXPORT ExportedFunction()
//        {
//            AFX_MANAGE_STATE(AfxGetStaticModuleState());
//            // normal function body here
//        }
//
//        It is very important that this macro appear in each
//        function, prior to any calls into MFC.  This means that
//        it must appear as the first statement within the 
//        function, even before any object variable declarations
//        as their constructors may generate calls into the MFC
//        DLL.
//
//        Please see MFC Technical Notes 33 and 58 for additional
//        details.
//
 
// CmbEasySendApp
 
 
class CmbEasySendModule :
    public ATL::CAtlMfcModule
{
public:
    DECLARE_LIBID(LIBID_mbEasySendLib);
    DECLARE_REGISTRY_APPID_RESOURCEID(IDR_MBEASYSEND, "{B2B8AAF9-1D75-408B-9052-1B1A9E58129C}");};
 
CmbEasySendModule _AtlModule;
 
BEGIN_MESSAGE_MAP(CmbEasySendApp, CWinApp)
END_MESSAGE_MAP()
 
 
// CmbEasySendApp construction
 
CmbEasySendApp::CmbEasySendApp()
{
    // TODO: add construction code here,
    // Place all significant initialization in InitInstance
}
 
 
// The one and only CmbEasySendApp object
 
CmbEasySendApp theApp;
 
 
// CmbEasySendApp initialization
 
BOOL CmbEasySendApp::InitInstance()
{
    COleObjectFactory::RegisterAll();
    
    CWinApp::InitInstance();
 
    return TRUE;
}
 
// DllCanUnloadNow - Allows COM to unload DLL
#if !defined(_WIN32_WCE) && !defined(_AMD64_) && !defined(_IA64_)
#pragma comment(linker, "/EXPORT:DllCanUnloadNow=_DllCanUnloadNow@0,PRIVATE")
#pragma comment(linker, "/EXPORT:DllGetClassObject=_DllGetClassObject@12,PRIVATE")
#pragma comment(linker, "/EXPORT:DllRegisterServer=_DllRegisterServer@0,PRIVATE")
#pragma comment(linker, "/EXPORT:DllUnregisterServer=_DllUnregisterServer@0,PRIVATE")
#else
#if defined(_X86_) || defined(_SHX_)
#pragma comment(linker, "/EXPORT:DllCanUnloadNow=_DllCanUnloadNow,PRIVATE")
#pragma comment(linker, "/EXPORT:DllGetClassObject=_DllGetClassObject,PRIVATE")
#pragma comment(linker, "/EXPORT:DllRegisterServer=_DllRegisterServer,PRIVATE")
#pragma comment(linker, "/EXPORT:DllUnregisterServer=_DllUnregisterServer,PRIVATE")
#else
#pragma comment(linker, "/EXPORT:DllCanUnloadNow,PRIVATE")
#pragma comment(linker, "/EXPORT:DllGetClassObject,PRIVATE")
#pragma comment(linker, "/EXPORT:DllRegisterServer,PRIVATE")
#pragma comment(linker, "/EXPORT:DllUnregisterServer,PRIVATE")
#endif // (_X86_)||(_SHX_)
#endif // !_WIN32_WCE && !_AMD64_ && !_IA64_ 
 
STDAPI DllCanUnloadNow(void)
{
    AFX_MANAGE_STATE(AfxGetStaticModuleState());
    if (_AtlModule.GetLockCount() > 0)
        return S_FALSE;
    return S_OK;
}
 
// DllGetClassObject - Returns class factory
STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
{
    AFX_MANAGE_STATE(AfxGetStaticModuleState());
    if (S_OK == _AtlModule.GetClassObject(rclsid, riid, ppv))
        return S_OK;
    return AfxDllGetClassObject(rclsid, riid, ppv);
}
 
// DllRegisterServer - Adds entries to the system registry
STDAPI DllRegisterServer(void)
{
    AFX_MANAGE_STATE(AfxGetStaticModuleState());
    if ( 0 == (GetVersion() & 0x80000000UL) )
    {
        CRegKey    reg;
        LONG    lRet;
 
        lRet    = reg.Open ( HKEY_LOCAL_MACHINE,
                          _T("Software\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Approved"),
                          KEY_SET_VALUE );
 
        if ( ERROR_SUCCESS != lRet )
            return E_ACCESSDENIED;
 
        lRet = reg.SetValue ( _T("MBC EasySend shell extension"), 
                              _T("{A8FF42A6-681E-4AA6-B914-D8D2D6A20F78}") );
        if ( ERROR_SUCCESS != lRet )
            return E_ACCESSDENIED;
    }
    _AtlModule.UpdateRegistryAppId(TRUE);
    HRESULT hRes2 = _AtlModule.RegisterServer(TRUE);
    if (hRes2 != S_OK)
        return hRes2;
    if (!COleObjectFactory::UpdateRegistryAll(TRUE))
        return ResultFromScode(SELFREG_E_CLASS);
    return S_OK;
}
 
// DllUnregisterServer - Removes entries from the system registry
STDAPI DllUnregisterServer(void)
{
    AFX_MANAGE_STATE(AfxGetStaticModuleState());
    if ( 0 == (GetVersion() & 0x80000000UL) )
    {
        CRegKey reg;
        LONG    lRet;
 
        lRet = reg.Open ( HKEY_LOCAL_MACHINE,
                          _T("Software\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Approved"),
                          KEY_SET_VALUE );
 
        if ( ERROR_SUCCESS == lRet )
        {
            lRet = reg.DeleteValue ( _T("{A8FF42A6-681E-4AA6-B914-D8D2D6A20F78}") );
        }
    }
    _AtlModule.UpdateRegistryAppId(FALSE);
    HRESULT hRes2 = _AtlModule.UnregisterServer(TRUE);
    if (hRes2 != S_OK)
        return hRes2;
    if (!COleObjectFactory::UpdateRegistryAll(FALSE))
        return ResultFromScode(SELFREG_E_CLASS);
    return S_OK;
}