+
+// ----------------------------------------------------------------------------
+// wxTimerHiddenWindowModule functions
+// ----------------------------------------------------------------------------
+
+
+HWND wxTimerHiddenWindowModule::ms_hwnd = NULL;
+
+const wxChar *wxTimerHiddenWindowModule::ms_className = NULL;
+
+bool wxTimerHiddenWindowModule::OnInit()
+{
+ // do not initialize ms_hwnd to ms_className to NULL here: it may happen
+ // that our GetHWND() is called before the modules are initialized if a
+ // timer is created from wxApp-derived class ctor and in this case we
+ // shouldn't overwrite it
+
+ return true;
+}
+
+void wxTimerHiddenWindowModule::OnExit()
+{
+ if ( ms_hwnd )
+ {
+ if ( !::DestroyWindow(ms_hwnd) )
+ {
+ wxLogLastError(wxT("DestroyWindow(wxTimerHiddenWindow)"));
+ }
+
+ ms_hwnd = NULL;
+ }
+
+ if ( ms_className )
+ {
+ if ( !::UnregisterClass(ms_className, wxGetInstance()) )
+ {
+ wxLogLastError(wxT("UnregisterClass(\"wxTimerHiddenWindow\")"));
+ }
+
+ ms_className = NULL;
+ }
+}
+
+/* static */
+HWND wxTimerHiddenWindowModule::GetHWND()
+{
+ static const wxChar *HIDDEN_WINDOW_CLASS = wxT("wxTimerHiddenWindow");
+ if ( !ms_hwnd )
+ {
+ ms_hwnd = wxCreateHiddenWindow(&ms_className, HIDDEN_WINDOW_CLASS,
+ wxTimerWndProc);
+ }
+
+ return ms_hwnd;
+}
+
+#endif // wxUSE_TIMER