Filedlg hook fix
Huw D M Davies
h.davies1 at physics.ox.ac.uk
Mon Jan 19 10:48:51 CST 2004
Huw Davies <huw at codeweavers.com>
Directly use the hook proc for the custom template dialog
rather than calling it through another dlgproc.
Deliver the old style file_ok message with SendMessage, this
allows the dialog to be subclassed (as ATL/WTL does). Only
deliver this message if the app didn't reject the WM_NOTIFY
message.
--
Huw Davies
huw at codeweavers.com
Index: dlls/commdlg/filedlg.c
===================================================================
RCS file: /home/wine/wine/dlls/commdlg/filedlg.c,v
retrieving revision 1.71
diff -u -r1.71 filedlg.c
--- dlls/commdlg/filedlg.c 12 Jan 2004 22:12:58 -0000 1.71
+++ dlls/commdlg/filedlg.c 19 Jan 2004 16:46:31 -0000
@@ -676,30 +676,11 @@
INT_PTR CALLBACK FileOpenDlgProcUserTemplate(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- FileOpenDlgInfos *fodInfos;
-
-#if 0
- TRACE("0x%04x\n", uMsg);
-#endif
-
- switch(uMsg)
- {
- case WM_INITDIALOG:
- {
- fodInfos = (FileOpenDlgInfos *)lParam;
- lParam = (LPARAM) fodInfos->ofnInfos;
-
- if(fodInfos && IsHooked(fodInfos))
- return CallWindowProcA((WNDPROC)fodInfos->ofnInfos->lpfnHook,hwnd,uMsg,wParam,lParam);
- return 0;
- }
+ switch(uMsg) {
+ case WM_INITDIALOG:
+ return TRUE;
}
-
- fodInfos = (FileOpenDlgInfos *) GetPropA(GetParent(hwnd),FileOpenDlgInfosStr);
- if(fodInfos && IsHooked(fodInfos))
- return CallWindowProcA((WNDPROC)fodInfos->ofnInfos->lpfnHook,hwnd,uMsg,wParam,lParam);
-
- return 0;
+ return FALSE;
}
HWND CreateTemplateDialog(FileOpenDlgInfos *fodInfos, HWND hwnd)
@@ -753,8 +734,9 @@
return NULL;
}
}
- hChildDlg= CreateDialogIndirectParamA(COMDLG32_hInstance, template,
- hwnd, FileOpenDlgProcUserTemplate, (LPARAM)fodInfos);
+ hChildDlg = CreateDialogIndirectParamA(COMDLG32_hInstance, template, hwnd,
+ IsHooked(fodInfos) ? (DLGPROC)fodInfos->ofnInfos->lpfnHook : FileOpenDlgProcUserTemplate,
+ (LPARAM)fodInfos->ofnInfos);
if(hChildDlg)
{
ShowWindow(hChildDlg,SW_SHOW);
@@ -779,7 +761,7 @@
temp.menu = temp.class = temp.title = 0;
hChildDlg = CreateDialogIndirectParamA(COMDLG32_hInstance, &temp.tmplate,
- hwnd, FileOpenDlgProcUserTemplate, (LPARAM)fodInfos);
+ hwnd, (DLGPROC)fodInfos->ofnInfos->lpfnHook, (LPARAM)fodInfos->ofnInfos);
return hChildDlg;
}
@@ -1490,12 +1472,16 @@
TRACE("---\n");
/* First send CDN_FILEOK as MSDN doc says */
SendCustomDlgNotificationMessage(hwnd,CDN_FILEOK);
+ if (GetWindowLongW(fodInfos->DlgInfos.hwndCustomDlg, DWL_MSGRESULT))
+ {
+ TRACE("canceled\n");
+ return FALSE;
+ }
/* fodInfos->ofnInfos points to an ASCII or UNICODE structure as appropriate */
- CallWindowProcA((WNDPROC)fodInfos->ofnInfos->lpfnHook,
- fodInfos->DlgInfos.hwndCustomDlg,
- fodInfos->HookMsg.fileokstring, 0, (LPARAM)fodInfos->ofnInfos);
- if (GetWindowLongA(fodInfos->DlgInfos.hwndCustomDlg, DWL_MSGRESULT))
+ SendMessageW(fodInfos->DlgInfos.hwndCustomDlg,
+ fodInfos->HookMsg.fileokstring, 0, (LPARAM)fodInfos->ofnInfos);
+ if (GetWindowLongW(fodInfos->DlgInfos.hwndCustomDlg, DWL_MSGRESULT))
{
TRACE("canceled\n");
return FALSE;
More information about the wine-patches
mailing list