From 45a352a7734a373d7992f8387c8e2c372f6653c7 Mon Sep 17 00:00:00 2001 From: Aric Stewart Date: Tue, 21 Oct 2008 13:11:23 -0500 Subject: [PATCH] comdlg32: Some applications expect the filter combo to be filled before the CustomDlg is created. --- dlls/comdlg32/filedlg.c | 7 ++++--- dlls/comdlg32/tests/filedlg.c | 12 ++++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/dlls/comdlg32/filedlg.c b/dlls/comdlg32/filedlg.c index dd4752835e6..65d73d2f307 100644 --- a/dlls/comdlg32/filedlg.c +++ b/dlls/comdlg32/filedlg.c @@ -1388,6 +1388,10 @@ static LRESULT FILEDLG95_InitControls(HWND hwnd) LoadStringW(COMDLG32_hInstance, IDS_SAVE_IN, buf, sizeof(buf)/sizeof(WCHAR)); SetDlgItemTextW(hwnd, IDC_LOOKINSTATIC, buf); } + + /* Initialize the filter combo box */ + FILEDLG95_FILETYPE_Init(hwnd); + return 0; } @@ -1476,9 +1480,6 @@ static LRESULT FILEDLG95_FillControls(HWND hwnd, WPARAM wParam, LPARAM lParam) /* Initialize the Look In combo box */ FILEDLG95_LOOKIN_Init(fodInfos->DlgInfos.hwndLookInCB); - /* Initialize the filter combo box */ - FILEDLG95_FILETYPE_Init(hwnd); - /* Browse to the initial directory */ IShellBrowser_BrowseObject(fodInfos->Shell.FOIShellBrowser,pidlItemId, SBSP_ABSOLUTE); diff --git a/dlls/comdlg32/tests/filedlg.c b/dlls/comdlg32/tests/filedlg.c index 6cfcd17154e..c3ca118233e 100644 --- a/dlls/comdlg32/tests/filedlg.c +++ b/dlls/comdlg32/tests/filedlg.c @@ -207,6 +207,17 @@ cleanup: static LONG_PTR WINAPI template_hook(HWND dlg, UINT msg, WPARAM wParam, LPARAM lParam) { + if (msg == WM_INITDIALOG) + { + HWND p,cb; + INT sel; + p = GetParent(dlg); + ok(p!=(HWND)NULL, "Failed to get parent of template\n"); + cb = GetDlgItem(p,0x470); + ok(cb!=(HWND)NULL, "Failed to get filter combobox\n"); + sel = SendMessage(cb, CB_GETCURSEL, 0, 0); + ok (sel != -1, "Failed to get selection from filter listbox\n"); + } if (msg == WM_NOTIFY) { if (((LPNMHDR)lParam)->code == CDN_FOLDERCHANGE) @@ -245,6 +256,7 @@ static void test_create_view_template(void) ofn.Flags = OFN_ENABLEHOOK | OFN_EXPLORER| OFN_ENABLETEMPLATE; ofn.hInstance = GetModuleHandleW(NULL); ofn.lpTemplateName = "template1"; + ofn.lpstrFilter="text\0*.txt\0All\0*\0\0"; ret = GetOpenFileNameA(&ofn); ok(!ret, "GetOpenFileNameA returned %#x\n", ret); ret = CommDlgExtendedError(); -- 2.11.4.GIT