// 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)
|