+ if ( !wxTimerImpl::Start( nMilliseconds, bOneShot ) )
+ return false;
+
+ wxWindow* pWin = NULL;
+
+ if (m_owner)
+ {
+ pWin = (wxWindow*)m_owner;
+ m_ulId = ::WinStartTimer( m_Hab
+ ,pWin->GetHWND()
+ ,m_idTimer
+ ,(ULONG)nMilliseconds
+ );
+ }
+ else
+ {
+ m_ulId = ::WinStartTimer( m_Hab
+ ,NULLHANDLE
+ ,0
+ ,(ULONG)nMilliseconds
+ );
+ }
+
+ if (m_ulId > 0L)
+ {
+ // check that SetTimer() didn't reuse an existing id: according to
+ // the MSDN this can happen and this would be catastrophic to us as
+ // we rely on ids uniquely identifying the timers because we use
+ // them as keys in the hash
+ if ( TimerMap().find(m_ulId) != TimerMap().end() )
+ {
+ wxLogError(_("Timer creation failed."));
+
+ ::WinStopTimer(m_Hab, pWin?(pWin->GetHWND()):NULL, m_ulId);
+ m_ulId = 0;
+
+ return false;
+ }
+
+ TimerMap()[m_ulId] = this;
+
+ return true;
+ }
+ else
+ {
+ wxLogSysError(_("Couldn't create a timer"));
+
+ return false;
+ }