try to use IShellFolderViewCB::MessageSFVCB() in order to override
explorer context menus
Modified: trunk/reactos/subsys/system/explorer/shell/shellbrowser.cpp
Modified: trunk/reactos/subsys/system/explorer/shell/shellbrowser.h
Modified: trunk/reactos/subsys/system/explorer/shell/webchild.h
Modified: trunk/reactos/subsys/system/explorer/utility/shellclasses.h
_____
Modified: trunk/reactos/subsys/system/explorer/shell/shellbrowser.cpp
--- trunk/reactos/subsys/system/explorer/shell/shellbrowser.cpp
2005-09-25 13:58:27 UTC (rev 18054)
+++ trunk/reactos/subsys/system/explorer/shell/shellbrowser.cpp
2005-09-25 15:59:38 UTC (rev 18055)
@@ -33,7 +33,12 @@
ShellBrowser::ShellBrowser(HWND hwnd, HWND left_hwnd, WindowHandle&
right_hwnd, ShellPathInfo& create_info,
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),
_right_hwnd(right_hwnd),
_create_info(create_info),
@@ -357,7 +362,18 @@
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);
+#endif
if (FAILED(hr)) {
_pShellView = NULL;
@@ -378,6 +394,23 @@
}
+#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)
{
CONTEXT("ShellBrowser::OnDefaultCommand()");
_____
Modified: trunk/reactos/subsys/system/explorer/shell/shellbrowser.h
--- trunk/reactos/subsys/system/explorer/shell/shellbrowser.h
2005-09-25 13:58:27 UTC (rev 18054)
+++ trunk/reactos/subsys/system/explorer/shell/shellbrowser.h
2005-09-25 15:59:38 UTC (rev 18055)
@@ -57,6 +57,10 @@
/// Implementation of IShellBrowserImpl interface in explorer child
windows
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,
HIMAGELIST himl,
BrowserCallback* cb, CtxMenuInterfaces& cm_ifs);
@@ -162,6 +166,13 @@
void InitializeTree(HIMAGELIST himl);
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
};
_____
Modified: trunk/reactos/subsys/system/explorer/shell/webchild.h
--- trunk/reactos/subsys/system/explorer/shell/webchild.h
2005-09-25 13:58:27 UTC (rev 18054)
+++ trunk/reactos/subsys/system/explorer/shell/webchild.h
2005-09-25 15:59:38 UTC (rev 18055)
@@ -79,94 +79,10 @@
#endif
#ifdef _MSC_VER
-#define NOVTABLE __declspec(novtable)
-#else
-#define NOVTABLE
-#endif
-#define ANSUNC
-
-#ifdef _MSC_VER
#pragma warning(disable: 4355) // use of 'this' for initialization of
_connector
#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>
{
ConnectionPoint(IConnectionPointContainer* pCPC, REFIID riid)
_____
Modified: trunk/reactos/subsys/system/explorer/utility/shellclasses.h
--- trunk/reactos/subsys/system/explorer/utility/shellclasses.h
2005-09-25 13:58:27 UTC (rev 18054)
+++ trunk/reactos/subsys/system/explorer/utility/shellclasses.h
2005-09-25 15:59:38 UTC (rev 18055)
@@ -52,7 +52,14 @@
#define CFSTR_SHELLIDLIST sCFSTR_SHELLIDLIST
#endif
+#ifdef _MSC_VER
+#define NOVTABLE __declspec(novtable)
+#else
+#define NOVTABLE
+#endif
+#define ANSUNC
+
// Exception Handling
#ifndef _NO_COMUTIL
@@ -438,7 +445,84 @@
};
+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;