Не экспериментировал с этим. Можно создавать любое количество ToolTip'ов таким образом:
hwnd1 := TrackToolTip("tip1", 500, 500)
hwnd2 := TrackToolTip("tip2", 600, 500)
return
!1::WinClose, ahk_id %hwnd1%
!2::WinClose, ahk_id %hwnd2%
TrackToolTip( sText
, x = "" ; если не указаны, то вблизи курсора
, y = ""
, sTitle = ""
, h_icon = 0 ; h_icon — 0: None, 1:Info, 2: Warning, 3: Error, n > 3: предполагается hIcon
, CloseButton = 0
, nColorBack = 0xFFFFE1
, nColorText = 0
, BallonTip = 0 ; BalloonTip — это ToolTip с хвостиком
, w = 400) ; максимальная ширина
{
TTS_NOPREFIX := 2, TTS_ALWAYSTIP := 1, TTS_BALLOON := 0x40, TTS_CLOSE := 0x80
hWnd := DllCall("CreateWindowEx", UInt, WS_EX_TOPMOST := 8
, Str, "tooltips_class32", Str, ""
, UInt, TTS_NOPREFIX|TTS_ALWAYSTIP|(CloseButton ? TTS_CLOSE : 0)|(BallonTip ? TTS_BALLOON : 0)
, Int, 0, Int, 0, Int, 0, Int, 0
, Ptr, 0, Ptr, 0, Ptr, 0, Ptr, 0)
if (x = "" || y = "")
{
CoordMode, Mouse
MouseGetPos, xtt, ytt
xtt := x = "" ? xtt + 10 : x
ytt := y = "" ? ytt + 10 : y
}
Else
xtt := x, ytt := y
NumPut(VarSetCapacity(TOOLINFO, A_PtrSize = 4 ? 48 : 72, 0), TOOLINFO, "UInt")
NumPut(0x20, TOOLINFO, 4, "UInt") ; TTF_TRACK = 0x20
NumPut(&sText, TOOLINFO, A_PtrSize = 4 ? 36 : 48, "UInt")
DHW := A_DetectHiddenWindows
DetectHiddenWindows, On
WinWait, ahk_id %hWnd%
WM_USER := 0x400
SendMessage, WM_USER + 24,, w ; TTM_SETMAXTIPWIDTH
SendMessage, WM_USER + (A_IsUnicode ? 50 : 4),, &TOOLINFO ; TTM_ADDTOOL
SendMessage, WM_USER + 19, RGB_to_BGR(nColorBack) ; TTM_SETTIPBKCOLOR
SendMessage, WM_USER + 20, RGB_to_BGR(nColorText) ; TTM_SETTIPTEXTCOLOR
SendMessage, WM_USER + (A_IsUnicode ? 33 : 32), h_icon, &sTitle ; TTM_SETTITLEA и TTM_SETTITLEW
SendMessage, WM_USER + (A_IsUnicode ? 57 : 12),, &TOOLINFO ; TTM_UPDATETIPTEXTA и TTM_UPDATETIPTEXTW
SendMessage, WM_USER + 18,, xtt|(ytt<<16) ; TTM_TRACKPOSITION
SendMessage, WM_USER + 17, 1, &TOOLINFO ; TTM_TRACKACTIVATE
WinGetPos,,, W, H
if (xtt + W + 10 > A_ScreenWidth || ytt + H + 10 > A_ScreenHeight)
{
WinHide
xtt := xtt + W + 10 > A_ScreenWidth ? A_ScreenWidth - W - 10 : xtt
ytt := ytt + H + 10 > A_ScreenHeight ? A_ScreenHeight - H - 10 : ytt
SendMessage, 1042,, xtt|(ytt<<16) ; TTM_TRACKPOSITION
WinShow
}
DetectHiddenWindows, % DHW
Return hWnd
}
RGB_to_BGR(RGB)
{
CurrentFormat := A_FormatInteger
SetFormat, IntegerFast, H
C := SubStr("0x000000", 1, -(StrLen(RGB+0) - 2)) . SubStr(RGB+0, 3)
BGR := RegExReplace(C, "0x(..)(..)(..)", "0x$3$2$1")
SetFormat, IntegerFast, %CurrentFormat%
Return BGR
}