1 | ; This script diplays information about the toolbar button the mouse is over using the TTM_*A and TTM_*W versions of the Win API ToolTip messages. |
---|
2 | ; To use hover the mouse over a toolbar button and wait until a tooltip appears, if there is one, then |
---|
3 | ; press 1 to dissplay info using TTM_*A version |
---|
4 | ; press 2 to dissplay info using TTM_*W version |
---|
5 | ; press 3 to exit |
---|
6 | |
---|
7 | #include <GuiToolTip.au3> |
---|
8 | #include <array.au3> |
---|
9 | |
---|
10 | HotKeySet("1","ShowToolTipsInfoA") |
---|
11 | HotKeySet("2","ShowToolTipsInfoW") |
---|
12 | HotKeySet("3","Stop") |
---|
13 | |
---|
14 | While 1 |
---|
15 | |
---|
16 | WEnd |
---|
17 | Func Stop() |
---|
18 | Exit |
---|
19 | EndFunc |
---|
20 | |
---|
21 | Func ShowToolTipsInfoW() |
---|
22 | Local $aArray = 0 |
---|
23 | Local $hTool = 0 |
---|
24 | Local $iCount = 0 |
---|
25 | Local $aArrayTips = 0 |
---|
26 | |
---|
27 | $aArray = _WinAPI_EnumWindowsPopup() |
---|
28 | If IsArray($aArray) Then |
---|
29 | If $aArray[0][0] > 0 Then |
---|
30 | $hTool = $aArray[1][0] |
---|
31 | $iCount = _GUIToolTip_GetToolCount($hTool) |
---|
32 | For $i = 0 To $iCount - 1 Step 1 |
---|
33 | $aArrayTips = _GUIToolTip_EnumToolsW($hTool, $i) |
---|
34 | _ArrayDisplay($aArrayTips,$i + 1 & " of " & $iCount) |
---|
35 | Next |
---|
36 | EndIf |
---|
37 | EndIf |
---|
38 | EndFunc |
---|
39 | |
---|
40 | Func ShowToolTipsInfoA() |
---|
41 | Local $aArray = 0 |
---|
42 | Local $hTool = 0 |
---|
43 | Local $iCount = 0 |
---|
44 | Local $aArrayTips = 0 |
---|
45 | |
---|
46 | $aArray = _WinAPI_EnumWindowsPopup() |
---|
47 | If IsArray($aArray) Then |
---|
48 | If $aArray[0][0] > 0 Then |
---|
49 | $hTool = $aArray[1][0] |
---|
50 | $iCount = _GUIToolTip_GetToolCount($hTool) |
---|
51 | For $i = 0 To $iCount - 1 Step 1 |
---|
52 | $aArrayTips = _GUIToolTip_EnumToolsA($hTool, $i) |
---|
53 | _ArrayDisplay($aArrayTips,$i + 1 & " of " & $iCount) |
---|
54 | Next |
---|
55 | EndIf |
---|
56 | EndIf |
---|
57 | EndFunc |
---|
58 | |
---|
59 | Func _GUIToolTip_EnumToolsA($hWnd, $iIndex) |
---|
60 | Local $iToolInfo, $pToolInfo, $tToolInfo, $pMemory, $tMemMap, $fResult |
---|
61 | |
---|
62 | $tToolInfo = DllStructCreate($tagTOOLINFO) |
---|
63 | $pToolInfo = DllStructGetPtr($tToolInfo) |
---|
64 | $iToolInfo = DllStructGetSize($tToolInfo) |
---|
65 | DllStructSetData($tToolInfo, "Size", $iToolInfo) |
---|
66 | If _WinAPI_InProcess($hWnd, $_TT_ghTTLastWnd) Then |
---|
67 | $fResult = _SendMessage($hWnd, $TTM_ENUMTOOLS, $iIndex, $pToolInfo, 0, "wparam", "ptr") |
---|
68 | Else |
---|
69 | $pMemory = _MemInit($hWnd, $iToolInfo, $tMemMap) |
---|
70 | _MemWrite($tMemMap, $pToolInfo, $pMemory, $iToolInfo) |
---|
71 | $fResult = _SendMessage($hWnd, $TTM_ENUMTOOLS, $iIndex, $pMemory, 0, "wparam", "ptr") |
---|
72 | _MemRead($tMemMap, $pMemory, $pToolInfo, $iToolInfo) |
---|
73 | _MemFree($tMemMap) |
---|
74 | EndIf |
---|
75 | Return _GUIToolTip_ToolToArrayA($hWnd, $tToolInfo, $fResult = True) |
---|
76 | EndFunc ;==>_GUIToolTip_EnumTools |
---|
77 | |
---|
78 | Func _GUIToolTip_ToolToArrayA($hWnd, ByRef $tToolInfo, $iError) |
---|
79 | Local $aTool[10] |
---|
80 | |
---|
81 | $aTool[0] = _GUIToolTip_TTFToBits(DllStructGetData($tToolInfo, "Flags")) |
---|
82 | $aTool[1] = DllStructGetData($tToolInfo, "hWnd") |
---|
83 | $aTool[2] = DllStructGetData($tToolInfo, "ID") |
---|
84 | $aTool[3] = DllStructGetData($tToolInfo, "Left") |
---|
85 | $aTool[4] = DllStructGetData($tToolInfo, "Top") |
---|
86 | $aTool[5] = DllStructGetData($tToolInfo, "Right") |
---|
87 | $aTool[6] = DllStructGetData($tToolInfo, "Bottom") |
---|
88 | $aTool[7] = DllStructGetData($tToolInfo, "hInst") |
---|
89 | $aTool[8] = _GUIToolTip_GetTextA($hWnd, $aTool[1], $aTool[2]) |
---|
90 | $aTool[9] = DllStructGetData($tToolInfo, "Param") |
---|
91 | Return SetError($iError, 0, $aTool) |
---|
92 | EndFunc ;==>_GUIToolTip_ToolToArray |
---|
93 | |
---|
94 | Func _GUIToolTip_EnumToolsW($hWnd, $iIndex) |
---|
95 | Local $iToolInfo, $pToolInfo, $tToolInfo, $pMemory, $tMemMap, $fResult |
---|
96 | |
---|
97 | $tToolInfo = DllStructCreate($tagTOOLINFO) |
---|
98 | $pToolInfo = DllStructGetPtr($tToolInfo) |
---|
99 | $iToolInfo = DllStructGetSize($tToolInfo) |
---|
100 | DllStructSetData($tToolInfo, "Size", $iToolInfo) |
---|
101 | If _WinAPI_InProcess($hWnd, $_TT_ghTTLastWnd) Then |
---|
102 | $fResult = _SendMessage($hWnd, $TTM_ENUMTOOLSW, $iIndex, $pToolInfo, 0, "wparam", "ptr") |
---|
103 | Else |
---|
104 | $pMemory = _MemInit($hWnd, $iToolInfo, $tMemMap) |
---|
105 | _MemWrite($tMemMap, $pToolInfo, $pMemory, $iToolInfo) |
---|
106 | $fResult = _SendMessage($hWnd, $TTM_ENUMTOOLSW, $iIndex, $pMemory, 0, "wparam", "ptr") |
---|
107 | _MemRead($tMemMap, $pMemory, $pToolInfo, $iToolInfo) |
---|
108 | _MemFree($tMemMap) |
---|
109 | EndIf |
---|
110 | Return _GUIToolTip_ToolToArrayW($hWnd, $tToolInfo, $fResult = True) |
---|
111 | EndFunc ;==>_GUIToolTip_EnumTools |
---|
112 | |
---|
113 | Func _GUIToolTip_ToolToArrayW($hWnd, ByRef $tToolInfo, $iError) |
---|
114 | Local $aTool[10] |
---|
115 | |
---|
116 | $aTool[0] = _GUIToolTip_TTFToBits(DllStructGetData($tToolInfo, "Flags")) |
---|
117 | $aTool[1] = DllStructGetData($tToolInfo, "hWnd") |
---|
118 | $aTool[2] = DllStructGetData($tToolInfo, "ID") |
---|
119 | $aTool[3] = DllStructGetData($tToolInfo, "Left") |
---|
120 | $aTool[4] = DllStructGetData($tToolInfo, "Top") |
---|
121 | $aTool[5] = DllStructGetData($tToolInfo, "Right") |
---|
122 | $aTool[6] = DllStructGetData($tToolInfo, "Bottom") |
---|
123 | $aTool[7] = DllStructGetData($tToolInfo, "hInst") |
---|
124 | $aTool[8] = _GUIToolTip_GetTextW($hWnd, $aTool[1], $aTool[2]) |
---|
125 | $aTool[9] = DllStructGetData($tToolInfo, "Param") |
---|
126 | Return SetError($iError, 0, $aTool) |
---|
127 | EndFunc ;==>_GUIToolTip_ToolToArray |
---|
128 | |
---|
129 | Func _GUIToolTip_GetTextA($hWnd, $hTool, $iID) |
---|
130 | Local $iToolInfo, $pToolInfo, $tToolInfo, $pBuffer, $tBuffer, $pMemory, $tMemMap, $pText |
---|
131 | |
---|
132 | $tBuffer = DllStructCreate("char Text[4096]") |
---|
133 | $pBuffer = DllStructGetPtr($tBuffer) |
---|
134 | $tToolInfo = DllStructCreate($tagTOOLINFO) |
---|
135 | $pToolInfo = DllStructGetPtr($tToolInfo) |
---|
136 | $iToolInfo = DllStructGetSize($tToolInfo) |
---|
137 | DllStructSetData($tToolInfo, "Size", $iToolInfo) |
---|
138 | DllStructSetData($tToolInfo, "hWnd", $hTool) |
---|
139 | DllStructSetData($tToolInfo, "ID", $iID) |
---|
140 | If _WinAPI_InProcess($hWnd, $_TT_ghTTLastWnd) Then |
---|
141 | DllStructSetData($tToolInfo, "Text", $pBuffer) |
---|
142 | _SendMessage($hWnd, $TTM_GETTEXT, 0, $pToolInfo, 0, "wparam", "ptr") |
---|
143 | Else |
---|
144 | $pMemory = _MemInit($hWnd, $iToolInfo + 4096, $tMemMap) |
---|
145 | $pText = $pMemory + $iToolInfo |
---|
146 | DllStructSetData($tToolInfo, "Text", $pText) |
---|
147 | _MemWrite($tMemMap, $pToolInfo, $pMemory, $iToolInfo) |
---|
148 | _SendMessage($hWnd, $TTM_GETTEXT, 0, $pMemory, 0, "wparam", "ptr") |
---|
149 | _MemRead($tMemMap, $pText, $pBuffer, 81) |
---|
150 | _MemFree($tMemMap) |
---|
151 | EndIf |
---|
152 | Return DllStructGetData($tBuffer, "Text") |
---|
153 | EndFunc ;==>_GUIToolTip_GetText |
---|
154 | |
---|
155 | Func _GUIToolTip_GetTextW($hWnd, $hTool, $iID) |
---|
156 | Local $iToolInfo, $pToolInfo, $tToolInfo, $pBuffer, $tBuffer, $pMemory, $tMemMap, $pText |
---|
157 | |
---|
158 | $tBuffer = DllStructCreate("wchar Text[4096]") |
---|
159 | $pBuffer = DllStructGetPtr($tBuffer) |
---|
160 | $tToolInfo = DllStructCreate($tagTOOLINFO) |
---|
161 | $pToolInfo = DllStructGetPtr($tToolInfo) |
---|
162 | $iToolInfo = DllStructGetSize($tToolInfo) |
---|
163 | DllStructSetData($tToolInfo, "Size", $iToolInfo) |
---|
164 | DllStructSetData($tToolInfo, "hWnd", $hTool) |
---|
165 | DllStructSetData($tToolInfo, "ID", $iID) |
---|
166 | If _WinAPI_InProcess($hWnd, $_TT_ghTTLastWnd) Then |
---|
167 | DllStructSetData($tToolInfo, "Text", $pBuffer) |
---|
168 | _SendMessage($hWnd, $TTM_GETTEXTW, 0, $pToolInfo, 0, "wparam", "ptr") |
---|
169 | Else |
---|
170 | $pMemory = _MemInit($hWnd, $iToolInfo + 4096, $tMemMap) |
---|
171 | $pText = $pMemory + $iToolInfo |
---|
172 | DllStructSetData($tToolInfo, "Text", $pText) |
---|
173 | _MemWrite($tMemMap, $pToolInfo, $pMemory, $iToolInfo) |
---|
174 | _SendMessage($hWnd, $TTM_GETTEXTW, 0, $pMemory, 0, "wparam", "ptr") |
---|
175 | _MemRead($tMemMap, $pText, $pBuffer, 81) |
---|
176 | _MemFree($tMemMap) |
---|
177 | EndIf |
---|
178 | Return DllStructGetData($tBuffer, "Text") |
---|
179 | EndFunc ;==>_GUIToolTip_GetText |
---|