函数逻辑简单,直接贴出函数代码: HWND WINAPI CreateToolTip(HWND hwndOwner, LPCTSTR szTip){INITCOMMONCONTROLSEX iccex; HWND hwndTT; // handle to the ToolTip controlTOOLINFO ti;unsigned int uid = 0; // for ti initializationRECT rect; // for client area coordinates/* INITIALIZE COMMON CONTROLS */iccex.dwICC = ICC_WIN95_CLASSES;iccex.dwSize = sizeof(INITCOMMONCONTROLSEX);InitCommonControlsEx(&iccex);/* CREATE A TOOLTIP WINDOW */hwndTT = CreateWindowEx(WS_EX_TOPMOST,TOOLTIPS_CLASS,NULL,WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,hwndOwner,NULL,gAppInstance,NULL);SetWindowPos(hwndTT,HWND_TOPMOST,0,0,0,0,SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);/* GET COORDINATES OF THE MAIN CLIENT AREA */GetClientRect (hwndOwner, &rect);/* INITIALIZE MEMBERS OF THE TOOLINFO STRUCTURE */ti.cbSize = sizeof(TOOLINFO);ti.uFlags = TTF_SUBCLASS;ti.hwnd = hwndOwner;ti.hinst = gAppInstance;ti.uId = uid;ti.lpszText = (LPTSTR)szTip;// ToolTip control will cover the whole windowti.rect.left = rect.left; ti.rect.top = rect.top;ti.rect.right = rect.right;ti.rect.bottom = rect.bottom;/* SEND AN ADDTOOL MESSAGE TO THE TOOLTIP CONTROL WINDOW */SendMessage(hwndTT, TTM_ADDTOOL, 0, (LPARAM) (LPTOOLINFO) &ti);return hwndTT;}HWND WINAPI CreateToolTip(HW 你的当前访问异常,请进行认证后继续阅读剩余内容。 提交