]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/app.cpp
Typo correction
[wxWidgets.git] / src / msw / app.cpp
index 23307d06b1760037ae6ccf3764d9a7a90be5a464..61218c71902647361d85cde2696201497e7cb760 100644 (file)
@@ -25,6 +25,7 @@
 #endif
 
 #ifndef WX_PRECOMP
+    #include "wx/msw/wrapcctl.h"
     #include "wx/dynarray.h"
     #include "wx/frame.h"
     #include "wx/app.h"
     #include "wx/intl.h"
     #include "wx/wxchar.h"
     #include "wx/log.h"
+    #include "wx/module.h"
 #endif
 
 #include "wx/apptrait.h"
 #include "wx/filename.h"
-#include "wx/module.h"
 #include "wx/dynlib.h"
 #include "wx/evtloop.h"
 
@@ -76,8 +77,6 @@
 #include <string.h>
 #include <ctype.h>
 
-#include "wx/msw/wrapcctl.h"
-
 // For MB_TASKMODAL
 #ifdef __WXWINCE__
 #include "wx/msw/wince/missing.h"
@@ -226,6 +225,26 @@ bool wxGUIAppTraits::DoMessageFromThreadWait()
     return evtLoop->Dispatch();
 }
 
+DWORD wxGUIAppTraits::WaitForThread(WXHANDLE hThread)
+{
+    // if we don't have a running event loop, we shouldn't wait for the
+    // messages as we never remove them from the message queue and so we enter
+    // an infinite loop as MsgWaitForMultipleObjects() keeps returning
+    // WAIT_OBJECT_0 + 1
+    if ( !wxEventLoop::GetActive() )
+        return DoSimpleWaitForThread(hThread);
+
+    return ::MsgWaitForMultipleObjects
+             (
+               1,                   // number of objects to wait for
+               (HANDLE *)&hThread,  // the objects
+               false,               // wait for any objects, not all
+               INFINITE,            // no timeout
+               QS_ALLINPUT |        // return as soon as there are any events
+               QS_ALLPOSTMESSAGE
+             );
+}
+
 wxPortId wxGUIAppTraits::GetToolkitVersion(int *majVer, int *minVer) const
 {
     OSVERSIONINFO info;