- if ( parent->IsKindOf(CLASSINFO(wxFrame)) )
- {
- frame = (wxFrame *)parent;
-
- break;
- }
- else if ( parent->IsKindOf(CLASSINFO(wxDialog)) )
- {
- dialog = (wxDialog *)parent;
-
- break;
- }
-
- parent = parent->GetParent();
- }
-
- wxCHECK_MSG( frame || dialog, 0,
- _T("can't create tooltip control outside a frame or a dialog") );
-
- HWND hwndTT = (HWND)(frame ? frame->GetToolTipCtrl()
- : dialog->GetToolTipCtrl());
- if ( !hwndTT )
- {
- hwndTT = ::CreateWindow(TOOLTIPS_CLASS,
- (LPSTR)NULL,
- TTS_ALWAYSTIP,
- CW_USEDEFAULT, CW_USEDEFAULT,
- CW_USEDEFAULT, CW_USEDEFAULT,
- (HWND)parent->GetHWND(), (HMENU)NULL,
- wxGetInstance(), NULL);
-
- if ( hwndTT )
- {
- if ( frame )
- frame->SetToolTipCtrl((WXHWND)hwndTT);
- else
- dialog->SetToolTipCtrl((WXHWND)hwndTT);
- }
- else
- {
- wxLogSysError(_("Can not create tooltip control"));
- }
+ ms_hwndTT = (WXHWND)::CreateWindow(TOOLTIPS_CLASS,
+ (LPSTR)NULL,
+ TTS_ALWAYSTIP,
+ CW_USEDEFAULT, CW_USEDEFAULT,
+ CW_USEDEFAULT, CW_USEDEFAULT,
+ NULL, (HMENU)NULL,
+ wxGetInstance(),
+ NULL);
+ if ( ms_hwndTT )
+ {
+ HWND hwnd = (HWND)ms_hwndTT;
+ SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0,
+ SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
+
+#if wxUSE_TTM_WINDOWFROMPOINT
+ // subclass the newly created control
+ gs_wndprocToolTip = (WNDPROC)::GetWindowLong(hwnd, GWL_WNDPROC);
+ ::SetWindowLong(hwnd, GWL_WNDPROC, (long)wxToolTipWndProc);
+#endif // wxUSE_TTM_WINDOWFROMPOINT
+ }