From 3d6d9b210a25fbe05ecfca446a84aeeafc4efe0e Mon Sep 17 00:00:00 2001 From: Huw Davies Date: Wed, 18 Oct 2006 17:42:54 +0100 Subject: [PATCH] oledlg: Load the correct dialog template and add a skeleton dialog proc. --- dlls/oledlg/oledlg_private.h | 2 ++ dlls/oledlg/pastespl.c | 44 ++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/dlls/oledlg/oledlg_private.h b/dlls/oledlg/oledlg_private.h index 671eb3edba7..c0b16e51195 100644 --- a/dlls/oledlg/oledlg_private.h +++ b/dlls/oledlg/oledlg_private.h @@ -21,6 +21,8 @@ #ifndef __OLEDLG_PRIVATE_H__ #define __OLEDLG_PRIVATE_H__ +extern HINSTANCE OLEDLG_hInstance; + extern UINT cf_embed_source; extern UINT cf_embedded_object; extern UINT cf_link_source; diff --git a/dlls/oledlg/pastespl.c b/dlls/oledlg/pastespl.c index f255486cd51..56bcbb131be 100644 --- a/dlls/oledlg/pastespl.c +++ b/dlls/oledlg/pastespl.c @@ -28,6 +28,9 @@ #include "winuser.h" #include "winnls.h" #include "oledlg.h" + +#include "oledlg_private.h" + #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(ole); @@ -107,6 +110,30 @@ static inline WCHAR *strdupAtoW(const char *str) return ret; } +static INT_PTR CALLBACK ps_dlg_proc(HWND hdlg, UINT msg, WPARAM wp, LPARAM lp) +{ + TRACE("(%p, %04x, %08x, %08lx)\n", hdlg, msg, wp, lp); + switch(msg) + { + case WM_INITDIALOG: + + return TRUE; /* use default focus */ + + case WM_COMMAND: + switch(LOWORD(wp)) + { + case IDOK: + case IDCANCEL: + EndDialog(hdlg, wp); + return TRUE; + } + return FALSE; + default: + return FALSE; + } + +} + /*********************************************************************** * OleUIPasteSpecialA (OLEDLG.4) */ @@ -170,10 +197,27 @@ UINT WINAPI OleUIPasteSpecialA(LPOLEUIPASTESPECIALA psA) */ UINT WINAPI OleUIPasteSpecialW(LPOLEUIPASTESPECIALW ps) { + LPCDLGTEMPLATEW dlg_templ = (LPCDLGTEMPLATEW)ps->hResource; + TRACE("(%p)\n", ps); if(TRACE_ON(ole)) dump_pastespecial(ps); + if(ps->hInstance || !ps->hResource) + { + HINSTANCE hInst = ps->hInstance ? ps->hInstance : OLEDLG_hInstance; + const WCHAR *name = ps->hInstance ? ps->lpszTemplate : MAKEINTRESOURCEW(IDD_PASTESPECIAL4); + HRSRC hrsrc; + + if(name == NULL) return OLEUI_ERR_LPSZTEMPLATEINVALID; + hrsrc = FindResourceW(hInst, name, MAKEINTRESOURCEW(RT_DIALOG)); + if(!hrsrc) return OLEUI_ERR_FINDTEMPLATEFAILURE; + dlg_templ = LoadResource(hInst, hrsrc); + if(!dlg_templ) return OLEUI_ERR_LOADTEMPLATEFAILURE; + } + + DialogBoxIndirectParamW(OLEDLG_hInstance, dlg_templ, ps->hWndOwner, ps_dlg_proc, (LPARAM)ps); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); return OLEUI_FALSE; }