- // find a window for SetTimer(): it should be a valid HWND owned by this
- // thread (even if we had a non NULL m_hwnd before, reset it in case the
- // owner has changed)
- m_hwnd = NULL;
-
- // first try the owner window
- if ( m_owner )
- {
- wxWindow *win = wxDynamicCast(m_owner, wxWindow);
- if ( win )
- {
- m_hwnd = win->GetHWND();
- }
- }
-
- // if not, use a shared hidden window
- if ( !m_hwnd )
- {
- if ( !s_hwndTimer )
- {
- s_hwndTimer = wxCreateHiddenWindow
- (
- &s_classnameTimerWnd,
- wxMSWTIMER_WNDCLASSNAME,
- ::DefWindowProc
- );
-
- if ( !s_hwndTimer )
- {
- wxASSERT_MSG( s_hwndTimer, wxT("can't create a HWND for wxTimer") );
- return false;
- }
- }
-
- m_hwnd = (WXHWND)s_hwndTimer;
-
- }