GuiImageList.au3 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549
  1. #include-once
  2. #include "ColorConstants.au3"
  3. #include "ImageListConstants.au3"
  4. #include "StructureConstants.au3"
  5. #include "WinAPIConstants.au3"
  6. #include "WinAPIConv.au3"
  7. #include "WinAPIError.au3"
  8. ;~ #include "WinAPIGdi.au3"
  9. #include "WinAPIIcons.au3"
  10. #include "WinAPIRes.au3"
  11. ; #INDEX# =======================================================================================================================
  12. ; Title .........: ImageList
  13. ; AutoIt Version : 3.3.14.5
  14. ; Description ...: Functions that assist with ImageList control management.
  15. ; An image list is a collection of images of the same size, each of which can be referred to by its index. Image
  16. ; lists are used to efficiently manage large sets of icons or bitmaps. All images in an image list are contained
  17. ; in a single, wide bitmap in screen device format. An image list can also include a monochrome bitmap that
  18. ; contains masks used to draw images transparently (icon style).
  19. ; Author(s)......: Paul Campbell (PaulIA)
  20. ; ===============================================================================================================================
  21. ; #CONSTANTS# ===================================================================================================================
  22. Global Const $__IMAGELISTCONSTANT_IMAGE_BITMAP = 0
  23. ; ===============================================================================================================================
  24. ; #NO_DOC_FUNCTION# =============================================================================================================
  25. ; Not documented at this time
  26. ;
  27. ; _GUIImageList_DragShowNolock
  28. ; _GUIImageList_Merge
  29. ; _GUIImageList_Replace
  30. ; _GUIImageList_SetDragCursorImage
  31. ; _GUIImageList_SetOverlayImage
  32. ; ===============================================================================================================================
  33. ; #CURRENT# =====================================================================================================================
  34. ; _GUIImageList_Add
  35. ; _GUIImageList_AddMasked
  36. ; _GUIImageList_AddBitmap
  37. ; _GUIImageList_AddIcon
  38. ; _GUIImageList_BeginDrag
  39. ; _GUIImageList_Copy
  40. ; _GUIImageList_Create
  41. ; _GUIImageList_Destroy
  42. ; _GUIImageList_DestroyIcon
  43. ; _GUIImageList_DragEnter
  44. ; _GUIImageList_DragLeave
  45. ; _GUIImageList_DragMove
  46. ; _GUIImageList_Draw
  47. ; _GUIImageList_DrawEx
  48. ; _GUIImageList_Duplicate
  49. ; _GUIImageList_EndDrag
  50. ; _GUIImageList_GetBkColor
  51. ; _GUIImageList_GetIcon
  52. ; _GUIImageList_GetIconHeight
  53. ; _GUIImageList_GetIconSize
  54. ; _GUIImageList_GetIconSizeEx
  55. ; _GUIImageList_GetIconWidth
  56. ; _GUIImageList_GetImageCount
  57. ; _GUIImageList_GetImageInfoEx
  58. ; _GUIImageList_Remove
  59. ; _GUIImageList_ReplaceIcon
  60. ; _GUIImageList_SetBkColor
  61. ; _GUIImageList_SetIconSize
  62. ; _GUIImageList_SetImageCount
  63. ; _GUIImageList_Swap
  64. ; ===============================================================================================================================
  65. ; #FUNCTION# ====================================================================================================================
  66. ; Author ........: Paul Campbell (PaulIA)
  67. ; Modified.......:
  68. ; ===============================================================================================================================
  69. Func _GUIImageList_Add($hWnd, $hImage, $hMask = 0)
  70. Local $aResult = DllCall("comctl32.dll", "int", "ImageList_Add", "handle", $hWnd, "handle", $hImage, "handle", $hMask)
  71. If @error Then Return SetError(@error, @extended, -1)
  72. Return $aResult[0]
  73. EndFunc ;==>_GUIImageList_Add
  74. ; #FUNCTION# ====================================================================================================================
  75. ; Author ........: Paul Campbell (PaulIA)
  76. ; Modified.......:
  77. ; ===============================================================================================================================
  78. Func _GUIImageList_AddMasked($hWnd, $hImage, $iMask = 0)
  79. Local $aResult = DllCall("comctl32.dll", "int", "ImageList_AddMasked", "handle", $hWnd, "handle", $hImage, "dword", $iMask)
  80. If @error Then Return SetError(@error, @extended, -1)
  81. Return $aResult[0]
  82. EndFunc ;==>_GUIImageList_AddMasked
  83. ; #FUNCTION# ====================================================================================================================
  84. ; Author ........: Paul Campbell (PaulIA)
  85. ; Modified.......:
  86. ; ===============================================================================================================================
  87. Func _GUIImageList_AddBitmap($hWnd, $sImage, $sMask = "")
  88. Local $aSize = _GUIImageList_GetIconSize($hWnd)
  89. Local $hImage = _WinAPI_LoadImage(0, $sImage, $__IMAGELISTCONSTANT_IMAGE_BITMAP, $aSize[0], $aSize[1], $LR_LOADFROMFILE)
  90. If $hImage = 0 Then Return SetError(_WinAPI_GetLastError(), 1, -1)
  91. Local $hMask = 0
  92. If $sMask <> "" Then
  93. $hMask = _WinAPI_LoadImage(0, $sMask, $__IMAGELISTCONSTANT_IMAGE_BITMAP, $aSize[0], $aSize[1], $LR_LOADFROMFILE)
  94. If $hMask = 0 Then Return SetError(_WinAPI_GetLastError(), 2, -1)
  95. EndIf
  96. Local $iRet = _GUIImageList_Add($hWnd, $hImage, $hMask)
  97. _WinAPI_DeleteObject($hImage)
  98. If $hMask <> 0 Then _WinAPI_DeleteObject($hMask)
  99. Return $iRet
  100. EndFunc ;==>_GUIImageList_AddBitmap
  101. ; #FUNCTION# ====================================================================================================================
  102. ; Author ........: Paul Campbell (PaulIA)
  103. ; Modified.......:
  104. ; ===============================================================================================================================
  105. Func _GUIImageList_AddIcon($hWnd, $sFilePath, $iIndex = 0, $bLarge = False)
  106. Local $iRet, $tIcon = DllStructCreate("handle Handle")
  107. If $bLarge Then
  108. $iRet = _WinAPI_ExtractIconEx($sFilePath, $iIndex, $tIcon, 0, 1)
  109. Else
  110. $iRet = _WinAPI_ExtractIconEx($sFilePath, $iIndex, 0, $tIcon, 1)
  111. EndIf
  112. If $iRet <= 0 Then Return SetError(-1, $iRet, -1)
  113. Local $hIcon = DllStructGetData($tIcon, "Handle")
  114. $iRet = _GUIImageList_ReplaceIcon($hWnd, -1, $hIcon)
  115. _WinAPI_DestroyIcon($hIcon)
  116. If $iRet = -1 Then Return SetError(-2, $iRet, -1)
  117. Return $iRet
  118. EndFunc ;==>_GUIImageList_AddIcon
  119. ; #FUNCTION# ====================================================================================================================
  120. ; Author ........: Paul Campbell (PaulIA)
  121. ; Modified.......:
  122. ; ===============================================================================================================================
  123. Func _GUIImageList_BeginDrag($hWnd, $iTrack, $iXHotSpot, $iYHotSpot)
  124. Local $aResult = DllCall("comctl32.dll", "bool", "ImageList_BeginDrag", "handle", $hWnd, "int", $iTrack, "int", $iXHotSpot, "int", $iYHotSpot)
  125. If @error Then Return SetError(@error, @extended, False)
  126. Return $aResult[0] <> 0
  127. EndFunc ;==>_GUIImageList_BeginDrag
  128. ; #FUNCTION# ====================================================================================================================
  129. ; Author ........: Gary Frost (gafrost)
  130. ; Modified.......:
  131. ; ===============================================================================================================================
  132. Func _GUIImageList_Copy($hWnd, $iSource, $iDestination)
  133. Local $aResult = DllCall("comctl32.dll", "bool", "ImageList_Copy", "handle", $hWnd, "int", $iDestination, "handle", $hWnd, "int", $iSource, "uint", $ILCF_MOVE)
  134. If @error Then Return SetError(@error, @extended, False)
  135. Return $aResult[0] <> 0
  136. EndFunc ;==>_GUIImageList_Copy
  137. ; #FUNCTION# ====================================================================================================================
  138. ; Author ........: Paul Campbell (PaulIA)
  139. ; Modified.......:
  140. ; ===============================================================================================================================
  141. Func _GUIImageList_Create($iCX = 16, $iCY = 16, $iColor = 4, $iOptions = 0, $iInitial = 4, $iGrow = 4)
  142. Local Const $aColor[7] = [$ILC_COLOR, $ILC_COLOR4, $ILC_COLOR8, $ILC_COLOR16, $ILC_COLOR24, $ILC_COLOR32, $ILC_COLORDDB]
  143. Local $iFlags = 0
  144. If BitAND($iOptions, 1) <> 0 Then $iFlags = BitOR($iFlags, $ILC_MASK)
  145. If BitAND($iOptions, 2) <> 0 Then $iFlags = BitOR($iFlags, $ILC_MIRROR)
  146. If BitAND($iOptions, 4) <> 0 Then $iFlags = BitOR($iFlags, $ILC_PERITEMMIRROR)
  147. $iFlags = BitOR($iFlags, $aColor[$iColor])
  148. Local $aResult = DllCall("comctl32.dll", "handle", "ImageList_Create", "int", $iCX, "int", $iCY, "uint", $iFlags, "int", $iInitial, "int", $iGrow)
  149. If @error Then Return SetError(@error, @extended, 0)
  150. Return $aResult[0]
  151. EndFunc ;==>_GUIImageList_Create
  152. ; #FUNCTION# ====================================================================================================================
  153. ; Author ........: Paul Campbell (PaulIA)
  154. ; Modified.......:
  155. ; ===============================================================================================================================
  156. Func _GUIImageList_Destroy($hWnd)
  157. Local $aResult = DllCall("comctl32.dll", "bool", "ImageList_Destroy", "handle", $hWnd)
  158. If @error Then Return SetError(@error, @extended, False)
  159. Return $aResult[0] <> 0
  160. EndFunc ;==>_GUIImageList_Destroy
  161. ; #FUNCTION# ====================================================================================================================
  162. ; Author ........: Gary Frost (gafrost)
  163. ; Modified.......:
  164. ; ===============================================================================================================================
  165. Func _GUIImageList_DestroyIcon($hIcon)
  166. Return _WinAPI_DestroyIcon($hIcon)
  167. EndFunc ;==>_GUIImageList_DestroyIcon
  168. ; #FUNCTION# ====================================================================================================================
  169. ; Author ........: Gary Frost (gafrost)
  170. ; Modified.......:
  171. ; ===============================================================================================================================
  172. Func _GUIImageList_DragEnter($hWnd, $iX, $iY)
  173. Local $aResult = DllCall("comctl32.dll", "bool", "ImageList_DragEnter", "hwnd", $hWnd, "int", $iX, "int", $iY)
  174. If @error Then Return SetError(@error, @extended, False)
  175. Return $aResult[0] <> 0
  176. EndFunc ;==>_GUIImageList_DragEnter
  177. ; #FUNCTION# ====================================================================================================================
  178. ; Author ........: Gary Frost (gafrost)
  179. ; Modified.......:
  180. ; ===============================================================================================================================
  181. Func _GUIImageList_DragLeave($hWnd)
  182. Local $aResult = DllCall("comctl32.dll", "bool", "ImageList_DragLeave", "hwnd", $hWnd)
  183. If @error Then Return SetError(@error, @extended, False)
  184. Return $aResult[0] <> 0
  185. EndFunc ;==>_GUIImageList_DragLeave
  186. ; #FUNCTION# ====================================================================================================================
  187. ; Author ........: Gary Frost (gafrost)
  188. ; Modified.......:
  189. ; ===============================================================================================================================
  190. Func _GUIImageList_DragMove($iX, $iY)
  191. Local $aResult = DllCall("comctl32.dll", "bool", "ImageList_DragMove", "int", $iX, "int", $iY)
  192. If @error Then Return SetError(@error, @extended, False)
  193. Return $aResult[0] <> 0
  194. EndFunc ;==>_GUIImageList_DragMove
  195. ; #NO_DOC_FUNCTION# =============================================================================================================
  196. ; Name...........: _GUIImageList_DragShowNolock
  197. ; Description ...: Shows or hides the image being dragged
  198. ; Syntax.........: _GUIImageList_DragShowNolock ( $bShow )
  199. ; Parameters ....: $bShow - Show or hide the image being dragged
  200. ; | True - Show
  201. ; |False - Hide
  202. ; Return values .: Success - True
  203. ; Failure - False
  204. ; Author ........: Gary Frost (gafrost)
  205. ; Modified.......:
  206. ; Remarks .......:
  207. ; Related .......:
  208. ; Link ..........:
  209. ; Example .......:
  210. ; ===============================================================================================================================
  211. Func _GUIImageList_DragShowNolock($bShow)
  212. Local $aResult = DllCall("comctl32.dll", "bool", "ImageList_DragShowNolock", "bool", $bShow)
  213. If @error Then Return SetError(@error, @extended, False)
  214. Return $aResult[0] <> 0
  215. EndFunc ;==>_GUIImageList_DragShowNolock
  216. ; #FUNCTION# ====================================================================================================================
  217. ; Author ........: Paul Campbell (PaulIA)
  218. ; Modified.......:
  219. ; ===============================================================================================================================
  220. Func _GUIImageList_Draw($hWnd, $iIndex, $hDC, $iX, $iY, $iStyle = 0)
  221. Local $iFlags = 0
  222. If BitAND($iStyle, 1) <> 0 Then $iFlags = BitOR($iFlags, $ILD_TRANSPARENT)
  223. If BitAND($iStyle, 2) <> 0 Then $iFlags = BitOR($iFlags, $ILD_BLEND25)
  224. If BitAND($iStyle, 4) <> 0 Then $iFlags = BitOR($iFlags, $ILD_BLEND50)
  225. If BitAND($iStyle, 8) <> 0 Then $iFlags = BitOR($iFlags, $ILD_MASK)
  226. Local $aResult = DllCall("comctl32.dll", "bool", "ImageList_Draw", "handle", $hWnd, "int", $iIndex, "handle", $hDC, "int", $iX, "int", $iY, "uint", $iFlags)
  227. If @error Then Return SetError(@error, @extended, False)
  228. Return $aResult[0] <> 0
  229. EndFunc ;==>_GUIImageList_Draw
  230. ; #FUNCTION# ====================================================================================================================
  231. ; Author ........: Gary Frost (gafrost)
  232. ; Modified.......:
  233. ; ===============================================================================================================================
  234. Func _GUIImageList_DrawEx($hWnd, $iIndex, $hDC, $iX, $iY, $iDX = 0, $iDY = 0, $iRGBBk = 0xFFFFFFFF, $iRGBFg = 0xFFFFFFFF, $iStyle = 0)
  235. If $iDX = -1 Then $iDX = 0
  236. If $iDY = -1 Then $iDY = 0
  237. If $iRGBBk = -1 Then $iRGBBk = 0xFFFFFFFF
  238. If $iRGBFg = -1 Then $iRGBFg = 0xFFFFFFFF
  239. Local $iFlags = 0
  240. If BitAND($iStyle, 1) <> 0 Then $iFlags = BitOR($iFlags, $ILD_TRANSPARENT)
  241. If BitAND($iStyle, 2) <> 0 Then $iFlags = BitOR($iFlags, $ILD_BLEND25)
  242. If BitAND($iStyle, 4) <> 0 Then $iFlags = BitOR($iFlags, $ILD_BLEND50)
  243. If BitAND($iStyle, 8) <> 0 Then $iFlags = BitOR($iFlags, $ILD_MASK)
  244. Local $aResult = DllCall("comctl32.dll", "bool", "ImageList_DrawEx", "handle", $hWnd, "int", $iIndex, "handle", $hDC, "int", $iX, "int", $iY, _
  245. "int", $iDX, "int", $iDY, "dword", $iRGBBk, "dword", $iRGBFg, "uint", $iFlags)
  246. If @error Then Return SetError(@error, @extended, False)
  247. Return $aResult[0] <> 0
  248. EndFunc ;==>_GUIImageList_DrawEx
  249. ; #FUNCTION# ====================================================================================================================
  250. ; Author ........: Gary Frost (gafrost)
  251. ; Modified.......:
  252. ; ===============================================================================================================================
  253. Func _GUIImageList_Duplicate($hWnd)
  254. Local $aResult = DllCall("comctl32.dll", "handle", "ImageList_Duplicate", "handle", $hWnd)
  255. If @error Then Return SetError(@error, @extended, 0)
  256. Return $aResult[0]
  257. EndFunc ;==>_GUIImageList_Duplicate
  258. ; #FUNCTION# ====================================================================================================================
  259. ; Author ........: Paul Campbell (PaulIA)
  260. ; Modified.......:
  261. ; ===============================================================================================================================
  262. Func _GUIImageList_EndDrag()
  263. DllCall("comctl32.dll", "none", "ImageList_EndDrag")
  264. If @error Then Return SetError(@error, @extended)
  265. EndFunc ;==>_GUIImageList_EndDrag
  266. ; #FUNCTION# ====================================================================================================================
  267. ; Author ........: Gary Frost (gafrost)
  268. ; Modified.......:
  269. ; ===============================================================================================================================
  270. Func _GUIImageList_GetBkColor($hWnd)
  271. Local $aResult = DllCall("comctl32.dll", "dword", "ImageList_GetBkColor", "handle", $hWnd)
  272. If @error Then Return SetError(@error, @extended, 0)
  273. Return $aResult[0]
  274. EndFunc ;==>_GUIImageList_GetBkColor
  275. ; #FUNCTION# ====================================================================================================================
  276. ; Author ........: Gary Frost (gafrost)
  277. ; Modified.......:
  278. ; ===============================================================================================================================
  279. Func _GUIImageList_GetIcon($hWnd, $iIndex, $iStyle = 0)
  280. Local $iFlags = 0
  281. If BitAND($iStyle, 1) <> 0 Then $iFlags = BitOR($iFlags, $ILD_TRANSPARENT)
  282. If BitAND($iStyle, 2) <> 0 Then $iFlags = BitOR($iFlags, $ILD_BLEND25)
  283. If BitAND($iStyle, 4) <> 0 Then $iFlags = BitOR($iFlags, $ILD_BLEND50)
  284. If BitAND($iStyle, 8) <> 0 Then $iFlags = BitOR($iFlags, $ILD_MASK)
  285. Local $aResult = DllCall("comctl32.dll", "handle", "ImageList_GetIcon", "handle", $hWnd, "int", $iIndex, "uint", $iFlags)
  286. If @error Then Return SetError(@error, @extended, 0)
  287. Return $aResult[0]
  288. EndFunc ;==>_GUIImageList_GetIcon
  289. ; #FUNCTION# ====================================================================================================================
  290. ; Author ........: Paul Campbell (PaulIA)
  291. ; Modified.......:
  292. ; ===============================================================================================================================
  293. Func _GUIImageList_GetIconHeight($hWnd)
  294. Local $aSize = _GUIImageList_GetIconSize($hWnd)
  295. Return $aSize[1]
  296. EndFunc ;==>_GUIImageList_GetIconHeight
  297. ; #FUNCTION# ====================================================================================================================
  298. ; Author ........: Paul Campbell (PaulIA)
  299. ; Modified.......:
  300. ; ===============================================================================================================================
  301. Func _GUIImageList_GetIconSize($hWnd)
  302. Local $aSize[2]
  303. Local $tPoint = _GUIImageList_GetIconSizeEx($hWnd)
  304. $aSize[0] = DllStructGetData($tPoint, "X")
  305. $aSize[1] = DllStructGetData($tPoint, "Y")
  306. Return $aSize
  307. EndFunc ;==>_GUIImageList_GetIconSize
  308. ; #FUNCTION# ====================================================================================================================
  309. ; Author ........: Paul Campbell (PaulIA)
  310. ; Modified.......:
  311. ; ===============================================================================================================================
  312. Func _GUIImageList_GetIconSizeEx($hWnd)
  313. Local $tPoint = DllStructCreate($tagPOINT)
  314. Local $pPointX = DllStructGetPtr($tPoint, "X")
  315. Local $pPointY = DllStructGetPtr($tPoint, "Y")
  316. Local $aResult = DllCall("comctl32.dll", "bool", "ImageList_GetIconSize", "hwnd", $hWnd, "struct*", $pPointX, "struct*", $pPointY)
  317. If @error Then Return SetError(@error, @extended, 0)
  318. Return SetExtended($aResult[0], $tPoint)
  319. EndFunc ;==>_GUIImageList_GetIconSizeEx
  320. ; #FUNCTION# ====================================================================================================================
  321. ; Author ........: Paul Campbell (PaulIA)
  322. ; Modified.......:
  323. ; ===============================================================================================================================
  324. Func _GUIImageList_GetIconWidth($hWnd)
  325. Local $aSize = _GUIImageList_GetIconSize($hWnd)
  326. Return $aSize[0]
  327. EndFunc ;==>_GUIImageList_GetIconWidth
  328. ; #FUNCTION# ====================================================================================================================
  329. ; Author ........: Gary Frost (gafrost)
  330. ; Modified.......:
  331. ; ===============================================================================================================================
  332. Func _GUIImageList_GetImageCount($hWnd)
  333. Local $aResult = DllCall("comctl32.dll", "int", "ImageList_GetImageCount", "handle", $hWnd)
  334. If @error Then Return SetError(@error, @extended, 0)
  335. Return $aResult[0]
  336. EndFunc ;==>_GUIImageList_GetImageCount
  337. ; #FUNCTION# ====================================================================================================================
  338. ; Author ........: Paul Campbell (PaulIA)
  339. ; Modified.......:
  340. ; ===============================================================================================================================
  341. Func _GUIImageList_GetImageInfoEx($hWnd, $iIndex)
  342. Local $tImage = DllStructCreate($tagIMAGEINFO)
  343. Local $aResult = DllCall("comctl32.dll", "bool", "ImageList_GetImageInfo", "handle", $hWnd, "int", $iIndex, "struct*", $tImage)
  344. If @error Then Return SetError(@error, @extended, 0)
  345. Return SetExtended($aResult[0], $tImage)
  346. EndFunc ;==>_GUIImageList_GetImageInfoEx
  347. ; #NO_DOC_FUNCTION# =============================================================================================================
  348. ; Name...........: _GUIImageList_Merge
  349. ; Description ...: Creates a new image by combining two existing images
  350. ; Syntax.........: _GUIImageList_Merge ( $hWnd1, $iIndex1, $hWnd2, $iIndex2, $iDX, $IDY )
  351. ; Parameters ....: $hWnd1 - Handle to the 1st image control
  352. ; $iIndex1 - Zero based of the first existing image
  353. ; $hWnd2 - Handle to the 2nd image control
  354. ; $iIndex2 - Zero based of the second existing image
  355. ; $iDX - The x-offset of the second image relative to the first image
  356. ; $iDY - The y-offset of the second image relative to the first image
  357. ; Return values .: Success - The handle to the new image list
  358. ; Failure - 0
  359. ; Author ........: Gary Frost (gafrost)
  360. ; Modified.......:
  361. ; Remarks .......: The new image consists of the second existing image drawn transparently over the first.
  362. ; The mask for the new image is the result of performing a logical OR operation on the masks
  363. ; of the two existing images.
  364. ; Related .......:
  365. ; Link ..........:
  366. ; Example .......:
  367. ; ===============================================================================================================================
  368. Func _GUIImageList_Merge($hWnd1, $iIndex1, $hWnd2, $iIndex2, $iDX, $iDY)
  369. Local $aResult = DllCall("comctl32.dll", "handle", "ImageList_Merge", "handle", $hWnd1, "int", $iIndex1, _
  370. "handle", $hWnd2, "int", $iIndex2, "int", $iDX, "int", $iDY)
  371. If @error Then Return SetError(@error, @extended, 0)
  372. Return $aResult[0]
  373. EndFunc ;==>_GUIImageList_Merge
  374. ; #FUNCTION# ====================================================================================================================
  375. ; Author ........: Gary Frost (gafrost)
  376. ; Modified.......:
  377. ; ===============================================================================================================================
  378. Func _GUIImageList_Remove($hWnd, $iIndex = -1)
  379. Local $aResult = DllCall("comctl32.dll", "bool", "ImageList_Remove", "handle", $hWnd, "int", $iIndex)
  380. If @error Then Return SetError(@error, @extended, False)
  381. Return $aResult[0] <> 0
  382. EndFunc ;==>_GUIImageList_Remove
  383. ; #NO_DOC_FUNCTION# =============================================================================================================
  384. ; Name...........: _GUIImageList_Replace
  385. ; Description ...: Replaces an image with an icon or cursor
  386. ; Syntax.........: _GUIImageList_ReplaceIcon ( $hWnd, $iIndex, $hIcon )
  387. ; Parameters ....: $hWnd - Handle to the control
  388. ; $iIndex - Index of the image to replace.
  389. ; $hImage - Handle to the bitmap that contains the image
  390. ; $hMask - A handle to the bitmap that contains the mask.
  391. ; +If no mask is used with the image list, this parameter is ignored
  392. ; Return values .: Success - True
  393. ; Failure - False
  394. ; Author ........: Gary Frost (gafrost)
  395. ; Modified.......:
  396. ; Remarks .......: The _GUIImageList_Replace function copies the bitmap to an internal data structure.
  397. ; Be sure to use the _WinAPI_DeleteObject function to delete $hImage and $hMask after the function returns.
  398. ; Related .......:
  399. ; Link ..........:
  400. ; Example .......:
  401. ; ===============================================================================================================================
  402. Func _GUIImageList_Replace($hWnd, $iIndex, $hImage, $hMask = 0)
  403. Local $aResult = DllCall("comctl32.dll", "bool", "ImageList_Replace", "handle", $hWnd, "int", $iIndex, "handle", $hImage, "handle", $hMask)
  404. If @error Then Return SetError(@error, @extended, False)
  405. Return $aResult[0] <> 0
  406. EndFunc ;==>_GUIImageList_Replace
  407. ; #FUNCTION# ====================================================================================================================
  408. ; Author ........: Paul Campbell (PaulIA)
  409. ; Modified.......: Gary Frost (GaryFrost) changed return type from hwnd to int
  410. ; ===============================================================================================================================
  411. Func _GUIImageList_ReplaceIcon($hWnd, $iIndex, $hIcon)
  412. Local $aResult = DllCall("comctl32.dll", "int", "ImageList_ReplaceIcon", "handle", $hWnd, "int", $iIndex, "handle", $hIcon)
  413. If @error Then Return SetError(@error, @extended, -1)
  414. Return $aResult[0]
  415. EndFunc ;==>_GUIImageList_ReplaceIcon
  416. ; #FUNCTION# ====================================================================================================================
  417. ; Author ........: Gary Frost (gafrost)
  418. ; Modified.......:
  419. ; ===============================================================================================================================
  420. Func _GUIImageList_SetBkColor($hWnd, $iClrBk)
  421. Local $aResult = DllCall("comctl32.dll", "dword", "ImageList_SetBkColor", "handle", $hWnd, "dword", $iClrBk)
  422. If @error Then Return SetError(@error, @extended, $CLR_NONE)
  423. Return $aResult[0]
  424. EndFunc ;==>_GUIImageList_SetBkColor
  425. ; #NO_DOC_FUNCTION# =============================================================================================================
  426. ; Name...........: _GUIImageList_SetDragCursorImage
  427. ; Description ...: Creates a new drag image
  428. ; Syntax.........: _GUIImageList_SetDragCursorImage ( $hWnd, $iDrag, $iDXHotSpot, $iDYHotSpot )
  429. ; Parameters ....: $hWnd - A handle to the image list that contains the new image to combine with the drag image
  430. ; $iDrag - The index of the new image to combine with the drag image
  431. ; $iDXHotSpot - The x-position of the hot spot within the new image
  432. ; $iDYHotSpot - The y-position of the hot spot within the new image
  433. ; Return values .: Success - True
  434. ; Failure - False
  435. ; Author ........: Gary Frost (gafrost)
  436. ; Modified.......:
  437. ; Remarks .......: Creates a new drag image by combining the specified image (typically a mouse cursor image)
  438. ; with the current drag image
  439. ; Related .......:
  440. ; Link ..........:
  441. ; Example .......:
  442. ; ===============================================================================================================================
  443. Func _GUIImageList_SetDragCursorImage($hWnd, $iDrag, $iDXHotSpot, $iDYHotSpot)
  444. Local $aResult = DllCall("comctl32.dll", "bool", "ImageList_SetDragCursorImage", "handle", $hWnd, "int", $iDrag, "int", $iDXHotSpot, "int", $iDYHotSpot)
  445. If @error Then Return SetError(@error, @extended, False)
  446. Return $aResult[0] <> 0
  447. EndFunc ;==>_GUIImageList_SetDragCursorImage
  448. ; #FUNCTION# ====================================================================================================================
  449. ; Author ........: Gary Frost (gafrost)
  450. ; Modified.......:
  451. ; ===============================================================================================================================
  452. Func _GUIImageList_SetIconSize($hWnd, $iCX, $iCY)
  453. Local $aResult = DllCall("comctl32.dll", "bool", "ImageList_SetIconSize", "handle", $hWnd, "int", $iCX, "int", $iCY)
  454. If @error Then Return SetError(@error, @extended, False)
  455. Return $aResult[0] <> 0
  456. EndFunc ;==>_GUIImageList_SetIconSize
  457. ; #FUNCTION# ====================================================================================================================
  458. ; Author ........: Gary Frost (gafrost)
  459. ; Modified.......:
  460. ; ===============================================================================================================================
  461. Func _GUIImageList_SetImageCount($hWnd, $iNewCount)
  462. Local $aResult = DllCall("comctl32.dll", "bool", "ImageList_SetImageCount", "handle", $hWnd, "uint", $iNewCount)
  463. If @error Then Return SetError(@error, @extended, False)
  464. Return $aResult[0] <> 0
  465. EndFunc ;==>_GUIImageList_SetImageCount
  466. ; #NO_DOC_FUNCTION# =============================================================================================================
  467. ; Name...........: _GUIImageList_SetOverlayImage
  468. ; Description ...: Adds a specified image to the list of images to be used as overlay masks
  469. ; Syntax.........: _GUIImageList_SetOverlayImage ( $hWnd, $iImage, $iOverlay )
  470. ; Parameters ....: $hWnd - Handle to the control
  471. ; $iImage - The zero-based index of an image in the himl image list
  472. ; +This index identifies the image to use as an overlay mask
  473. ; $iOverlay - The one-based index of the overlay mask
  474. ; Return values .: Success - True
  475. ; Failure - False
  476. ; Author ........: Gary Frost (gafrost)
  477. ; Modified.......:
  478. ; Remarks .......: An image list can have up to four overlay masks in (comctl32.dll) version 4.70 and earlier
  479. ; and up to 15 in version 4.71. The function assigns an overlay mask index to the specified image.
  480. ; +
  481. ; An overlay mask is an image drawn transparently over another image.
  482. ; To draw an overlay mask over an image, call the _GUIImageList_Draw or _GUIImageList_DrawEx function.
  483. ; +
  484. ; A call to this method fails and returns $E_INVALIDARG unless the image list is created using a mask.
  485. ; Related .......:
  486. ; Link ..........:
  487. ; Example .......:
  488. ; ===============================================================================================================================
  489. Func _GUIImageList_SetOverlayImage($hWnd, $iImage, $iOverlay)
  490. Local $aResult = DllCall("comctl32.dll", "bool", "ImageList_SetOverlayImage", "handle", $hWnd, "int", $iImage, "int", $iOverlay)
  491. If @error Then Return SetError(@error, @extended, False)
  492. Return $aResult[0] <> 0
  493. EndFunc ;==>_GUIImageList_SetOverlayImage
  494. ; #FUNCTION# ====================================================================================================================
  495. ; Author ........: Gary Frost (gafrost)
  496. ; Modified.......:
  497. ; ===============================================================================================================================
  498. Func _GUIImageList_Swap($hWnd, $iSource, $iDestination)
  499. Local $aResult = DllCall("comctl32.dll", "bool", "ImageList_Copy", "handle", $hWnd, "int", $iDestination, "handle", $hWnd, "int", $iSource, "uint", $ILCF_SWAP)
  500. If @error Then Return SetError(@error, @extended, False)
  501. Return $aResult[0] <> 0
  502. EndFunc ;==>_GUIImageList_Swap