Commit 8e9e8922 authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

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.
parent 301bbc49
...@@ -676,30 +676,11 @@ static void ArrangeCtrlPositions(HWND hwndChildDlg, HWND hwndParentDlg, BOOL hid ...@@ -676,30 +676,11 @@ static void ArrangeCtrlPositions(HWND hwndChildDlg, HWND hwndParentDlg, BOOL hid
INT_PTR CALLBACK FileOpenDlgProcUserTemplate(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) INT_PTR CALLBACK FileOpenDlgProcUserTemplate(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
FileOpenDlgInfos *fodInfos; switch(uMsg) {
case WM_INITDIALOG:
#if 0 return TRUE;
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;
}
} }
return FALSE;
fodInfos = (FileOpenDlgInfos *) GetPropA(GetParent(hwnd),FileOpenDlgInfosStr);
if(fodInfos && IsHooked(fodInfos))
return CallWindowProcA((WNDPROC)fodInfos->ofnInfos->lpfnHook,hwnd,uMsg,wParam,lParam);
return 0;
} }
HWND CreateTemplateDialog(FileOpenDlgInfos *fodInfos, HWND hwnd) HWND CreateTemplateDialog(FileOpenDlgInfos *fodInfos, HWND hwnd)
...@@ -753,8 +734,9 @@ HWND CreateTemplateDialog(FileOpenDlgInfos *fodInfos, HWND hwnd) ...@@ -753,8 +734,9 @@ HWND CreateTemplateDialog(FileOpenDlgInfos *fodInfos, HWND hwnd)
return NULL; return NULL;
} }
} }
hChildDlg= CreateDialogIndirectParamA(COMDLG32_hInstance, template, hChildDlg = CreateDialogIndirectParamA(COMDLG32_hInstance, template, hwnd,
hwnd, FileOpenDlgProcUserTemplate, (LPARAM)fodInfos); IsHooked(fodInfos) ? (DLGPROC)fodInfos->ofnInfos->lpfnHook : FileOpenDlgProcUserTemplate,
(LPARAM)fodInfos->ofnInfos);
if(hChildDlg) if(hChildDlg)
{ {
ShowWindow(hChildDlg,SW_SHOW); ShowWindow(hChildDlg,SW_SHOW);
...@@ -779,7 +761,7 @@ HWND CreateTemplateDialog(FileOpenDlgInfos *fodInfos, HWND hwnd) ...@@ -779,7 +761,7 @@ HWND CreateTemplateDialog(FileOpenDlgInfos *fodInfos, HWND hwnd)
temp.menu = temp.class = temp.title = 0; temp.menu = temp.class = temp.title = 0;
hChildDlg = CreateDialogIndirectParamA(COMDLG32_hInstance, &temp.tmplate, hChildDlg = CreateDialogIndirectParamA(COMDLG32_hInstance, &temp.tmplate,
hwnd, FileOpenDlgProcUserTemplate, (LPARAM)fodInfos); hwnd, (DLGPROC)fodInfos->ofnInfos->lpfnHook, (LPARAM)fodInfos->ofnInfos);
return hChildDlg; return hChildDlg;
} }
...@@ -1490,12 +1472,16 @@ static BOOL FILEDLG95_SendFileOK( HWND hwnd, FileOpenDlgInfos *fodInfos ) ...@@ -1490,12 +1472,16 @@ static BOOL FILEDLG95_SendFileOK( HWND hwnd, FileOpenDlgInfos *fodInfos )
TRACE("---\n"); TRACE("---\n");
/* First send CDN_FILEOK as MSDN doc says */ /* First send CDN_FILEOK as MSDN doc says */
SendCustomDlgNotificationMessage(hwnd,CDN_FILEOK); 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 */ /* fodInfos->ofnInfos points to an ASCII or UNICODE structure as appropriate */
CallWindowProcA((WNDPROC)fodInfos->ofnInfos->lpfnHook, SendMessageW(fodInfos->DlgInfos.hwndCustomDlg,
fodInfos->DlgInfos.hwndCustomDlg, fodInfos->HookMsg.fileokstring, 0, (LPARAM)fodInfos->ofnInfos);
fodInfos->HookMsg.fileokstring, 0, (LPARAM)fodInfos->ofnInfos); if (GetWindowLongW(fodInfos->DlgInfos.hwndCustomDlg, DWL_MSGRESULT))
if (GetWindowLongA(fodInfos->DlgInfos.hwndCustomDlg, DWL_MSGRESULT))
{ {
TRACE("canceled\n"); TRACE("canceled\n");
return FALSE; return FALSE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment