// developpers only
         wxStrcat(szBuf, wxT("\nDo you want to stop the program?\nYou can also choose [Cancel] to suppress further warnings."));
 
-#if wxUSE_GUI
-        switch ( wxMessageBox(szBuf, wxT("Debug"),
-                              wxYES_NO | wxCANCEL | wxICON_STOP ) ) {
-            case wxYES:
+        // use the native message box if available: this is more robust than
+        // using our own
+#ifdef __WXMSW__
+        switch ( ::MessageBox(NULL, szBuf, _T("Debug"),
+                              MB_YESNOCANCEL | MB_ICONSTOP ) ) {
+            case IDYES:
                 Trap();
                 break;
 
-            case wxCANCEL:
+            case IDCANCEL:
                 s_bNoAsserts = TRUE;
                 break;
 
-            //case wxNO: nothing to do
+            //case IDNO: nothing to do
         }
-#else // !GUI, but MSW
-        switch ( ::MessageBox(NULL, szBuf, _T("Debug"),
-                              MB_YESNOCANCEL | MB_ICONSTOP ) ) {
-            case IDYES:
+#else // !MSW
+        switch ( wxMessageBox(szBuf, wxT("Debug"),
+                              wxYES_NO | wxCANCEL | wxICON_STOP ) ) {
+            case wxYES:
                 Trap();
                 break;
 
-            case IDCANCEL:
+            case wxCANCEL:
                 s_bNoAsserts = TRUE;
                 break;
 
-            //case IDNO: nothing to do
+            //case wxNO: nothing to do
         }
 #endif // GUI or MSW