]>
git.saurik.com Git - wxWidgets.git/blob - src/msw/basemsw.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: msw/basemsw.cpp
3 // Purpose: misc stuff only used in console applications under MSW
4 // Author: Vadim Zeitlin
8 // Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwindows.org>
9 // License: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 // for compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
30 #include "wx/apptrait.h"
31 #include "wx/msw/private/timer.h"
32 // MBN: this is a workaround for MSVC 5: if it is not #included in
33 // some wxBase file, wxRecursionGuard methods won't be exported from
34 // wxBase.dll, and MSVC 5 will give linker errors
35 #include "wx/recguard.h"
37 #include "wx/msw/private.h"
39 // ============================================================================
40 // wxAppTraits implementation
41 // ============================================================================
43 WXDWORD
wxAppTraits::DoSimpleWaitForThread(WXHANDLE hThread
)
45 return ::WaitForSingleObject((HANDLE
)hThread
, INFINITE
);
48 // ============================================================================
49 // wxConsoleAppTraits implementation
50 // ============================================================================
52 void wxConsoleAppTraits::AlwaysYield()
54 // we need to use special logic to deal with WM_PAINT: as this pseudo
55 // message is generated automatically as long as there are invalidated
56 // windows belonging to this thread, we'd never return if we waited here
57 // until we have no more of them left. OTOH, this message is always the
58 // last one in the queue, so we can safely return as soon as we detect it
60 while ( ::PeekMessage(&msg
, NULL
, 0, 0, PM_REMOVE
) )
62 if ( msg
.message
== WM_PAINT
)
67 void *wxConsoleAppTraits::BeforeChildWaitLoop()
73 void wxConsoleAppTraits::AfterChildWaitLoop(void * WXUNUSED(data
))
78 bool wxConsoleAppTraits::DoMessageFromThreadWait()
80 // nothing to process here
85 wxConsoleAppTraits::CreateTimerImpl(wxTimer
*timer
)
87 return new wxMSWTimerImpl(timer
);
91 WXDWORD
wxConsoleAppTraits::WaitForThread(WXHANDLE hThread
)
93 return DoSimpleWaitForThread(hThread
);