#include <WinAPI.au3>
#include <WindowsConstants.au3>
#include <GUIToolTip.au3>
Opt('MustDeclareVars', 1)
Global $iIconID = 43
If @OSVersion == "WIN_VISTA" Then $iIconID = 51
Global $hIcon = _WinAPI_LoadShell32Icon($iIconID)
Global $hToolTip1 = _GUIToolTip_CreateToolTip(0, "Close tooltip to exit", "ToolTip 1", Default, _
@DesktopWidth / 2, @DesktopHeight / 2 - 120, 2 + 16, 0xFFFFFF, 0x985428, $hIcon)
Global $hToolTip2 = _GUIToolTip_CreateToolTip(0, "UDF ToolTip", "ToolTip 2", 0, _
@DesktopWidth / 2, @DesktopHeight / 2, 2 + 16, 0xFF0000, 0xFFFFFF, $hIcon)
Global $hToolTip3 = _GUIToolTip_CreateToolTip(0, "UDF ToolTip", "ToolTip 3", 0, _
@DesktopWidth / 2, @DesktopHeight / 2 + 75, 2 + 16)
Global $hToolTip4 = _GUIToolTip_CreateToolTip(0, "", "ToolTip 4", 0, _
@DesktopWidth / 2, @DesktopHeight / 2 + 130, 2 + 16)
_WinAPI_DestroyIcon($hIcon)
Do
Sleep(100)
Until BitAND(WinGetState($hToolTip1), 2) <> 2 ; exit if Tooltip not visible (closed by balloon tip button)
_GUIToolTip_Destroy($hToolTip1)
_GUIToolTip_Destroy($hToolTip2)
_GUIToolTip_Destroy($hToolTip3)
_GUIToolTip_Destroy($hToolTip4)
;Author: rover and et al.
;$iIcon [optional] Pre-defined icon to show next to the title: Requires a title.
;0 = No icon, 1 = Info icon, 2 = Warning icon, 3 = Error Icon
; From _GUIToolTip_SetTitle() remarks
; As of Windows XP SP2 and later, $iIcon can contain an HICON value.
; Any value greater than 3 is assumed to be an HICON.
Func _GUIToolTip_CreateToolTip($hWnd, $sTitle, $sText, $iStyle=-1, $iX=-1, $iY=-1, $iFlags=0, $iColTxt=-1, $iColBk=-1, $iIcon=0)
Local Const $CW_USEDEFAULT = 0x80000000
Local Const $HWND_TOPMOST = -1
If Not IsHWnd($hWnd) Or IsKeyword($hWnd) Then $hWnd = 0
If IsKeyword($iX) Or $iX < 0 Or Not IsNumber($iX) Then $iX = 0
If IsKeyword($iY) Or $iY < 0 Or Not IsNumber($iY) Then $iY = 0
If IsKeyword($iFlags) Or $iFlags <= 0 Or Not IsNumber($iFlags) Then $iFlags = 32 + 8 + 1
If IsKeyword($iStyle) Or $iStyle = -1 Then $iStyle = BitOR($TTS_BALLOON, $TTS_CLOSE)
Local $hTip = _WinAPI_CreateWindowEx($WS_EX_TOPMOST, "tooltips_class32", "", BitOR($iStyle, $TTS_ALWAYSTIP, $TTS_NOPREFIX), _
$CW_USEDEFAULT, $CW_USEDEFAULT, $CW_USEDEFAULT, $CW_USEDEFAULT, $hWnd)
_GUIToolTip_AddTool($hTip, $hWnd, $sText, $hWnd, 0, 0, 0, 0, $iFlags, 0)
If Number($iIcon) > 3 And @OSVersion = "WIN_XP" And Number(StringRight(@OSServicePack, 1)) < 2 Then $iIcon = 0
If Not IsNumber($iIcon) Or $iIcon < 0 Then $iIcon = 0
_GUIToolTip_SetTitle($hTip, $sTitle, $iIcon)
If IsInt($iColTxt) And $iColTxt <> -1 Then _GUIToolTip_SetTipTextColor($hTip, $iColTxt)
If IsInt($iColBk) And $iColBk <> -1 Then _GUIToolTip_SetTipBkColor($hTip, $iColBk)
If $hWnd = 0 Or $hWnd = -1 Or IsKeyword($hwnd) Then
_GUIToolTip_TrackPosition($hTip, $iX, $iY)
_GUIToolTip_TrackActivate($hTip, True, $hWnd, $hWnd)
Return $hTip
EndIf
Return $hTip
EndFunc