GuiToolTip.au3 47 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892
  1. #include-once
  2. #include "Memory.au3"
  3. #include "SendMessage.au3"
  4. #include "StructureConstants.au3"
  5. #include "ToolTipConstants.au3"
  6. #include "WinAPIConv.au3"
  7. #include "WinAPISysInternals.au3"
  8. ; #INDEX# =======================================================================================================================
  9. ; Title .........: ToolTip
  10. ; AutoIt Version : 3.3.14.5
  11. ; Description ...: Functions that assist with ToolTip control management.
  12. ; ToolTip controls are pop-up windows that display text. The text usually describes a tool, which is either a
  13. ; window, such as a child window or control, or an application-defined rectangular area within a window's client
  14. ; area.
  15. ; Author(s) .....: Paul Campbell (PaulIA)
  16. ; ===============================================================================================================================
  17. ; #VARIABLES# ===================================================================================================================
  18. Global $__g_hTTLastWnd
  19. ; ===============================================================================================================================
  20. ; #CONSTANTS# ===================================================================================================================
  21. Global Const $_TOOLTIPCONSTANTS_ClassName = "tooltips_class32"
  22. Global Const $_TT_ghTTDefaultStyle = BitOR($TTS_ALWAYSTIP, $TTS_NOPREFIX)
  23. ; ===============================================================================================================================
  24. ; #CURRENT# =====================================================================================================================
  25. ; _GUIToolTip_Activate
  26. ; _GUIToolTip_AddTool
  27. ; _GUIToolTip_AdjustRect
  28. ; _GUIToolTip_BitsToTTF
  29. ; _GUIToolTip_Create
  30. ; _GUIToolTip_Deactivate
  31. ; _GUIToolTip_DelTool
  32. ; _GUIToolTip_Destroy
  33. ; _GUIToolTip_EnumTools
  34. ; _GUIToolTip_GetBubbleHeight
  35. ; _GUIToolTip_GetBubbleSize
  36. ; _GUIToolTip_GetBubbleWidth
  37. ; _GUIToolTip_GetCurrentTool
  38. ; _GUIToolTip_GetDelayTime
  39. ; _GUIToolTip_GetMargin
  40. ; _GUIToolTip_GetMarginEx
  41. ; _GUIToolTip_GetMaxTipWidth
  42. ; _GUIToolTip_GetText
  43. ; _GUIToolTip_GetTipBkColor
  44. ; _GUIToolTip_GetTipTextColor
  45. ; _GUIToolTip_GetTitleBitMap
  46. ; _GUIToolTip_GetTitleText
  47. ; _GUIToolTip_GetToolCount
  48. ; _GUIToolTip_GetToolInfo
  49. ; _GUIToolTip_HitTest
  50. ; _GUIToolTip_NewToolRect
  51. ; _GUIToolTip_Pop
  52. ; _GUIToolTip_PopUp
  53. ; _GUIToolTip_SetDelayTime
  54. ; _GUIToolTip_SetMargin
  55. ; _GUIToolTip_SetMaxTipWidth
  56. ; _GUIToolTip_SetTipBkColor
  57. ; _GUIToolTip_SetTipTextColor
  58. ; _GUIToolTip_SetTitle
  59. ; _GUIToolTip_SetToolInfo
  60. ; _GUIToolTip_SetWindowTheme
  61. ; _GUIToolTip_ToolExists
  62. ; _GUIToolTip_ToolToArray
  63. ; _GUIToolTip_TrackActivate
  64. ; _GUIToolTip_TrackPosition
  65. ; _GUIToolTip_Update
  66. ; _GUIToolTip_UpdateTipText
  67. ; ===============================================================================================================================
  68. ; #NEW_FUNCTIONS# ===============================================================================================================
  69. ; _GUIToolTip_Deactivate
  70. ; ===============================================================================================================================
  71. ; #INTERNAL_USE_ONLY# ===========================================================================================================
  72. ; $tagNMTTDISPINFO
  73. ; $tagTOOLINFO
  74. ; $tagTTGETTITLE
  75. ; $tagTTHITTESTINFO
  76. ; ===============================================================================================================================
  77. ; #INTERNAL_USE_ONLY# ===========================================================================================================
  78. ; Name...........: $tagNMTTDISPINFO
  79. ; Description ...: Contains information used in handling the $TTN_GETDISPINFOW notification message
  80. ; Fields ........: $tagNMHDR - Contains information about a notification message
  81. ; pText - Pointer to a string that will be displayed as the ToolTip text. If Instance specifies an instance
  82. ; +handle, this member must be the identifier of a string resource.
  83. ; aText - Buffer that receives the ToolTip text. An application can copy the text to this buffer instead of
  84. ; +specifying a string address or string resource.
  85. ; Instance - Handle to the instance that contains a string resource to be used as the ToolTip text. If pText is
  86. ; +the address of the ToolTip text string, this member must be 0.
  87. ; Flags - Flags that indicates how to interpret the IDFrom member:
  88. ; |$TTF_IDISHWND - If this flag is set, IDFrom is the tool's handle. Otherwise, it is the tool's identifier.
  89. ; |$TTF_RTLREADING - Specifies right to left text
  90. ; |$TTF_DI_SETITEM - If you add this flag to Flags while processing the notification, the ToolTip control will
  91. ; +retain the supplied information and not request it again.
  92. ; Param - Application-defined data associated with the tool
  93. ; Author ........: Paul Campbell (PaulIA)
  94. ; Remarks .......: You need to point the pText array to your own private buffer when the text used in the ToolTip text exceeds 80
  95. ; +characters in length. The system automatically strips the accelerator from all strings passed to a ToolTip
  96. ; control, unless the control has the $TTS_NOPREFIX style.
  97. ; ===============================================================================================================================
  98. Global Const $tagNMTTDISPINFO = $tagNMHDR & ";ptr pText;wchar aText[80];ptr Instance;uint Flags;lparam Param"
  99. ; #INTERNAL_USE_ONLY# ===========================================================================================================
  100. ; Name...........: $tagTOOLINFO
  101. ; Description ...: Contains information about a tool in a ToolTip contr
  102. ; Fields ........: Size - Size of this structure, in bytes
  103. ; Flags - Flags that control the ToolTip display. This member can be a combination of the following values:
  104. ; |$TTF_ABSOLUTE - Positions the ToolTip at the same coordinates provided by $TTM_TRACKPOSITION
  105. ; |$TTF_CENTERTIP - Centers the ToolTip below the tool specified by the ID member
  106. ; |$TTF_IDISHWND - Indicates that the ID member is the window handle to the tool
  107. ; |$TTF_PARSELINKS - Indicates that links in the tooltip text should be parsed
  108. ; |$TTF_RTLREADING - Indicates that the ToolTip text will be displayed in the opposite direction
  109. ; |$TTF_SUBCLASS - Indicates that the ToolTip control should subclass the tool's window to intercept messages
  110. ; |$TTF_TRACK - Positions the ToolTip next to the tool to which it corresponds
  111. ; |$TTF_TRANSPARENT - Causes the ToolTip control to forward mouse event messages to the parent window
  112. ; hWnd - Handle to the window that contains the tool
  113. ; ID - Application-defined identifier of the tool
  114. ; Left - X position of upper left corner of bounding rectangle
  115. ; Top - Y position of upper left corner of bounding rectangle
  116. ; Right - X position of lower right corner of bounding rectangle
  117. ; Bottom - Y position of lower right corner of bounding rectangle
  118. ; hInst - Handle to the instance that contains the string resource for the too
  119. ; Text - Pointer to the buffer that contains the text for the tool
  120. ; Param - A 32-bit application-defined value that is associated with the tool
  121. ; Reserved - Reserved
  122. ; Author ........: Paul Campbell (PaulIA)
  123. ; Remarks .......:
  124. ; ===============================================================================================================================
  125. Global Const $tagTOOLINFO = "uint Size;uint Flags;hwnd hWnd;uint_ptr ID;" & $tagRECT & ";handle hInst;ptr Text;lparam Param;ptr Reserved"
  126. ; #INTERNAL_USE_ONLY# ===========================================================================================================
  127. ; Name...........: $tagTTGETTITLE
  128. ; Description ...: Provides information about the title of a tooltip control
  129. ; Fields ........: Size - Size of this structure, in bytes
  130. ; Bitmap - The tooltip icon
  131. ; TitleMax - Specifies the number of characters in the title
  132. ; Title - Pointer to a wide character string that contains the title
  133. ; Author ........: Paul Campbell (PaulIA)
  134. ; Remarks .......:
  135. ; ===============================================================================================================================
  136. Global Const $tagTTGETTITLE = "dword Size;uint Bitmap;uint TitleMax;ptr Title"
  137. ; #INTERNAL_USE_ONLY# ===========================================================================================================
  138. ; Name...........: $tagTTHITTESTINFO
  139. ; Description ...: Contains information that a ToolTip control uses to determine whether a point is in the bounding rectangle of the specified tool
  140. ; Fields ........: Tool - Handle to the tool or window with the specified tool
  141. ; X - X position to be tested, in client coordinates
  142. ; Y - Y position to be tested, in client coordinates
  143. ; Size - Size of a TOOLINFO structure
  144. ; Flags - Flags that control the ToolTip display. This member can be a combination of the following values:
  145. ; |$TTF_ABSOLUTE - Positions the ToolTip at the same coordinates provided by $TTM_TRACKPOSITION
  146. ; |$TTF_CENTERTIP - Centers the ToolTip below the tool specified by the ID member
  147. ; |$TTF_IDISHWND - Indicates that the ID member is the window handle to the tool
  148. ; |$TTF_PARSELINKS - Indicates that links in the tooltip text should be parsed
  149. ; |$TTF_RTLREADING - Indicates that the ToolTip text will be displayed in the opposite direction
  150. ; |$TTF_SUBCLASS - Indicates that the ToolTip control should subclass the tool's window to intercept messages
  151. ; |$TTF_TRACK - Positions the ToolTip next to the tool to which it corresponds
  152. ; |$TTF_TRANSPARENT - Causes the ToolTip control to forward mouse event messages to the parent window
  153. ; hWnd - Handle to the window that contains the tool
  154. ; ID - Application-defined identifier of the tool
  155. ; Left - X position of upper left corner of bounding rectangle
  156. ; Top - Y position of upper left corner of bounding rectangle
  157. ; Right - X position of lower right corner of bounding rectangle
  158. ; Bottom - Y position of lower right corner of bounding rectangle
  159. ; hInst - Handle to the instance that contains the string resource for the too
  160. ; Text - Pointer to the buffer that contains the text for the tool
  161. ; Param - A 32-bit application-defined value that is associated with the tool
  162. ; Reserved - Reserved
  163. ; Author ........: Paul Campbell (PaulIA)
  164. ; Remarks .......:
  165. ; ===============================================================================================================================
  166. Global Const $tagTTHITTESTINFO = "hwnd Tool;" & $tagPOINT & ";" & $tagTOOLINFO
  167. ; #FUNCTION# ====================================================================================================================
  168. ; Author ........: Paul Campbell (PaulIA)
  169. ; Modified.......: Bob Marotte (BrewManNH)
  170. ; ===============================================================================================================================
  171. Func _GUIToolTip_Activate($hWnd)
  172. _SendMessage($hWnd, $TTM_ACTIVATE, True)
  173. EndFunc ;==>_GUIToolTip_Activate
  174. ; #FUNCTION# ====================================================================================================================
  175. ; Author ........: Paul Campbell (PaulIA)
  176. ; Modified.......: Bob Marotte (BrewManNH)
  177. ; ===============================================================================================================================
  178. Func _GUIToolTip_AddTool($hTool, $hWnd, $sText, $iID = 0, $iLeft = 0, $iTop = 0, $iRight = 0, $iBottom = 0, $iFlags = Default, $iParam = 0)
  179. Local $iBuffer, $tBuffer, $pBuffer
  180. If $iFlags = Default Then $iFlags = BitOR($TTF_SUBCLASS, $TTF_IDISHWND)
  181. If $sText <> -1 Then
  182. $iBuffer = StringLen($sText) + 1
  183. $tBuffer = DllStructCreate("wchar Text[" & $iBuffer & "]")
  184. $iBuffer *= 2
  185. $pBuffer = DllStructGetPtr($tBuffer)
  186. DllStructSetData($tBuffer, "Text", $sText)
  187. Else
  188. $iBuffer = 0
  189. $pBuffer = -1 ; LPSTR_TEXTCALLBACK
  190. EndIf
  191. Local $tToolInfo = DllStructCreate($tagTOOLINFO)
  192. Local $iToolInfo = DllStructGetSize($tToolInfo)
  193. DllStructSetData($tToolInfo, "Size", $iToolInfo)
  194. DllStructSetData($tToolInfo, "Flags", $iFlags)
  195. DllStructSetData($tToolInfo, "hWnd", $hWnd)
  196. DllStructSetData($tToolInfo, "ID", $iID)
  197. DllStructSetData($tToolInfo, "Left", $iLeft)
  198. DllStructSetData($tToolInfo, "Top", $iTop)
  199. DllStructSetData($tToolInfo, "Right", $iRight)
  200. DllStructSetData($tToolInfo, "Bottom", $iBottom)
  201. DllStructSetData($tToolInfo, "Param", $iParam)
  202. Local $iRet
  203. If _WinAPI_InProcess($hTool, $__g_hTTLastWnd) Then
  204. DllStructSetData($tToolInfo, "Text", $pBuffer)
  205. $iRet = _SendMessage($hTool, $TTM_ADDTOOLW, 0, $tToolInfo, 0, "wparam", "struct*")
  206. Else
  207. Local $tMemMap
  208. Local $pMemory = _MemInit($hTool, $iToolInfo + $iBuffer, $tMemMap)
  209. If $sText <> -1 Then
  210. Local $pText = $pMemory + $iToolInfo
  211. DllStructSetData($tToolInfo, "Text", $pText)
  212. _MemWrite($tMemMap, $tBuffer, $pText, $iBuffer)
  213. Else
  214. DllStructSetData($tToolInfo, "Text", -1) ; LPSTR_TEXTCALLBACK
  215. EndIf
  216. _MemWrite($tMemMap, $tToolInfo, $pMemory, $iToolInfo)
  217. $iRet = _SendMessage($hTool, $TTM_ADDTOOLW, 0, $pMemory, 0, "wparam", "ptr")
  218. _MemFree($tMemMap)
  219. EndIf
  220. Return $iRet <> 0
  221. EndFunc ;==>_GUIToolTip_AddTool
  222. ; #FUNCTION# ====================================================================================================================
  223. ; Author ........: Paul Campbell (PaulIA)
  224. ; Modified.......:
  225. ; ===============================================================================================================================
  226. Func _GUIToolTip_AdjustRect($hWnd, ByRef $tRECT, $bLarger = True)
  227. If _WinAPI_InProcess($hWnd, $__g_hTTLastWnd) Then
  228. _SendMessage($hWnd, $TTM_ADJUSTRECT, $bLarger, $tRECT, 0, "wparam", "struct*")
  229. Else
  230. Local $iRect = DllStructGetSize($tRECT)
  231. Local $tMemMap
  232. Local $pMemory = _MemInit($hWnd, $iRect, $tMemMap)
  233. _MemWrite($tMemMap, $tRECT)
  234. _SendMessage($hWnd, $TTM_ADJUSTRECT, $bLarger, $pMemory, 0, "wparam", "ptr")
  235. _MemRead($tMemMap, $pMemory, $tRECT, $iRect)
  236. _MemFree($tMemMap)
  237. EndIf
  238. Return $tRECT
  239. EndFunc ;==>_GUIToolTip_AdjustRect
  240. ; #FUNCTION# ====================================================================================================================
  241. ; Author ........: Paul Campbell (PaulIA)
  242. ; Modified.......: Bob Marotte (BrewManNH)
  243. ; ===============================================================================================================================
  244. Func _GUIToolTip_BitsToTTF($iFlags)
  245. Local $iN = ""
  246. If BitAND($iFlags, $TTF_IDISHWND) <> 0 Then $iN &= "TTF_IDISHWND,"
  247. If BitAND($iFlags, $TTF_CENTERTIP) <> 0 Then $iN &= "TTF_CENTERTIP,"
  248. If BitAND($iFlags, $TTF_RTLREADING) <> 0 Then $iN &= "TTF_RTLREADING,"
  249. If BitAND($iFlags, $TTF_SUBCLASS) <> 0 Then $iN &= "TTF_SUBCLASS,"
  250. If BitAND($iFlags, $TTF_TRACK) <> 0 Then $iN &= "TTF_TRACK,"
  251. If BitAND($iFlags, $TTF_ABSOLUTE) <> 0 Then $iN &= "TTF_ABSOLUTE,"
  252. If BitAND($iFlags, $TTF_TRANSPARENT) <> 0 Then $iN &= "TTF_TRANSPARENT,"
  253. If BitAND($iFlags, $TTF_PARSELINKS) <> 0 Then $iN &= "TTF_PARSELINKS,"
  254. Return StringTrimRight($iN, 1)
  255. EndFunc ;==>_GUIToolTip_BitsToTTF
  256. ; #FUNCTION# ====================================================================================================================
  257. ; Author ........: Paul Campbell (PaulIA)
  258. ; Modified.......: Gary Frost
  259. ; ===============================================================================================================================
  260. Func _GUIToolTip_Create($hWnd, $iStyle = $_TT_ghTTDefaultStyle)
  261. Return _WinAPI_CreateWindowEx(0, $_TOOLTIPCONSTANTS_ClassName, "", $iStyle, 0, 0, 0, 0, $hWnd)
  262. EndFunc ;==>_GUIToolTip_Create
  263. ; #FUNCTION# ====================================================================================================================
  264. ; Author ........: Bob Marotte (BrewManNH)
  265. ; Modified.......:
  266. ; ===============================================================================================================================
  267. Func _GUIToolTip_Deactivate($hWnd)
  268. _SendMessage($hWnd, $TTM_ACTIVATE, False)
  269. EndFunc ;==>_GUIToolTip_Deactivate
  270. ; #FUNCTION# ====================================================================================================================
  271. ; Author ........: Paul Campbell (PaulIA)
  272. ; Modified.......: Bob Marotte (BrewManNH)
  273. ; ===============================================================================================================================
  274. Func _GUIToolTip_DelTool($hWnd, $hTool, $iID = 0)
  275. Local $tToolInfo = DllStructCreate($tagTOOLINFO)
  276. Local $iToolInfo = DllStructGetSize($tToolInfo)
  277. DllStructSetData($tToolInfo, "Size", $iToolInfo)
  278. DllStructSetData($tToolInfo, "ID", $iID)
  279. DllStructSetData($tToolInfo, "hWnd", $hTool)
  280. If _WinAPI_InProcess($hWnd, $__g_hTTLastWnd) Then
  281. _SendMessage($hWnd, $TTM_DELTOOLW, 0, $tToolInfo, 0, "wparam", "struct*")
  282. Else
  283. Local $tMemMap
  284. Local $pMemory = _MemInit($hWnd, $iToolInfo, $tMemMap)
  285. _MemWrite($tMemMap, $tToolInfo)
  286. _SendMessage($hWnd, $TTM_DELTOOLW, 0, $pMemory, 0, "wparam", "ptr")
  287. _MemFree($tMemMap)
  288. EndIf
  289. EndFunc ;==>_GUIToolTip_DelTool
  290. ; #FUNCTION# ====================================================================================================================
  291. ; Author ........: Gary Frost
  292. ; Modified.......:
  293. ; ===============================================================================================================================
  294. Func _GUIToolTip_Destroy(ByRef $hWnd)
  295. If Not _WinAPI_IsClassName($hWnd, $_TOOLTIPCONSTANTS_ClassName) Then Return SetError(2, 2, False)
  296. Local $iDestroyed = 0
  297. If IsHWnd($hWnd) Then
  298. If _WinAPI_InProcess($hWnd, $__g_hTTLastWnd) Then
  299. $iDestroyed = _WinAPI_DestroyWindow($hWnd)
  300. Else
  301. ; Not Allowed to Destroy Other Applications Control(s)
  302. Return SetError(1, 1, False)
  303. EndIf
  304. EndIf
  305. If $iDestroyed Then $hWnd = 0
  306. Return $iDestroyed <> 0
  307. EndFunc ;==>_GUIToolTip_Destroy
  308. ; #FUNCTION# ====================================================================================================================
  309. ; Author ........: Paul Campbell (PaulIA)
  310. ; Modified.......:
  311. ; ===============================================================================================================================
  312. Func _GUIToolTip_EnumTools($hWnd, $iIndex)
  313. Local $tToolInfo = DllStructCreate($tagTOOLINFO)
  314. Local $iToolInfo = DllStructGetSize($tToolInfo)
  315. DllStructSetData($tToolInfo, "Size", $iToolInfo)
  316. Local $bResult
  317. If _WinAPI_InProcess($hWnd, $__g_hTTLastWnd) Then
  318. $bResult = _SendMessage($hWnd, $TTM_ENUMTOOLSW, $iIndex, $tToolInfo, 0, "wparam", "struct*")
  319. Else
  320. Local $tMemMap
  321. Local $pMemory = _MemInit($hWnd, $iToolInfo, $tMemMap)
  322. _MemWrite($tMemMap, $tToolInfo, $pMemory, $iToolInfo)
  323. $bResult = _SendMessage($hWnd, $TTM_ENUMTOOLSW, $iIndex, $pMemory, 0, "wparam", "ptr")
  324. _MemRead($tMemMap, $pMemory, $tToolInfo, $iToolInfo)
  325. _MemFree($tMemMap)
  326. EndIf
  327. Return _GUIToolTip_ToolToArray($hWnd, $tToolInfo, $bResult = True)
  328. EndFunc ;==>_GUIToolTip_EnumTools
  329. ; #FUNCTION# ====================================================================================================================
  330. ; Author ........: Paul Campbell (PaulIA)
  331. ; Modified.......: Bob Marotte (BrewManNH)
  332. ; ===============================================================================================================================
  333. Func _GUIToolTip_GetBubbleHeight($hWnd, $hTool, $iID, $iFlags = Default)
  334. If $iFlags = Default Then $iFlags = BitOR($TTF_IDISHWND, $TTF_SUBCLASS)
  335. Return _WinAPI_HiWord(_GUIToolTip_GetBubbleSize($hWnd, $hTool, $iID, $iFlags))
  336. EndFunc ;==>_GUIToolTip_GetBubbleHeight
  337. ; #FUNCTION# ====================================================================================================================
  338. ; Author ........: Paul Campbell (PaulIA)
  339. ; Modified.......: Bob Marotte (BrewManNH)
  340. ; ===============================================================================================================================
  341. Func _GUIToolTip_GetBubbleSize($hWnd, $hTool, $iID, $iFlags = Default)
  342. If $iFlags = Default Then $iFlags = BitOR($TTF_IDISHWND, $TTF_SUBCLASS)
  343. Local $tToolInfo = DllStructCreate($tagTOOLINFO)
  344. Local $iToolInfo = DllStructGetSize($tToolInfo)
  345. DllStructSetData($tToolInfo, "Size", $iToolInfo)
  346. DllStructSetData($tToolInfo, "hWnd", $hTool)
  347. DllStructSetData($tToolInfo, "ID", $iID)
  348. DllStructSetData($tToolInfo, "Flags", $iFlags)
  349. Local $iRet
  350. If _WinAPI_InProcess($hWnd, $__g_hTTLastWnd) Then
  351. $iRet = _SendMessage($hWnd, $TTM_GETBUBBLESIZE, 0, $tToolInfo, 0, "wparam", "struct*")
  352. Else
  353. Local $tMemMap
  354. Local $pMemory = _MemInit($hWnd, $iToolInfo, $tMemMap)
  355. _MemWrite($tMemMap, $tToolInfo)
  356. $iRet = _SendMessage($hWnd, $TTM_GETBUBBLESIZE, 0, $pMemory, 0, "wparam", "ptr")
  357. _MemFree($tMemMap)
  358. EndIf
  359. Return $iRet
  360. EndFunc ;==>_GUIToolTip_GetBubbleSize
  361. ; #FUNCTION# ====================================================================================================================
  362. ; Author ........: Paul Campbell (PaulIA)
  363. ; Modified.......: Bob Marotte (BrewManNH)
  364. ; ===============================================================================================================================
  365. Func _GUIToolTip_GetBubbleWidth($hWnd, $hTool, $iID, $iFlags = Default)
  366. If $iFlags = Default Then $iFlags = BitOR($TTF_IDISHWND, $TTF_SUBCLASS)
  367. Return _WinAPI_LoWord(_GUIToolTip_GetBubbleSize($hWnd, $hTool, $iID, $iFlags))
  368. EndFunc ;==>_GUIToolTip_GetBubbleWidth
  369. ; #FUNCTION# ====================================================================================================================
  370. ; Author ........: Paul Campbell (PaulIA)
  371. ; Modified.......:
  372. ; ===============================================================================================================================
  373. Func _GUIToolTip_GetCurrentTool($hWnd)
  374. Local $tToolInfo = DllStructCreate($tagTOOLINFO)
  375. Local $iToolInfo = DllStructGetSize($tToolInfo)
  376. DllStructSetData($tToolInfo, "Size", $iToolInfo)
  377. Local $bResult
  378. If _WinAPI_InProcess($hWnd, $__g_hTTLastWnd) Then
  379. $bResult = _SendMessage($hWnd, $TTM_GETCURRENTTOOLW, 0, $tToolInfo, 0, "wparam", "struct*")
  380. Else
  381. Local $tMemMap
  382. Local $pMemory = _MemInit($hWnd, $iToolInfo, $tMemMap)
  383. _MemWrite($tMemMap, $tToolInfo, $pMemory, $iToolInfo)
  384. $bResult = _SendMessage($hWnd, $TTM_GETCURRENTTOOLW, 0, $pMemory, 0, "wparam", "ptr")
  385. _MemRead($tMemMap, $pMemory, $tToolInfo, $iToolInfo)
  386. _MemFree($tMemMap)
  387. EndIf
  388. Return _GUIToolTip_ToolToArray($hWnd, $tToolInfo, $bResult = True)
  389. EndFunc ;==>_GUIToolTip_GetCurrentTool
  390. ; #FUNCTION# ====================================================================================================================
  391. ; Author ........: Paul Campbell (PaulIA)
  392. ; Modified.......: Bob Marotte (BrewManNH)
  393. ; ===============================================================================================================================
  394. Func _GUIToolTip_GetDelayTime($hWnd, $iDuration)
  395. Return _SendMessage($hWnd, $TTM_GETDELAYTIME, $iDuration)
  396. EndFunc ;==>_GUIToolTip_GetDelayTime
  397. ; #FUNCTION# ====================================================================================================================
  398. ; Author ........: Paul Campbell (PaulIA)
  399. ; Modified.......:
  400. ; ===============================================================================================================================
  401. Func _GUIToolTip_GetMargin($hWnd)
  402. Local $aMargin[4]
  403. Local $tRECT = _GUIToolTip_GetMarginEx($hWnd)
  404. $aMargin[0] = DllStructGetData($tRECT, "Left")
  405. $aMargin[1] = DllStructGetData($tRECT, "Top")
  406. $aMargin[2] = DllStructGetData($tRECT, "Right")
  407. $aMargin[3] = DllStructGetData($tRECT, "Bottom")
  408. Return $aMargin
  409. EndFunc ;==>_GUIToolTip_GetMargin
  410. ; #FUNCTION# ====================================================================================================================
  411. ; Author ........: Paul Campbell (PaulIA)
  412. ; Modified.......:
  413. ; ===============================================================================================================================
  414. Func _GUIToolTip_GetMarginEx($hWnd)
  415. Local $tRECT = DllStructCreate($tagRECT)
  416. If _WinAPI_InProcess($hWnd, $__g_hTTLastWnd) Then
  417. _SendMessage($hWnd, $TTM_GETMARGIN, 0, $tRECT, 0, "wparam", "struct*")
  418. Else
  419. Local $iRect = DllStructGetSize($tRECT)
  420. Local $tMemMap
  421. Local $pMemory = _MemInit($hWnd, $iRect, $tMemMap)
  422. _SendMessage($hWnd, $TTM_GETMARGIN, 0, $pMemory, 0, "wparam", "ptr")
  423. _MemRead($tMemMap, $pMemory, $tRECT, $iRect)
  424. _MemFree($tMemMap)
  425. EndIf
  426. Return $tRECT
  427. EndFunc ;==>_GUIToolTip_GetMarginEx
  428. ; #FUNCTION# ====================================================================================================================
  429. ; Author ........: Paul Campbell (PaulIA)
  430. ; Modified.......:
  431. ; ===============================================================================================================================
  432. Func _GUIToolTip_GetMaxTipWidth($hWnd)
  433. Return _SendMessage($hWnd, $TTM_GETMAXTIPWIDTH)
  434. EndFunc ;==>_GUIToolTip_GetMaxTipWidth
  435. ; #FUNCTION# ====================================================================================================================
  436. ; Author ........: Paul Campbell (PaulIA)
  437. ; Modified.......:
  438. ; ===============================================================================================================================
  439. Func _GUIToolTip_GetText($hWnd, $hTool, $iID)
  440. Local $tBuffer = DllStructCreate("wchar Text[4096]")
  441. Local $tToolInfo = DllStructCreate($tagTOOLINFO)
  442. Local $iToolInfo = DllStructGetSize($tToolInfo)
  443. DllStructSetData($tToolInfo, "Size", $iToolInfo)
  444. DllStructSetData($tToolInfo, "hWnd", $hTool)
  445. DllStructSetData($tToolInfo, "ID", $iID)
  446. If _WinAPI_InProcess($hWnd, $__g_hTTLastWnd) Then
  447. DllStructSetData($tToolInfo, "Text", DllStructGetPtr($tBuffer))
  448. _SendMessage($hWnd, $TTM_GETTEXTW, 0, $tToolInfo, 0, "wparam", "struct*")
  449. Else
  450. Local $tMemMap
  451. Local $pMemory = _MemInit($hWnd, $iToolInfo + 4096, $tMemMap)
  452. Local $pText = $pMemory + $iToolInfo
  453. DllStructSetData($tToolInfo, "Text", $pText)
  454. _MemWrite($tMemMap, $tToolInfo, $pMemory, $iToolInfo)
  455. _SendMessage($hWnd, $TTM_GETTEXTW, 0, $pMemory, 0, "wparam", "ptr")
  456. _MemRead($tMemMap, $pText, $tBuffer, 81)
  457. _MemFree($tMemMap)
  458. EndIf
  459. Return DllStructGetData($tBuffer, "Text")
  460. EndFunc ;==>_GUIToolTip_GetText
  461. ; #FUNCTION# ====================================================================================================================
  462. ; Author ........: Paul Campbell (PaulIA)
  463. ; Modified.......:
  464. ; ===============================================================================================================================
  465. Func _GUIToolTip_GetTipBkColor($hWnd)
  466. Return _SendMessage($hWnd, $TTM_GETTIPBKCOLOR)
  467. EndFunc ;==>_GUIToolTip_GetTipBkColor
  468. ; #FUNCTION# ====================================================================================================================
  469. ; Author ........: Paul Campbell (PaulIA)
  470. ; Modified.......:
  471. ; ===============================================================================================================================
  472. Func _GUIToolTip_GetTipTextColor($hWnd)
  473. Return _SendMessage($hWnd, $TTM_GETTIPTEXTCOLOR)
  474. EndFunc ;==>_GUIToolTip_GetTipTextColor
  475. ; #FUNCTION# ====================================================================================================================
  476. ; Author ........: Paul Campbell (PaulIA)
  477. ; Modified.......:
  478. ; ===============================================================================================================================
  479. Func _GUIToolTip_GetTitleBitMap($hWnd)
  480. Local $tBuffer = DllStructCreate("wchar Text[4096]")
  481. Local $tTitle = DllStructCreate($tagTTGETTITLE)
  482. Local $iTitle = DllStructGetSize($tTitle)
  483. DllStructSetData($tTitle, "TitleMax", DllStructGetSize($tBuffer))
  484. DllStructSetData($tTitle, "Size", $iTitle)
  485. If _WinAPI_InProcess($hWnd, $__g_hTTLastWnd) Then
  486. DllStructSetData($tTitle, "Title", DllStructGetPtr($tBuffer))
  487. _SendMessage($hWnd, $TTM_GETTITLE, 0, $tTitle, 0, "wparam", "struct*")
  488. Else
  489. Local $tMemMap
  490. Local $pMemory = _MemInit($hWnd, $iTitle + 4096, $tMemMap)
  491. Local $pText = $pMemory + $iTitle
  492. DllStructSetData($tTitle, "Title", $pText)
  493. _MemWrite($tMemMap, $tTitle, $pMemory, $iTitle)
  494. _SendMessage($hWnd, $TTM_GETTITLE, 0, $pMemory, 0, "wparam", "ptr")
  495. _MemRead($tMemMap, $pText, $tBuffer, 4096)
  496. _MemFree($tMemMap)
  497. EndIf
  498. Return DllStructGetData($tTitle, "Bitmap")
  499. EndFunc ;==>_GUIToolTip_GetTitleBitMap
  500. ; #FUNCTION# ====================================================================================================================
  501. ; Author ........: Paul Campbell (PaulIA)
  502. ; Modified.......:
  503. ; ===============================================================================================================================
  504. Func _GUIToolTip_GetTitleText($hWnd)
  505. Local $tBuffer = DllStructCreate("wchar Text[4096]")
  506. Local $tTitle = DllStructCreate($tagTTGETTITLE)
  507. Local $iTitle = DllStructGetSize($tTitle)
  508. DllStructSetData($tTitle, "TitleMax", DllStructGetSize($tBuffer))
  509. DllStructSetData($tTitle, "Size", $iTitle)
  510. If _WinAPI_InProcess($hWnd, $__g_hTTLastWnd) Then
  511. DllStructSetData($tTitle, "Title", DllStructGetPtr($tBuffer))
  512. _SendMessage($hWnd, $TTM_GETTITLE, 0, $tTitle, 0, "wparam", "struct*")
  513. Else
  514. Local $tMemMap
  515. Local $pMemory = _MemInit($hWnd, $iTitle + 4096, $tMemMap)
  516. Local $pText = $pMemory + $iTitle
  517. DllStructSetData($tTitle, "Title", $pText)
  518. _MemWrite($tMemMap, $tTitle, $pMemory, $iTitle)
  519. _SendMessage($hWnd, $TTM_GETTITLE, 0, $pMemory, 0, "wparam", "ptr")
  520. _MemRead($tMemMap, $pText, $tBuffer, 4096)
  521. _MemFree($tMemMap)
  522. EndIf
  523. Return DllStructGetData($tBuffer, "Text")
  524. EndFunc ;==>_GUIToolTip_GetTitleText
  525. ; #FUNCTION# ====================================================================================================================
  526. ; Author ........: Paul Campbell (PaulIA)
  527. ; Modified.......:
  528. ; ===============================================================================================================================
  529. Func _GUIToolTip_GetToolCount($hWnd)
  530. Return _SendMessage($hWnd, $TTM_GETTOOLCOUNT)
  531. EndFunc ;==>_GUIToolTip_GetToolCount
  532. ; #FUNCTION# ====================================================================================================================
  533. ; Author ........: Paul Campbell (PaulIA)
  534. ; Modified.......:
  535. ; ===============================================================================================================================
  536. Func _GUIToolTip_GetToolInfo($hWnd, $hTool, $iID)
  537. Local $tToolInfo = DllStructCreate($tagTOOLINFO)
  538. Local $iToolInfo = DllStructGetSize($tToolInfo)
  539. DllStructSetData($tToolInfo, "Size", $iToolInfo)
  540. DllStructSetData($tToolInfo, "hWnd", $hTool)
  541. DllStructSetData($tToolInfo, "ID", $iID)
  542. Local $bResult
  543. If _WinAPI_InProcess($hWnd, $__g_hTTLastWnd) Then
  544. $bResult = _SendMessage($hWnd, $TTM_GETTOOLINFOW, 0, $tToolInfo, 0, "wparam", "struct*")
  545. Else
  546. Local $tMemMap
  547. Local $pMemory = _MemInit($hWnd, $iToolInfo, $tMemMap)
  548. _MemWrite($tMemMap, $tToolInfo, $pMemory, $iToolInfo)
  549. $bResult = _SendMessage($hWnd, $TTM_GETTOOLINFOW, 0, $pMemory, 0, "wparam", "ptr")
  550. _MemRead($tMemMap, $pMemory, $tToolInfo, $iToolInfo)
  551. _MemFree($tMemMap)
  552. EndIf
  553. Return _GUIToolTip_ToolToArray($hWnd, $tToolInfo, $bResult = True)
  554. EndFunc ;==>_GUIToolTip_GetToolInfo
  555. ; #FUNCTION# ====================================================================================================================
  556. ; Author ........: Paul Campbell (PaulIA)
  557. ; Modified.......:
  558. ; ===============================================================================================================================
  559. Func _GUIToolTip_HitTest($hWnd, $hTool, $iX, $iY)
  560. Local $tHitTest = DllStructCreate($tagTTHITTESTINFO)
  561. Local $tToolInfo = DllStructCreate($tagTOOLINFO)
  562. Local $iToolInfo = DllStructGetSize($tToolInfo)
  563. DllStructSetData($tHitTest, "Tool", $hTool)
  564. DllStructSetData($tHitTest, "X", $iX)
  565. DllStructSetData($tHitTest, "Y", $iY)
  566. DllStructSetData($tHitTest, "Size", $iToolInfo)
  567. Local $bResult
  568. If _WinAPI_InProcess($hWnd, $__g_hTTLastWnd) Then
  569. $bResult = _SendMessage($hWnd, $TTM_HITTESTW, 0, $tHitTest, 0, "wparam", "struct*")
  570. Else
  571. Local $iHitTest = DllStructGetSize($tHitTest)
  572. Local $tMemMap
  573. Local $pMemory = _MemInit($hWnd, $iHitTest, $tMemMap)
  574. _MemWrite($tMemMap, $tHitTest, $pMemory, $iHitTest)
  575. $bResult = _SendMessage($hWnd, $TTM_HITTESTW, 0, $pMemory, 0, "wparam", "ptr")
  576. _MemRead($tMemMap, $pMemory, $tHitTest, $iHitTest)
  577. _MemFree($tMemMap)
  578. EndIf
  579. DllStructSetData($tToolInfo, "Size", DllStructGetData($tHitTest, "Size"))
  580. DllStructSetData($tToolInfo, "Flags", DllStructGetData($tHitTest, "Flags"))
  581. DllStructSetData($tToolInfo, "hWnd", DllStructGetData($tHitTest, "hWnd"))
  582. DllStructSetData($tToolInfo, "ID", DllStructGetData($tHitTest, "ID"))
  583. DllStructSetData($tToolInfo, "Left", DllStructGetData($tHitTest, "Left"))
  584. DllStructSetData($tToolInfo, "Top", DllStructGetData($tHitTest, "Top"))
  585. DllStructSetData($tToolInfo, "Right", DllStructGetData($tHitTest, "Right"))
  586. DllStructSetData($tToolInfo, "Bottom", DllStructGetData($tHitTest, "Bottom"))
  587. DllStructSetData($tToolInfo, "hInst", DllStructGetData($tHitTest, "hInst"))
  588. DllStructSetData($tToolInfo, "Param", DllStructGetData($tHitTest, "Param"))
  589. Return _GUIToolTip_ToolToArray($hWnd, $tToolInfo, $bResult = True)
  590. EndFunc ;==>_GUIToolTip_HitTest
  591. ; #FUNCTION# ====================================================================================================================
  592. ; Author ........: Paul Campbell (PaulIA)
  593. ; Modified.......:
  594. ; ===============================================================================================================================
  595. Func _GUIToolTip_NewToolRect($hWnd, $hTool, $iID, $iLeft, $iTop, $iRight, $iBottom)
  596. Local $tToolInfo = DllStructCreate($tagTOOLINFO)
  597. Local $iToolInfo = DllStructGetSize($tToolInfo)
  598. DllStructSetData($tToolInfo, "Size", $iToolInfo)
  599. DllStructSetData($tToolInfo, "hwnd", $hTool)
  600. DllStructSetData($tToolInfo, "ID", $iID)
  601. DllStructSetData($tToolInfo, "Left", $iLeft)
  602. DllStructSetData($tToolInfo, "Top", $iTop)
  603. DllStructSetData($tToolInfo, "Right", $iRight)
  604. DllStructSetData($tToolInfo, "Bottom", $iBottom)
  605. If _WinAPI_InProcess($hWnd, $__g_hTTLastWnd) Then
  606. _SendMessage($hWnd, $TTM_NEWTOOLRECTW, 0, $tToolInfo, 0, "wparam", "struct*")
  607. Else
  608. Local $tMemMap
  609. Local $pMemory = _MemInit($hWnd, $iToolInfo, $tMemMap)
  610. _MemWrite($tMemMap, $tToolInfo)
  611. _SendMessage($hWnd, $TTM_NEWTOOLRECTW, 0, $pMemory, 0, "wparam", "ptr")
  612. _MemFree($tMemMap)
  613. EndIf
  614. EndFunc ;==>_GUIToolTip_NewToolRect
  615. ; #FUNCTION# ====================================================================================================================
  616. ; Author ........: Paul Campbell (PaulIA)
  617. ; Modified.......:
  618. ; ===============================================================================================================================
  619. Func _GUIToolTip_Pop($hWnd)
  620. _SendMessage($hWnd, $TTM_POP)
  621. EndFunc ;==>_GUIToolTip_Pop
  622. ; #FUNCTION# ====================================================================================================================
  623. ; Author ........: Paul Campbell (PaulIA)
  624. ; Modified.......:
  625. ; ===============================================================================================================================
  626. Func _GUIToolTip_PopUp($hWnd)
  627. _SendMessage($hWnd, $TTM_POPUP)
  628. EndFunc ;==>_GUIToolTip_PopUp
  629. ; #FUNCTION# ====================================================================================================================
  630. ; Author ........: Paul Campbell (PaulIA)
  631. ; Modified.......:
  632. ; ===============================================================================================================================
  633. Func _GUIToolTip_SetDelayTime($hWnd, $iDuration, $iTime)
  634. _SendMessage($hWnd, $TTM_SETDELAYTIME, $iDuration, $iTime)
  635. EndFunc ;==>_GUIToolTip_SetDelayTime
  636. ; #FUNCTION# ====================================================================================================================
  637. ; Author ........: Paul Campbell (PaulIA)
  638. ; Modified.......:
  639. ; ===============================================================================================================================
  640. Func _GUIToolTip_SetMargin($hWnd, $iLeft, $iTop, $iRight, $iBottom)
  641. Local $tRECT = DllStructCreate($tagRECT)
  642. DllStructSetData($tRECT, "Left", $iLeft)
  643. DllStructSetData($tRECT, "Top", $iTop)
  644. DllStructSetData($tRECT, "Right", $iRight)
  645. DllStructSetData($tRECT, "Bottom", $iBottom)
  646. If _WinAPI_InProcess($hWnd, $__g_hTTLastWnd) Then
  647. _SendMessage($hWnd, $TTM_SETMARGIN, 0, $tRECT, 0, "wparam", "struct*")
  648. Else
  649. Local $iRect = DllStructGetSize($tRECT)
  650. Local $tMemMap
  651. Local $pMemory = _MemInit($hWnd, $iRect, $tMemMap)
  652. _MemWrite($tMemMap, $tRECT)
  653. _SendMessage($hWnd, $TTM_SETMARGIN, 0, $pMemory, 0, "wparam", "ptr")
  654. _MemFree($tMemMap)
  655. EndIf
  656. EndFunc ;==>_GUIToolTip_SetMargin
  657. ; #FUNCTION# ====================================================================================================================
  658. ; Author ........: Paul Campbell (PaulIA)
  659. ; Modified.......:
  660. ; ===============================================================================================================================
  661. Func _GUIToolTip_SetMaxTipWidth($hWnd, $iWidth)
  662. Return _SendMessage($hWnd, $TTM_SETMAXTIPWIDTH, 0, $iWidth)
  663. EndFunc ;==>_GUIToolTip_SetMaxTipWidth
  664. ; #FUNCTION# ====================================================================================================================
  665. ; Author ........: Paul Campbell (PaulIA)
  666. ; Modified.......:
  667. ; ===============================================================================================================================
  668. Func _GUIToolTip_SetTipBkColor($hWnd, $iColor)
  669. _SendMessage($hWnd, $TTM_SETTIPBKCOLOR, $iColor)
  670. EndFunc ;==>_GUIToolTip_SetTipBkColor
  671. ; #FUNCTION# ====================================================================================================================
  672. ; Author ........: Paul Campbell (PaulIA)
  673. ; Modified.......:
  674. ; ===============================================================================================================================
  675. Func _GUIToolTip_SetTipTextColor($hWnd, $iColor)
  676. _SendMessage($hWnd, $TTM_SETTIPTEXTCOLOR, $iColor)
  677. EndFunc ;==>_GUIToolTip_SetTipTextColor
  678. ; #FUNCTION# ====================================================================================================================
  679. ; Author ........: Paul Campbell (PaulIA)
  680. ; Modified.......:
  681. ; ===============================================================================================================================
  682. Func _GUIToolTip_SetTitle($hWnd, $sTitle, $iIcon = 0)
  683. Local $iBuffer = StringLen($sTitle) + 1
  684. Local $tBuffer = DllStructCreate("wchar Text[" & $iBuffer & "]")
  685. $iBuffer *= 2
  686. DllStructSetData($tBuffer, "Text", $sTitle)
  687. Local $iRet
  688. If _WinAPI_InProcess($hWnd, $__g_hTTLastWnd) Then
  689. $iRet = _SendMessage($hWnd, $TTM_SETTITLEW, $iIcon, $tBuffer, 0, "wparam", "struct*")
  690. Else
  691. Local $tMemMap
  692. Local $pMemory = _MemInit($hWnd, $iBuffer, $tMemMap)
  693. _MemWrite($tMemMap, $tBuffer)
  694. $iRet = _SendMessage($hWnd, $TTM_SETTITLEW, $iIcon, $pMemory, 0, "wparam", "ptr")
  695. _MemFree($tMemMap)
  696. EndIf
  697. Return $iRet <> 0
  698. EndFunc ;==>_GUIToolTip_SetTitle
  699. ; #FUNCTION# ====================================================================================================================
  700. ; Author ........: Paul Campbell (PaulIA)
  701. ; Modified.......:
  702. ; ===============================================================================================================================
  703. Func _GUIToolTip_SetToolInfo($hWnd, $sText, $iID = 0, $iLeft = 0, $iTop = 0, $iRight = 0, $iBottom = 0, $iFlags = Default, $iParam = 0)
  704. If $iFlags = Default Then $iFlags = BitOR($TTF_SUBCLASS, $TTF_IDISHWND)
  705. Local $tBuffer = DllStructCreate("wchar Text[4096]")
  706. Local $tToolInfo = DllStructCreate($tagTOOLINFO)
  707. Local $iToolInfo = DllStructGetSize($tToolInfo)
  708. DllStructSetData($tBuffer, "Text", $sText)
  709. DllStructSetData($tToolInfo, "Size", $iToolInfo)
  710. DllStructSetData($tToolInfo, "Flags", $iFlags)
  711. DllStructSetData($tToolInfo, "hWnd", $hWnd)
  712. DllStructSetData($tToolInfo, "ID", $iID)
  713. DllStructSetData($tToolInfo, "Left", $iLeft)
  714. DllStructSetData($tToolInfo, "Top", $iTop)
  715. DllStructSetData($tToolInfo, "Right", $iRight)
  716. DllStructSetData($tToolInfo, "Bottom", $iBottom)
  717. DllStructSetData($tToolInfo, "Param", $iParam)
  718. If _WinAPI_InProcess($hWnd, $__g_hTTLastWnd) Then
  719. DllStructSetData($tToolInfo, "Text", DllStructGetPtr($tBuffer))
  720. _SendMessage($hWnd, $TTM_SETTOOLINFOW, 0, $tToolInfo, 0, "wparam", "struct*")
  721. Else
  722. Local $tMemMap
  723. Local $pMemory = _MemInit($hWnd, $iToolInfo + 4096, $tMemMap)
  724. Local $pText = $pMemory + $iToolInfo
  725. DllStructSetData($tToolInfo, "Text", $pText)
  726. _MemWrite($tMemMap, $tToolInfo, $pMemory, $iToolInfo)
  727. _MemWrite($tMemMap, $pText, $tBuffer, 4096)
  728. _SendMessage($hWnd, $TTM_SETTOOLINFOW, 0, $pMemory, 0, "wparam", "ptr")
  729. _MemFree($tMemMap)
  730. EndIf
  731. EndFunc ;==>_GUIToolTip_SetToolInfo
  732. ; #FUNCTION# ====================================================================================================================
  733. ; Author ........: Paul Campbell (PaulIA)
  734. ; Modified.......:
  735. ; ===============================================================================================================================
  736. Func _GUIToolTip_SetWindowTheme($hWnd, $sStyle)
  737. Local $tBuffer = _WinAPI_MultiByteToWideChar($sStyle)
  738. If _WinAPI_InProcess($hWnd, $__g_hTTLastWnd) Then
  739. _SendMessage($hWnd, $TTM_SETWINDOWTHEME, 0, $tBuffer, 0, "wparam", "struct*")
  740. Else
  741. Local $tMemMap
  742. Local $pMemory = _MemInit($hWnd, 4096, $tMemMap)
  743. _MemWrite($tMemMap, $tBuffer)
  744. _SendMessage($hWnd, $TTM_SETWINDOWTHEME, 0, $pMemory, 0, "wparam", "ptr")
  745. _MemFree($tMemMap)
  746. EndIf
  747. EndFunc ;==>_GUIToolTip_SetWindowTheme
  748. ; #FUNCTION# ====================================================================================================================
  749. ; Author ........: Paul Campbell (PaulIA)
  750. ; Modified.......:
  751. ; ===============================================================================================================================
  752. Func _GUIToolTip_ToolExists($hWnd)
  753. Return _SendMessage($hWnd, $TTM_GETCURRENTTOOL) <> 0
  754. EndFunc ;==>_GUIToolTip_ToolExists
  755. ; #FUNCTION# ====================================================================================================================
  756. ; Author ........: Paul Campbell (PaulIA)
  757. ; Modified.......:
  758. ; ===============================================================================================================================
  759. Func _GUIToolTip_ToolToArray($hWnd, ByRef $tToolInfo, $iError)
  760. Local $aTool[10]
  761. $aTool[0] = DllStructGetData($tToolInfo, "Flags")
  762. $aTool[1] = DllStructGetData($tToolInfo, "hWnd")
  763. $aTool[2] = DllStructGetData($tToolInfo, "ID")
  764. $aTool[3] = DllStructGetData($tToolInfo, "Left")
  765. $aTool[4] = DllStructGetData($tToolInfo, "Top")
  766. $aTool[5] = DllStructGetData($tToolInfo, "Right")
  767. $aTool[6] = DllStructGetData($tToolInfo, "Bottom")
  768. $aTool[7] = DllStructGetData($tToolInfo, "hInst")
  769. $aTool[8] = _GUIToolTip_GetText($hWnd, $aTool[1], $aTool[2])
  770. $aTool[9] = DllStructGetData($tToolInfo, "Param")
  771. Return SetError($iError, 0, $aTool)
  772. EndFunc ;==>_GUIToolTip_ToolToArray
  773. ; #FUNCTION# ====================================================================================================================
  774. ; Author ........: Paul Campbell (PaulIA)
  775. ; Modified.......:
  776. ; ===============================================================================================================================
  777. Func _GUIToolTip_TrackActivate($hWnd, $bActivate = True, $hTool = 0, $iID = 0)
  778. Local $tToolInfo = DllStructCreate($tagTOOLINFO)
  779. Local $iToolInfo = DllStructGetSize($tToolInfo)
  780. DllStructSetData($tToolInfo, "Size", $iToolInfo)
  781. DllStructSetData($tToolInfo, "hWnd", $hTool)
  782. DllStructSetData($tToolInfo, "ID", $iID)
  783. If _WinAPI_InProcess($hWnd, $__g_hTTLastWnd) Then
  784. _SendMessage($hWnd, $TTM_TRACKACTIVATE, $bActivate, $tToolInfo, 0, "wparam", "struct*")
  785. Else
  786. $iToolInfo = DllStructGetSize($tToolInfo)
  787. Local $tMemMap
  788. Local $pMemory = _MemInit($hWnd, $iToolInfo, $tMemMap)
  789. _MemWrite($tMemMap, $tToolInfo)
  790. _SendMessage($hWnd, $TTM_TRACKACTIVATE, $bActivate, $pMemory, 0, "wparam", "ptr")
  791. _MemFree($tMemMap)
  792. EndIf
  793. EndFunc ;==>_GUIToolTip_TrackActivate
  794. ; #FUNCTION# ====================================================================================================================
  795. ; Author ........: Paul Campbell (PaulIA)
  796. ; Modified.......:
  797. ; ===============================================================================================================================
  798. Func _GUIToolTip_TrackPosition($hWnd, $iX, $iY)
  799. _SendMessage($hWnd, $TTM_TRACKPOSITION, 0, _WinAPI_MakeLong($iX, $iY))
  800. EndFunc ;==>_GUIToolTip_TrackPosition
  801. ; #FUNCTION# ====================================================================================================================
  802. ; Author ........: Paul Campbell (PaulIA)
  803. ; Modified.......:
  804. ; ===============================================================================================================================
  805. Func _GUIToolTip_Update($hWnd)
  806. _SendMessage($hWnd, $TTM_UPDATE)
  807. EndFunc ;==>_GUIToolTip_Update
  808. ; #FUNCTION# ====================================================================================================================
  809. ; Author ........: Paul Campbell (PaulIA)
  810. ; Modified.......:
  811. ; ===============================================================================================================================
  812. Func _GUIToolTip_UpdateTipText($hWnd, $hTool, $iID, $sText)
  813. Local $iBuffer = StringLen($sText) + 1
  814. Local $tBuffer = DllStructCreate("wchar Text[" & $iBuffer & "]")
  815. $iBuffer *= 2
  816. Local $tToolInfo = DllStructCreate($tagTOOLINFO)
  817. Local $iToolInfo = DllStructGetSize($tToolInfo)
  818. DllStructSetData($tBuffer, "Text", $sText)
  819. DllStructSetData($tToolInfo, "Size", $iToolInfo)
  820. DllStructSetData($tToolInfo, "hWnd", $hTool)
  821. DllStructSetData($tToolInfo, "ID", $iID)
  822. If _WinAPI_InProcess($hWnd, $__g_hTTLastWnd) Then
  823. DllStructSetData($tToolInfo, "Text", DllStructGetPtr($tBuffer))
  824. _SendMessage($hWnd, $TTM_UPDATETIPTEXTW, 0, $tToolInfo, 0, "wparam", "struct*")
  825. Else
  826. Local $tMemMap
  827. Local $pMemory = _MemInit($hWnd, $iToolInfo + $iBuffer, $tMemMap)
  828. Local $pText = $pMemory + $iToolInfo
  829. DllStructSetData($tToolInfo, "Text", $pText)
  830. _MemWrite($tMemMap, $tToolInfo, $pMemory, $iToolInfo)
  831. _MemWrite($tMemMap, $tBuffer, $pText, $iBuffer)
  832. _SendMessage($hWnd, $TTM_UPDATETIPTEXTW, 0, $pMemory, 0, "wparam", "ptr")
  833. _MemFree($tMemMap)
  834. EndIf
  835. EndFunc ;==>_GUIToolTip_UpdateTipText