使用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
// MBShellExt.h : Declaration of the CMBShellExt
 
#pragma once
#include "resource.h"       // main symbols
 
 
 
#include "mbEasySend_i.h"
 
 
#include <shlobj.h>
#include <afx.h>
#include <comdef.h>
 
#if _MSC_VER >= 1400
struct __declspec(uuid("000214e4-0000-0000-c000-000000000046")) 
IContextMenu; 
_COM_SMARTPTR_TYPEDEF(IContextMenu, __uuidof(IContextMenu)); 
#endif
 
 
#if defined(_WIN32_WCE) && !defined(_CE_DCOM) && !defined(_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA)
#error "Single-threaded COM objects are not properly supported on Windows CE platform, such as the Windows Mobile platforms that do not include full DCOM support. Define _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA to force ATL to support creating single-thread COM object's and allow use of it's single-threaded COM object implementations. The threading model in your rgs file was set to 'Free' as that is the only threading model supported in non DCOM Windows CE platforms."
#endif
 
using namespace ATL;
 
 
// CMBShellExt
 
class ATL_NO_VTABLE CMBShellExt :
    public CComObjectRootEx<CComSingleThreadModel>,
    public CComCoClass<CMBShellExt, &CLSID_MBShellExt>,
    public IDispatchImpl<IMBShellExt, &IID_IMBShellExt, &LIBID_mbEasySendLib, /*wMajor =*/ 1, /*wMinor =*/ 0>,
    public IShellExtInit,
    public IContextMenu
{
public:
    CMBShellExt()
    {
        m_strBinPath = _T("");
        //m_hShareMemory = NULL;
        //m_hEventShareMemory= NULL;
    }
    // IShellExtInit
public:
    STDMETHOD(Initialize)(LPCITEMIDLIST, LPDATAOBJECT, HKEY);
 
// IContextMenu
public:
#ifdef _WIN64
    STDMETHOD(GetCommandString)(UINT_PTR, UINT, UINT*, LPSTR, UINT);
#else
    STDMETHOD(GetCommandString)(UINT, UINT, UINT*, LPSTR, UINT);
#endif
    STDMETHOD(InvokeCommand)(LPCMINVOKECOMMANDINFO);
    STDMETHOD(QueryContextMenu)(HMENU, UINT, UINT, UINT, UINT);
 
DECLARE_REGISTRY_RESOURCEID(IDR_MBSHELLEXT)
 
 
BEGIN_COM_MAP(CMBShellExt)
    COM_INTERFACE_ENTRY(IMBShellExt)
    COM_INTERFACE_ENTRY(IDispatch)
    COM_INTERFACE_ENTRY(IShellExtInit)
    COM_INTERFACE_ENTRY(IContextMenu)
END_COM_MAP()
 
 
 
    DECLARE_PROTECT_FINAL_CONSTRUCT()
 
    HRESULT FinalConstruct()
    {
        
        return S_OK;
    }
 
    void FinalRelease()
    {
        /*if(m_hShareMemory)
        {
            CloseHandle(m_hShareMemory);
            m_hShareMemory = NULL;
        }*/
        /*if(m_hEventShareMemory)
        {
            CloseHandle(m_hEventShareMemory);
            m_hEventShareMemory = NULL;
        }*/
    }
 
public:
    // IASShellExt
public:
    CStringList        m_lsFiles;
 
    CStringList        m_lsAddInName;                // AddinµÄÃû³Æ
    CStringList        m_lsAddInDispName;            // AddinµÄÏÔʾÃû³Æ
    CString            m_strBinPath;
    //HANDLE            m_hShareMemory;
    //HANDLE            m_hEventShareMemory;
// Operations
public:
    void            GetAddInMenu( );
    void            WriteLog( CString strLog );
    bool            CStringToAnsi( LPCTSTR pszT,  LPSTR *ppszA  );
private:
    CString    GetSTKWorkDir();
    CString    GetPathName( CString strFileName );
     CString GetModulePath( );
    bool            DoSTKCom( long nMenuID, HWND hWnd);
    HBITMAP            GetSTKBitmap(int nMenuType = 0);
 
 
};
 
OBJECT_ENTRY_AUTO(__uuidof(MBShellExt), CMBShellExt)