mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
try to use IShellFolderViewCB::MessageSFVCB() in order to override explorer context menus
svn path=/trunk/; revision=18055
This commit is contained in:
parent
edd28d722f
commit
b59af67517
4 changed files with 129 additions and 85 deletions
|
@ -33,7 +33,12 @@
|
||||||
|
|
||||||
ShellBrowser::ShellBrowser(HWND hwnd, HWND left_hwnd, WindowHandle& right_hwnd, ShellPathInfo& create_info,
|
ShellBrowser::ShellBrowser(HWND hwnd, HWND left_hwnd, WindowHandle& right_hwnd, ShellPathInfo& create_info,
|
||||||
HIMAGELIST himl, BrowserCallback* cb, CtxMenuInterfaces& cm_ifs)
|
HIMAGELIST himl, BrowserCallback* cb, CtxMenuInterfaces& cm_ifs)
|
||||||
: _hwnd(hwnd),
|
#ifndef __MINGW32__ // IShellFolderViewCB missing in MinGW (as of 25.09.2005)
|
||||||
|
: super(IID_IShellFolderViewCB),
|
||||||
|
#else
|
||||||
|
:
|
||||||
|
#endif
|
||||||
|
_hwnd(hwnd),
|
||||||
_left_hwnd(left_hwnd),
|
_left_hwnd(left_hwnd),
|
||||||
_right_hwnd(right_hwnd),
|
_right_hwnd(right_hwnd),
|
||||||
_create_info(create_info),
|
_create_info(create_info),
|
||||||
|
@ -357,7 +362,18 @@ void ShellBrowser::UpdateFolderView(IShellFolder* folder)
|
||||||
fs.fFlags = FWF_NOCLIENTEDGE|FWF_BESTFITWINDOW;
|
fs.fFlags = FWF_NOCLIENTEDGE|FWF_BESTFITWINDOW;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef __MINGW32__ // IShellFolderViewCB missing in MinGW (as of 25.09.2005)
|
||||||
|
SFV_CREATE sfv_create;
|
||||||
|
|
||||||
|
sfv_create.cbSize = sizeof(SFV_CREATE);
|
||||||
|
sfv_create.pshf = folder;
|
||||||
|
sfv_create.psvOuter = NULL;
|
||||||
|
sfv_create.psfvcb = this;
|
||||||
|
|
||||||
|
HRESULT hr = SHCreateShellFolderView(&sfv_create, &_pShellView);
|
||||||
|
#else
|
||||||
HRESULT hr = folder->CreateViewObject(_hwnd, IID_IShellView, (void**)&_pShellView);
|
HRESULT hr = folder->CreateViewObject(_hwnd, IID_IShellView, (void**)&_pShellView);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (FAILED(hr)) {
|
if (FAILED(hr)) {
|
||||||
_pShellView = NULL;
|
_pShellView = NULL;
|
||||||
|
@ -378,6 +394,23 @@ void ShellBrowser::UpdateFolderView(IShellFolder* folder)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef __MINGW32__ // IShellFolderViewCB missing in MinGW (as of 25.09.2005)
|
||||||
|
|
||||||
|
/// shell view callback
|
||||||
|
HRESULT STDMETHODCALLTYPE ShellBrowser::MessageSFVCB(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
|
{
|
||||||
|
if (uMsg == SFVM_INITMENUPOPUP) {
|
||||||
|
//@todo never reached
|
||||||
|
InsertMenu((HMENU)lParam, 0, MF_BYPOSITION, 12345, TEXT("TEST ENTRY"));
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
HRESULT ShellBrowser::OnDefaultCommand(LPIDA pida)
|
HRESULT ShellBrowser::OnDefaultCommand(LPIDA pida)
|
||||||
{
|
{
|
||||||
CONTEXT("ShellBrowser::OnDefaultCommand()");
|
CONTEXT("ShellBrowser::OnDefaultCommand()");
|
||||||
|
|
|
@ -57,6 +57,10 @@ struct BrowserCallback
|
||||||
|
|
||||||
/// Implementation of IShellBrowserImpl interface in explorer child windows
|
/// Implementation of IShellBrowserImpl interface in explorer child windows
|
||||||
struct ShellBrowser : public IShellBrowserImpl
|
struct ShellBrowser : public IShellBrowserImpl
|
||||||
|
#ifndef __MINGW32__ // IShellFolderViewCB missing in MinGW (as of 25.09.2005)
|
||||||
|
, public IComSrvBase<IShellFolderViewCB, ShellBrowser>,
|
||||||
|
public SimpleComObject
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
ShellBrowser(HWND hwnd, HWND left_hwnd, WindowHandle& right_hwnd, ShellPathInfo& create_info,
|
ShellBrowser(HWND hwnd, HWND left_hwnd, WindowHandle& right_hwnd, ShellPathInfo& create_info,
|
||||||
HIMAGELIST himl, BrowserCallback* cb, CtxMenuInterfaces& cm_ifs);
|
HIMAGELIST himl, BrowserCallback* cb, CtxMenuInterfaces& cm_ifs);
|
||||||
|
@ -162,6 +166,13 @@ protected:
|
||||||
|
|
||||||
void InitializeTree(HIMAGELIST himl);
|
void InitializeTree(HIMAGELIST himl);
|
||||||
bool InitDragDrop();
|
bool InitDragDrop();
|
||||||
|
|
||||||
|
#ifndef __MINGW32__ // IShellFolderViewCB missing in MinGW (as of 25.09.2005)
|
||||||
|
typedef IComSrvBase<IShellFolderViewCB, ShellBrowser> super;
|
||||||
|
|
||||||
|
// IShellFolderViewCB
|
||||||
|
virtual HRESULT STDMETHODCALLTYPE MessageSFVCB(UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -78,95 +78,11 @@
|
||||||
#define V_INT(x) V_UNION(x, intVal)
|
#define V_INT(x) V_UNION(x, intVal)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
#define NOVTABLE __declspec(novtable)
|
|
||||||
#else
|
|
||||||
#define NOVTABLE
|
|
||||||
#endif
|
|
||||||
#define ANSUNC
|
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(disable: 4355) // use of 'this' for initialization of _connector
|
#pragma warning(disable: 4355) // use of 'this' for initialization of _connector
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
struct NOVTABLE ComSrvObject // NOVTABLE erlaubt, da protected Destruktor
|
|
||||||
{
|
|
||||||
protected:
|
|
||||||
ComSrvObject() : _ref(1) {}
|
|
||||||
virtual ~ComSrvObject() {}
|
|
||||||
|
|
||||||
ULONG _ref;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct SimpleComObject : public ComSrvObject
|
|
||||||
{
|
|
||||||
ULONG IncRef() {return ++_ref;}
|
|
||||||
ULONG DecRef() {ULONG ref=--_ref; if (!ref) {_ref++; delete this;} return ref;}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// server object interfaces
|
|
||||||
|
|
||||||
template<typename BASE> struct IComSrvQI : public BASE
|
|
||||||
{
|
|
||||||
IComSrvQI(REFIID uuid_base)
|
|
||||||
: _uuid_base(uuid_base)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
STDMETHODIMP QueryInterface(REFIID riid, LPVOID* ppv)
|
|
||||||
{
|
|
||||||
*ppv = NULL;
|
|
||||||
|
|
||||||
if (IsEqualIID(riid, _uuid_base) || IsEqualIID(riid, IID_IUnknown))
|
|
||||||
{*ppv=static_cast<BASE*>(this); this->AddRef(); return S_OK;}
|
|
||||||
|
|
||||||
return E_NOINTERFACE;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
IComSrvQI() {}
|
|
||||||
virtual ~IComSrvQI() {}
|
|
||||||
|
|
||||||
REFIID _uuid_base;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<> struct IComSrvQI<IUnknown> : public IUnknown
|
|
||||||
{
|
|
||||||
STDMETHODIMP QueryInterface(REFIID riid, LPVOID* ppv)
|
|
||||||
{
|
|
||||||
*ppv = NULL;
|
|
||||||
|
|
||||||
if (IsEqualIID(riid, IID_IUnknown))
|
|
||||||
{*ppv=this; AddRef(); return S_OK;}
|
|
||||||
|
|
||||||
return E_NOINTERFACE;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
IComSrvQI<IUnknown>() {}
|
|
||||||
virtual ~IComSrvQI<IUnknown>() {}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
template<typename BASE, typename OBJ>
|
|
||||||
class IComSrvBase : public IComSrvQI<BASE>
|
|
||||||
{
|
|
||||||
typedef IComSrvQI<BASE> super;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
IComSrvBase(REFIID uuid_base)
|
|
||||||
: super(uuid_base)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
|
||||||
STDMETHODIMP_(ULONG) AddRef() {return static_cast<OBJ*>(this)->IncRef();}
|
|
||||||
STDMETHODIMP_(ULONG) Release() {return static_cast<OBJ*>(this)->DecRef();}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
template<typename T> struct ConnectionPoint : public SIfacePtr<T>
|
template<typename T> struct ConnectionPoint : public SIfacePtr<T>
|
||||||
{
|
{
|
||||||
ConnectionPoint(IConnectionPointContainer* pCPC, REFIID riid)
|
ConnectionPoint(IConnectionPointContainer* pCPC, REFIID riid)
|
||||||
|
|
|
@ -52,6 +52,13 @@ extern const LPCTSTR sCFSTR_SHELLIDLIST;
|
||||||
#define CFSTR_SHELLIDLIST sCFSTR_SHELLIDLIST
|
#define CFSTR_SHELLIDLIST sCFSTR_SHELLIDLIST
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#define NOVTABLE __declspec(novtable)
|
||||||
|
#else
|
||||||
|
#define NOVTABLE
|
||||||
|
#endif
|
||||||
|
#define ANSUNC
|
||||||
|
|
||||||
|
|
||||||
// Exception Handling
|
// Exception Handling
|
||||||
|
|
||||||
|
@ -438,6 +445,83 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
struct NOVTABLE ComSrvObject // NOVTABLE erlaubt, da protected Destruktor
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
ComSrvObject() : _ref(1) {}
|
||||||
|
virtual ~ComSrvObject() {}
|
||||||
|
|
||||||
|
ULONG _ref;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SimpleComObject : public ComSrvObject
|
||||||
|
{
|
||||||
|
ULONG IncRef() {return ++_ref;}
|
||||||
|
ULONG DecRef() {ULONG ref=--_ref; if (!ref) {_ref++; delete this;} return ref;}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// server object interfaces
|
||||||
|
|
||||||
|
template<typename BASE> struct IComSrvQI : public BASE
|
||||||
|
{
|
||||||
|
IComSrvQI(REFIID uuid_base)
|
||||||
|
: _uuid_base(uuid_base)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
STDMETHODIMP QueryInterface(REFIID riid, LPVOID* ppv)
|
||||||
|
{
|
||||||
|
*ppv = NULL;
|
||||||
|
|
||||||
|
if (IsEqualIID(riid, _uuid_base) || IsEqualIID(riid, IID_IUnknown))
|
||||||
|
{*ppv=static_cast<BASE*>(this); this->AddRef(); return S_OK;}
|
||||||
|
|
||||||
|
return E_NOINTERFACE;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
IComSrvQI() {}
|
||||||
|
virtual ~IComSrvQI() {}
|
||||||
|
|
||||||
|
REFIID _uuid_base;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<> struct IComSrvQI<IUnknown> : public IUnknown
|
||||||
|
{
|
||||||
|
STDMETHODIMP QueryInterface(REFIID riid, LPVOID* ppv)
|
||||||
|
{
|
||||||
|
*ppv = NULL;
|
||||||
|
|
||||||
|
if (IsEqualIID(riid, IID_IUnknown))
|
||||||
|
{*ppv=this; AddRef(); return S_OK;}
|
||||||
|
|
||||||
|
return E_NOINTERFACE;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
IComSrvQI<IUnknown>() {}
|
||||||
|
virtual ~IComSrvQI<IUnknown>() {}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
template<typename BASE, typename OBJ>
|
||||||
|
class IComSrvBase : public IComSrvQI<BASE>
|
||||||
|
{
|
||||||
|
typedef IComSrvQI<BASE> super;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
IComSrvBase(REFIID uuid_base)
|
||||||
|
: super(uuid_base)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
STDMETHODIMP_(ULONG) AddRef() {return static_cast<OBJ*>(this)->IncRef();}
|
||||||
|
STDMETHODIMP_(ULONG) Release() {return static_cast<OBJ*>(this)->DecRef();}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct ShellFolder;
|
struct ShellFolder;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue