[PATCH 1/3] browseui: Add IOleWindow to IProgressDialog

Detlef Riekenberg wine.dev at web.de
Sun Apr 15 15:08:36 CDT 2012


Used by apps to adjust the dialog position
or remove the cancel button before vista

--
By by ... Detlef
---
 dlls/browseui/progressdlg.c |   69 ++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 68 insertions(+), 1 deletions(-)

diff --git a/dlls/browseui/progressdlg.c b/dlls/browseui/progressdlg.c
index 9b970e2..2807622 100644
--- a/dlls/browseui/progressdlg.c
+++ b/dlls/browseui/progressdlg.c
@@ -60,6 +60,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(browseui);
 
 typedef struct tagProgressDialog {
     IProgressDialog IProgressDialog_iface;
+    IOleWindow IOleWindow_iface;
     LONG refCount;
     CRITICAL_SECTION cs;
     HWND hwnd;
@@ -79,6 +80,11 @@ static inline ProgressDialog *impl_from_IProgressDialog(IProgressDialog *iface)
     return CONTAINING_RECORD(iface, ProgressDialog, IProgressDialog_iface);
 }
 
+static inline ProgressDialog *impl_from_IOleWindow(IOleWindow *iface)
+{
+    return CONTAINING_RECORD(iface, ProgressDialog, IOleWindow_iface);
+}
+
 static void set_buffer(LPWSTR *buffer, LPCWSTR string)
 {
     static const WCHAR empty_string[] = {0};
@@ -270,9 +276,20 @@ static HRESULT WINAPI ProgressDialog_QueryInterface(IProgressDialog *iface, REFI
     ProgressDialog *This = impl_from_IProgressDialog(iface);
     *ppvOut = NULL;
 
-    if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_IProgressDialog))
+    if (IsEqualIID(iid, &IID_IUnknown))
     {
         *ppvOut = This;
+        TRACE("(%p, IID_IUnknown, %p) -> %p\n", This, ppvOut, This);
+    }
+    else if (IsEqualIID(iid, &IID_IProgressDialog))
+    {
+        *ppvOut = This;
+        TRACE("(%p, IID_IProgressDialog, %p) -> %p\n", This, ppvOut, This);
+    }
+    else if (IsEqualIID(iid, &IID_IOleWindow))
+    {
+        *ppvOut = &This->IOleWindow_iface;
+        TRACE("(%p, IID_IOleWindow, %p) -> %p\n", This, ppvOut, *ppvOut);
     }
 
     if (*ppvOut)
@@ -495,6 +512,55 @@ static const IProgressDialogVtbl ProgressDialogVtbl =
     ProgressDialog_Timer
 };
 
+static HRESULT WINAPI OleWindow_QueryInterface(IOleWindow *iface, REFIID iid, LPVOID *ppvOut)
+{
+    ProgressDialog *This = impl_from_IOleWindow(iface);
+
+    TRACE("(%p, %s, %p)\n", iface, debugstr_guid(iid), ppvOut);
+    return ProgressDialog_QueryInterface(&This->IProgressDialog_iface, iid, ppvOut);
+}
+
+static ULONG WINAPI OleWindow_AddRef(IOleWindow *iface)
+{
+    ProgressDialog *This = impl_from_IOleWindow(iface);
+    return ProgressDialog_AddRef(&This->IProgressDialog_iface);
+}
+
+static ULONG WINAPI OleWindow_Release(IOleWindow *iface)
+{
+    ProgressDialog *This = impl_from_IOleWindow(iface);
+    return ProgressDialog_Release(&This->IProgressDialog_iface);
+}
+
+static HRESULT WINAPI OleWindow_GetWindow(IOleWindow* iface, HWND* phwnd)
+{
+    ProgressDialog *This = impl_from_IOleWindow(iface);
+
+    TRACE("(%p, %p)\n", This, phwnd);
+    EnterCriticalSection(&This->cs);
+    *phwnd = This->hwnd;
+    LeaveCriticalSection(&This->cs);
+    return S_OK;
+}
+
+static HRESULT WINAPI OleWindow_ContextSensitiveHelp(IOleWindow* iface, BOOL fEnterMode)
+{
+    ProgressDialog *This = impl_from_IOleWindow(iface);
+
+    FIXME("(%p, %d): stub\n", This, fEnterMode);
+    return E_NOTIMPL;
+}
+
+static const IOleWindowVtbl OleWindowVtbl =
+{
+    OleWindow_QueryInterface,
+    OleWindow_AddRef,
+    OleWindow_Release,
+    OleWindow_GetWindow,
+    OleWindow_ContextSensitiveHelp
+};
+
+
 HRESULT ProgressDialog_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut)
 {
     ProgressDialog *This;
@@ -506,6 +572,7 @@ HRESULT ProgressDialog_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut)
         return E_OUTOFMEMORY;
 
     This->IProgressDialog_iface.lpVtbl = &ProgressDialogVtbl;
+    This->IOleWindow_iface.lpVtbl = &OleWindowVtbl;
     This->refCount = 1;
     InitializeCriticalSection(&This->cs);
     This->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": ProgressDialog.cs");
-- 
1.7.5.4




More information about the wine-patches mailing list