+
+void wxTLWHiddenParentModule::OnExit()
+{
+ if ( ms_hwnd )
+ {
+ if ( !::DestroyWindow(ms_hwnd) )
+ {
+ wxLogLastError(_T("DestroyWindow(hidden TLW parent)"));
+ }
+
+ ms_hwnd = NULL;
+ }
+
+ if ( ms_className )
+ {
+ if ( !::UnregisterClass(ms_className, wxGetInstance()) )
+ {
+ wxLogLastError(_T("UnregisterClass(\"wxTLWHiddenParent\")"));
+ }
+
+ ms_className = NULL;
+ }
+}
+
+/* static */
+HWND wxTLWHiddenParentModule::GetHWND()
+{
+ if ( !ms_hwnd )
+ {
+ if ( !ms_className )
+ {
+ static const wxChar *HIDDEN_PARENT_CLASS = _T("wxTLWHiddenParent");
+
+ WNDCLASS wndclass;
+ wxZeroMemory(wndclass);
+
+ wndclass.lpfnWndProc = DefWindowProc;
+ wndclass.hInstance = wxGetInstance();
+ wndclass.lpszClassName = HIDDEN_PARENT_CLASS;
+
+ if ( !::RegisterClass(&wndclass) )
+ {
+ wxLogLastError(_T("RegisterClass(\"wxTLWHiddenParent\")"));
+ }
+ else
+ {
+ ms_className = HIDDEN_PARENT_CLASS;
+ }
+ }
+
+ ms_hwnd = ::CreateWindow(ms_className, _T(""), 0, 0, 0, 0, 0, NULL,
+ (HMENU)NULL, wxGetInstance(), NULL);
+ if ( !ms_hwnd )
+ {
+ wxLogLastError(_T("CreateWindow(hidden TLW parent)"));
+ }
+ }
+
+ return ms_hwnd;
+}
+