187878 - FileDialog with MULTI has old look
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java
index 71a5b27..41b693c 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java
@@ -632,6 +632,7 @@
public static final int FEATURE_DISABLE_NAVIGATION_SOUNDS = 21;
public static final int FILE_ATTRIBUTE_NORMAL = 0x00000080;
public static final int FNERR_INVALIDFILENAME = 0x3002;
+ public static final int FNERR_BUFFERTOOSMALL = 0x3003;
public static final int FORMAT_MESSAGE_ALLOCATE_BUFFER = 0x00000100;
public static final int FORMAT_MESSAGE_FROM_SYSTEM = 0x00001000;
public static final int FORMAT_MESSAGE_IGNORE_INSERTS = 0x00000200;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/FileDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/FileDialog.java
index 8532eb7..ddffc20 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/FileDialog.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/FileDialog.java
@@ -38,6 +38,7 @@
String filterPath = "", fileName = "";
static final String FILTER = "*.*";
static int BUFFER_SIZE = 1024 * 32;
+ static boolean USE_HOOK;
/**
* Constructs a new instance of this class given only its parent.
@@ -247,7 +248,7 @@
Callback callback = null;
if ((style & SWT.MULTI) != 0) {
struct.Flags |= OS.OFN_ALLOWMULTISELECT | OS.OFN_EXPLORER;
- if (!OS.IsWinCE) {
+ if (!OS.IsWinCE && USE_HOOK) {
callback = new Callback (this, "OFNHookProc", 4); //$NON-NLS-1$
int lpfnHook = callback.getAddress ();
if (lpfnHook == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS);
@@ -303,9 +304,14 @@
* file name, use an empty file name and open it again.
*/
boolean success = (save) ? OS.GetSaveFileName (struct) : OS.GetOpenFileName (struct);
- if (OS.CommDlgExtendedError () == OS.FNERR_INVALIDFILENAME) {
- OS.MoveMemory (lpstrFile, new TCHAR (0, "", true), TCHAR.sizeof);
- success = (save) ? OS.GetSaveFileName (struct) : OS.GetOpenFileName (struct);
+ switch (OS.CommDlgExtendedError ()) {
+ case OS.FNERR_INVALIDFILENAME:
+ OS.MoveMemory (lpstrFile, new TCHAR (0, "", true), TCHAR.sizeof);
+ success = (save) ? OS.GetSaveFileName (struct) : OS.GetOpenFileName (struct);
+ break;
+ case OS.FNERR_BUFFERTOOSMALL:
+ USE_HOOK = true;
+ break;
}
display.runMessagesInIdle = oldRunMessagesInIdle;