Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. CTooltipCtrl for a modeless dialog in a DLL

CTooltipCtrl for a modeless dialog in a DLL

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++debuggingworkspace
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    madmax0001
    wrote on last edited by
    #1

    Hi, me again... a few days a go I posted a problem with showing tooltips in a modeless dialog in a dll. I got a hint which seems to solve the problem. I have done several tests in the meantime and unfortunatelly there is still a small problem with the tooltip. To setup the tooltips for the modeless dialog in my dll I use this function: ////////////////////////////////////////// void CMyDialog::SetToolTip(CWnd* pWnd, LPCTSTR lpszText) { if((pWnd != NULL) && (m_pTip != NULL)){ TOOLINFO ti; ti.cbSize = sizeof(TOOLINFO); ti.lpszText = (LPTSTR)lpszText; ti.hinst = AfxGetInstanceHandle(); ti.hwnd = pWnd->m_hWnd; ti.uFlags = TTF_SUBCLASS | TTF_IDISHWND; ti.uId = (UINT)pWnd->m_hWnd; m_pTip->SendMessage(TTM_ADDTOOL, 0, (LPARAM)&ti); } } ////////////////////////////////////////// THe tooltip is shown and this works without (!) any call to CMyDialog::PreTranslateMessage(MSG* pMsg) and RelayEvent. But I need this call, because there is an MFC bug with tooltips for disabled controls and I used in my other modal dialogs this code: ////////////////////////////////////////// BOOL CMyDialog::PreTranslateMessage(MSG* pMsg) { TRACE("PreTranslateMessage\n"); if(m_pTip != NULL){ // The following code is a workaround for a MFC tooltip bug which // prevents the popup of a tooltip for a disabled control in a modal dialog. // Transate the message based on TTM_WINDOWFROMPOINT MSG msg = *pMsg; msg.hwnd = (HWND)m_pTip->SendMessage(TTM_WINDOWFROMPOINT, 0, (LPARAM)&msg.pt); CPoint pt = pMsg->pt; if((msg.message >= WM_MOUSEFIRST) && (msg.message <= WM_MOUSELAST)) ::ScreenToClient(msg.hwnd, &pt); msg.lParam = MAKELONG(pt.x, pt.y); // Let the ToolTip process this message. m_pTip->RelayEvent(&msg); } // if return CDialog::PreTranslateMessage(pMsg); } ////////////////////////////////////////// Then I tried to use the message hook which was neccessary to use accellerators in CMyDialog to call PreTranslateMessage: ////////////////////////////////////////// // Hook procedure for WH_GETMESSAGE hook type. LRESULT CALLBACK GetMessageProc(int nCode, WPARAM wParam, LPARAM lParam) // If this is a keystrokes message, translate it in controls' // PreTranslateMessage(). LPMSG lpMsg = (LPMSG)lParam; if((nCode >= 0) && (PM_REMOVE == wParam) && (lpMsg->message >= WM_KEYFIRST && l

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups