Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Cornu2003-04-14 15:49:43 +0000
committerChristophe Cornu2003-04-14 15:49:43 +0000
commita0c92515a5dd09286169b720ccbb60ccfc5bf862 (patch)
tree7b719e4d5d14c8eb24daac3820ac2d00b691eb6a
parentb243b45a5d0e4308832d914b27c7d7a19a7629db (diff)
downloadeclipse.platform.swt-a0c92515a5dd09286169b720ccbb60ccfc5bf862.tar.gz
eclipse.platform.swt-a0c92515a5dd09286169b720ccbb60ccfc5bf862.tar.xz
eclipse.platform.swt-a0c92515a5dd09286169b720ccbb60ccfc5bf862.zip
PR35837
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/swt.c11
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/win32/OS.java2
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/DirectoryDialog.java17
3 files changed, 30 insertions, 0 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/swt.c b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/swt.c
index ba63a7197e..6d2f93381f 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/swt.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/library/swt.c
@@ -174,6 +174,7 @@
#define NO_SendMessageA__II_3I_3I
#define NO_SendMessageW__IIILorg_eclipse_swt_internal_win32_TOOLINFO_2
#define NO_SetDIBColorTable
+#define NO_SetErrorMode
#define NO_SetMenu
#define NO_SetMenuDefaultItem
#define NO_SetMenuInfo
@@ -6491,6 +6492,16 @@ JNIEXPORT jint JNICALL OS_NATIVE(SetDIBColorTable)
}
#endif /* NO_SetDIBColorTable */
+#ifndef NO_SetErrorMode
+JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_win32_OS_SetErrorMode
+ (JNIEnv *env, jclass that, jint arg0)
+{
+ DEBUG_CALL("SetErrorMode\n")
+
+ return (jint)SetErrorMode(arg0);
+}
+#endif /* NO_SetErrorMode */
+
#ifndef NO_SetFocus
JNIEXPORT jint JNICALL OS_NATIVE(SetFocus)
(JNIEnv *env, jclass that, jint arg0)
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 146f43ae14..6b9fa8cbe4 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
@@ -777,6 +777,7 @@ public class OS {
public static final int SC_SIZE = 0xf000;
public static final int SC_TASKLIST = 0xf130;
public static final int SC_VSCROLL = 0xf070;
+ public static final int SEM_FAILCRITICALERRORS = 0x1;
public static final int SF_RTF = 0x2;
public static final int SHCMBF_HIDDEN = 0x2;
public static final int SHCMBM_OVERRIDEKEY = OS.WM_USER + 403;
@@ -2370,6 +2371,7 @@ public static final native int SetClipboardData (int uFormat, int hMem);
public static final native int SetCursor (int hCursor);
public static final native boolean SetCursorPos (int X, int Y);
public static final native int SetDIBColorTable (int hdc, int uStartIndex, int cEntries, byte[] pColors);
+public static final native int SetErrorMode (int uMode);
public static final native int SetFocus (int hWnd);
public static final native boolean SetForegroundWindow (int hWnd);
public static final native int SetLayout (int hdc, int dwLayout);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/DirectoryDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/DirectoryDialog.java
index e7a5e5ff9e..028296247b 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/DirectoryDialog.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/DirectoryDialog.java
@@ -181,7 +181,24 @@ public String open () {
lpbi.lpszTitle = lpszTitle;
lpbi.ulFlags = OS.BIF_NEWDIALOGSTYLE | OS.BIF_RETURNONLYFSDIRS | OS.BIF_EDITBOX | OS.BIF_VALIDATE;
lpbi.lpfn = address;
+ /*
+ * Bug on Windows. On some configurations, SHBrowseForFolder brings up
+ * multiple warning dialogs with the message "There is no disk in the
+ * drive. Please insert a disk into \Device\Harddisk0\DR0". This is
+ * possibly caused by SHBrowseForFolder() calling internally
+ * GetVolumeInformation(). MSDN for GetVolumeInformation() says:
+ * "If you are attempting to obtain information about a floppy drive
+ * that does not have a floppy disk or a CD-ROM drive that does not
+ * have a compact disc, the system displays a message box asking the
+ * user to insert a floppy disk or a compact disc, respectively.
+ * To prevent the system from displaying this message box, call the
+ * SetErrorMode function with SEM_FAILCRITICALERRORS."
+ * The workaround is to call SetErrorMode with the
+ * SEM_FAILCRITICALERRORS flag before calling SHBrowseForFolder.
+ */
+ int oldErrorMode = OS.SetErrorMode(OS.SEM_FAILCRITICALERRORS);
int lpItemIdList = OS.SHBrowseForFolder (lpbi);
+ OS.SetErrorMode(oldErrorMode);
boolean success = lpItemIdList != 0;
if (success) {
/* Use the character encoding for the default locale */

Back to the top