Contraint l'info-bulle à s'afficher aux coordonnées du dernier message de la souris
#include <GuiToolTip.au3>
_GUIToolTip_PopUp ( $hWnd )
$hWnd | Handle du contrôle info-bulle (retourné par _GUIToolTip_Create.) |
#include <GUIConstantsEx.au3> #include <GUIToolTip.au3> Example() Func Example() Local $hGUI = GUICreate(StringTrimRight(@ScriptName, StringLen(".exe")), 350, 200) Local $idButton = GUICtrlCreateButton("ToolTip showing", 30, 32, 130, 28) Local $hButton = GUICtrlGetHandle($idButton) Local $hToolTip = _GUIToolTip_Create($hGUI, BitOR($_TT_ghTTDefaultStyle, $TTS_BALLOON)) _GUIToolTip_AddTool($hToolTip, 0, " ", $hButton) GUISetState(@SW_SHOW) _GUIToolTip_TrackActivate($hToolTip, True, 0, $hButton) Local $bDisplay = True Local $hTimer = TimerInit() Local $iMsg Do Sleep(10) Local $aMousePos = MouseGetPos() _GUIToolTip_TrackPosition($hToolTip, $aMousePos[0] + 10, $aMousePos[1] + 20) _GUIToolTip_UpdateTipText($hToolTip, 0, $hButton, "X: " & $aMousePos[0] & " Y: " & $aMousePos[1]) $iMsg = GUIGetMsg() If $iMsg <> $GUI_EVENT_CLOSE Then ; Chaque 8 secondes l'info-bulle sera "popped" in ou out de la vue ; Pour faire ceci, après que les 8 secondes sont passées, vous devez survolrt le bouton. If TimerDiff($hTimer) > 8000 Then $bDisplay = Not $bDisplay $hTimer = TimerInit() If $bDisplay Then GUICtrlSetData($idButton, "ToolTip showing") _GUIToolTip_PopUp($hToolTip) Else GUICtrlSetData($idButton, "Hover here now") _GUIToolTip_Pop($hToolTip) EndIf EndIf EndIf Until $iMsg = $GUI_EVENT_CLOSE ; Détruit le contrôle info-bulle _GUIToolTip_Destroy($hToolTip) GUIDelete($hGUI) EndFunc ;==>Example