msp0815

Hello everybody,

after switching from Visual C++ 6.0 (VC 6) to Visual C++ 2005 (VC 8), many tooltips in my dialogues would not show up anymore.  It took me quite a  while to pin down the reason for this behaviour:

The tooltips don't show up anymore for all child window controls which lie inside the window rect of another control like a group box or a tab control(*) preceding it in the tab order. The enclosing control has child window id IDC_STATIC, which in VC 6 meant that it was ignored by CWnd::OnToolHitTest()  (more precisely by _AfxChildWindowFromPoint(), which is used by OnToolHitTest(), see below). Now in VC 8 the constant for the controls-to-be-ignored changed from (WORD)-1  (=IDC_STATIC)  to (WORD)0.

(*) i don't use a subdialogs to show the content of the active tab. All controls on the active tab are children of the main dialog which are shown/hidden by me when the active tab changes.

By changing the child window ids of my group boxes (resp. tab controls) accordingly, I was able to fix the problem. Since our sources must be compilable with both versions of the compiler, I had to introduce a preprocessor switch for this.

Does anybody know more about the reason for this breaking change or did anybody of you encounter similar problems   I was irritated by the fact that I could not find any information on the microsoft site or elsewhere on the internet.  (a tooltip for a control in a group box should not be such a rare thing ).  Therefore I post this information here, hoping it may save other programmers some time.

MSP

 

HWND AFXAPI _AfxChildWindowFromPoint(HWND hWnd, POINT pt)
{
 ASSERT(hWnd != NULL);

 // check child windows
 ::ClientToScreen(hWnd, &pt);
 HWND hWndChild = ::GetWindow(hWnd, GW_CHILD);
 for (; hWndChild != NULL; hWndChild = ::GetWindow(hWndChild, GW_HWNDNEXT))
 {
  if (_AfxGetDlgCtrlID(hWndChild) != (WORD)0 /* used to be (WORD)-1 in VC 6*/ &&
   (::GetWindowLong(hWndChild, GWL_STYLE) & WS_VISIBLE))
  {
   // see if point hits the child window
   CRect rect;
   ::GetWindowRect(hWndChild, rect);
   if (rect.PtInRect(pt))
    return hWndChild;
  }
 }

 return NULL;    // not found
}

 



Re: Visual C++ General Tooltips disappeared after switch from VC 6 to VC 8 due to breaking change in CWnd::OnToolHitTest()

msp0815

I forgot to mention: There is a feedback on the Microsoft Connect site where this problem is mentioned, but the thread was closed without any comment.

https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx FeedbackID=101921





Re: Visual C++ General Tooltips disappeared after switch from VC 6 to VC 8 due to breaking change in CWnd::OnToolHitTest()

Karpov Andrey

Code migration from VC 6 to VC 8 is not so problematic. Much more troubles compilation of 64-bit versions for the sake of which many pass from VC 6 to VC 8 delivers. If the purpose is the 64-bit version I recommend familiarizing with following articles.





Re: Visual C++ General Tooltips disappeared after switch from VC 6 to VC 8 due to breaking change in CWnd::OnToolHitTest()

msp0815

Hello Andrey,

currently and in the near future we are only targeting the 32-bit platform. Anyway, thank you for providing the interesting link, even though it does not answer my question.

Regards,

Matthias





Re: Visual C++ General Tooltips disappeared after switch from VC 6 to VC 8 due to breaking change in CWnd::OnToolHitTest()

Ted.

I think your item was closed by mistake as per

http://blogs.msdn.com/vcblog/archive/2006/12/11/bugs-reported-on-the-connect-website-pardon-our-faux-pas.aspx

Please inform them of this, so they can reopen it.





Re: Visual C++ General Tooltips disappeared after switch from VC 6 to VC 8 due to breaking change in CWnd::OnToolHitTest()

msp0815

Thank you for the information. I opened a new feedback item at

https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx FeedbackID=255412