Click here to Skip to main content
11,718,589 members (83,591 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: MFC tabs
Hi all,
I created an MDI application and I want to show a tooltip containing document path when I move cursor on the relative tab (the same behaviour of Visual Studio).
I found this article:

How to obtain the absolute path of the tab(ToolTip) for mouse .[^]

but I cannot get path (or name) of the document. CMFCBaseTabCtrl struct contains a lot of informations such as tab index, but I cannot use this value to loop on open documents if I allow tab swapping or if I divide the View in two or more parts dragging and dropping a tab in the View.

Could you somebody please help me?

Thanks a lot
Posted 8-Feb-12 23:04pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Please extend the parent of your tab Smile | :) :

1. Its message map:

2. Its function:
LRESULT CYourFrame::OnTabToolTipNeeded(WPARAM wParam, LPARAM lParam)
  if (m_cTabCtrl.GetSafeHwnd()) {
    CMFCTabToolTipInfo* pcInfo = (CMFCTabToolTipInfo*) lParam;
    if (pcInfo) {
      CString cszText;
      if (m_cTabCtrl.GetTabLabel(pcInfo->m_nTabIndex, cszText) &&
          cszText.GetLength()) {
        CYourView* pcView(DYNAMIC_DOWNCAST(CYourView, m_cTabCtrl.GetTabWnd(pcInfo->m_nTabIndex)));
        if (pcView->GetSafeHwnd()) {
          cszText += _T(" [");
          cszText += pcView->GetPath();
          cszText += _T("]");
        pcInfo->m_strText = cszText;
  return 0;
symreds at 9-Feb-12 7:55am
thank you very much!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 651
1 OriginalGriff 210
2 F-ES Sitecore 185
3 Jochen Arndt 160
4 Maciej Los 130
0 OriginalGriff 535
1 Maciej Los 529
2 Richard MacCutchan 440
3 CHill60 415
4 F-ES Sitecore 415

Advertise | Privacy | Mobile
Web01 | 2.8.150901.1 | Last Updated 9 Feb 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100