Rein Klazes : comdlg32: Make explorer type file dialogs without custom template or hook proc resizable .
Alexandre Julliard
julliard at winehq.org
Wed Oct 7 09:46:05 CDT 2009
Module: wine
Branch: master
Commit: 3e76f88d2794e9979fe4a2dded7fed875c566fdd
URL: http://source.winehq.org/git/wine.git/?a=commit;h=3e76f88d2794e9979fe4a2dded7fed875c566fdd
Author: Rein Klazes <wijn at online.nl>
Date: Wed Oct 7 11:17:05 2009 +0200
comdlg32: Make explorer type file dialogs without custom template or hook proc resizable.
---
dlls/comdlg32/filedlg.c | 7 ++++++
dlls/comdlg32/tests/filedlg.c | 47 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 54 insertions(+), 0 deletions(-)
diff --git a/dlls/comdlg32/filedlg.c b/dlls/comdlg32/filedlg.c
index d1147eb..afd02dc 100644
--- a/dlls/comdlg32/filedlg.c
+++ b/dlls/comdlg32/filedlg.c
@@ -271,6 +271,13 @@ static BOOL GetFileName95(FileOpenDlgInfos *fodInfos)
return FALSE;
}
+ /* msdn: explorer style dialogs permit sizing by default.
+ * The OFN_ENABLESIZING flag is only needed when a hook or
+ * custom tmeplate is provided */
+ if( (fodInfos->ofnInfos->Flags & OFN_EXPLORER) &&
+ !(fodInfos->ofnInfos->Flags & ( OFN_ENABLEHOOK | OFN_ENABLETEMPLATE | OFN_ENABLETEMPLATEHANDLE)))
+ fodInfos->ofnInfos->Flags |= OFN_ENABLESIZING;
+
if (fodInfos->ofnInfos->Flags & OFN_ENABLESIZING)
{
((LPDLGTEMPLATEW)template)->style |= WS_SIZEBOX;
diff --git a/dlls/comdlg32/tests/filedlg.c b/dlls/comdlg32/tests/filedlg.c
index 6583130..aca2841 100644
--- a/dlls/comdlg32/tests/filedlg.c
+++ b/dlls/comdlg32/tests/filedlg.c
@@ -29,6 +29,8 @@
/* ##### */
+static int resizesupported = TRUE;
+
static void toolbarcheck( HWND hDlg)
{
/* test toolbar properties */
@@ -349,6 +351,7 @@ static LONG_PTR WINAPI resize_template_hook(HWND dlg, UINT msg, WPARAM wParam, L
if( resize_testcases[index].flags & OFN_ENABLESIZING)
if( !(style & WS_SIZEBOX)) {
win_skip( "OFN_ENABLESIZING flag not supported.\n");
+ resizesupported = FALSE;
PostMessage( parent, WM_COMMAND, IDCANCEL, 0);
} else
ok( style & WS_SIZEBOX,
@@ -934,6 +937,49 @@ static void test_getfolderpath(void)
CommDlgExtendedError());
}
+static void test_resizable2(void)
+{
+ OPENFILENAMEA ofn = {0};
+ char filename[1024] = "pls press Enter if sizable, Esc otherwise";
+ DWORD ret;
+
+ /* interactive because there is no hook function */
+ if( !winetest_interactive) {
+ skip( "some interactive resizable dialog tests (set WINETEST_INTERACTIVE=1)\n");
+ return;
+ }
+ ofn.lStructSize = sizeof(ofn);
+ ofn.lpstrFile = filename;
+ ofn.nMaxFile = 1024;
+ ofn.lpfnHook = NULL;
+ ofn.hInstance = GetModuleHandleA(NULL);
+ ofn.lpTemplateName = "template1";
+ ofn.Flags = OFN_EXPLORER;
+#define ISSIZABLE 1
+ ret = GetOpenFileNameA(&ofn);
+ ok( ret == ISSIZABLE, "File Dialog should have been sizable\n");
+ ret = CommDlgExtendedError();
+ ok(!ret, "CommDlgExtendedError returned %#x\n", ret);
+ ofn.Flags = OFN_EXPLORER | OFN_ENABLETEMPLATE;
+ ret = GetOpenFileNameA(&ofn);
+ ok( ret != ISSIZABLE, "File Dialog should NOT have been sizable\n");
+ ret = CommDlgExtendedError();
+ ok(!ret, "CommDlgExtendedError returned %#x\n", ret);
+ ofn.Flags = OFN_EXPLORER | OFN_ENABLETEMPLATEHANDLE;
+ ofn.hInstance = LoadResource( GetModuleHandle(NULL), FindResource( GetModuleHandle(NULL), "template1", (LPSTR)RT_DIALOG));
+ ofn.lpTemplateName = NULL;
+ ret = GetOpenFileNameA(&ofn);
+ ok( ret != ISSIZABLE, "File Dialog should NOT have been sizable\n");
+ ret = CommDlgExtendedError();
+ ok(!ret, "CommDlgExtendedError returned %#x\n", ret);
+ ofn.Flags = OFN_EXPLORER | OFN_ENABLEHOOK;
+ ret = GetOpenFileNameA(&ofn);
+ ok( ret != ISSIZABLE, "File Dialog should NOT have been sizable\n");
+ ret = CommDlgExtendedError();
+ ok(!ret, "CommDlgExtendedError returned %#x\n", ret);
+#undef ISSIZABLE
+}
+
START_TEST(filedlg)
{
test_DialogCancel();
@@ -943,4 +989,5 @@ START_TEST(filedlg)
test_resize();
test_ok();
test_getfolderpath();
+ if( resizesupported) test_resizable2();
}
More information about the wine-cvs
mailing list