| 60 | IMPLEMENT_DYNAMIC(CMountPropertyPage, CCryptPropertyPage) |
| 61 | |
| 62 | void CMountPropertyPage::HandleTooltipsActivation(MSG * pMsg, CWnd * This, CWnd * disabledCtrls[], int numOfCtrls, CToolTipCtrl * pTooltip) |
| 63 | { |
| 64 | CRect rect; |
| 65 | POINT pt; |
| 66 | |
| 67 | HWND hWnd = pMsg->hwnd; |
| 68 | LPARAM lParam = pMsg->lParam; |
| 69 | |
| 70 | //--------------------------------------------------------------------------- |
| 71 | // Disabled control do not show tool tips, in modal dialog |
| 72 | // |
| 73 | // |
| 74 | // The hwnd of the WM_MOUSEMOVE above a disabled control |
| 75 | // is the hWnd of the Dialog itself, this confuse the tooltip |
| 76 | // |
| 77 | // To correct this, if we get WM_MOUSEMOVE and the hwnd is the dialog's hwnd |
| 78 | // |
| 79 | // We check on all the controls that are Visible, but disabled if the point is in their |
| 80 | // rectangle. |
| 81 | // |
| 82 | // In this case we alter the msg to the controls hWnd and coordinates before |
| 83 | // Relaying it to the toolTip control |
| 84 | //---------------------------------------- |
| 85 | |
| 86 | |
| 87 | if ((pMsg->message == WM_MOUSEMOVE) && (pMsg->hwnd == This->m_hWnd)) { |
| 88 | |
| 89 | //--------------------------- |
| 90 | // The point is in the dialog |
| 91 | // client coordinates |
| 92 | //--------------------------- |
| 93 | pt.x = LOWORD(pMsg->lParam); // horizontal position of cursor |
| 94 | pt.y = HIWORD(pMsg->lParam); // vertical position of cursor |
| 95 | |
| 96 | for (int i = 0; i < numOfCtrls; i++) { |
| 97 | |
| 98 | //--------------------------------- |
| 99 | // rect is the control rectangel in |
| 100 | // Dialog client coordinates |
| 101 | //---------------------------------- |
| 102 | disabledCtrls[i]->GetWindowRect(&rect); |
| 103 | This->ScreenToClient(&rect); |
| 104 | |
| 105 | if (rect.PtInRect(pt)) { |
| 106 | //---------------------------------------------------------------- |
| 107 | // The mouse is inside the control |
| 108 | // |
| 109 | // 1. We change the Msg hwnd to the controls hWnd |
| 110 | // 2. We change the Msg lParam to the controls client coordinates |
| 111 | // |
| 112 | //---------------------------------------------------------------- |
| 113 | |
| 114 | pMsg->hwnd = disabledCtrls[i]->m_hWnd; |
| 115 | |
| 116 | This->ClientToScreen(&pt); |
| 117 | disabledCtrls[i]->ScreenToClient(&pt); |
| 118 | pMsg->lParam = MAKELPARAM(pt.x, pt.y); |
| 119 | break; |
nothing calls this directly
no outgoing calls
no test coverage detected