Funktionreferenz


_GUIToolTip_GetToolInfo

Beschreibung anzeigen in

Ermittelt die Informationen über ein festgelegtes Tool

#include <GuiToolTip.au3>
_GUIToolTip_GetToolInfo ( $hTool, $hWnd, $iID )

Parameter

$hTool Handle des Controls (welches von _GUIToolTip_Create zurückgegeben wird.)
$hWnd Handle zum Fenster welches das Tool enthält
$iID Handle des Controls welches mit dem Tool assoziiert ist oder die ID des Tools

Rückgabewert

Erfolg: ein Array mit dem folgende Format:
[0] – Flags, die die Anzeige von Tooltips steuern. Dieses Mitglied kann eine Kombination der folgenden Werte sein:
  $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
Fehler: setzt @error (siehe Bemerkungen)

Bemerkungen

Wenn sich das von $hWnd referenzierte Steuerelement nicht im selben Prozess befindet und beide Prozesse in unterschiedlichen AutoIt-Modi (@AutoItVersion) ausgeführt werden, wird @error auf 6 gesetzt.

Die Flags können mit _GUIToolTip_BitsToTTF() in eine lesbare Zeichenfolge umgewandelt werden.

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

Verwandte Funktionen

_GUIToolTip_EnumTools, _GUIToolTip_GetCurrentTool, _GUIToolTip_SetToolInfo, _GUIToolTip_ToolToArray, _GUIToolTip_BitsToTTF

Beispiel

Beispiel 1

#include "Extras\HelpFileInternals.au3"

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

Example()

Func Example()
    Local $hGUI = GUICreate("ToolTip Get ToolInfo v(" & @AutoItVersion & ")", 450, 300, 100, 100)

    ; create a tooltip control using default settings
    Local $hToolTip = _GUIToolTip_Create(0)
    _MemoSetHandleInProcess($hToolTip)

    Local $idButton = GUICtrlCreateButton("Button", 30, 32, 130, 28)
    Local $hButton = GUICtrlGetHandle($idButton)

;~  $hGUI = 0 ; no text
    ; add a tool to the tooltip control
    _GUIToolTip_AddTool($hToolTip, $hGUI, "This is a ToolTip", $hButton)

    GUISetState(@SW_SHOW)

    ; Display the information for the tool assigned to the button
    Local $aTool = _GUIToolTip_GetToolInfo($hToolTip, $hGUI, $hButton)
    _MemoMsgBox($MB_SYSTEMMODAL, "Tooltip info", "Flags: " & @TAB & _GUIToolTip_BitsToTTF($aTool[0]) & @CRLF & _
            "HWnd: " & @TAB & $aTool[1] & @CRLF & _
            "ID: " & @TAB & "0x" & Hex($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])

    ; Set the information for the tool assigned to the button
    _GUIToolTip_SetToolInfo($hToolTip, $aTool[1], $aTool[2], "New ToolTip", $aTool[0], $aTool[3], $aTool[4], $aTool[5], $aTool[6], $aTool[7], $aTool[9])
    $aTool = _GUIToolTip_GetToolInfo($hToolTip, $hGUI, $hButton)
    _MemoMsgBox($MB_SYSTEMMODAL, "Tooltip New info", "Flags: " & @TAB & _GUIToolTip_BitsToTTF($aTool[0]) & @CRLF & _
            "HWnd: " & @TAB & $aTool[1] & @CRLF & _
            "ID: " & @TAB & "0x" & Hex($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])

    While 1
        If GUIGetMsg() = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd

    ; Destroy the tooltip control
    _MemoResetHandleInProcess($hTooltip)
    _GUIToolTip_Destroy($hToolTip)
    GUIDelete($hGUI)
EndFunc   ;==>Example

Example 2 : ToolTip Get/Set ToolInfo to an External process

#include "Extras\HelpFileInternals.au3"

#include <GUIToolTip.au3>

Example()

Func Example()
    Local $sFromTo
    Local $hWin = _MemoRunAU3OutProcess($sFromTo, True) ; OK same mode, KO if different mode
    Local $hButton = _MemoCreateOutProcess($hWin, "Button", 2, $sFromTo)

    Local $hToolTip = _MemoGetHandleInProcess()

    Local $aTool = _GUIToolTip_GetToolInfo($hToolTip, $hWin, $hButton)
    If @error Then
        _MemoMsgBox($MB_ICONERROR, "Info" & $sFromTo, "_GUIToolTip_GetToolInfo()" & " @error = " & @error &  @CRLF & _
                @TAB & "cannot be accessed from an external process" & @CRLF & _
                @TAB & "running in different mode")
    Else
        ; only working if both processes are running in "same mode"
        _MemoWrite("<<< Tooltip info" & $sFromTo & @CRLF & _
                "Flags: " & @TAB & _GUIToolTip_BitsToTTF($aTool[0]) & @CRLF & _
                "HWnd: " & @TAB & "0x" & Hex($aTool[1]) & @CRLF & _
                "ID: " & @TAB & "0x" & Hex($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])

        ; Set the information for the tool assigned to the button
        _GUIToolTip_SetToolInfo($hToolTip, $aTool[1], $aTool[2], ">>> New ToolTip", $aTool[0], $aTool[3], $aTool[4], $aTool[5], $aTool[6], $aTool[7], $aTool[9])
        $aTool = _GUIToolTip_GetToolInfo($hToolTip, $hWin, $hButton)
        _MemoWrite("<<< Tooltip New Set info" & $sFromTo  & @CRLF & _
                "Flags: " & @TAB & _GUIToolTip_BitsToTTF($aTool[0]) & @CRLF & _
                "HWnd: " & @TAB & $aTool[1] & @CRLF & _
                "ID: " & @TAB & "0x" & Hex($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

    _MemoMsgBoxStatus("", Default, $hWin) ; no more action, wait GUI for closing, close also OutProcess GUI

EndFunc   ;==>Example