LRESULT CALLBACK WndProcAbout(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { const WCHAR * url; POINT pt; switch (message) { case WM_CREATE: assert(!gHwndAbout); break; case WM_ERASEBKGND: // do nothing, helps to avoid flicker return TRUE; case WM_PAINT: OnPaintAbout(hwnd); break; case WM_SETCURSOR: if (GetCursorPosInHwnd(hwnd, pt)) { StaticLinkInfo linkInfo; if (GetStaticLink(gLinkInfo, pt.x, pt.y, &linkInfo)) { CreateInfotipForLink(linkInfo); SetCursor(gCursorHand); return TRUE; } } ClearInfotip(); return DefWindowProc(hwnd, message, wParam, lParam); case WM_LBUTTONDOWN: gClickedURL = GetStaticLink(gLinkInfo, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); break; case WM_LBUTTONUP: url = GetStaticLink(gLinkInfo, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); if (url && url == gClickedURL) LaunchBrowser(url); break; case WM_CHAR: if (VK_ESCAPE == wParam) DestroyWindow(hwnd); break; case WM_DESTROY: ClearInfotip(); assert(gHwndAbout); gHwndAbout = NULL; break; default: return DefWindowProc(hwnd, message, wParam, lParam); } return 0; }
// note: all derived classes must call Control::NotifyMouseLeave() // from their own NotifyMouseLeave(). void Control::NotifyMouseLeave() { // hide url tooltip HwndWrapper *hw = GetRootHwndWnd(this); HWND hwndParent = hw->hwndParent; ClearInfotip(hwndParent); }