Maza Faka
Advanced Member | Редактировать | Профиль | Сообщение | ICQ | Цитировать | Сообщить модератору ViSiToR Цитата: минус в том что нет кнопки закрытия у этой подсказки | Hackproof Цитата: Закрытие не принципиально | Ещё один вариант: Код: #include <GuiConstants.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <Constants.au3> $GUI = GUICreate("Test Script", 300, 200) $hIcon = GUICtrlCreateIcon("shell32.dll", -2, 120, 20) $Button = GUICtrlCreateButton("Show hint", 100, 120, 75, 25) GUISetState(@SW_SHOW, $GUI) Sleep(1000) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $Button _ToolTip_OnControl($GUI, $hIcon, "My ToolTip", "Some Title", 1, 5) EndSwitch WEnd Func _ToolTip_OnControl($hWnd, $nCtrl, $sText, $sTitle = "", $iIcon = 0, $iOptions = 0) Local $aCtrlPos = ControlGetPos($hWnd, "", $nCtrl) If @error Then Return SetError(1, 0, 0) Local $stPoint = DllStructCreate("int;int") DllStructSetData($stPoint, 1, $aCtrlPos[0]) DllStructSetData($stPoint, 2, $aCtrlPos[1]) DllCall("user32.dll", "int", "ClientToScreen", "hwnd", $hWnd, "ptr", DllStructGetPtr($stPoint)) ToolTip($sText, DllStructGetData($stPoint, 1) + 25, DllStructGetData($stPoint, 2) + 10, $sTitle, $iIcon, $iOptions) Local $hToolTip = WinGetHandle("My ToolTip") If @error Then Return $sTemp = _WinAPI_GetWindowLong($hToolTip, $GWL_STYLE) _WinAPI_SetWindowLong($hToolTip, $GWL_STYLE, BitOR($sTemp, 0x00000080)) ToolTip($sText, DllStructGetData($stPoint, 1) + 25, DllStructGetData($stPoint, 2) + 10, $sTitle, $iIcon, $iOptions) EndFunc | Добавлено: Hackproof А вообще, все эти перехваты и модификации не "своего" tooltipa - изврат ещё тот Правильно будет создать свой tooltip и делать с ним всё, что нужно. Быстрый и грубый пример: Код: #include <WindowsConstants.au3> #include <GuiToolTip.au3> Global Const $CW_USEDEFAULT = 0x80000000 Global Const $TOOLTIPS_CLASSA = "tooltips_class32" Global Const $HWND_TOPMOST = -1 Global Const $SWP_NOMOVE = 0x2 Global Const $SWP_NOACTIVATE = 0x10 Global Const $SWP_NOSIZE = 0x1 Global $TOOLINFO $hGUI = GUICreate("Test GUI", 300, 200) $hIcon = GUICtrlCreateIcon("shell32.dll", -2, 120, 20) $Button = GUICtrlCreateButton("Show hint", 100, 140, 75, 25) GUISetState() $hToolTip = _ToolTip_Create($hIcon, "Title", "This is tooltip new custom tooltip") While 1 $msg = GUIGetMsg() Switch $msg Case -3 ExitLoop Case $Button _ToolTip_Popup($hToolTip) EndSwitch WEnd DllCall("user32.dll", "int", "DestroyWindow", "hwnd", $hToolTip) $TOOLINFO = 0 Func _ToolTip_Create($nControl, $sTitle = "", $sText = "") ;Create ToolTip window Local $hToolTip = DllCall("user32.dll", "hwnd", "CreateWindowEx", "int", $WS_EX_TOPMOST, "str", $TOOLTIPS_CLASSA, _ "str", 0, "int", BitOR($WS_POPUP, $TTS_ALWAYSTIP, $TTS_BALLOON, $TTS_CLOSE), "int", $CW_USEDEFAULT, _ "int", $CW_USEDEFAULT, "int", $CW_USEDEFAULT, "int", $CW_USEDEFAULT, "hwnd", $hGUI, "hwnd", 0, _ "hwnd", 0, "ptr", 0) $hToolTip = $hToolTip[0] ;Create buffer which contain ToolTip text Local $tBuffer = DllStructCreate("char[256]") DllStructSetData($tBuffer, 1, $sText) ;Create TOOLINFO structure $TOOLINFO = DllStructCreate("int cbSize;int uFlags;hwnd hWnd;int uId;int rect[4];hwnd hinst;" & _ "ptr lpszText;int lParam;int lpReserved") DllStructSetData($TOOLINFO, "cbSize", DllStructGetSize($TOOLINFO)) DllStructSetData($TOOLINFO, "uFlags", $TTF_TRACK) ;DllStructSetData($TOOLINFO, "hwnd", _WinAPI_GetDesktopWindow()) DllStructSetData($TOOLINFO, "lpszText", DllStructGetPtr($tBuffer)) ;Send message to a system, that a creating ToolTip message DllCall("user32.dll", "int", "SendMessage", "hwnd", $hToolTip, "int", $TTM_ADDTOOL, "int", 0, _ "ptr", DllStructGetPtr($TOOLINFO)) ;Set a title for ToolTip DllCall("user32.dll", "int", "SendMessage", "hwnd", $hToolTip, "int", $TTM_SETTITLE, "int", 1, "str", $sTitle) ;Set ToolTip width DllCall("user32.dll", "int", "SendMessage", "hwnd", $hToolTip, "int", $TTM_SETMAXTIPWIDTH, "int", 0, "int", 100) ;Set ToolTip text color DllCall("user32.dll", "int", "SendMessage", "hwnd", $hToolTip, "int", $TTM_SETTIPTEXTCOLOR, "int", "0x" & Hex(255), "int", 0) ;Set ToolTip back color DllCall("user32.dll", "int", "SendMessage", "hwnd", $hToolTip, "int", $TTM_SETTIPBKCOLOR, "int", 0, "int", 0) Local $aPos = WinGetPos(GUICtrlGetHandle($nControl)) DllCall("user32.dll", "int", "SendMessage", "hwnd", $hToolTip, "int", $TTM_TRACKPOSITION, "int", 0, _ "int", BitOR(BitAND($aPos[0] + 20, 0x0000FFFF), BitShift($aPos[1] + 20, -16))) Return $hToolTip EndFunc Func _ToolTip_Popup($hToolTip) DllCall("user32.dll", "int", "SendMessage", "hwnd", $hToolTip, "int", $TTM_TRACKACTIVATE, "int", 0, _ "ptr", DllStructGetPtr($TOOLINFO)) DllCall("user32.dll", "int", "SendMessage", "hwnd", $hToolTip, "int", $TTM_TRACKACTIVATE, "int", 1, _ "ptr", DllStructGetPtr($TOOLINFO)) EndFunc | Для доп. информации, можешь "поковырять" ToolTip_UDF |