發表文章

目前顯示的是 1月, 2013的文章

Tooltip Controls

圖片
最近工作上需要用到 Windows API 來實作 Tooltip 的功能,所以就開始在網路上找 Sample code 來參考,可是奇怪的是:怎麼試都顯示不出來 // Description: // Creates a tooltip for an item in a dialog box. // Parameters: // idTool - identifier of an dialog box item. // nDlg - window handle of the dialog box. // pszText - string to use as the tooltip text. // Returns: // The handle to the tooltip. // HWND CreateToolTip(int toolID, HWND hDlg, PTSTR pszText) { if (!toolID || !hDlg || !pszText) { return FALSE; } // Get the window of the tool. HWND hwndTool = GetDlgItem(hDlg, toolID); // Create the tooltip. g_hInst is the global instance handle. HWND hwndTip = CreateWindowEx(NULL, TOOLTIPS_CLASS, NULL, WS_POPUP |TTS_ALWAYSTIP | TTS_BALLOON, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hDlg, NULL, g_hInst, NULL); if (!hwndT