Funktionreferenz


_GUIToolTip_GetCurrentTool

Beschreibung anzeigen in

Ermittelt Informationen für das aktuelle Tool

#include <GuiToolTip.au3>
_GUIToolTip_GetCurrentTool ( $hWnd )

Parameter

$hWnd Handle des Controls (welches von _GUIToolTip_Create zurückgegeben wird.)

Rückgabewert

Erfolg: Array mit dem folgenden Format:
    [0] - kommaseparierter String welcher die enthaltenen $TTF_-Flags beinhaltet
      $TTF_IDISHWND = Zeigt an, dass $iID ist das Fenster Handle des Tools anstatt der ID
      $TTF_CENTERTIP = Zentriert das Fenster, zugehörig zu dem durch $iID festgelegten Tool
      $TTF_RTLREADING = Zeigt an, dass der Text in umgekehrter Richtung angezeigt werden soll
      $TTF_SUBCLASS - Zeigt an, dass das Control das Fenster des Tool unterklassifizieren soll um Nachrichten abzufangen
      $TTF_TRACK - Positioniert das Control neben dem zugehörigen Tool
      $TTF_ABSOLUTE - Positioniert das Fenster bei den gleichen Koordinaten wie $TTM_TRACKPOSITION
      $TTF_TRANSPARENT - Sorgt dafür, dass das Control die Nachrichten an das Elternfenster weiterleitet
      $TTF_PARSELINKS - Zeigt an, dass Links im Control Text ausgegliedert werden sollen
    [1] - Handle zum Fenster welches das Tool enthält ($hWnd)
    [2] - ID des Tools ($iID)
    [3] - X Koordinate der oberen linken Ecke des Rechtecks
    [4] - Y Koordinate der oberen linken Ecke des Rechtecks
    [5] - X Koordinate der unteren rechten Ecke des Rechtecks
    [6] - Y Koordinate der unteren rechten Ecke des Rechtecks
    [7] - Handle zu der Instanz welche die Stringressource für das Tool enthält
    [8] - Text für das Tool
    [9] - anwendungsspezifischer Wert der mit dem Tool verknüpft ist

Bemerkungen

Das Tooltip muss während der Ausführung dieser Funktion zu sehen sein, da ansonsten alle Rückgabewerte 0 werden.

- - - - - - - - Erklärung der Controls - - - - - - - -

Verwandte Funktionen

_GUIToolTip_EnumTools, _GUIToolTip_GetToolInfo

Beispiel

Beispiel 1

#include <GUIConstantsEx.au3>
#include <GUIToolTip.au3>
#include <MsgBoxConstants.au3>

Global $g_hToolTip

; Hover over the button on the GUI and press the "g" key to disply the information
HotKeySet("g", "Get_Tool")

Example()

Func Example()
    Local $hGUI = GUICreate(StringTrimRight(@ScriptName, StringLen(".exe")), 350, 200)

    Local $idButton = GUICtrlCreateButton("Button ToolTip", 30, 32, 130, 28)
    Local $hButton = GUICtrlGetHandle($idButton)
    ; create a tooltip control using default settings
    $g_hToolTip = _GUIToolTip_Create(0)

    ; add a tool to the tooltip control
    _GUIToolTip_AddTool($g_hToolTip, 0, "This is a ToolTip", $hButton)
    GUISetState(@SW_SHOW)
    While 1
        If GUIGetMsg() = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd
    ; Destroy the tooltip control
    _GUIToolTip_Destroy($g_hToolTip)
    GUIDelete($hGUI)
EndFunc   ;==>Example

Func Get_Tool()
    Local $aTool = _GUIToolTip_GetCurrentTool($g_hToolTip)
    MsgBox($MB_SYSTEMMODAL, "Tooltip info", "Flags: " & @TAB & _GUIToolTip_BitsToTTF($aTool[0]) & @CRLF & _
            "HWnd: " & @TAB & $aTool[1] & @CRLF & _
            "ID: " & @TAB & $aTool[2] & @CRLF & _
            "Left X:" & @TAB & $aTool[3] & @CRLF & _
            "Left Y:" & @TAB & $aTool[4] & @CRLF & _
            "Right X:" & @TAB & $aTool[5] & @CRLF & _
            "Right Y:" & @TAB & $aTool[6] & @CRLF & _
            "Instance:" & @TAB & $aTool[7] & @CRLF & _
            "Text:" & @TAB & $aTool[8] & @CRLF & _
            "lParam:" & @TAB & $aTool[9])
EndFunc   ;==>Get_Tool

Beispiel 2

#include <GUIConstantsEx.au3>
#include <GUIToolTip.au3>
#include <MsgBoxConstants.au3>

Global $g_iPID

; Hover over one of the characters in the Charmap app to get a tooltip to display, then press 'g' to
; retrieve its information.
HotKeySet('g', "_Read_Tip")

Example()

Func Example()
    ; Run character map program
    $g_iPID = Run("charmap.exe")
    ; Wait for it to become the active window
    WinWaitActive("Character Map", "", 10)
    While ProcessExists($g_iPID)
        Sleep(100)
    WEnd
EndFunc   ;==>Example

Func _Read_Tip()
    ; Get list of tooltips
    Local $aTipList = WinList("[CLASS:tooltips_class32]")
    ; See which belong to your app
    For $i = 1 To $aTipList[0][0]
        If WinGetProcess($aTipList[$i][1]) = $g_iPID Then
            ; See which one is active
            _GUIToolTip_GetCurrentTool($aTipList[$i][1])
            ; If one is active then display it
            Local $aTool = _GUIToolTip_GetCurrentTool($aTipList[$i][1])
            MsgBox($MB_SYSTEMMODAL, "Tooltip info", "Flags: " & @TAB & _GUIToolTip_BitsToTTF($aTool[0]) & @CRLF & _
                    "HWnd: " & @TAB & $aTool[1] & @CRLF & _
                    "ID: " & @TAB & $aTool[2] & @CRLF & _
                    "Left X:" & @TAB & $aTool[3] & @CRLF & _
                    "Left Y:" & @TAB & $aTool[4] & @CRLF & _
                    "Right X:" & @TAB & $aTool[5] & @CRLF & _
                    "Right Y:" & @TAB & $aTool[6] & @CRLF & _
                    "Instance:" & @TAB & $aTool[7] & @CRLF & _
                    "Text:" & @TAB & $aTool[8] & @CRLF & _
                    "lParam:" & @TAB & $aTool[9])
        EndIf
    Next
EndFunc   ;==>_Read_Tip