Advertisement
Guest User

Loader build 5.au3

a guest
Feb 17th, 2016
378
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 255.54 KB | None | 0 0
  1. #NoTrayIcon
  2. #RequireAdmin
  3. #Region
  4.     #AutoIt3Wrapper_Icon=..\A1a - Opus one\images\Logo.ico
  5.     #AutoIt3Wrapper_UseUpx=y
  6. #EndRegion
  7. Global Const $bs_groupbox = 7
  8. Global Const $bs_bottom = 2048
  9. Global Const $bs_center = 768
  10. Global Const $bs_defpushbutton = 1
  11. Global Const $bs_left = 256
  12. Global Const $bs_multiline = 8192
  13. Global Const $bs_pushbox = 10
  14. Global Const $bs_pushlike = 4096
  15. Global Const $bs_right = 512
  16. Global Const $bs_rightbutton = 32
  17. Global Const $bs_top = 1024
  18. Global Const $bs_vcenter = 3072
  19. Global Const $bs_flat = 32768
  20. Global Const $bs_icon = 64
  21. Global Const $bs_bitmap = 128
  22. Global Const $bs_notify = 16384
  23. Global Const $bs_splitbutton = 12
  24. Global Const $bs_defsplitbutton = 13
  25. Global Const $bs_commandlink = 14
  26. Global Const $bs_defcommandlink = 15
  27. Global Const $bcsif_glyph = 1
  28. Global Const $bcsif_image = 2
  29. Global Const $bcsif_style = 4
  30. Global Const $bcsif_size = 8
  31. Global Const $bcss_nosplit = 1
  32. Global Const $bcss_stretch = 2
  33. Global Const $bcss_alignleft = 4
  34. Global Const $bcss_image = 8
  35. Global Const $button_imagelist_align_left = 0
  36. Global Const $button_imagelist_align_right = 1
  37. Global Const $button_imagelist_align_top = 2
  38. Global Const $button_imagelist_align_bottom = 3
  39. Global Const $button_imagelist_align_center = 4
  40. Global Const $bs_3state = 5
  41. Global Const $bs_auto3state = 6
  42. Global Const $bs_autocheckbox = 3
  43. Global Const $bs_checkbox = 2
  44. Global Const $bs_radiobutton = 4
  45. Global Const $bs_autoradiobutton = 9
  46. Global Const $bs_ownerdraw = 11
  47. Global Const $gui_ss_default_button = 0
  48. Global Const $gui_ss_default_checkbox = 0
  49. Global Const $gui_ss_default_group = 0
  50. Global Const $gui_ss_default_radio = 0
  51. Global Const $bcm_first = 5632
  52. Global Const $bcm_getidealsize = ($bcm_first + 1)
  53. Global Const $bcm_getimagelist = ($bcm_first + 3)
  54. Global Const $bcm_getnote = ($bcm_first + 10)
  55. Global Const $bcm_getnotelength = ($bcm_first + 11)
  56. Global Const $bcm_getsplitinfo = ($bcm_first + 8)
  57. Global Const $bcm_gettextmargin = ($bcm_first + 5)
  58. Global Const $bcm_setdropdownstate = ($bcm_first + 6)
  59. Global Const $bcm_setimagelist = ($bcm_first + 2)
  60. Global Const $bcm_setnote = ($bcm_first + 9)
  61. Global Const $bcm_setshield = ($bcm_first + 12)
  62. Global Const $bcm_setsplitinfo = ($bcm_first + 7)
  63. Global Const $bcm_settextmargin = ($bcm_first + 4)
  64. Global Const $bm_click = 245
  65. Global Const $bm_getcheck = 240
  66. Global Const $bm_getimage = 246
  67. Global Const $bm_getstate = 242
  68. Global Const $bm_setcheck = 241
  69. Global Const $bm_setdontclick = 248
  70. Global Const $bm_setimage = 247
  71. Global Const $bm_setstate = 243
  72. Global Const $bm_setstyle = 244
  73. Global Const $bcn_first = -1250
  74. Global Const $bcn_dropdown = ($bcn_first + 2)
  75. Global Const $bcn_hotitemchange = ($bcn_first + 1)
  76. Global Const $bn_clicked = 0
  77. Global Const $bn_paint = 1
  78. Global Const $bn_hilite = 2
  79. Global Const $bn_unhilite = 3
  80. Global Const $bn_disable = 4
  81. Global Const $bn_doubleclicked = 5
  82. Global Const $bn_setfocus = 6
  83. Global Const $bn_killfocus = 7
  84. Global Const $bn_pushed = $bn_hilite
  85. Global Const $bn_unpushed = $bn_unhilite
  86. Global Const $bn_dblclk = $bn_doubleclicked
  87. Global Const $bst_checked = 1
  88. Global Const $bst_indeterminate = 2
  89. Global Const $bst_unchecked = 0
  90. Global Const $bst_focus = 8
  91. Global Const $bst_pushed = 4
  92. Global Const $bst_dontclick = 128
  93. Global Const $es_left = 0
  94. Global Const $es_center = 1
  95. Global Const $es_right = 2
  96. Global Const $es_multiline = 4
  97. Global Const $es_uppercase = 8
  98. Global Const $es_lowercase = 16
  99. Global Const $es_password = 32
  100. Global Const $es_autovscroll = 64
  101. Global Const $es_autohscroll = 128
  102. Global Const $es_nohidesel = 256
  103. Global Const $es_oemconvert = 1024
  104. Global Const $es_readonly = 2048
  105. Global Const $es_wantreturn = 4096
  106. Global Const $es_number = 8192
  107. Global Const $ec_err = -1
  108. Global Const $ecm_first = 5376
  109. Global Const $em_canundo = 198
  110. Global Const $em_charfrompos = 215
  111. Global Const $em_emptyundobuffer = 205
  112. Global Const $em_fmtlines = 200
  113. Global Const $em_getcuebanner = ($ecm_first + 2)
  114. Global Const $em_getfirstvisibleline = 206
  115. Global Const $em_gethandle = 189
  116. Global Const $em_getimestatus = 217
  117. Global Const $em_getlimittext = 213
  118. Global Const $em_getline = 196
  119. Global Const $em_getlinecount = 186
  120. Global Const $em_getmargins = 212
  121. Global Const $em_getmodify = 184
  122. Global Const $em_getpasswordchar = 210
  123. Global Const $em_getrect = 178
  124. Global Const $em_getsel = 176
  125. Global Const $em_getthumb = 190
  126. Global Const $em_getwordbreakproc = 209
  127. Global Const $em_hideballoontip = ($ecm_first + 4)
  128. Global Const $em_limittext = 197
  129. Global Const $em_linefromchar = 201
  130. Global Const $em_lineindex = 187
  131. Global Const $em_linelength = 193
  132. Global Const $em_linescroll = 182
  133. Global Const $em_posfromchar = 214
  134. Global Const $em_replacesel = 194
  135. Global Const $em_scroll = 181
  136. Global Const $em_scrollcaret = 183
  137. Global Const $em_setcuebanner = ($ecm_first + 1)
  138. Global Const $em_sethandle = 188
  139. Global Const $em_setimestatus = 216
  140. Global Const $em_setlimittext = $em_limittext
  141. Global Const $em_setmargins = 211
  142. Global Const $em_setmodify = 185
  143. Global Const $em_setpasswordchar = 204
  144. Global Const $em_setreadonly = 207
  145. Global Const $em_setrect = 179
  146. Global Const $em_setrectnp = 180
  147. Global Const $em_setsel = 177
  148. Global Const $em_settabstops = 203
  149. Global Const $em_setwordbreakproc = 208
  150. Global Const $em_showballoontip = ($ecm_first + 3)
  151. Global Const $em_undo = 199
  152. Global Const $ec_leftmargin = 1
  153. Global Const $ec_rightmargin = 2
  154. Global Const $ec_usefontinfo = 65535
  155. Global Const $emsis_compositionstring = 1
  156. Global Const $eimes_getcompstratonce = 1
  157. Global Const $eimes_cancelcompstrinfocus = 2
  158. Global Const $eimes_completecompstrkillfocus = 4
  159. Global Const $en_align_ltr_ec = 1792
  160. Global Const $en_align_rtl_ec = 1793
  161. Global Const $en_change = 768
  162. Global Const $en_errspace = 1280
  163. Global Const $en_hscroll = 1537
  164. Global Const $en_killfocus = 512
  165. Global Const $en_maxtext = 1281
  166. Global Const $en_setfocus = 256
  167. Global Const $en_update = 1024
  168. Global Const $en_vscroll = 1538
  169. Global Const $gui_ss_default_edit = 3150016
  170. Global Const $gui_ss_default_input = 128
  171. Global Const $gui_event_single = 0
  172. Global Const $gui_event_array = 1
  173. Global Const $gui_event_none = 0
  174. Global Const $gui_event_close = -3
  175. Global Const $gui_event_minimize = -4
  176. Global Const $gui_event_restore = -5
  177. Global Const $gui_event_maximize = -6
  178. Global Const $gui_event_primarydown = -7
  179. Global Const $gui_event_primaryup = -8
  180. Global Const $gui_event_secondarydown = -9
  181. Global Const $gui_event_secondaryup = -10
  182. Global Const $gui_event_mousemove = -11
  183. Global Const $gui_event_resized = -12
  184. Global Const $gui_event_dropped = -13
  185. Global Const $gui_rundefmsg = "GUI_RUNDEFMSG"
  186. Global Const $gui_avistop = 0
  187. Global Const $gui_avistart = 1
  188. Global Const $gui_aviclose = 2
  189. Global Const $gui_checked = 1
  190. Global Const $gui_indeterminate = 2
  191. Global Const $gui_unchecked = 4
  192. Global Const $gui_dropaccepted = 8
  193. Global Const $gui_nodropaccepted = 4096
  194. Global Const $gui_acceptfiles = $gui_dropaccepted
  195. Global Const $gui_show = 16
  196. Global Const $gui_hide = 32
  197. Global Const $gui_enable = 64
  198. Global Const $gui_disable = 128
  199. Global Const $gui_focus = 256
  200. Global Const $gui_nofocus = 8192
  201. Global Const $gui_defbutton = 512
  202. Global Const $gui_expand = 1024
  203. Global Const $gui_ontop = 2048
  204. Global Const $gui_fontnormal = 0
  205. Global Const $gui_fontitalic = 2
  206. Global Const $gui_fontunder = 4
  207. Global Const $gui_fontstrike = 8
  208. Global Const $gui_dockauto = 1
  209. Global Const $gui_dockleft = 2
  210. Global Const $gui_dockright = 4
  211. Global Const $gui_dockhcenter = 8
  212. Global Const $gui_docktop = 32
  213. Global Const $gui_dockbottom = 64
  214. Global Const $gui_dockvcenter = 128
  215. Global Const $gui_dockwidth = 256
  216. Global Const $gui_dockheight = 512
  217. Global Const $gui_docksize = 768
  218. Global Const $gui_dockmenubar = 544
  219. Global Const $gui_dockstatebar = 576
  220. Global Const $gui_dockall = 802
  221. Global Const $gui_dockborders = 102
  222. Global Const $gui_gr_close = 1
  223. Global Const $gui_gr_line = 2
  224. Global Const $gui_gr_bezier = 4
  225. Global Const $gui_gr_move = 6
  226. Global Const $gui_gr_color = 8
  227. Global Const $gui_gr_rect = 10
  228. Global Const $gui_gr_ellipse = 12
  229. Global Const $gui_gr_pie = 14
  230. Global Const $gui_gr_dot = 16
  231. Global Const $gui_gr_pixel = 18
  232. Global Const $gui_gr_hint = 20
  233. Global Const $gui_gr_refresh = 22
  234. Global Const $gui_gr_pensize = 24
  235. Global Const $gui_gr_nobkcolor = -2
  236. Global Const $gui_bkcolor_default = -1
  237. Global Const $gui_bkcolor_transparent = -2
  238. Global Const $gui_bkcolor_lv_alternate = -33554432
  239. Global Const $gui_read_default = 0
  240. Global Const $gui_read_extended = 1
  241. Global Const $gui_cursor_nooverride = 0
  242. Global Const $gui_cursor_override = 1
  243. Global Const $gui_ws_ex_parentdrag = 1048576
  244. Global Const $gmem_fixed = 0
  245. Global Const $gmem_moveable = 2
  246. Global Const $gmem_nocompact = 16
  247. Global Const $gmem_nodiscard = 32
  248. Global Const $gmem_zeroinit = 64
  249. Global Const $gmem_modify = 128
  250. Global Const $gmem_discardable = 256
  251. Global Const $gmem_not_banked = 4096
  252. Global Const $gmem_share = 8192
  253. Global Const $gmem_ddeshare = 8192
  254. Global Const $gmem_notify = 16384
  255. Global Const $gmem_lower = 4096
  256. Global Const $gmem_valid_flags = 32626
  257. Global Const $gmem_invalid_handle = 32768
  258. Global Const $gptr = BitOR($gmem_fixed, $gmem_zeroinit)
  259. Global Const $ghnd = BitOR($gmem_moveable, $gmem_zeroinit)
  260. Global Const $mem_commit = 4096
  261. Global Const $mem_reserve = 8192
  262. Global Const $mem_top_down = 1048576
  263. Global Const $mem_shared = 134217728
  264. Global Const $page_noaccess = 1
  265. Global Const $page_readonly = 2
  266. Global Const $page_readwrite = 4
  267. Global Const $page_execute = 16
  268. Global Const $page_execute_read = 32
  269. Global Const $page_execute_readwrite = 64
  270. Global Const $page_execute_writecopy = 128
  271. Global Const $page_guard = 256
  272. Global Const $page_nocache = 512
  273. Global Const $page_writecombine = 1024
  274. Global Const $page_writecopy = 8
  275. Global Const $mem_decommit = 16384
  276. Global Const $mem_release = 32768
  277. Global Const $process_terminate = 1
  278. Global Const $process_create_thread = 2
  279. Global Const $process_set_sessionid = 4
  280. Global Const $process_vm_operation = 8
  281. Global Const $process_vm_read = 16
  282. Global Const $process_vm_write = 32
  283. Global Const $process_dup_handle = 64
  284. Global Const $process_create_process = 128
  285. Global Const $process_set_quota = 256
  286. Global Const $process_set_information = 512
  287. Global Const $process_query_information = 1024
  288. Global Const $process_query_limited_information = 4096
  289. Global Const $process_suspend_resume = 2048
  290. Global Const $process_all_access = 2035711
  291. Global Const $se_assignprimarytoken_name = "SeAssignPrimaryTokenPrivilege"
  292. Global Const $se_audit_name = "SeAuditPrivilege"
  293. Global Const $se_backup_name = "SeBackupPrivilege"
  294. Global Const $se_change_notify_name = "SeChangeNotifyPrivilege"
  295. Global Const $se_create_global_name = "SeCreateGlobalPrivilege"
  296. Global Const $se_create_pagefile_name = "SeCreatePagefilePrivilege"
  297. Global Const $se_create_permanent_name = "SeCreatePermanentPrivilege"
  298. Global Const $se_create_symbolic_link_name = "SeCreateSymbolicLinkPrivilege"
  299. Global Const $se_create_token_name = "SeCreateTokenPrivilege"
  300. Global Const $se_debug_name = "SeDebugPrivilege"
  301. Global Const $se_enable_delegation_name = "SeEnableDelegationPrivilege"
  302. Global Const $se_impersonate_name = "SeImpersonatePrivilege"
  303. Global Const $se_inc_base_priority_name = "SeIncreaseBasePriorityPrivilege"
  304. Global Const $se_inc_working_set_name = "SeIncreaseWorkingSetPrivilege"
  305. Global Const $se_increase_quota_name = "SeIncreaseQuotaPrivilege"
  306. Global Const $se_load_driver_name = "SeLoadDriverPrivilege"
  307. Global Const $se_lock_memory_name = "SeLockMemoryPrivilege"
  308. Global Const $se_machine_account_name = "SeMachineAccountPrivilege"
  309. Global Const $se_manage_volume_name = "SeManageVolumePrivilege"
  310. Global Const $se_prof_single_process_name = "SeProfileSingleProcessPrivilege"
  311. Global Const $se_relabel_name = "SeRelabelPrivilege"
  312. Global Const $se_remote_shutdown_name = "SeRemoteShutdownPrivilege"
  313. Global Const $se_restore_name = "SeRestorePrivilege"
  314. Global Const $se_security_name = "SeSecurityPrivilege"
  315. Global Const $se_shutdown_name = "SeShutdownPrivilege"
  316. Global Const $se_sync_agent_name = "SeSyncAgentPrivilege"
  317. Global Const $se_system_environment_name = "SeSystemEnvironmentPrivilege"
  318. Global Const $se_system_profile_name = "SeSystemProfilePrivilege"
  319. Global Const $se_systemtime_name = "SeSystemtimePrivilege"
  320. Global Const $se_take_ownership_name = "SeTakeOwnershipPrivilege"
  321. Global Const $se_tcb_name = "SeTcbPrivilege"
  322. Global Const $se_time_zone_name = "SeTimeZonePrivilege"
  323. Global Const $se_trusted_credman_access_name = "SeTrustedCredManAccessPrivilege"
  324. Global Const $se_unsolicited_input_name = "SeUnsolicitedInputPrivilege"
  325. Global Const $se_undock_name = "SeUndockPrivilege"
  326. Global Const $se_privilege_enabled_by_default = 1
  327. Global Const $se_privilege_enabled = 2
  328. Global Const $se_privilege_removed = 4
  329. Global Const $se_privilege_used_for_access = -2147483648
  330. Global Const $se_group_mandatory = 1
  331. Global Const $se_group_enabled_by_default = 2
  332. Global Const $se_group_enabled = 4
  333. Global Const $se_group_owner = 8
  334. Global Const $se_group_use_for_deny_only = 16
  335. Global Const $se_group_integrity = 32
  336. Global Const $se_group_integrity_enabled = 64
  337. Global Const $se_group_resource = 536870912
  338. Global Const $se_group_logon_id = -1073741824
  339. Global Enum $tokenprimary = 1, $tokenimpersonation
  340. Global Enum $securityanonymous = 0, $securityidentification, $securityimpersonation, $securitydelegation
  341. Global Enum $tokenuser = 1, $tokengroups, $tokenprivileges, $tokenowner, $tokenprimarygroup, $tokendefaultdacl, $tokensource, $tokentype, $tokenimpersonationlevel, $tokenstatistics, $tokenrestrictedsids, $tokensessionid, $tokengroupsandprivileges, $tokensessionreference, $tokensandboxinert, $tokenauditpolicy, $tokenorigin, $tokenelevationtype, $tokenlinkedtoken, $tokenelevation, $tokenhasrestrictions, $tokenaccessinformation, $tokenvirtualizationallowed, $tokenvirtualizationenabled, $tokenintegritylevel, $tokenuiaccess, $tokenmandatorypolicy, $tokenlogonsid
  342. Global Const $token_assign_primary = 1
  343. Global Const $token_duplicate = 2
  344. Global Const $token_impersonate = 4
  345. Global Const $token_query = 8
  346. Global Const $token_query_source = 16
  347. Global Const $token_adjust_privileges = 32
  348. Global Const $token_adjust_groups = 64
  349. Global Const $token_adjust_default = 128
  350. Global Const $token_adjust_sessionid = 256
  351. Global Const $token_all_access = 983551
  352. Global Const $token_read = 131080
  353. Global Const $token_write = 131296
  354. Global Const $token_execute = 131072
  355. Global Const $token_has_traverse_privilege = 1
  356. Global Const $token_has_backup_privilege = 2
  357. Global Const $token_has_restore_privilege = 4
  358. Global Const $token_has_admin_group = 8
  359. Global Const $token_is_restricted = 16
  360. Global Const $token_session_not_referenced = 32
  361. Global Const $token_sandbox_inert = 64
  362. Global Const $token_has_impersonate_privilege = 128
  363. Global Const $rights_delete = 65536
  364. Global Const $read_control = 131072
  365. Global Const $write_dac = 262144
  366. Global Const $write_owner = 524288
  367. Global Const $synchronize = 1048576
  368. Global Const $access_system_security = 16777216
  369. Global Const $standard_rights_required = 983040
  370. Global Const $standard_rights_read = $read_control
  371. Global Const $standard_rights_write = $read_control
  372. Global Const $standard_rights_execute = $read_control
  373. Global Const $standard_rights_all = 2031616
  374. Global Const $specific_rights_all = 65535
  375. Global Enum $not_used_access = 0, $grant_access, $set_access, $deny_access, $revoke_access, $set_audit_success, $set_audit_failure
  376. Global Enum $trustee_is_unknown = 0, $trustee_is_user, $trustee_is_group, $trustee_is_domain, $trustee_is_alias, $trustee_is_well_known_group, $trustee_is_deleted, $trustee_is_invalid, $trustee_is_computer
  377. Global Const $logon_with_profile = 1
  378. Global Const $logon_netcredentials_only = 2
  379. Global Enum $sidtypeuser = 1, $sidtypegroup, $sidtypedomain, $sidtypealias, $sidtypewellknowngroup, $sidtypedeletedaccount, $sidtypeinvalid, $sidtypeunknown, $sidtypecomputer, $sidtypelabel
  380. Global Const $sid_administrators = "S-1-5-32-544"
  381. Global Const $sid_users = "S-1-5-32-545"
  382. Global Const $sid_guests = "S-1-5-32-546"
  383. Global Const $sid_account_operators = "S-1-5-32-548"
  384. Global Const $sid_server_operators = "S-1-5-32-549"
  385. Global Const $sid_print_operators = "S-1-5-32-550"
  386. Global Const $sid_backup_operators = "S-1-5-32-551"
  387. Global Const $sid_replicator = "S-1-5-32-552"
  388. Global Const $sid_owner = "S-1-3-0"
  389. Global Const $sid_everyone = "S-1-1-0"
  390. Global Const $sid_network = "S-1-5-2"
  391. Global Const $sid_interactive = "S-1-5-4"
  392. Global Const $sid_system = "S-1-5-18"
  393. Global Const $sid_authenticated_users = "S-1-5-11"
  394. Global Const $sid_schannel_authentication = "S-1-5-64-14"
  395. Global Const $sid_digest_authentication = "S-1-5-64-21"
  396. Global Const $sid_nt_service = "S-1-5-80"
  397. Global Const $sid_untrusted_mandatory_level = "S-1-16-0"
  398. Global Const $sid_low_mandatory_level = "S-1-16-4096"
  399. Global Const $sid_medium_mandatory_level = "S-1-16-8192"
  400. Global Const $sid_medium_plus_mandatory_level = "S-1-16-8448"
  401. Global Const $sid_high_mandatory_level = "S-1-16-12288"
  402. Global Const $sid_system_mandatory_level = "S-1-16-16384"
  403. Global Const $sid_protected_process_mandatory_level = "S-1-16-20480"
  404. Global Const $sid_secure_process_mandatory_level = "S-1-16-28672"
  405. Global Const $sid_all_services = "S-1-5-80-0"
  406.  
  407. Func _winapi_getlasterror(Const $_icurrenterror = @error, Const $_icurrentextended = @extended)
  408.     Local $aresult = DllCall("kernel32.dll", "dword", "GetLastError")
  409.     Return SetError($_icurrenterror, $_icurrentextended, $aresult[0])
  410. EndFunc
  411.  
  412. Func _winapi_setlasterror($ierrorcode, Const $_icurrenterror = @error, Const $_icurrentextended = @extended)
  413.     DllCall("kernel32.dll", "none", "SetLastError", "dword", $ierrorcode)
  414.     Return SetError($_icurrenterror, $_icurrentextended, NULL )
  415. EndFunc
  416.  
  417. Func __comerrorformating($ocomerror, $sprefix = @TAB)
  418.     Local Const $str_striptrailing = 2
  419.     Local $serror = "COM Error encountered in " & @ScriptName & " (" & $ocomerror.scriptline & ") :" & @CRLF & $sprefix & "Number        " & @TAB & "= 0x" & Hex($ocomerror.number, 8) & " (" & $ocomerror.number & ")" & @CRLF & $sprefix & "WinDescription" & @TAB & "= " & StringStripWS($ocomerror.windescription, $str_striptrailing) & @CRLF & $sprefix & "Description   " & @TAB & "= " & StringStripWS($ocomerror.description, $str_striptrailing) & @CRLF & $sprefix & "Source        " & @TAB & "= " & $ocomerror.source & @CRLF & $sprefix & "HelpFile      " & @TAB & "= " & $ocomerror.helpfile & @CRLF & $sprefix & "HelpContext   " & @TAB & "= " & $ocomerror.helpcontext & @CRLF & $sprefix & "LastDllError  " & @TAB & "= " & $ocomerror.lastdllerror & @CRLF & $sprefix & "Retcode       " & @TAB & "= 0x" & Hex($ocomerror.retcode)
  420.     Return $serror
  421. EndFunc
  422.  
  423. Func _security__adjusttokenprivileges($htoken, $bdisableall, $tnewstate, $ibufferlen, $tprevstate = 0, $prequired = 0)
  424.     Local $acall = DllCall("advapi32.dll", "bool", "AdjustTokenPrivileges", "handle", $htoken, "bool", $bdisableall, "struct*", $tnewstate, "dword", $ibufferlen, "struct*", $tprevstate, "struct*", $prequired)
  425.     If @error Then Return SetError(@error, @extended, False)
  426.     Return NOT ($acall[0] = 0)
  427. EndFunc
  428.  
  429. Func _security__createprocesswithtoken($htoken, $ilogonflags, $scommandline, $icreationflags, $scurdir, $tstartupinfo, $tprocess_information)
  430.     Local $acall = DllCall("advapi32.dll", "bool", "CreateProcessWithTokenW", "handle", $htoken, "dword", $ilogonflags, "ptr", 0, "wstr", $scommandline, "dword", $icreationflags, "struct*", 0, "wstr", $scurdir, "struct*", $tstartupinfo, "struct*", $tprocess_information)
  431.     If @error OR NOT $acall[0] Then Return SetError(@error, @extended, False)
  432.     Return True
  433. EndFunc
  434.  
  435. Func _security__duplicatetokenex($hexistingtoken, $idesiredaccess, $iimpersonationlevel, $itokentype)
  436.     Local $acall = DllCall("advapi32.dll", "bool", "DuplicateTokenEx", "handle", $hexistingtoken, "dword", $idesiredaccess, "struct*", 0, "int", $iimpersonationlevel, "int", $itokentype, "handle*", 0)
  437.     If @error OR NOT $acall[0] Then Return SetError(@error, @extended, 0)
  438.     Return $acall[6]
  439. EndFunc
  440.  
  441. Func _security__getaccountsid($saccount, $ssystem = "")
  442.     Local $aacct = _security__lookupaccountname($saccount, $ssystem)
  443.     If @error Then Return SetError(@error, @extended, 0)
  444.     If IsArray($aacct) Then Return _security__stringsidtosid($aacct[0])
  445.     Return ""
  446. EndFunc
  447.  
  448. Func _security__getlengthsid($psid)
  449.     If NOT _security__isvalidsid($psid) Then Return SetError(@error + 10, @extended, 0)
  450.     Local $acall = DllCall("advapi32.dll", "dword", "GetLengthSid", "struct*", $psid)
  451.     If @error Then Return SetError(@error, @extended, 0)
  452.     Return $acall[0]
  453. EndFunc
  454.  
  455. Func _security__gettokeninformation($htoken, $iclass)
  456.     Local $acall = DllCall("advapi32.dll", "bool", "GetTokenInformation", "handle", $htoken, "int", $iclass, "struct*", 0, "dword", 0, "dword*", 0)
  457.     If @error OR NOT $acall[5] Then Return SetError(@error + 10, @extended, 0)
  458.     Local $ilen = $acall[5]
  459.     Local $tbuffer = DllStructCreate("byte[" & $ilen & "]")
  460.     $acall = DllCall("advapi32.dll", "bool", "GetTokenInformation", "handle", $htoken, "int", $iclass, "struct*", $tbuffer, "dword", DllStructGetSize($tbuffer), "dword*", 0)
  461.     If @error OR NOT $acall[0] Then Return SetError(@error, @extended, 0)
  462.     Return $tbuffer
  463. EndFunc
  464.  
  465. Func _security__impersonateself($ilevel = $securityimpersonation)
  466.     Local $acall = DllCall("advapi32.dll", "bool", "ImpersonateSelf", "int", $ilevel)
  467.     If @error Then Return SetError(@error, @extended, False)
  468.     Return NOT ($acall[0] = 0)
  469. EndFunc
  470.  
  471. Func _security__isvalidsid($psid)
  472.     Local $acall = DllCall("advapi32.dll", "bool", "IsValidSid", "struct*", $psid)
  473.     If @error Then Return SetError(@error, @extended, False)
  474.     Return NOT ($acall[0] = 0)
  475. EndFunc
  476.  
  477. Func _security__lookupaccountname($saccount, $ssystem = "")
  478.     Local $tdata = DllStructCreate("byte SID[256]")
  479.     Local $acall = DllCall("advapi32.dll", "bool", "LookupAccountNameW", "wstr", $ssystem, "wstr", $saccount, "struct*", $tdata, "dword*", DllStructGetSize($tdata), "wstr", "", "dword*", DllStructGetSize($tdata), "int*", 0)
  480.     If @error OR NOT $acall[0] Then Return SetError(@error, @extended, 0)
  481.     Local $aacct[3]
  482.     $aacct[0] = _security__sidtostringsid(DllStructGetPtr($tdata, "SID"))
  483.     $aacct[1] = $acall[5]
  484.     $aacct[2] = $acall[7]
  485.     Return $aacct
  486. EndFunc
  487.  
  488. Func _security__lookupaccountsid($vsid, $ssystem = "")
  489.     Local $psid, $aacct[3]
  490.     If IsString($vsid) Then
  491.         $psid = _security__stringsidtosid($vsid)
  492.     Else
  493.         $psid = $vsid
  494.     EndIf
  495.     If NOT _security__isvalidsid($psid) Then Return SetError(@error + 10, @extended, 0)
  496.     Local $stypesystem = "ptr"
  497.     If $ssystem Then $stypesystem = "wstr"
  498.     Local $acall = DllCall("advapi32.dll", "bool", "LookupAccountSidW", $stypesystem, $ssystem, "struct*", $psid, "wstr", "", "dword*", 65536, "wstr", "", "dword*", 65536, "int*", 0)
  499.     If @error OR NOT $acall[0] Then Return SetError(@error, @extended, 0)
  500.     Local $aacct[3]
  501.     $aacct[0] = $acall[3]
  502.     $aacct[1] = $acall[5]
  503.     $aacct[2] = $acall[7]
  504.     Return $aacct
  505. EndFunc
  506.  
  507. Func _security__lookupprivilegevalue($ssystem, $sname)
  508.     Local $acall = DllCall("advapi32.dll", "bool", "LookupPrivilegeValueW", "wstr", $ssystem, "wstr", $sname, "int64*", 0)
  509.     If @error OR NOT $acall[0] Then Return SetError(@error, @extended, 0)
  510.     Return $acall[3]
  511. EndFunc
  512.  
  513. Func _security__openprocesstoken($hprocess, $iaccess)
  514.     Local $acall = DllCall("advapi32.dll", "bool", "OpenProcessToken", "handle", $hprocess, "dword", $iaccess, "handle*", 0)
  515.     If @error OR NOT $acall[0] Then Return SetError(@error, @extended, 0)
  516.     Return $acall[3]
  517. EndFunc
  518.  
  519. Func _security__openthreadtoken($iaccess, $hthread = 0, $bopenasself = False)
  520.     If $hthread = 0 Then
  521.         Local $aresult = DllCall("kernel32.dll", "handle", "GetCurrentThread")
  522.         If @error Then Return SetError(@error + 10, @extended, 0)
  523.         $hthread = $aresult[0]
  524.     EndIf
  525.     Local $acall = DllCall("advapi32.dll", "bool", "OpenThreadToken", "handle", $hthread, "dword", $iaccess, "bool", $bopenasself, "handle*", 0)
  526.     If @error OR NOT $acall[0] Then Return SetError(@error, @extended, 0)
  527.     Return $acall[4]
  528. EndFunc
  529.  
  530. Func _security__openthreadtokenex($iaccess, $hthread = 0, $bopenasself = False)
  531.     Local $htoken = _security__openthreadtoken($iaccess, $hthread, $bopenasself)
  532.     If $htoken = 0 Then
  533.         Local Const $error_no_token = 1008
  534.         If _winapi_getlasterror() <> $error_no_token Then Return SetError(20, _winapi_getlasterror(), 0)
  535.         If NOT _security__impersonateself() Then Return SetError(@error + 10, _winapi_getlasterror(), 0)
  536.         $htoken = _security__openthreadtoken($iaccess, $hthread, $bopenasself)
  537.         If $htoken = 0 Then Return SetError(@error, _winapi_getlasterror(), 0)
  538.     EndIf
  539.     Return $htoken
  540. EndFunc
  541.  
  542. Func _security__setprivilege($htoken, $sprivilege, $benable)
  543.     Local $iluid = _security__lookupprivilegevalue("", $sprivilege)
  544.     If $iluid = 0 Then Return SetError(@error + 10, @extended, False)
  545.     Local Const $tagtoken_privileges = "dword Count;align 4;int64 LUID;dword Attributes"
  546.     Local $tcurrstate = DllStructCreate($tagtoken_privileges)
  547.     Local $icurrstate = DllStructGetSize($tcurrstate)
  548.     Local $tprevstate = DllStructCreate($tagtoken_privileges)
  549.     Local $iprevstate = DllStructGetSize($tprevstate)
  550.     Local $trequired = DllStructCreate("int Data")
  551.     DllStructSetData($tcurrstate, "Count", 1)
  552.     DllStructSetData($tcurrstate, "LUID", $iluid)
  553.     If NOT _security__adjusttokenprivileges($htoken, False, $tcurrstate, $icurrstate, $tprevstate, $trequired) Then Return SetError(2, @error, False)
  554.     DllStructSetData($tprevstate, "Count", 1)
  555.     DllStructSetData($tprevstate, "LUID", $iluid)
  556.     Local $iattributes = DllStructGetData($tprevstate, "Attributes")
  557.     If $benable Then
  558.         $iattributes = BitOR($iattributes, $se_privilege_enabled)
  559.     Else
  560.         $iattributes = BitAND($iattributes, BitNOT($se_privilege_enabled))
  561.     EndIf
  562.     DllStructSetData($tprevstate, "Attributes", $iattributes)
  563.     If NOT _security__adjusttokenprivileges($htoken, False, $tprevstate, $iprevstate, $tcurrstate, $trequired) Then Return SetError(3, @error, False)
  564.     Return True
  565. EndFunc
  566.  
  567. Func _security__settokeninformation($htoken, $itokeninformation, $vtokeninformation, $itokeninformationlength)
  568.     Local $acall = DllCall("advapi32.dll", "bool", "SetTokenInformation", "handle", $htoken, "int", $itokeninformation, "struct*", $vtokeninformation, "dword", $itokeninformationlength)
  569.     If @error OR NOT $acall[0] Then Return SetError(@error, @extended, False)
  570.     Return True
  571. EndFunc
  572.  
  573. Func _security__sidtostringsid($psid)
  574.     If NOT _security__isvalidsid($psid) Then Return SetError(@error + 10, 0, "")
  575.     Local $acall = DllCall("advapi32.dll", "bool", "ConvertSidToStringSidW", "struct*", $psid, "ptr*", 0)
  576.     If @error OR NOT $acall[0] Then Return SetError(@error, @extended, "")
  577.     Local $pstringsid = $acall[2]
  578.     Local $alen = DllCall("kernel32.dll", "int", "lstrlenW", "struct*", $pstringsid)
  579.     Local $ssid = DllStructGetData(DllStructCreate("wchar Text[" & $alen[0] + 1 & "]", $pstringsid), "Text")
  580.     DllCall("kernel32.dll", "handle", "LocalFree", "handle", $pstringsid)
  581.     Return $ssid
  582. EndFunc
  583.  
  584. Func _security__sidtypestr($itype)
  585.     Switch $itype
  586.         Case $sidtypeuser
  587.             Return "User"
  588.         Case $sidtypegroup
  589.             Return "Group"
  590.         Case $sidtypedomain
  591.             Return "Domain"
  592.         Case $sidtypealias
  593.             Return "Alias"
  594.         Case $sidtypewellknowngroup
  595.             Return "Well Known Group"
  596.         Case $sidtypedeletedaccount
  597.             Return "Deleted Account"
  598.         Case $sidtypeinvalid
  599.             Return "Invalid"
  600.         Case $sidtypeunknown
  601.             Return "Unknown Type"
  602.         Case $sidtypecomputer
  603.             Return "Computer"
  604.         Case $sidtypelabel
  605.             Return "A mandatory integrity label SID"
  606.         Case Else
  607.             Return "Unknown SID Type"
  608.     EndSwitch
  609. EndFunc
  610.  
  611. Func _security__stringsidtosid($ssid)
  612.     Local $acall = DllCall("advapi32.dll", "bool", "ConvertStringSidToSidW", "wstr", $ssid, "ptr*", 0)
  613.     If @error OR NOT $acall[0] Then Return SetError(@error, @extended, 0)
  614.     Local $psid = $acall[2]
  615.     Local $tbuffer = DllStructCreate("byte Data[" & _security__getlengthsid($psid) & "]", $psid)
  616.     Local $tsid = DllStructCreate("byte Data[" & DllStructGetSize($tbuffer) & "]")
  617.     DllStructSetData($tsid, "Data", DllStructGetData($tbuffer, "Data"))
  618.     DllCall("kernel32.dll", "handle", "LocalFree", "handle", $psid)
  619.     Return $tsid
  620. EndFunc
  621.  
  622. Global Const $tagpoint = "struct;long X;long Y;endstruct"
  623. Global Const $tagrect = "struct;long Left;long Top;long Right;long Bottom;endstruct"
  624. Global Const $tagsize = "struct;long X;long Y;endstruct"
  625. Global Const $tagmargins = "int cxLeftWidth;int cxRightWidth;int cyTopHeight;int cyBottomHeight"
  626. Global Const $tagfiletime = "struct;dword Lo;dword Hi;endstruct"
  627. Global Const $tagsystemtime = "struct;word Year;word Month;word Dow;word Day;word Hour;word Minute;word Second;word MSeconds;endstruct"
  628. Global Const $tagtime_zone_information = "struct;long Bias;wchar StdName[32];word StdDate[8];long StdBias;wchar DayName[32];word DayDate[8];long DayBias;endstruct"
  629. Global Const $tagnmhdr = "struct;hwnd hWndFrom;uint_ptr IDFrom;INT Code;endstruct"
  630. Global Const $tagcomboboxexitem = "uint Mask;int_ptr Item;ptr Text;int TextMax;int Image;int SelectedImage;int OverlayImage;" & "int Indent;lparam Param"
  631. Global Const $tagnmcbedragbegin = $tagnmhdr & ";int ItemID;wchar szText[260]"
  632. Global Const $tagnmcbeendedit = $tagnmhdr & ";bool fChanged;int NewSelection;wchar szText[260];int Why"
  633. Global Const $tagnmcomboboxex = $tagnmhdr & ";uint Mask;int_ptr Item;ptr Text;int TextMax;int Image;" & "int SelectedImage;int OverlayImage;int Indent;lparam Param"
  634. Global Const $tagdtprange = "word MinYear;word MinMonth;word MinDOW;word MinDay;word MinHour;word MinMinute;" & "word MinSecond;word MinMSecond;word MaxYear;word MaxMonth;word MaxDOW;word MaxDay;word MaxHour;" & "word MaxMinute;word MaxSecond;word MaxMSecond;bool MinValid;bool MaxValid"
  635. Global Const $tagnmdatetimechange = $tagnmhdr & ";dword Flag;" & $tagsystemtime
  636. Global Const $tagnmdatetimeformat = $tagnmhdr & ";ptr Format;" & $tagsystemtime & ";ptr pDisplay;wchar Display[64]"
  637. Global Const $tagnmdatetimeformatquery = $tagnmhdr & ";ptr Format;struct;long SizeX;long SizeY;endstruct"
  638. Global Const $tagnmdatetimekeydown = $tagnmhdr & ";int VirtKey;ptr Format;" & $tagsystemtime
  639. Global Const $tagnmdatetimestring = $tagnmhdr & ";ptr UserString;" & $tagsystemtime & ";dword Flags"
  640. Global Const $tageventlogrecord = "dword Length;dword Reserved;dword RecordNumber;dword TimeGenerated;dword TimeWritten;dword EventID;" & "word EventType;word NumStrings;word EventCategory;word ReservedFlags;dword ClosingRecordNumber;dword StringOffset;" & "dword UserSidLength;dword UserSidOffset;dword DataLength;dword DataOffset"
  641. Global Const $taggdip_effectparams_blur = "float Radius; bool ExpandEdge"
  642. Global Const $taggdip_effectparams_brightnesscontrast = "int BrightnessLevel; int ContrastLevel"
  643. Global Const $taggdip_effectparams_colorbalance = "int CyanRed; int MagentaGreen; int YellowBlue"
  644. Global Const $taggdip_effectparams_colorcurve = "int Adjustment; int Channel; int AdjustValue"
  645. Global Const $taggdip_effectparams_colorlut = "byte LutB[256]; byte LutG[256]; byte LutR[256]; byte LutA[256]"
  646. Global Const $taggdip_effectparams_huesaturationlightness = "int HueLevel; int SaturationLevel; int LightnessLevel"
  647. Global Const $taggdip_effectparams_levels = "int Highlight; int Midtone; int Shadow"
  648. Global Const $taggdip_effectparams_redeyecorrection = "uint NumberOfAreas; ptr Areas"
  649. Global Const $taggdip_effectparams_sharpen = "float Radius; float Amount"
  650. Global Const $taggdip_effectparams_tint = "int Hue; int Amount"
  651. Global Const $taggdipbitmapdata = "uint Width;uint Height;int Stride;int Format;ptr Scan0;uint_ptr Reserved"
  652. Global Const $taggdipcolormatrix = "float m[25]"
  653. Global Const $taggdipencoderparam = "struct;byte GUID[16];ulong NumberOfValues;ulong Type;ptr Values;endstruct"
  654. Global Const $taggdipencoderparams = "uint Count;" & $taggdipencoderparam
  655. Global Const $taggdiprectf = "struct;float X;float Y;float Width;float Height;endstruct"
  656. Global Const $taggdipstartupinput = "uint Version;ptr Callback;bool NoThread;bool NoCodecs"
  657. Global Const $taggdipstartupoutput = "ptr HookProc;ptr UnhookProc"
  658. Global Const $taggdipimagecodecinfo = "byte CLSID[16];byte FormatID[16];ptr CodecName;ptr DllName;ptr FormatDesc;ptr FileExt;" & "ptr MimeType;dword Flags;dword Version;dword SigCount;dword SigSize;ptr SigPattern;ptr SigMask"
  659. Global Const $taggdippencoderparams = "uint Count;byte Params[1]"
  660. Global Const $taghditem = "uint Mask;int XY;ptr Text;handle hBMP;int TextMax;int Fmt;lparam Param;int Image;int Order;uint Type;ptr pFilter;uint State"
  661. Global Const $tagnmhddispinfo = $tagnmhdr & ";int Item;uint Mask;ptr Text;int TextMax;int Image;lparam lParam"
  662. Global Const $tagnmhdfilterbtnclick = $tagnmhdr & ";int Item;" & $tagrect
  663. Global Const $tagnmheader = $tagnmhdr & ";int Item;int Button;ptr pItem"
  664. Global Const $taggetipaddress = "byte Field4;byte Field3;byte Field2;byte Field1"
  665. Global Const $tagnmipaddress = $tagnmhdr & ";int Field;int Value"
  666. Global Const $taglvfindinfo = "struct;uint Flags;ptr Text;lparam Param;" & $tagpoint & ";uint Direction;endstruct"
  667. Global Const $taglvhittestinfo = $tagpoint & ";uint Flags;int Item;int SubItem;int iGroup"
  668. Global Const $taglvitem = "struct;uint Mask;int Item;int SubItem;uint State;uint StateMask;ptr Text;int TextMax;int Image;lparam Param;" & "int Indent;int GroupID;uint Columns;ptr pColumns;ptr piColFmt;int iGroup;endstruct"
  669. Global Const $tagnmlistview = $tagnmhdr & ";int Item;int SubItem;uint NewState;uint OldState;uint Changed;" & "struct;long ActionX;long ActionY;endstruct;lparam Param"
  670. Global Const $tagnmlvcustomdraw = "struct;" & $tagnmhdr & ";dword dwDrawStage;handle hdc;" & $tagrect & ";dword_ptr dwItemSpec;uint uItemState;lparam lItemlParam;endstruct" & ";dword clrText;dword clrTextBk;int iSubItem;dword dwItemType;dword clrFace;int iIconEffect;" & "int iIconPhase;int iPartID;int iStateID;struct;long TextLeft;long TextTop;long TextRight;long TextBottom;endstruct;uint uAlign"
  671. Global Const $tagnmlvdispinfo = $tagnmhdr & ";" & $taglvitem
  672. Global Const $tagnmlvfinditem = $tagnmhdr & ";int Start;" & $taglvfindinfo
  673. Global Const $tagnmlvgetinfotip = $tagnmhdr & ";dword Flags;ptr Text;int TextMax;int Item;int SubItem;lparam lParam"
  674. Global Const $tagnmitemactivate = $tagnmhdr & ";int Index;int SubItem;uint NewState;uint OldState;uint Changed;" & $tagpoint & ";lparam lParam;uint KeyFlags"
  675. Global Const $tagnmlvkeydown = "align 1;" & $tagnmhdr & ";word VKey;uint Flags"
  676. Global Const $tagnmlvscroll = $tagnmhdr & ";int DX;int DY"
  677. Global Const $tagmchittestinfo = "uint Size;" & $tagpoint & ";uint Hit;" & $tagsystemtime & ";" & $tagrect & ";int iOffset;int iRow;int iCol"
  678. Global Const $tagmcmonthrange = "word MinYear;word MinMonth;word MinDOW;word MinDay;word MinHour;word MinMinute;word MinSecond;" & "word MinMSeconds;word MaxYear;word MaxMonth;word MaxDOW;word MaxDay;word MaxHour;word MaxMinute;word MaxSecond;" & "word MaxMSeconds;short Span"
  679. Global Const $tagmcrange = "word MinYear;word MinMonth;word MinDOW;word MinDay;word MinHour;word MinMinute;word MinSecond;" & "word MinMSeconds;word MaxYear;word MaxMonth;word MaxDOW;word MaxDay;word MaxHour;word MaxMinute;word MaxSecond;" & "word MaxMSeconds;short MinSet;short MaxSet"
  680. Global Const $tagmcselrange = "word MinYear;word MinMonth;word MinDOW;word MinDay;word MinHour;word MinMinute;word MinSecond;" & "word MinMSeconds;word MaxYear;word MaxMonth;word MaxDOW;word MaxDay;word MaxHour;word MaxMinute;word MaxSecond;" & "word MaxMSeconds"
  681. Global Const $tagnmdaystate = $tagnmhdr & ";" & $tagsystemtime & ";int DayState;ptr pDayState"
  682. Global Const $tagnmselchange = $tagnmhdr & ";struct;word BegYear;word BegMonth;word BegDOW;word BegDay;word BegHour;word BegMinute;word BegSecond;word BegMSeconds;endstruct;" & "struct;word EndYear;word EndMonth;word EndDOW;word EndDay;word EndHour;word EndMinute;word EndSecond;word EndMSeconds;endstruct"
  683. Global Const $tagnmobjectnotify = $tagnmhdr & ";int Item;ptr piid;ptr pObject;long Result;dword dwFlags"
  684. Global Const $tagnmtckeydown = "align 1;" & $tagnmhdr & ";word VKey;uint Flags"
  685. Global Const $tagtvitem = "struct;uint Mask;handle hItem;uint State;uint StateMask;ptr Text;int TextMax;int Image;int SelectedImage;" & "int Children;lparam Param;endstruct"
  686. Global Const $tagtvitemex = "struct;" & $tagtvitem & ";int Integral;uint uStateEx;hwnd hwnd;int iExpandedImage;int iReserved;endstruct"
  687. Global Const $tagnmtreeview = $tagnmhdr & ";uint Action;" & "struct;uint OldMask;handle OldhItem;uint OldState;uint OldStateMask;" & "ptr OldText;int OldTextMax;int OldImage;int OldSelectedImage;int OldChildren;lparam OldParam;endstruct;" & "struct;uint NewMask;handle NewhItem;uint NewState;uint NewStateMask;" & "ptr NewText;int NewTextMax;int NewImage;int NewSelectedImage;int NewChildren;lparam NewParam;endstruct;" & "struct;long PointX;long PointY;endstruct"
  688. Global Const $tagnmtvcustomdraw = "struct;" & $tagnmhdr & ";dword DrawStage;handle HDC;" & $tagrect & ";dword_ptr ItemSpec;uint ItemState;lparam ItemParam;endstruct" & ";dword ClrText;dword ClrTextBk;int Level"
  689. Global Const $tagnmtvdispinfo = $tagnmhdr & ";" & $tagtvitem
  690. Global Const $tagnmtvgetinfotip = $tagnmhdr & ";ptr Text;int TextMax;handle hItem;lparam lParam"
  691. Global Const $tagnmtvitemchange = $tagnmhdr & ";uint Changed;handle hItem;uint StateNew;uint StateOld;lparam lParam;"
  692. Global Const $tagtvhittestinfo = $tagpoint & ";uint Flags;handle Item"
  693. Global Const $tagnmtvkeydown = "align 1;" & $tagnmhdr & ";word VKey;uint Flags"
  694. Global Const $tagnmmouse = $tagnmhdr & ";dword_ptr ItemSpec;dword_ptr ItemData;" & $tagpoint & ";lparam HitInfo"
  695. Global Const $tagtoken_privileges = "dword Count;align 4;int64 LUID;dword Attributes"
  696. Global Const $tagimageinfo = "handle hBitmap;handle hMask;int Unused1;int Unused2;" & $tagrect
  697. Global Const $tagmenuinfo = "dword Size;INT Mask;dword Style;uint YMax;handle hBack;dword ContextHelpID;ulong_ptr MenuData"
  698. Global Const $tagmenuiteminfo = "uint Size;uint Mask;uint Type;uint State;uint ID;handle SubMenu;handle BmpChecked;handle BmpUnchecked;" & "ulong_ptr ItemData;ptr TypeData;uint CCH;handle BmpItem"
  699. Global Const $tagrebarbandinfo = "uint cbSize;uint fMask;uint fStyle;dword clrFore;dword clrBack;ptr lpText;uint cch;" & "int iImage;hwnd hwndChild;uint cxMinChild;uint cyMinChild;uint cx;handle hbmBack;uint wID;uint cyChild;uint cyMaxChild;" & "uint cyIntegral;uint cxIdeal;lparam lParam;uint cxHeader" & ((@OSVersion = "WIN_XP") ? "" : ";" & $tagrect & ";uint uChevronState")
  700. Global Const $tagnmrebarautobreak = $tagnmhdr & ";uint uBand;uint wID;lparam lParam;uint uMsg;uint fStyleCurrent;bool fAutoBreak"
  701. Global Const $tagnmrbautosize = $tagnmhdr & ";bool fChanged;" & "struct;long TargetLeft;long TargetTop;long TargetRight;long TargetBottom;endstruct;" & "struct;long ActualLeft;long ActualTop;long ActualRight;long ActualBottom;endstruct"
  702. Global Const $tagnmrebar = $tagnmhdr & ";dword dwMask;uint uBand;uint fStyle;uint wID;lparam lParam"
  703. Global Const $tagnmrebarchevron = $tagnmhdr & ";uint uBand;uint wID;lparam lParam;" & $tagrect & ";lparam lParamNM"
  704. Global Const $tagnmrebarchildsize = $tagnmhdr & ";uint uBand;uint wID;" & "struct;long CLeft;long CTop;long CRight;long CBottom;endstruct;" & "struct;long BLeft;long BTop;long BRight;long BBottom;endstruct"
  705. Global Const $tagcolorscheme = "dword Size;dword BtnHighlight;dword BtnShadow"
  706. Global Const $tagnmtoolbar = $tagnmhdr & ";int iItem;" & "struct;int iBitmap;int idCommand;byte fsState;byte fsStyle;dword_ptr dwData;int_ptr iString;endstruct" & ";int cchText;ptr pszText;" & $tagrect
  707. Global Const $tagnmtbhotitem = $tagnmhdr & ";int idOld;int idNew;dword dwFlags"
  708. Global Const $tagtbbutton = "int Bitmap;int Command;byte State;byte Style;dword_ptr Param;int_ptr String"
  709. Global Const $tagtbbuttoninfo = "uint Size;dword Mask;int Command;int Image;byte State;byte Style;word CX;dword_ptr Param;ptr Text;int TextMax"
  710. Global Const $tagnetresource = "dword Scope;dword Type;dword DisplayType;dword Usage;ptr LocalName;ptr RemoteName;ptr Comment;ptr Provider"
  711. Global Const $tagoverlapped = "ulong_ptr Internal;ulong_ptr InternalHigh;struct;dword Offset;dword OffsetHigh;endstruct;handle hEvent"
  712. Global Const $tagopenfilename = "dword StructSize;hwnd hwndOwner;handle hInstance;ptr lpstrFilter;ptr lpstrCustomFilter;" & "dword nMaxCustFilter;dword nFilterIndex;ptr lpstrFile;dword nMaxFile;ptr lpstrFileTitle;dword nMaxFileTitle;" & "ptr lpstrInitialDir;ptr lpstrTitle;dword Flags;word nFileOffset;word nFileExtension;ptr lpstrDefExt;lparam lCustData;" & "ptr lpfnHook;ptr lpTemplateName;ptr pvReserved;dword dwReserved;dword FlagsEx"
  713. Global Const $tagbitmapinfoheader = "struct;dword biSize;long biWidth;long biHeight;word biPlanes;word biBitCount;" & "dword biCompression;dword biSizeImage;long biXPelsPerMeter;long biYPelsPerMeter;dword biClrUsed;dword biClrImportant;endstruct"
  714. Global Const $tagbitmapinfo = $tagbitmapinfoheader & ";dword biRGBQuad[1]"
  715. Global Const $tagblendfunction = "byte Op;byte Flags;byte Alpha;byte Format"
  716. Global Const $tagguid = "struct;ulong Data1;ushort Data2;ushort Data3;byte Data4[8];endstruct"
  717. Global Const $tagwindowplacement = "uint length;uint flags;uint showCmd;long ptMinPosition[2];long ptMaxPosition[2];long rcNormalPosition[4]"
  718. Global Const $tagwindowpos = "hwnd hWnd;hwnd InsertAfter;int X;int Y;int CX;int CY;uint Flags"
  719. Global Const $tagscrollinfo = "uint cbSize;uint fMask;int nMin;int nMax;uint nPage;int nPos;int nTrackPos"
  720. Global Const $tagscrollbarinfo = "dword cbSize;" & $tagrect & ";int dxyLineButton;int xyThumbTop;" & "int xyThumbBottom;int reserved;dword rgstate[6]"
  721. Global Const $taglogfont = "struct;long Height;long Width;long Escapement;long Orientation;long Weight;byte Italic;byte Underline;" & "byte Strikeout;byte CharSet;byte OutPrecision;byte ClipPrecision;byte Quality;byte PitchAndFamily;wchar FaceName[32];endstruct"
  722. Global Const $tagkbdllhookstruct = "dword vkCode;dword scanCode;dword flags;dword time;ulong_ptr dwExtraInfo"
  723. Global Const $tagprocess_information = "handle hProcess;handle hThread;dword ProcessID;dword ThreadID"
  724. Global Const $tagstartupinfo = "dword Size;ptr Reserved1;ptr Desktop;ptr Title;dword X;dword Y;dword XSize;dword YSize;dword XCountChars;" & "dword YCountChars;dword FillAttribute;dword Flags;word ShowWindow;word Reserved2;ptr Reserved3;handle StdInput;" & "handle StdOutput;handle StdError"
  725. Global Const $tagsecurity_attributes = "dword Length;ptr Descriptor;bool InheritHandle"
  726. Global Const $tagwin32_find_data = "dword dwFileAttributes;dword ftCreationTime[2];dword ftLastAccessTime[2];dword ftLastWriteTime[2];dword nFileSizeHigh;dword nFileSizeLow;dword dwReserved0;dword dwReserved1;wchar cFileName[260];wchar cAlternateFileName[14]"
  727. Global Const $tagtextmetric = "long tmHeight;long tmAscent;long tmDescent;long tmInternalLeading;long tmExternalLeading;" & "long tmAveCharWidth;long tmMaxCharWidth;long tmWeight;long tmOverhang;long tmDigitizedAspectX;long tmDigitizedAspectY;" & "wchar tmFirstChar;wchar tmLastChar;wchar tmDefaultChar;wchar tmBreakChar;byte tmItalic;byte tmUnderlined;byte tmStruckOut;" & "byte tmPitchAndFamily;byte tmCharSet"
  728. Global Const $tagmemmap = "handle hProc;ulong_ptr Size;ptr Mem"
  729.  
  730. Func _memfree(ByRef $tmemmap)
  731.     Local $pmemory = DllStructGetData($tmemmap, "Mem")
  732.     Local $hprocess = DllStructGetData($tmemmap, "hProc")
  733.     Local $bresult = _memvirtualfreeex($hprocess, $pmemory, 0, $mem_release)
  734.     DllCall("kernel32.dll", "bool", "CloseHandle", "handle", $hprocess)
  735.     If @error Then Return SetError(@error, @extended, False)
  736.     Return $bresult
  737. EndFunc
  738.  
  739. Func _memglobalalloc($ibytes, $iflags = 0)
  740.     Local $aresult = DllCall("kernel32.dll", "handle", "GlobalAlloc", "uint", $iflags, "ulong_ptr", $ibytes)
  741.     If @error Then Return SetError(@error, @extended, 0)
  742.     Return $aresult[0]
  743. EndFunc
  744.  
  745. Func _memglobalfree($hmemory)
  746.     Local $aresult = DllCall("kernel32.dll", "ptr", "GlobalFree", "handle", $hmemory)
  747.     If @error Then Return SetError(@error, @extended, False)
  748.     Return $aresult[0]
  749. EndFunc
  750.  
  751. Func _memgloballock($hmemory)
  752.     Local $aresult = DllCall("kernel32.dll", "ptr", "GlobalLock", "handle", $hmemory)
  753.     If @error Then Return SetError(@error, @extended, 0)
  754.     Return $aresult[0]
  755. EndFunc
  756.  
  757. Func _memglobalsize($hmemory)
  758.     Local $aresult = DllCall("kernel32.dll", "ulong_ptr", "GlobalSize", "handle", $hmemory)
  759.     If @error Then Return SetError(@error, @extended, 0)
  760.     Return $aresult[0]
  761. EndFunc
  762.  
  763. Func _memglobalunlock($hmemory)
  764.     Local $aresult = DllCall("kernel32.dll", "bool", "GlobalUnlock", "handle", $hmemory)
  765.     If @error Then Return SetError(@error, @extended, 0)
  766.     Return $aresult[0]
  767. EndFunc
  768.  
  769. Func _meminit($hwnd, $isize, ByRef $tmemmap)
  770.     Local $aresult = DllCall("user32.dll", "dword", "GetWindowThreadProcessId", "hwnd", $hwnd, "dword*", 0)
  771.     If @error Then Return SetError(@error + 10, @extended, 0)
  772.     Local $iprocessid = $aresult[2]
  773.     If $iprocessid = 0 Then Return SetError(1, 0, 0)
  774.     Local $iaccess = BitOR($process_vm_operation, $process_vm_read, $process_vm_write)
  775.     Local $hprocess = __mem_openprocess($iaccess, False, $iprocessid, True)
  776.     Local $ialloc = BitOR($mem_reserve, $mem_commit)
  777.     Local $pmemory = _memvirtualallocex($hprocess, 0, $isize, $ialloc, $page_readwrite)
  778.     If $pmemory = 0 Then Return SetError(2, 0, 0)
  779.     $tmemmap = DllStructCreate($tagmemmap)
  780.     DllStructSetData($tmemmap, "hProc", $hprocess)
  781.     DllStructSetData($tmemmap, "Size", $isize)
  782.     DllStructSetData($tmemmap, "Mem", $pmemory)
  783.     Return $pmemory
  784. EndFunc
  785.  
  786. Func _memmovememory($psource, $pdest, $ilength)
  787.     DllCall("kernel32.dll", "none", "RtlMoveMemory", "struct*", $pdest, "struct*", $psource, "ulong_ptr", $ilength)
  788.     If @error Then Return SetError(@error, @extended)
  789. EndFunc
  790.  
  791. Func _memread(ByRef $tmemmap, $psrce, $pdest, $isize)
  792.     Local $aresult = DllCall("kernel32.dll", "bool", "ReadProcessMemory", "handle", DllStructGetData($tmemmap, "hProc"), "ptr", $psrce, "struct*", $pdest, "ulong_ptr", $isize, "ulong_ptr*", 0)
  793.     If @error Then Return SetError(@error, @extended, False)
  794.     Return $aresult[0]
  795. EndFunc
  796.  
  797. Func _memwrite(ByRef $tmemmap, $psrce, $pdest = 0, $isize = 0, $ssrce = "struct*")
  798.     If $pdest = 0 Then $pdest = DllStructGetData($tmemmap, "Mem")
  799.     If $isize = 0 Then $isize = DllStructGetData($tmemmap, "Size")
  800.     Local $aresult = DllCall("kernel32.dll", "bool", "WriteProcessMemory", "handle", DllStructGetData($tmemmap, "hProc"), "ptr", $pdest, $ssrce, $psrce, "ulong_ptr", $isize, "ulong_ptr*", 0)
  801.     If @error Then Return SetError(@error, @extended, False)
  802.     Return $aresult[0]
  803. EndFunc
  804.  
  805. Func _memvirtualalloc($paddress, $isize, $iallocation, $iprotect)
  806.     Local $aresult = DllCall("kernel32.dll", "ptr", "VirtualAlloc", "ptr", $paddress, "ulong_ptr", $isize, "dword", $iallocation, "dword", $iprotect)
  807.     If @error Then Return SetError(@error, @extended, 0)
  808.     Return $aresult[0]
  809. EndFunc
  810.  
  811. Func _memvirtualallocex($hprocess, $paddress, $isize, $iallocation, $iprotect)
  812.     Local $aresult = DllCall("kernel32.dll", "ptr", "VirtualAllocEx", "handle", $hprocess, "ptr", $paddress, "ulong_ptr", $isize, "dword", $iallocation, "dword", $iprotect)
  813.     If @error Then Return SetError(@error, @extended, 0)
  814.     Return $aresult[0]
  815. EndFunc
  816.  
  817. Func _memvirtualfree($paddress, $isize, $ifreetype)
  818.     Local $aresult = DllCall("kernel32.dll", "bool", "VirtualFree", "ptr", $paddress, "ulong_ptr", $isize, "dword", $ifreetype)
  819.     If @error Then Return SetError(@error, @extended, False)
  820.     Return $aresult[0]
  821. EndFunc
  822.  
  823. Func _memvirtualfreeex($hprocess, $paddress, $isize, $ifreetype)
  824.     Local $aresult = DllCall("kernel32.dll", "bool", "VirtualFreeEx", "handle", $hprocess, "ptr", $paddress, "ulong_ptr", $isize, "dword", $ifreetype)
  825.     If @error Then Return SetError(@error, @extended, False)
  826.     Return $aresult[0]
  827. EndFunc
  828.  
  829. Func __mem_openprocess($iaccess, $binherit, $iprocessid, $bdebugpriv = False)
  830.     Local $aresult = DllCall("kernel32.dll", "handle", "OpenProcess", "dword", $iaccess, "bool", $binherit, "dword", $iprocessid)
  831.     If @error Then Return SetError(@error + 10, @extended, 0)
  832.     If $aresult[0] Then Return $aresult[0]
  833.     If NOT $bdebugpriv Then Return 0
  834.     Local $htoken = _security__openthreadtokenex(BitOR($token_adjust_privileges, $token_query))
  835.     If @error Then Return SetError(@error + 20, @extended, 0)
  836.     _security__setprivilege($htoken, "SeDebugPrivilege", True)
  837.     Local $ierror = @error
  838.     Local $ilasterror = @extended
  839.     Local $iret = 0
  840.     If NOT @error Then
  841.         $aresult = DllCall("kernel32.dll", "handle", "OpenProcess", "dword", $iaccess, "bool", $binherit, "dword", $iprocessid)
  842.         $ierror = @error
  843.         $ilasterror = @extended
  844.         If $aresult[0] Then $iret = $aresult[0]
  845.         _security__setprivilege($htoken, "SeDebugPrivilege", False)
  846.         If @error Then
  847.             $ierror = @error + 30
  848.             $ilasterror = @extended
  849.         EndIf
  850.     Else
  851.         $ierror = @error + 40
  852.     EndIf
  853.     DllCall("kernel32.dll", "bool", "CloseHandle", "handle", $htoken)
  854.     Return SetError($ierror, $ilasterror, $iret)
  855. EndFunc
  856.  
  857. Func _sendmessage($hwnd, $imsg, $wparam = 0, $lparam = 0, $ireturn = 0, $wparamtype = "wparam", $lparamtype = "lparam", $sreturntype = "lresult")
  858.     Local $aresult = DllCall("user32.dll", $sreturntype, "SendMessageW", "hwnd", $hwnd, "uint", $imsg, $wparamtype, $wparam, $lparamtype, $lparam)
  859.     If @error Then Return SetError(@error, @extended, "")
  860.     If $ireturn >= 0 AND $ireturn <= 4 Then Return $aresult[$ireturn]
  861.     Return $aresult
  862. EndFunc
  863.  
  864. Func _sendmessagea($hwnd, $imsg, $wparam = 0, $lparam = 0, $ireturn = 0, $wparamtype = "wparam", $lparamtype = "lparam", $sreturntype = "lresult")
  865.     Local $aresult = DllCall("user32.dll", $sreturntype, "SendMessageA", "hwnd", $hwnd, "uint", $imsg, $wparamtype, $wparam, $lparamtype, $lparam)
  866.     If @error Then Return SetError(@error, @extended, "")
  867.     If $ireturn >= 0 AND $ireturn <= 4 Then Return $aresult[$ireturn]
  868.     Return $aresult
  869. EndFunc
  870.  
  871. Global Const $sbars_sizegrip = 256
  872. Global Const $sbt_tooltips = 2048
  873. Global Const $sbars_tooltips = 2048
  874. Global Const $sbt_sunken = 0
  875. Global Const $sbt_noborders = 256
  876. Global Const $sbt_popout = 512
  877. Global Const $sbt_rtlreading = 1024
  878. Global Const $sbt_notabparsing = 2048
  879. Global Const $sbt_ownerdraw = 4096
  880. Global Const $__statusbarconstant_wm_user = 1024
  881. Global Const $sb_getborders = ($__statusbarconstant_wm_user + 7)
  882. Global Const $sb_geticon = ($__statusbarconstant_wm_user + 20)
  883. Global Const $sb_getparts = ($__statusbarconstant_wm_user + 6)
  884. Global Const $sb_getrect = ($__statusbarconstant_wm_user + 10)
  885. Global Const $sb_gettexta = ($__statusbarconstant_wm_user + 2)
  886. Global Const $sb_gettextw = ($__statusbarconstant_wm_user + 13)
  887. Global Const $sb_gettext = $sb_gettexta
  888. Global Const $sb_gettextlengtha = ($__statusbarconstant_wm_user + 3)
  889. Global Const $sb_gettextlengthw = ($__statusbarconstant_wm_user + 12)
  890. Global Const $sb_gettextlength = $sb_gettextlengtha
  891. Global Const $sb_gettiptexta = ($__statusbarconstant_wm_user + 18)
  892. Global Const $sb_gettiptextw = ($__statusbarconstant_wm_user + 19)
  893. Global Const $sb_getunicodeformat = 8192 + 6
  894. Global Const $sb_issimple = ($__statusbarconstant_wm_user + 14)
  895. Global Const $sb_setbkcolor = 8192 + 1
  896. Global Const $sb_seticon = ($__statusbarconstant_wm_user + 15)
  897. Global Const $sb_setminheight = ($__statusbarconstant_wm_user + 8)
  898. Global Const $sb_setparts = ($__statusbarconstant_wm_user + 4)
  899. Global Const $sb_settexta = ($__statusbarconstant_wm_user + 1)
  900. Global Const $sb_settextw = ($__statusbarconstant_wm_user + 11)
  901. Global Const $sb_settext = $sb_settexta
  902. Global Const $sb_settiptexta = ($__statusbarconstant_wm_user + 16)
  903. Global Const $sb_settiptextw = ($__statusbarconstant_wm_user + 17)
  904. Global Const $sb_setunicodeformat = 8192 + 5
  905. Global Const $sb_simple = ($__statusbarconstant_wm_user + 9)
  906. Global Const $sb_simpleid = 255
  907. Global Const $sbn_first = -880
  908. Global Const $sbn_simplemodechange = $sbn_first + 0
  909. Global Const $opt_coordsrelative = 0
  910. Global Const $opt_coordsabsolute = 1
  911. Global Const $opt_coordsclient = 2
  912. Global Const $opt_errorsilent = 0
  913. Global Const $opt_errorfatal = 1
  914. Global Const $opt_capsnostore = 0
  915. Global Const $opt_capsstore = 1
  916. Global Const $opt_matchstart = 1
  917. Global Const $opt_matchany = 2
  918. Global Const $opt_matchexact = 3
  919. Global Const $opt_matchadvanced = 4
  920. Global Const $ccs_top = 1
  921. Global Const $ccs_nomovey = 2
  922. Global Const $ccs_bottom = 3
  923. Global Const $ccs_noresize = 4
  924. Global Const $ccs_noparentalign = 8
  925. Global Const $ccs_nohilite = 16
  926. Global Const $ccs_adjustable = 32
  927. Global Const $ccs_nodivider = 64
  928. Global Const $ccs_vert = 128
  929. Global Const $ccs_left = 129
  930. Global Const $ccs_nomovex = 130
  931. Global Const $ccs_right = 131
  932. Global Const $dt_drivetype = 1
  933. Global Const $dt_ssdstatus = 2
  934. Global Const $dt_bustype = 3
  935. Global Const $proxy_ie = 0
  936. Global Const $proxy_none = 1
  937. Global Const $proxy_specified = 2
  938. Global Const $objid_window = 0
  939. Global Const $objid_titlebar = -2
  940. Global Const $objid_sizegrip = -7
  941. Global Const $objid_caret = -8
  942. Global Const $objid_cursor = -9
  943. Global Const $objid_alert = -10
  944. Global Const $objid_sound = -11
  945. Global Const $dlg_centerontop = 0
  946. Global Const $dlg_notitle = 1
  947. Global Const $dlg_notontop = 2
  948. Global Const $dlg_textleft = 4
  949. Global Const $dlg_textright = 8
  950. Global Const $dlg_moveable = 16
  951. Global Const $dlg_textvcenter = 32
  952. Global Const $idc_unknown = 0
  953. Global Const $idc_appstarting = 1
  954. Global Const $idc_arrow = 2
  955. Global Const $idc_cross = 3
  956. Global Const $idc_hand = 32649
  957. Global Const $idc_help = 4
  958. Global Const $idc_ibeam = 5
  959. Global Const $idc_icon = 6
  960. Global Const $idc_no = 7
  961. Global Const $idc_size = 8
  962. Global Const $idc_sizeall = 9
  963. Global Const $idc_sizenesw = 10
  964. Global Const $idc_sizens = 11
  965. Global Const $idc_sizenwse = 12
  966. Global Const $idc_sizewe = 13
  967. Global Const $idc_uparrow = 14
  968. Global Const $idc_wait = 15
  969. Global Const $idi_application = 32512
  970. Global Const $idi_asterisk = 32516
  971. Global Const $idi_exclamation = 32515
  972. Global Const $idi_hand = 32513
  973. Global Const $idi_question = 32514
  974. Global Const $idi_winlogo = 32517
  975. Global Const $idi_shield = 32518
  976. Global Const $idi_error = $idi_hand
  977. Global Const $idi_information = $idi_asterisk
  978. Global Const $idi_warning = $idi_exclamation
  979. Global Const $sd_logoff = 0
  980. Global Const $sd_shutdown = 1
  981. Global Const $sd_reboot = 2
  982. Global Const $sd_force = 4
  983. Global Const $sd_powerdown = 8
  984. Global Const $sd_forcehung = 16
  985. Global Const $sd_standby = 32
  986. Global Const $sd_hibernate = 64
  987. Global Const $stdin_child = 1
  988. Global Const $stdout_child = 2
  989. Global Const $stderr_child = 4
  990. Global Const $stderr_merged = 8
  991. Global Const $stdio_inherit_parent = 16
  992. Global Const $run_create_new_console = 65536
  993. Global Const $ubound_dimensions = 0
  994. Global Const $ubound_rows = 1
  995. Global Const $ubound_columns = 2
  996. Global Const $mouseeventf_absolute = 32768
  997. Global Const $mouseeventf_move = 1
  998. Global Const $mouseeventf_leftdown = 2
  999. Global Const $mouseeventf_leftup = 4
  1000. Global Const $mouseeventf_rightdown = 8
  1001. Global Const $mouseeventf_rightup = 16
  1002. Global Const $mouseeventf_middledown = 32
  1003. Global Const $mouseeventf_middleup = 64
  1004. Global Const $mouseeventf_wheel = 2048
  1005. Global Const $mouseeventf_xdown = 128
  1006. Global Const $mouseeventf_xup = 256
  1007. Global Const $reg_none = 0
  1008. Global Const $reg_sz = 1
  1009. Global Const $reg_expand_sz = 2
  1010. Global Const $reg_binary = 3
  1011. Global Const $reg_dword = 4
  1012. Global Const $reg_dword_little_endian = 4
  1013. Global Const $reg_dword_big_endian = 5
  1014. Global Const $reg_link = 6
  1015. Global Const $reg_multi_sz = 7
  1016. Global Const $reg_resource_list = 8
  1017. Global Const $reg_full_resource_descriptor = 9
  1018. Global Const $reg_resource_requirements_list = 10
  1019. Global Const $reg_qword = 11
  1020. Global Const $reg_qword_little_endian = 11
  1021. Global Const $hwnd_bottom = 1
  1022. Global Const $hwnd_notopmost = -2
  1023. Global Const $hwnd_top = 0
  1024. Global Const $hwnd_topmost = -1
  1025. Global Const $swp_nosize = 1
  1026. Global Const $swp_nomove = 2
  1027. Global Const $swp_nozorder = 4
  1028. Global Const $swp_noredraw = 8
  1029. Global Const $swp_noactivate = 16
  1030. Global Const $swp_framechanged = 32
  1031. Global Const $swp_drawframe = 32
  1032. Global Const $swp_showwindow = 64
  1033. Global Const $swp_hidewindow = 128
  1034. Global Const $swp_nocopybits = 256
  1035. Global Const $swp_noownerzorder = 512
  1036. Global Const $swp_noreposition = 512
  1037. Global Const $swp_nosendchanging = 1024
  1038. Global Const $swp_defererase = 8192
  1039. Global Const $swp_asyncwindowpos = 16384
  1040. Global Const $keyword_default = 1
  1041. Global Const $keyword_null = 2
  1042. Global Const $declared_local = -1
  1043. Global Const $declared_unknown = 0
  1044. Global Const $declared_global = 1
  1045. Global Const $assign_create = 0
  1046. Global Const $assign_forcelocal = 1
  1047. Global Const $assign_forceglobal = 2
  1048. Global Const $assign_existfail = 4
  1049. Global Const $bi_enable = 0
  1050. Global Const $bi_disable = 1
  1051. Global Const $break_enable = 1
  1052. Global Const $break_disable = 0
  1053. Global Const $cdtray_open = "open"
  1054. Global Const $cdtray_closed = "closed"
  1055. Global Const $send_default = 0
  1056. Global Const $send_raw = 1
  1057. Global Const $dir_default = 0
  1058. Global Const $dir_extended = 1
  1059. Global Const $dir_norecurse = 2
  1060. Global Const $dir_remove = 1
  1061. Global Const $dt_all = "ALL"
  1062. Global Const $dt_cdrom = "CDROM"
  1063. Global Const $dt_removable = "REMOVABLE"
  1064. Global Const $dt_fixed = "FIXED"
  1065. Global Const $dt_network = "NETWORK"
  1066. Global Const $dt_ramdisk = "RAMDISK"
  1067. Global Const $dt_unknown = "UNKNOWN"
  1068. Global Const $dt_undefined = 1
  1069. Global Const $dt_fat = "FAT"
  1070. Global Const $dt_fat32 = "FAT32"
  1071. Global Const $dt_exfat = "exFAT"
  1072. Global Const $dt_ntfs = "NTFS"
  1073. Global Const $dt_nwfs = "NWFS"
  1074. Global Const $dt_cdfs = "CDFS"
  1075. Global Const $dt_udf = "UDF"
  1076. Global Const $dma_default = 0
  1077. Global Const $dma_persistent = 1
  1078. Global Const $dma_authentication = 8
  1079. Global Const $ds_unknown = "UNKNOWN"
  1080. Global Const $ds_ready = "READY"
  1081. Global Const $ds_notready = "NOTREADY"
  1082. Global Const $ds_invalid = "INVALID"
  1083. Global Const $mouse_click_left = "left"
  1084. Global Const $mouse_click_right = "right"
  1085. Global Const $mouse_click_middle = "middle"
  1086. Global Const $mouse_click_main = "main"
  1087. Global Const $mouse_click_menu = "menu"
  1088. Global Const $mouse_click_primary = "primary"
  1089. Global Const $mouse_click_secondary = "secondary"
  1090. Global Const $mouse_wheel_up = "up"
  1091. Global Const $mouse_wheel_down = "down"
  1092. Global Const $number_auto = 0
  1093. Global Const $number_32bit = 1
  1094. Global Const $number_64bit = 2
  1095. Global Const $number_double = 3
  1096. Global Const $obj_name = 1
  1097. Global Const $obj_string = 2
  1098. Global Const $obj_progid = 3
  1099. Global Const $obj_file = 4
  1100. Global Const $obj_module = 5
  1101. Global Const $obj_clsid = 6
  1102. Global Const $obj_iid = 7
  1103. Global Const $exitclose_normal = 0
  1104. Global Const $exitclose_byexit = 1
  1105. Global Const $exitclose_byclick = 2
  1106. Global Const $exitclose_bylogoff = 3
  1107. Global Const $exitclose_bysutdown = 4
  1108. Global Const $process_stats_memory = 0
  1109. Global Const $process_stats_io = 1
  1110. Global Const $process_low = 0
  1111. Global Const $process_belownormal = 1
  1112. Global Const $process_normal = 2
  1113. Global Const $process_abovenormal = 3
  1114. Global Const $process_high = 4
  1115. Global Const $process_realtime = 5
  1116. Global Const $run_logon_noprofile = 0
  1117. Global Const $run_logon_profile = 1
  1118. Global Const $run_logon_network = 2
  1119. Global Const $run_logon_inherit = 4
  1120. Global Const $sound_nowait = 0
  1121. Global Const $sound_wait = 1
  1122. Global Const $shex_open = "open"
  1123. Global Const $shex_edit = "edit"
  1124. Global Const $shex_print = "print"
  1125. Global Const $shex_properties = "properties"
  1126. Global Const $tcp_data_default = 0
  1127. Global Const $tcp_data_binary = 1
  1128. Global Const $udp_open_default = 0
  1129. Global Const $udp_open_broadcast = 1
  1130. Global Const $udp_data_default = 0
  1131. Global Const $udp_data_binary = 1
  1132. Global Const $udp_data_array = 2
  1133. Global Const $tip_noicon = 0
  1134. Global Const $tip_infoicon = 1
  1135. Global Const $tip_warningicon = 2
  1136. Global Const $tip_erroricon = 3
  1137. Global Const $tip_balloon = 1
  1138. Global Const $tip_center = 2
  1139. Global Const $tip_forcevisible = 4
  1140. Global Const $windows_noontop = 0
  1141. Global Const $windows_ontop = 1
  1142. Global Const $fc_nooverwrite = 0
  1143. Global Const $fc_overwrite = 1
  1144. Global Const $fc_createpath = 8
  1145. Global Const $ft_modified = 0
  1146. Global Const $ft_created = 1
  1147. Global Const $ft_accessed = 2
  1148. Global Const $ft_array = 0
  1149. Global Const $ft_string = 1
  1150. Global Const $fsf_createbutton = 1
  1151. Global Const $fsf_newdialog = 2
  1152. Global Const $fsf_editcontrol = 4
  1153. Global Const $ft_nonrecursive = 0
  1154. Global Const $ft_recursive = 1
  1155. Global Const $fo_read = 0
  1156. Global Const $fo_append = 1
  1157. Global Const $fo_overwrite = 2
  1158. Global Const $fo_createpath = 8
  1159. Global Const $fo_binary = 16
  1160. Global Const $fo_unicode = 32
  1161. Global Const $fo_utf16_le = 32
  1162. Global Const $fo_utf16_be = 64
  1163. Global Const $fo_utf8 = 128
  1164. Global Const $fo_utf8_nobom = 256
  1165. Global Const $fo_ansi = 512
  1166. Global Const $fo_utf16_le_nobom = 1024
  1167. Global Const $fo_utf16_be_nobom = 2048
  1168. Global Const $fo_utf8_full = 16384
  1169. Global Const $fo_fullfile_detect = 16384
  1170. Global Const $eof = -1
  1171. Global Const $fd_filemustexist = 1
  1172. Global Const $fd_pathmustexist = 2
  1173. Global Const $fd_multiselect = 4
  1174. Global Const $fd_promptcreatenew = 8
  1175. Global Const $fd_promptoverwrite = 16
  1176. Global Const $create_new = 1
  1177. Global Const $create_always = 2
  1178. Global Const $open_existing = 3
  1179. Global Const $open_always = 4
  1180. Global Const $truncate_existing = 5
  1181. Global Const $invalid_set_file_pointer = -1
  1182. Global Const $file_begin = 0
  1183. Global Const $file_current = 1
  1184. Global Const $file_end = 2
  1185. Global Const $file_attribute_readonly = 1
  1186. Global Const $file_attribute_hidden = 2
  1187. Global Const $file_attribute_system = 4
  1188. Global Const $file_attribute_directory = 16
  1189. Global Const $file_attribute_archive = 32
  1190. Global Const $file_attribute_device = 64
  1191. Global Const $file_attribute_normal = 128
  1192. Global Const $file_attribute_temporary = 256
  1193. Global Const $file_attribute_sparse_file = 512
  1194. Global Const $file_attribute_reparse_point = 1024
  1195. Global Const $file_attribute_compressed = 2048
  1196. Global Const $file_attribute_offline = 4096
  1197. Global Const $file_attribute_not_content_indexed = 8192
  1198. Global Const $file_attribute_encrypted = 16384
  1199. Global Const $file_share_read = 1
  1200. Global Const $file_share_write = 2
  1201. Global Const $file_share_delete = 4
  1202. Global Const $file_share_readwrite = BitOR($file_share_read, $file_share_write)
  1203. Global Const $file_share_any = BitOR($file_share_read, $file_share_write, $file_share_delete)
  1204. Global Const $generic_all = 268435456
  1205. Global Const $generic_execute = 536870912
  1206. Global Const $generic_write = 1073741824
  1207. Global Const $generic_read = -2147483648
  1208. Global Const $generic_readwrite = BitOR($generic_read, $generic_write)
  1209. Global Const $file_encoding_utf16le = 32
  1210. Global Const $fe_entire_utf8 = 1
  1211. Global Const $fe_partialfirst_utf8 = 2
  1212. Global Const $fn_fullpath = 0
  1213. Global Const $fn_relativepath = 1
  1214. Global Const $fv_comments = "Comments"
  1215. Global Const $fv_companyname = "CompanyName"
  1216. Global Const $fv_filedescription = "FileDescription"
  1217. Global Const $fv_fileversion = "FileVersion"
  1218. Global Const $fv_internalname = "InternalName"
  1219. Global Const $fv_legalcopyright = "LegalCopyright"
  1220. Global Const $fv_legaltrademarks = "LegalTrademarks"
  1221. Global Const $fv_originalfilename = "OriginalFilename"
  1222. Global Const $fv_productname = "ProductName"
  1223. Global Const $fv_productversion = "ProductVersion"
  1224. Global Const $fv_privatebuild = "PrivateBuild"
  1225. Global Const $fv_specialbuild = "SpecialBuild"
  1226. Global Const $frta_nocount = 0
  1227. Global Const $frta_count = 1
  1228. Global Const $frta_intarrays = 2
  1229. Global Const $frta_entiresplit = 4
  1230. Global Const $flta_filesfolders = 0
  1231. Global Const $flta_files = 1
  1232. Global Const $flta_folders = 2
  1233. Global Const $fltar_filesfolders = 0
  1234. Global Const $fltar_files = 1
  1235. Global Const $fltar_folders = 2
  1236. Global Const $fltar_nohidden = 4
  1237. Global Const $fltar_nosystem = 8
  1238. Global Const $fltar_nolink = 16
  1239. Global Const $fltar_norecur = 0
  1240. Global Const $fltar_recur = 1
  1241. Global Const $fltar_nosort = 0
  1242. Global Const $fltar_sort = 1
  1243. Global Const $fltar_fastsort = 2
  1244. Global Const $fltar_nopath = 0
  1245. Global Const $fltar_relpath = 1
  1246. Global Const $fltar_fullpath = 2
  1247. Global Const $mb_ok = 0
  1248. Global Const $mb_okcancel = 1
  1249. Global Const $mb_abortretryignore = 2
  1250. Global Const $mb_yesnocancel = 3
  1251. Global Const $mb_yesno = 4
  1252. Global Const $mb_retrycancel = 5
  1253. Global Const $mb_canceltrycontinue = 6
  1254. Global Const $mb_help = 16384
  1255. Global Const $mb_iconstop = 16
  1256. Global Const $mb_iconerror = 16
  1257. Global Const $mb_iconhand = 16
  1258. Global Const $mb_iconquestion = 32
  1259. Global Const $mb_iconexclamation = 48
  1260. Global Const $mb_iconwarning = 48
  1261. Global Const $mb_iconinformation = 64
  1262. Global Const $mb_iconasterisk = 64
  1263. Global Const $mb_usericon = 128
  1264. Global Const $mb_defbutton1 = 0
  1265. Global Const $mb_defbutton2 = 256
  1266. Global Const $mb_defbutton3 = 512
  1267. Global Const $mb_defbutton4 = 768
  1268. Global Const $mb_applmodal = 0
  1269. Global Const $mb_systemmodal = 4096
  1270. Global Const $mb_taskmodal = 8192
  1271. Global Const $mb_default_desktop_only = 131072
  1272. Global Const $mb_right = 524288
  1273. Global Const $mb_rtlreading = 1048576
  1274. Global Const $mb_setforeground = 65536
  1275. Global Const $mb_topmost = 262144
  1276. Global Const $mb_service_notification = 2097152
  1277. Global Const $mb_rightjustified = $mb_right
  1278. Global Const $idtimeout = -1
  1279. Global Const $idok = 1
  1280. Global Const $idcancel = 2
  1281. Global Const $idabort = 3
  1282. Global Const $idretry = 4
  1283. Global Const $idignore = 5
  1284. Global Const $idyes = 6
  1285. Global Const $idno = 7
  1286. Global Const $idclose = 8
  1287. Global Const $idhelp = 9
  1288. Global Const $idtryagain = 10
  1289. Global Const $idcontinue = 11
  1290. Global Const $str_nocasesense = 0
  1291. Global Const $str_casesense = 1
  1292. Global Const $str_nocasesensebasic = 2
  1293. Global Const $str_stripleading = 1
  1294. Global Const $str_striptrailing = 2
  1295. Global Const $str_stripspaces = 4
  1296. Global Const $str_stripall = 8
  1297. Global Const $str_chrsplit = 0
  1298. Global Const $str_entiresplit = 1
  1299. Global Const $str_nocount = 2
  1300. Global Const $str_regexpmatch = 0
  1301. Global Const $str_regexparraymatch = 1
  1302. Global Const $str_regexparrayfullmatch = 2
  1303. Global Const $str_regexparrayglobalmatch = 3
  1304. Global Const $str_regexparrayglobalfullmatch = 4
  1305. Global Const $str_endisstart = 0
  1306. Global Const $str_endnotstart = 1
  1307. Global Const $sb_ansi = 1
  1308. Global Const $sb_utf16le = 2
  1309. Global Const $sb_utf16be = 3
  1310. Global Const $sb_utf8 = 4
  1311. Global Const $se_utf16 = 0
  1312. Global Const $se_ansi = 1
  1313. Global Const $se_utf8 = 2
  1314. Global Const $str_utf16 = 0
  1315. Global Const $str_ucs2 = 1
  1316. Global Const $hgdi_error = Ptr(-1)
  1317. Global Const $invalid_handle_value = Ptr(-1)
  1318. Global Const $clr_invalid = -1
  1319. Global Const $null_brush = 5
  1320. Global Const $null_pen = 8
  1321. Global Const $black_brush = 4
  1322. Global Const $dkgray_brush = 3
  1323. Global Const $dc_brush = 18
  1324. Global Const $gray_brush = 2
  1325. Global Const $hollow_brush = $null_brush
  1326. Global Const $ltgray_brush = 1
  1327. Global Const $white_brush = 0
  1328. Global Const $black_pen = 7
  1329. Global Const $dc_pen = 19
  1330. Global Const $white_pen = 6
  1331. Global Const $ansi_fixed_font = 11
  1332. Global Const $ansi_var_font = 12
  1333. Global Const $device_default_font = 14
  1334. Global Const $default_gui_font = 17
  1335. Global Const $oem_fixed_font = 10
  1336. Global Const $system_font = 13
  1337. Global Const $system_fixed_font = 16
  1338. Global Const $default_palette = 15
  1339. Global Const $mb_precomposed = 1
  1340. Global Const $mb_composite = 2
  1341. Global Const $mb_useglyphchars = 4
  1342. Global Const $ulw_alpha = 2
  1343. Global Const $ulw_colorkey = 1
  1344. Global Const $ulw_opaque = 4
  1345. Global Const $ulw_ex_noresize = 8
  1346. Global Const $wh_callwndproc = 4
  1347. Global Const $wh_callwndprocret = 12
  1348. Global Const $wh_cbt = 5
  1349. Global Const $wh_debug = 9
  1350. Global Const $wh_foregroundidle = 11
  1351. Global Const $wh_getmessage = 3
  1352. Global Const $wh_journalplayback = 1
  1353. Global Const $wh_journalrecord = 0
  1354. Global Const $wh_keyboard = 2
  1355. Global Const $wh_keyboard_ll = 13
  1356. Global Const $wh_mouse = 7
  1357. Global Const $wh_mouse_ll = 14
  1358. Global Const $wh_msgfilter = -1
  1359. Global Const $wh_shell = 10
  1360. Global Const $wh_sysmsgfilter = 6
  1361. Global Const $wpf_asyncwindowplacement = 4
  1362. Global Const $wpf_restoretomaximized = 2
  1363. Global Const $wpf_setminposition = 1
  1364. Global Const $kf_extended = 256
  1365. Global Const $kf_altdown = 8192
  1366. Global Const $kf_up = 32768
  1367. Global Const $llkhf_extended = BitShift($kf_extended, 8)
  1368. Global Const $llkhf_injected = 16
  1369. Global Const $llkhf_altdown = BitShift($kf_altdown, 8)
  1370. Global Const $llkhf_up = BitShift($kf_up, 8)
  1371. Global Const $ofn_allowmultiselect = 512
  1372. Global Const $ofn_createprompt = 8192
  1373. Global Const $ofn_dontaddtorecent = 33554432
  1374. Global Const $ofn_enablehook = 32
  1375. Global Const $ofn_enableincludenotify = 4194304
  1376. Global Const $ofn_enablesizing = 8388608
  1377. Global Const $ofn_enabletemplate = 64
  1378. Global Const $ofn_enabletemplatehandle = 128
  1379. Global Const $ofn_explorer = 524288
  1380. Global Const $ofn_extensiondifferent = 1024
  1381. Global Const $ofn_filemustexist = 4096
  1382. Global Const $ofn_forceshowhidden = 268435456
  1383. Global Const $ofn_hidereadonly = 4
  1384. Global Const $ofn_longnames = 2097152
  1385. Global Const $ofn_nochangedir = 8
  1386. Global Const $ofn_nodereferencelinks = 1048576
  1387. Global Const $ofn_nolongnames = 262144
  1388. Global Const $ofn_nonetworkbutton = 131072
  1389. Global Const $ofn_noreadonlyreturn = 32768
  1390. Global Const $ofn_notestfilecreate = 65536
  1391. Global Const $ofn_novalidate = 256
  1392. Global Const $ofn_overwriteprompt = 2
  1393. Global Const $ofn_pathmustexist = 2048
  1394. Global Const $ofn_readonly = 1
  1395. Global Const $ofn_shareaware = 16384
  1396. Global Const $ofn_showhelp = 16
  1397. Global Const $ofn_ex_noplacesbar = 1
  1398. Global Const $tmpf_fixed_pitch = 1
  1399. Global Const $tmpf_vector = 2
  1400. Global Const $tmpf_truetype = 4
  1401. Global Const $tmpf_device = 8
  1402. Global Const $duplicate_close_source = 1
  1403. Global Const $duplicate_same_access = 2
  1404. Global Const $di_mask = 1
  1405. Global Const $di_image = 2
  1406. Global Const $di_normal = 3
  1407. Global Const $di_compat = 4
  1408. Global Const $di_defaultsize = 8
  1409. Global Const $di_nomirror = 16
  1410. Global Const $display_device_attached_to_desktop = 1
  1411. Global Const $display_device_multi_driver = 2
  1412. Global Const $display_device_primary_device = 4
  1413. Global Const $display_device_mirroring_driver = 8
  1414. Global Const $display_device_vga_compatible = 16
  1415. Global Const $display_device_removable = 32
  1416. Global Const $display_device_disconnect = 33554432
  1417. Global Const $display_device_remote = 67108864
  1418. Global Const $display_device_modespruned = 134217728
  1419. Global Const $flashw_caption = 1
  1420. Global Const $flashw_tray = 2
  1421. Global Const $flashw_timer = 4
  1422. Global Const $flashw_timernofg = 12
  1423. Global Const $format_message_allocate_buffer = 256
  1424. Global Const $format_message_ignore_inserts = 512
  1425. Global Const $format_message_from_string = 1024
  1426. Global Const $format_message_from_hmodule = 2048
  1427. Global Const $format_message_from_system = 4096
  1428. Global Const $format_message_argument_array = 8192
  1429. Global Const $gw_hwndfirst = 0
  1430. Global Const $gw_hwndlast = 1
  1431. Global Const $gw_hwndnext = 2
  1432. Global Const $gw_hwndprev = 3
  1433. Global Const $gw_owner = 4
  1434. Global Const $gw_child = 5
  1435. Global Const $gw_enabledpopup = 6
  1436. Global Const $gwl_wndproc = -4
  1437. Global Const $gwl_hinstance = -6
  1438. Global Const $gwl_hwndparent = -8
  1439. Global Const $gwl_id = -12
  1440. Global Const $gwl_style = -16
  1441. Global Const $gwl_exstyle = -20
  1442. Global Const $gwl_userdata = -21
  1443. Global Const $std_cut = 0
  1444. Global Const $std_copy = 1
  1445. Global Const $std_paste = 2
  1446. Global Const $std_undo = 3
  1447. Global Const $std_redow = 4
  1448. Global Const $std_delete = 5
  1449. Global Const $std_filenew = 6
  1450. Global Const $std_fileopen = 7
  1451. Global Const $std_filesave = 8
  1452. Global Const $std_printpre = 9
  1453. Global Const $std_properties = 10
  1454. Global Const $std_help = 11
  1455. Global Const $std_find = 12
  1456. Global Const $std_replace = 13
  1457. Global Const $std_print = 14
  1458. Global Const $image_bitmap = 0
  1459. Global Const $image_icon = 1
  1460. Global Const $image_cursor = 2
  1461. Global Const $image_enhmetafile = 3
  1462. Global Const $kb_sendspecial = 0
  1463. Global Const $kb_sendraw = 1
  1464. Global Const $kb_capsoff = 0
  1465. Global Const $kb_capson = 1
  1466. Global Const $dont_resolve_dll_references = 1
  1467. Global Const $load_library_as_datafile = 2
  1468. Global Const $load_with_altered_search_path = 8
  1469. Global Const $load_ignore_code_authz_level = 16
  1470. Global Const $load_library_as_datafile_exclusive = 64
  1471. Global Const $load_library_as_image_resource = 32
  1472. Global Const $load_library_search_application_dir = 512
  1473. Global Const $load_library_search_default_dirs = 4096
  1474. Global Const $load_library_search_dll_load_dir = 256
  1475. Global Const $load_library_search_system32 = 2048
  1476. Global Const $load_library_search_user_dirs = 1024
  1477. Global Const $s_ok = 0
  1478. Global Const $e_abort = -2147467260
  1479. Global Const $e_accessdenied = -2147024891
  1480. Global Const $e_fail = -2147467259
  1481. Global Const $e_handle = -2147024890
  1482. Global Const $e_invalidarg = -2147024809
  1483. Global Const $e_nointerface = -2147467262
  1484. Global Const $e_notimpl = -2147467263
  1485. Global Const $e_outofmemory = -2147024882
  1486. Global Const $e_pointer = -2147467261
  1487. Global Const $e_unexpected = -2147418113
  1488. Global Const $lr_defaultcolor = 0
  1489. Global Const $lr_monochrome = 1
  1490. Global Const $lr_color = 2
  1491. Global Const $lr_copyreturnorg = 4
  1492. Global Const $lr_copydeleteorg = 8
  1493. Global Const $lr_loadfromfile = 16
  1494. Global Const $lr_loadtransparent = 32
  1495. Global Const $lr_defaultsize = 64
  1496. Global Const $lr_vgacolor = 128
  1497. Global Const $lr_loadmap3dcolors = 4096
  1498. Global Const $lr_createdibsection = 8192
  1499. Global Const $lr_copyfromresource = 16384
  1500. Global Const $lr_shared = 32768
  1501. Global Const $obm_trtype = 32732
  1502. Global Const $obm_lfarrowi = 32734
  1503. Global Const $obm_rgarrowi = 32735
  1504. Global Const $obm_dnarrowi = 32736
  1505. Global Const $obm_uparrowi = 32737
  1506. Global Const $obm_combo = 32738
  1507. Global Const $obm_mnarrow = 32739
  1508. Global Const $obm_lfarrowd = 32740
  1509. Global Const $obm_rgarrowd = 32741
  1510. Global Const $obm_dnarrowd = 32742
  1511. Global Const $obm_uparrowd = 32743
  1512. Global Const $obm_restored = 32744
  1513. Global Const $obm_zoomd = 32745
  1514. Global Const $obm_reduced = 32746
  1515. Global Const $obm_restore = 32747
  1516. Global Const $obm_zoom = 32748
  1517. Global Const $obm_reduce = 32749
  1518. Global Const $obm_lfarrow = 32750
  1519. Global Const $obm_rgarrow = 32751
  1520. Global Const $obm_dnarrow = 32752
  1521. Global Const $obm_uparrow = 32753
  1522. Global Const $obm_close = 32754
  1523. Global Const $obm_old_restore = 32755
  1524. Global Const $obm_old_zoom = 32756
  1525. Global Const $obm_old_reduce = 32757
  1526. Global Const $obm_btncorners = 32758
  1527. Global Const $obm_checkboxes = 32759
  1528. Global Const $obm_check = 32760
  1529. Global Const $obm_btsize = 32761
  1530. Global Const $obm_old_lfarrow = 32762
  1531. Global Const $obm_old_rgarrow = 32763
  1532. Global Const $obm_old_dnarrow = 32764
  1533. Global Const $obm_old_uparrow = 32765
  1534. Global Const $obm_size = 32766
  1535. Global Const $obm_old_close = 32767
  1536. Global Const $oic_sample = 32512
  1537. Global Const $oic_hand = 32513
  1538. Global Const $oic_ques = 32514
  1539. Global Const $oic_bang = 32515
  1540. Global Const $oic_note = 32516
  1541. Global Const $oic_winlogo = 32517
  1542. Global Const $oic_warning = $oic_bang
  1543. Global Const $oic_error = $oic_hand
  1544. Global Const $oic_information = $oic_note
  1545. Global $__g_ainprocess_winapi[64][2] = [[0, 0]]
  1546. Global $__g_awinlist_winapi[64][2] = [[0, 0]]
  1547. Global Const $__winapiconstant_wm_setfont = 48
  1548. Global Const $__winapiconstant_fw_normal = 400
  1549. Global Const $__winapiconstant_default_charset = 1
  1550. Global Const $__winapiconstant_out_default_precis = 0
  1551. Global Const $__winapiconstant_clip_default_precis = 0
  1552. Global Const $__winapiconstant_default_quality = 0
  1553. Global Const $__winapiconstant_logpixelsx = 88
  1554. Global Const $__winapiconstant_logpixelsy = 90
  1555. Global Const $tagcursorinfo = "dword Size;dword Flags;handle hCursor;" & $tagpoint
  1556. Global Const $tagdisplay_device = "dword Size;wchar Name[32];wchar String[128];dword Flags;wchar ID[128];wchar Key[128]"
  1557. Global Const $tagflashwinfo = "uint Size;hwnd hWnd;dword Flags;uint Count;dword TimeOut"
  1558. Global Const $tagiconinfo = "bool Icon;dword XHotSpot;dword YHotSpot;handle hMask;handle hColor"
  1559. Global Const $tagmemorystatusex = "dword Length;dword MemoryLoad;" & "uint64 TotalPhys;uint64 AvailPhys;uint64 TotalPageFile;uint64 AvailPageFile;" & "uint64 TotalVirtual;uint64 AvailVirtual;uint64 AvailExtendedVirtual"
  1560.  
  1561. Func _winapi_attachconsole($ipid = -1)
  1562.     Local $aresult = DllCall("kernel32.dll", "bool", "AttachConsole", "dword", $ipid)
  1563.     If @error Then Return SetError(@error, @extended, False)
  1564.     Return $aresult[0]
  1565. EndFunc
  1566.  
  1567. Func _winapi_attachthreadinput($iattach, $iattachto, $battach)
  1568.     Local $aresult = DllCall("user32.dll", "bool", "AttachThreadInput", "dword", $iattach, "dword", $iattachto, "bool", $battach)
  1569.     If @error Then Return SetError(@error, @extended, False)
  1570.     Return $aresult[0]
  1571. EndFunc
  1572.  
  1573. Func _winapi_beep($ifreq = 500, $iduration = 1000)
  1574.     Local $aresult = DllCall("kernel32.dll", "bool", "Beep", "dword", $ifreq, "dword", $iduration)
  1575.     If @error Then Return SetError(@error, @extended, False)
  1576.     Return $aresult[0]
  1577. EndFunc
  1578.  
  1579. Func _winapi_bitblt($hdestdc, $ixdest, $iydest, $iwidth, $iheight, $hsrcdc, $ixsrc, $iysrc, $irop)
  1580.     Local $aresult = DllCall("gdi32.dll", "bool", "BitBlt", "handle", $hdestdc, "int", $ixdest, "int", $iydest, "int", $iwidth, "int", $iheight, "handle", $hsrcdc, "int", $ixsrc, "int", $iysrc, "dword", $irop)
  1581.     If @error Then Return SetError(@error, @extended, False)
  1582.     Return $aresult[0]
  1583. EndFunc
  1584.  
  1585. Func _winapi_callnexthookex($hhook, $icode, $wparam, $lparam)
  1586.     Local $aresult = DllCall("user32.dll", "lresult", "CallNextHookEx", "handle", $hhook, "int", $icode, "wparam", $wparam, "lparam", $lparam)
  1587.     If @error Then Return SetError(@error, @extended, -1)
  1588.     Return $aresult[0]
  1589. EndFunc
  1590.  
  1591. Func _winapi_callwindowproc($pprevwndfunc, $hwnd, $imsg, $wparam, $lparam)
  1592.     Local $aresult = DllCall("user32.dll", "lresult", "CallWindowProc", "ptr", $pprevwndfunc, "hwnd", $hwnd, "uint", $imsg, "wparam", $wparam, "lparam", $lparam)
  1593.     If @error Then Return SetError(@error, @extended, -1)
  1594.     Return $aresult[0]
  1595. EndFunc
  1596.  
  1597. Func _winapi_clienttoscreen($hwnd, ByRef $tpoint)
  1598.     Local $aret = DllCall("user32.dll", "bool", "ClientToScreen", "hwnd", $hwnd, "struct*", $tpoint)
  1599.     If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
  1600.     Return $tpoint
  1601. EndFunc
  1602.  
  1603. Func _winapi_closehandle($hobject)
  1604.     Local $aresult = DllCall("kernel32.dll", "bool", "CloseHandle", "handle", $hobject)
  1605.     If @error Then Return SetError(@error, @extended, False)
  1606.     Return $aresult[0]
  1607. EndFunc
  1608.  
  1609. Func _winapi_combinergn($hrgndest, $hrgnsrc1, $hrgnsrc2, $icombinemode)
  1610.     Local $aresult = DllCall("gdi32.dll", "int", "CombineRgn", "handle", $hrgndest, "handle", $hrgnsrc1, "handle", $hrgnsrc2, "int", $icombinemode)
  1611.     If @error Then Return SetError(@error, @extended, 0)
  1612.     Return $aresult[0]
  1613. EndFunc
  1614.  
  1615. Func _winapi_commdlgextendederror()
  1616.     Local Const $cderr_dialogfailure = 65535
  1617.     Local Const $cderr_findresfailure = 6
  1618.     Local Const $cderr_initialization = 2
  1619.     Local Const $cderr_loadresfailure = 7
  1620.     Local Const $cderr_loadstrfailure = 5
  1621.     Local Const $cderr_lockresfailure = 8
  1622.     Local Const $cderr_memallocfailure = 9
  1623.     Local Const $cderr_memlockfailure = 10
  1624.     Local Const $cderr_nohinstance = 4
  1625.     Local Const $cderr_nohook = 11
  1626.     Local Const $cderr_notemplate = 3
  1627.     Local Const $cderr_registermsgfail = 12
  1628.     Local Const $cderr_structsize = 1
  1629.     Local Const $fnerr_buffertoosmall = 12291
  1630.     Local Const $fnerr_invalidfilename = 12290
  1631.     Local Const $fnerr_subclassfailure = 12289
  1632.     Local $aresult = DllCall("comdlg32.dll", "dword", "CommDlgExtendedError")
  1633.     If NOT @error Then
  1634.         Switch $aresult[0]
  1635.             Case $cderr_dialogfailure
  1636.                 Return SetError($aresult[0], 0, "The dialog box could not be created." & @LF & "The common dialog box function's call to the DialogBox function failed." & @LF & "For example, this error occurs if the common dialog box call specifies an invalid window handle.")
  1637.             Case $cderr_findresfailure
  1638.                 Return SetError($aresult[0], 0, "The common dialog box function failed to find a specified resource.")
  1639.             Case $cderr_initialization
  1640.                 Return SetError($aresult[0], 0, "The common dialog box function failed during initialization." & @LF & "This error often occurs when sufficient memory is not available.")
  1641.             Case $cderr_loadresfailure
  1642.                 Return SetError($aresult[0], 0, "The common dialog box function failed to load a specified resource.")
  1643.             Case $cderr_loadstrfailure
  1644.                 Return SetError($aresult[0], 0, "The common dialog box function failed to load a specified string.")
  1645.             Case $cderr_lockresfailure
  1646.                 Return SetError($aresult[0], 0, "The common dialog box function failed to lock a specified resource.")
  1647.             Case $cderr_memallocfailure
  1648.                 Return SetError($aresult[0], 0, "The common dialog box function was unable to allocate memory for internal structures.")
  1649.             Case $cderr_memlockfailure
  1650.                 Return SetError($aresult[0], 0, "The common dialog box function was unable to lock the memory associated with a handle.")
  1651.             Case $cderr_nohinstance
  1652.                 Return SetError($aresult[0], 0, "The ENABLETEMPLATE flag was set in the Flags member of the initialization structure for the corresponding common dialog box," & @LF & "but you failed to provide a corresponding instance handle.")
  1653.             Case $cderr_nohook
  1654.                 Return SetError($aresult[0], 0, "The ENABLEHOOK flag was set in the Flags member of the initialization structure for the corresponding common dialog box," & @LF & "but you failed to provide a pointer to a corresponding hook procedure.")
  1655.             Case $cderr_notemplate
  1656.                 Return SetError($aresult[0], 0, "The ENABLETEMPLATE flag was set in the Flags member of the initialization structure for the corresponding common dialog box," & @LF & "but you failed to provide a corresponding template.")
  1657.             Case $cderr_registermsgfail
  1658.                 Return SetError($aresult[0], 0, "The RegisterWindowMessage function returned an error code when it was called by the common dialog box function.")
  1659.             Case $cderr_structsize
  1660.                 Return SetError($aresult[0], 0, "The lStructSize member of the initialization structure for the corresponding common dialog box is invalid")
  1661.             Case $fnerr_buffertoosmall
  1662.                 Return SetError($aresult[0], 0, "The buffer pointed to by the lpstrFile member of the OPENFILENAME structure is too small for the file name specified by the user." & @LF & "The first two bytes of the lpstrFile buffer contain an integer value specifying the size, in TCHARs, required to receive the full name.")
  1663.             Case $fnerr_invalidfilename
  1664.                 Return SetError($aresult[0], 0, "A file name is invalid.")
  1665.             Case $fnerr_subclassfailure
  1666.                 Return SetError($aresult[0], 0, "An attempt to subclass a list box failed because sufficient memory was not available.")
  1667.         EndSwitch
  1668.     EndIf
  1669.     Return SetError(@error, @extended, "0x" & Hex($aresult[0]))
  1670. EndFunc
  1671.  
  1672. Func _winapi_copyicon($hicon)
  1673.     Local $aresult = DllCall("user32.dll", "handle", "CopyIcon", "handle", $hicon)
  1674.     If @error Then Return SetError(@error, @extended, 0)
  1675.     Return $aresult[0]
  1676. EndFunc
  1677.  
  1678. Func _winapi_createbitmap($iwidth, $iheight, $iplanes = 1, $ibitsperpel = 1, $pbits = 0)
  1679.     Local $aresult = DllCall("gdi32.dll", "handle", "CreateBitmap", "int", $iwidth, "int", $iheight, "uint", $iplanes, "uint", $ibitsperpel, "struct*", $pbits)
  1680.     If @error Then Return SetError(@error, @extended, 0)
  1681.     Return $aresult[0]
  1682. EndFunc
  1683.  
  1684. Func _winapi_createcompatiblebitmap($hdc, $iwidth, $iheight)
  1685.     Local $aresult = DllCall("gdi32.dll", "handle", "CreateCompatibleBitmap", "handle", $hdc, "int", $iwidth, "int", $iheight)
  1686.     If @error Then Return SetError(@error, @extended, 0)
  1687.     Return $aresult[0]
  1688. EndFunc
  1689.  
  1690. Func _winapi_createcompatibledc($hdc)
  1691.     Local $aresult = DllCall("gdi32.dll", "handle", "CreateCompatibleDC", "handle", $hdc)
  1692.     If @error Then Return SetError(@error, @extended, 0)
  1693.     Return $aresult[0]
  1694. EndFunc
  1695.  
  1696. Func _winapi_createevent($tattributes = 0, $bmanualreset = True, $binitialstate = True, $sname = "")
  1697.     Local $snametype = "wstr"
  1698.     If $sname = "" Then
  1699.         $sname = 0
  1700.         $snametype = "ptr"
  1701.     EndIf
  1702.     Local $aresult = DllCall("kernel32.dll", "handle", "CreateEventW", "struct*", $tattributes, "bool", $bmanualreset, "bool", $binitialstate, $snametype, $sname)
  1703.     If @error Then Return SetError(@error, @extended, 0)
  1704.     Return $aresult[0]
  1705. EndFunc
  1706.  
  1707. Func _winapi_createfile($sfilename, $icreation, $iaccess = 4, $ishare = 0, $iattributes = 0, $tsecurity = 0)
  1708.     Local $ida = 0, $ism = 0, $icd = 0, $ifa = 0
  1709.     If BitAND($iaccess, 1) <> 0 Then $ida = BitOR($ida, $generic_execute)
  1710.     If BitAND($iaccess, 2) <> 0 Then $ida = BitOR($ida, $generic_read)
  1711.     If BitAND($iaccess, 4) <> 0 Then $ida = BitOR($ida, $generic_write)
  1712.     If BitAND($ishare, 1) <> 0 Then $ism = BitOR($ism, $file_share_delete)
  1713.     If BitAND($ishare, 2) <> 0 Then $ism = BitOR($ism, $file_share_read)
  1714.     If BitAND($ishare, 4) <> 0 Then $ism = BitOR($ism, $file_share_write)
  1715.     Switch $icreation
  1716.         Case 0
  1717.             $icd = $create_new
  1718.         Case 1
  1719.             $icd = $create_always
  1720.         Case 2
  1721.             $icd = $open_existing
  1722.         Case 3
  1723.             $icd = $open_always
  1724.         Case 4
  1725.             $icd = $truncate_existing
  1726.     EndSwitch
  1727.     If BitAND($iattributes, 1) <> 0 Then $ifa = BitOR($ifa, $file_attribute_archive)
  1728.     If BitAND($iattributes, 2) <> 0 Then $ifa = BitOR($ifa, $file_attribute_hidden)
  1729.     If BitAND($iattributes, 4) <> 0 Then $ifa = BitOR($ifa, $file_attribute_readonly)
  1730.     If BitAND($iattributes, 8) <> 0 Then $ifa = BitOR($ifa, $file_attribute_system)
  1731.     Local $aresult = DllCall("kernel32.dll", "handle", "CreateFileW", "wstr", $sfilename, "dword", $ida, "dword", $ism, "struct*", $tsecurity, "dword", $icd, "dword", $ifa, "ptr", 0)
  1732.     If @error OR ($aresult[0] = $invalid_handle_value) Then Return SetError(@error, @extended, 0)
  1733.     Return $aresult[0]
  1734. EndFunc
  1735.  
  1736. Func _winapi_createfont($iheight, $iwidth, $iescape = 0, $iorientn = 0, $iweight = $__winapiconstant_fw_normal, $bitalic = False, $bunderline = False, $bstrikeout = False, $icharset = $__winapiconstant_default_charset, $ioutputprec = $__winapiconstant_out_default_precis, $iclipprec = $__winapiconstant_clip_default_precis, $iquality = $__winapiconstant_default_quality, $ipitch = 0, $sface = "Arial")
  1737.     Local $aresult = DllCall("gdi32.dll", "handle", "CreateFontW", "int", $iheight, "int", $iwidth, "int", $iescape, "int", $iorientn, "int", $iweight, "dword", $bitalic, "dword", $bunderline, "dword", $bstrikeout, "dword", $icharset, "dword", $ioutputprec, "dword", $iclipprec, "dword", $iquality, "dword", $ipitch, "wstr", $sface)
  1738.     If @error Then Return SetError(@error, @extended, 0)
  1739.     Return $aresult[0]
  1740. EndFunc
  1741.  
  1742. Func _winapi_createfontindirect($tlogfont)
  1743.     Local $aresult = DllCall("gdi32.dll", "handle", "CreateFontIndirectW", "struct*", $tlogfont)
  1744.     If @error Then Return SetError(@error, @extended, 0)
  1745.     Return $aresult[0]
  1746. EndFunc
  1747.  
  1748. Func _winapi_createpen($ipenstyle, $iwidth, $icolor)
  1749.     Local $aresult = DllCall("gdi32.dll", "handle", "CreatePen", "int", $ipenstyle, "int", $iwidth, "INT", $icolor)
  1750.     If @error Then Return SetError(@error, @extended, 0)
  1751.     Return $aresult[0]
  1752. EndFunc
  1753.  
  1754. Func _winapi_createprocess($sappname, $scommand, $tsecurity, $tthread, $binherit, $iflags, $penviron, $sdir, $tstartupinfo, $tprocess)
  1755.     Local $tcommand = 0
  1756.     Local $sappnametype = "wstr", $sdirtype = "wstr"
  1757.     If $sappname = "" Then
  1758.         $sappnametype = "ptr"
  1759.         $sappname = 0
  1760.     EndIf
  1761.     If $scommand <> "" Then
  1762.         $tcommand = DllStructCreate("wchar Text[" & 260 + 1 & "]")
  1763.         DllStructSetData($tcommand, "Text", $scommand)
  1764.     EndIf
  1765.     If $sdir = "" Then
  1766.         $sdirtype = "ptr"
  1767.         $sdir = 0
  1768.     EndIf
  1769.     Local $aresult = DllCall("kernel32.dll", "bool", "CreateProcessW", $sappnametype, $sappname, "struct*", $tcommand, "struct*", $tsecurity, "struct*", $tthread, "bool", $binherit, "dword", $iflags, "struct*", $penviron, $sdirtype, $sdir, "struct*", $tstartupinfo, "struct*", $tprocess)
  1770.     If @error Then Return SetError(@error, @extended, False)
  1771.     Return $aresult[0]
  1772. EndFunc
  1773.  
  1774. Func _winapi_createrectrgn($ileftrect, $itoprect, $irightrect, $ibottomrect)
  1775.     Local $aresult = DllCall("gdi32.dll", "handle", "CreateRectRgn", "int", $ileftrect, "int", $itoprect, "int", $irightrect, "int", $ibottomrect)
  1776.     If @error Then Return SetError(@error, @extended, 0)
  1777.     Return $aresult[0]
  1778. EndFunc
  1779.  
  1780. Func _winapi_createroundrectrgn($ileftrect, $itoprect, $irightrect, $ibottomrect, $iwidthellipse, $iheightellipse)
  1781.     Local $aresult = DllCall("gdi32.dll", "handle", "CreateRoundRectRgn", "int", $ileftrect, "int", $itoprect, "int", $irightrect, "int", $ibottomrect, "int", $iwidthellipse, "int", $iheightellipse)
  1782.     If @error Then Return SetError(@error, @extended, 0)
  1783.     Return $aresult[0]
  1784. EndFunc
  1785.  
  1786. Func _winapi_createsolidbitmap($hwnd, $icolor, $iwidth, $iheight, $brgb = 1)
  1787.     Local $hdc = _winapi_getdc($hwnd)
  1788.     Local $hdestdc = _winapi_createcompatibledc($hdc)
  1789.     Local $hbitmap = _winapi_createcompatiblebitmap($hdc, $iwidth, $iheight)
  1790.     Local $hold = _winapi_selectobject($hdestdc, $hbitmap)
  1791.     Local $trect = DllStructCreate($tagrect)
  1792.     DllStructSetData($trect, 1, 0)
  1793.     DllStructSetData($trect, 2, 0)
  1794.     DllStructSetData($trect, 3, $iwidth)
  1795.     DllStructSetData($trect, 4, $iheight)
  1796.     If $brgb Then
  1797.         $icolor = BitOR(BitAND($icolor, 65280), BitShift(BitAND($icolor, 255), -16), BitShift(BitAND($icolor, 16711680), 16))
  1798.     EndIf
  1799.     Local $hbrush = _winapi_createsolidbrush($icolor)
  1800.     If NOT _winapi_fillrect($hdestdc, $trect, $hbrush) Then
  1801.         _winapi_deleteobject($hbitmap)
  1802.         $hbitmap = 0
  1803.     EndIf
  1804.     _winapi_deleteobject($hbrush)
  1805.     _winapi_releasedc($hwnd, $hdc)
  1806.     _winapi_selectobject($hdestdc, $hold)
  1807.     _winapi_deletedc($hdestdc)
  1808.     If NOT $hbitmap Then Return SetError(1, 0, 0)
  1809.     Return $hbitmap
  1810. EndFunc
  1811.  
  1812. Func _winapi_createsolidbrush($icolor)
  1813.     Local $aresult = DllCall("gdi32.dll", "handle", "CreateSolidBrush", "INT", $icolor)
  1814.     If @error Then Return SetError(@error, @extended, 0)
  1815.     Return $aresult[0]
  1816. EndFunc
  1817.  
  1818. Func _winapi_createwindowex($iexstyle, $sclass, $sname, $istyle, $ix, $iy, $iwidth, $iheight, $hparent, $hmenu = 0, $hinstance = 0, $pparam = 0)
  1819.     If $hinstance = 0 Then $hinstance = _winapi_getmodulehandle("")
  1820.     Local $aresult = DllCall("user32.dll", "hwnd", "CreateWindowExW", "dword", $iexstyle, "wstr", $sclass, "wstr", $sname, "dword", $istyle, "int", $ix, "int", $iy, "int", $iwidth, "int", $iheight, "hwnd", $hparent, "handle", $hmenu, "handle", $hinstance, "struct*", $pparam)
  1821.     If @error Then Return SetError(@error, @extended, 0)
  1822.     Return $aresult[0]
  1823. EndFunc
  1824.  
  1825. Func _winapi_defwindowproc($hwnd, $imsg, $wparam, $lparam)
  1826.     Local $aresult = DllCall("user32.dll", "lresult", "DefWindowProc", "hwnd", $hwnd, "uint", $imsg, "wparam", $wparam, "lparam", $lparam)
  1827.     If @error Then Return SetError(@error, @extended, 0)
  1828.     Return $aresult[0]
  1829. EndFunc
  1830.  
  1831. Func _winapi_deletedc($hdc)
  1832.     Local $aresult = DllCall("gdi32.dll", "bool", "DeleteDC", "handle", $hdc)
  1833.     If @error Then Return SetError(@error, @extended, False)
  1834.     Return $aresult[0]
  1835. EndFunc
  1836.  
  1837. Func _winapi_deleteobject($hobject)
  1838.     Local $aresult = DllCall("gdi32.dll", "bool", "DeleteObject", "handle", $hobject)
  1839.     If @error Then Return SetError(@error, @extended, False)
  1840.     Return $aresult[0]
  1841. EndFunc
  1842.  
  1843. Func _winapi_destroyicon($hicon)
  1844.     Local $aresult = DllCall("user32.dll", "bool", "DestroyIcon", "handle", $hicon)
  1845.     If @error Then Return SetError(@error, @extended, False)
  1846.     Return $aresult[0]
  1847. EndFunc
  1848.  
  1849. Func _winapi_destroywindow($hwnd)
  1850.     Local $aresult = DllCall("user32.dll", "bool", "DestroyWindow", "hwnd", $hwnd)
  1851.     If @error Then Return SetError(@error, @extended, False)
  1852.     Return $aresult[0]
  1853. EndFunc
  1854.  
  1855. Func _winapi_drawedge($hdc, $trect, $iedgetype, $iflags)
  1856.     Local $aresult = DllCall("user32.dll", "bool", "DrawEdge", "handle", $hdc, "struct*", $trect, "uint", $iedgetype, "uint", $iflags)
  1857.     If @error Then Return SetError(@error, @extended, False)
  1858.     Return $aresult[0]
  1859. EndFunc
  1860.  
  1861. Func _winapi_drawframecontrol($hdc, $trect, $itype, $istate)
  1862.     Local $aresult = DllCall("user32.dll", "bool", "DrawFrameControl", "handle", $hdc, "struct*", $trect, "uint", $itype, "uint", $istate)
  1863.     If @error Then Return SetError(@error, @extended, False)
  1864.     Return $aresult[0]
  1865. EndFunc
  1866.  
  1867. Func _winapi_drawicon($hdc, $ix, $iy, $hicon)
  1868.     Local $aresult = DllCall("user32.dll", "bool", "DrawIcon", "handle", $hdc, "int", $ix, "int", $iy, "handle", $hicon)
  1869.     If @error Then Return SetError(@error, @extended, False)
  1870.     Return $aresult[0]
  1871. EndFunc
  1872.  
  1873. Func _winapi_drawiconex($hdc, $ix, $iy, $hicon, $iwidth = 0, $iheight = 0, $istep = 0, $hbrush = 0, $iflags = 3)
  1874.     Local $ioptions
  1875.     Switch $iflags
  1876.         Case 1
  1877.             $ioptions = $di_mask
  1878.         Case 2
  1879.             $ioptions = $di_image
  1880.         Case 3
  1881.             $ioptions = $di_normal
  1882.         Case 4
  1883.             $ioptions = $di_compat
  1884.         Case 5
  1885.             $ioptions = $di_defaultsize
  1886.         Case Else
  1887.             $ioptions = $di_nomirror
  1888.     EndSwitch
  1889.     Local $aresult = DllCall("user32.dll", "bool", "DrawIconEx", "handle", $hdc, "int", $ix, "int", $iy, "handle", $hicon, "int", $iwidth, "int", $iheight, "uint", $istep, "handle", $hbrush, "uint", $ioptions)
  1890.     If @error Then Return SetError(@error, @extended, False)
  1891.     Return $aresult[0]
  1892. EndFunc
  1893.  
  1894. Func _winapi_drawline($hdc, $ix1, $iy1, $ix2, $iy2)
  1895.     _winapi_moveto($hdc, $ix1, $iy1)
  1896.     If @error Then Return SetError(@error, @extended, False)
  1897.     _winapi_lineto($hdc, $ix2, $iy2)
  1898.     If @error Then Return SetError(@error + 10, @extended, False)
  1899.     Return True
  1900. EndFunc
  1901.  
  1902. Func _winapi_drawtext($hdc, $stext, ByRef $trect, $iflags)
  1903.     Local $aresult = DllCall("user32.dll", "int", "DrawTextW", "handle", $hdc, "wstr", $stext, "int", -1, "struct*", $trect, "uint", $iflags)
  1904.     If @error Then Return SetError(@error, @extended, 0)
  1905.     Return $aresult[0]
  1906. EndFunc
  1907.  
  1908. Func _winapi_duplicatehandle($hsourceprocesshandle, $hsourcehandle, $htargetprocesshandle, $idesiredaccess, $iinherithandle, $ioptions)
  1909.     Local $aresult = DllCall("kernel32.dll", "bool", "DuplicateHandle", "handle", $hsourceprocesshandle, "handle", $hsourcehandle, "handle", $htargetprocesshandle, "handle*", 0, "dword", $idesiredaccess, "bool", $iinherithandle, "dword", $ioptions)
  1910.     If @error OR NOT $aresult[0] Then Return SetError(@error, @extended, 0)
  1911.     Return $aresult[4]
  1912. EndFunc
  1913.  
  1914. Func _winapi_enablewindow($hwnd, $benable = True)
  1915.     Local $aresult = DllCall("user32.dll", "bool", "EnableWindow", "hwnd", $hwnd, "bool", $benable)
  1916.     If @error Then Return SetError(@error, @extended, False)
  1917.     Return $aresult[0]
  1918. EndFunc
  1919.  
  1920. Func _winapi_enumdisplaydevices($sdevice, $idevnum)
  1921.     Local $tname = 0, $iflags = 0, $adevice[5]
  1922.     If $sdevice <> "" Then
  1923.         $tname = DllStructCreate("wchar Text[" & StringLen($sdevice) + 1 & "]")
  1924.         DllStructSetData($tname, "Text", $sdevice)
  1925.     EndIf
  1926.     Local $tdevice = DllStructCreate($tagdisplay_device)
  1927.     Local $idevice = DllStructGetSize($tdevice)
  1928.     DllStructSetData($tdevice, "Size", $idevice)
  1929.     Local $aret = DllCall("user32.dll", "bool", "EnumDisplayDevicesW", "struct*", $tname, "dword", $idevnum, "struct*", $tdevice, "dword", 1)
  1930.     If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
  1931.     Local $in = DllStructGetData($tdevice, "Flags")
  1932.     If BitAND($in, $display_device_attached_to_desktop) <> 0 Then $iflags = BitOR($iflags, 1)
  1933.     If BitAND($in, $display_device_primary_device) <> 0 Then $iflags = BitOR($iflags, 2)
  1934.     If BitAND($in, $display_device_mirroring_driver) <> 0 Then $iflags = BitOR($iflags, 4)
  1935.     If BitAND($in, $display_device_vga_compatible) <> 0 Then $iflags = BitOR($iflags, 8)
  1936.     If BitAND($in, $display_device_removable) <> 0 Then $iflags = BitOR($iflags, 16)
  1937.     If BitAND($in, $display_device_modespruned) <> 0 Then $iflags = BitOR($iflags, 32)
  1938.     $adevice[0] = True
  1939.     $adevice[1] = DllStructGetData($tdevice, "Name")
  1940.     $adevice[2] = DllStructGetData($tdevice, "String")
  1941.     $adevice[3] = $iflags
  1942.     $adevice[4] = DllStructGetData($tdevice, "ID")
  1943.     Return $adevice
  1944. EndFunc
  1945.  
  1946. Func _winapi_enumwindows($bvisible = True, $hwnd = Default)
  1947.     __winapi_enumwindowsinit()
  1948.     If $hwnd = Default Then $hwnd = _winapi_getdesktopwindow()
  1949.     __winapi_enumwindowschild($hwnd, $bvisible)
  1950.     Return $__g_awinlist_winapi
  1951. EndFunc
  1952.  
  1953. Func __winapi_enumwindowsadd($hwnd, $sclass = "")
  1954.     If $sclass = "" Then $sclass = _winapi_getclassname($hwnd)
  1955.     $__g_awinlist_winapi[0][0] += 1
  1956.     Local $icount = $__g_awinlist_winapi[0][0]
  1957.     If $icount >= $__g_awinlist_winapi[0][1] Then
  1958.         ReDim $__g_awinlist_winapi[$icount + 64][2]
  1959.         $__g_awinlist_winapi[0][1] += 64
  1960.     EndIf
  1961.     $__g_awinlist_winapi[$icount][0] = $hwnd
  1962.     $__g_awinlist_winapi[$icount][1] = $sclass
  1963. EndFunc
  1964.  
  1965. Func __winapi_enumwindowschild($hwnd, $bvisible = True)
  1966.     $hwnd = _winapi_getwindow($hwnd, $gw_child)
  1967.     While $hwnd <> 0
  1968.         If (NOT $bvisible) OR _winapi_iswindowvisible($hwnd) Then
  1969.             __winapi_enumwindowsadd($hwnd)
  1970.             __winapi_enumwindowschild($hwnd, $bvisible)
  1971.         EndIf
  1972.         $hwnd = _winapi_getwindow($hwnd, $gw_hwndnext)
  1973.     WEnd
  1974. EndFunc
  1975.  
  1976. Func __winapi_enumwindowsinit()
  1977.     ReDim $__g_awinlist_winapi[64][2]
  1978.     $__g_awinlist_winapi[0][0] = 0
  1979.     $__g_awinlist_winapi[0][1] = 64
  1980. EndFunc
  1981.  
  1982. Func _winapi_enumwindowspopup()
  1983.     __winapi_enumwindowsinit()
  1984.     Local $hwnd = _winapi_getwindow(_winapi_getdesktopwindow(), $gw_child)
  1985.     Local $sclass
  1986.     While $hwnd <> 0
  1987.         If _winapi_iswindowvisible($hwnd) Then
  1988.             $sclass = _winapi_getclassname($hwnd)
  1989.             If $sclass = "#32768" Then
  1990.                 __winapi_enumwindowsadd($hwnd)
  1991.             ElseIf $sclass = "ToolbarWindow32" Then
  1992.                 __winapi_enumwindowsadd($hwnd)
  1993.             ElseIf $sclass = "ToolTips_Class32" Then
  1994.                 __winapi_enumwindowsadd($hwnd)
  1995.             ElseIf $sclass = "BaseBar" Then
  1996.                 __winapi_enumwindowschild($hwnd)
  1997.             EndIf
  1998.         EndIf
  1999.         $hwnd = _winapi_getwindow($hwnd, $gw_hwndnext)
  2000.     WEnd
  2001.     Return $__g_awinlist_winapi
  2002. EndFunc
  2003.  
  2004. Func _winapi_enumwindowstop()
  2005.     __winapi_enumwindowsinit()
  2006.     Local $hwnd = _winapi_getwindow(_winapi_getdesktopwindow(), $gw_child)
  2007.     While $hwnd <> 0
  2008.         If _winapi_iswindowvisible($hwnd) Then __winapi_enumwindowsadd($hwnd)
  2009.         $hwnd = _winapi_getwindow($hwnd, $gw_hwndnext)
  2010.     WEnd
  2011.     Return $__g_awinlist_winapi
  2012. EndFunc
  2013.  
  2014. Func _winapi_expandenvironmentstrings($sstring)
  2015.     Local $aresult = DllCall("kernel32.dll", "dword", "ExpandEnvironmentStringsW", "wstr", $sstring, "wstr", "", "dword", 4096)
  2016.     If @error OR NOT $aresult[0] Then Return SetError(@error + 10, @extended, "")
  2017.     Return $aresult[2]
  2018. EndFunc
  2019.  
  2020. Func _winapi_extracticonex($sfilepath, $iindex, $palarge, $pasmall, $iicons)
  2021.     Local $aresult = DllCall("shell32.dll", "uint", "ExtractIconExW", "wstr", $sfilepath, "int", $iindex, "struct*", $palarge, "struct*", $pasmall, "uint", $iicons)
  2022.     If @error Then Return SetError(@error, @extended, 0)
  2023.     Return $aresult[0]
  2024. EndFunc
  2025.  
  2026. Func _winapi_fatalappexit($smessage)
  2027.     DllCall("kernel32.dll", "none", "FatalAppExitW", "uint", 0, "wstr", $smessage)
  2028.     If @error Then Return SetError(@error, @extended)
  2029. EndFunc
  2030.  
  2031. Func _winapi_fillrect($hdc, $trect, $hbrush)
  2032.     Local $aresult
  2033.     If IsPtr($hbrush) Then
  2034.         $aresult = DllCall("user32.dll", "int", "FillRect", "handle", $hdc, "struct*", $trect, "handle", $hbrush)
  2035.     Else
  2036.         $aresult = DllCall("user32.dll", "int", "FillRect", "handle", $hdc, "struct*", $trect, "dword_ptr", $hbrush)
  2037.     EndIf
  2038.     If @error Then Return SetError(@error, @extended, False)
  2039.     Return $aresult[0]
  2040. EndFunc
  2041.  
  2042. Func _winapi_findexecutable($sfilename, $sdirectory = "")
  2043.     Local $aresult = DllCall("shell32.dll", "INT", "FindExecutableW", "wstr", $sfilename, "wstr", $sdirectory, "wstr", "")
  2044.     If @error Then Return SetError(@error, @extended, "")
  2045.     If $aresult[0] <= 32 Then Return SetError(10, $aresult[0], "")
  2046.     Return SetExtended($aresult[0], $aresult[3])
  2047. EndFunc
  2048.  
  2049. Func _winapi_findwindow($sclassname, $swindowname)
  2050.     Local $aresult = DllCall("user32.dll", "hwnd", "FindWindowW", "wstr", $sclassname, "wstr", $swindowname)
  2051.     If @error Then Return SetError(@error, @extended, 0)
  2052.     Return $aresult[0]
  2053. EndFunc
  2054.  
  2055. Func _winapi_flashwindow($hwnd, $binvert = True)
  2056.     Local $aresult = DllCall("user32.dll", "bool", "FlashWindow", "hwnd", $hwnd, "bool", $binvert)
  2057.     If @error Then Return SetError(@error, @extended, False)
  2058.     Return $aresult[0]
  2059. EndFunc
  2060.  
  2061. Func _winapi_flashwindowex($hwnd, $iflags = 3, $icount = 3, $itimeout = 0)
  2062.     Local $tflash = DllStructCreate($tagflashwinfo)
  2063.     Local $iflash = DllStructGetSize($tflash)
  2064.     Local $imode = 0
  2065.     If BitAND($iflags, 1) <> 0 Then $imode = BitOR($imode, $flashw_caption)
  2066.     If BitAND($iflags, 2) <> 0 Then $imode = BitOR($imode, $flashw_tray)
  2067.     If BitAND($iflags, 4) <> 0 Then $imode = BitOR($imode, $flashw_timer)
  2068.     If BitAND($iflags, 8) <> 0 Then $imode = BitOR($imode, $flashw_timernofg)
  2069.     DllStructSetData($tflash, "Size", $iflash)
  2070.     DllStructSetData($tflash, "hWnd", $hwnd)
  2071.     DllStructSetData($tflash, "Flags", $imode)
  2072.     DllStructSetData($tflash, "Count", $icount)
  2073.     DllStructSetData($tflash, "Timeout", $itimeout)
  2074.     Local $aresult = DllCall("user32.dll", "bool", "FlashWindowEx", "struct*", $tflash)
  2075.     If @error Then Return SetError(@error, @extended, False)
  2076.     Return $aresult[0]
  2077. EndFunc
  2078.  
  2079. Func _winapi_floattoint($nfloat)
  2080.     Local $tfloat = DllStructCreate("float")
  2081.     Local $tint = DllStructCreate("int", DllStructGetPtr($tfloat))
  2082.     DllStructSetData($tfloat, 1, $nfloat)
  2083.     Return DllStructGetData($tint, 1)
  2084. EndFunc
  2085.  
  2086. Func _winapi_flushfilebuffers($hfile)
  2087.     Local $aresult = DllCall("kernel32.dll", "bool", "FlushFileBuffers", "handle", $hfile)
  2088.     If @error Then Return SetError(@error, @extended, False)
  2089.     Return $aresult[0]
  2090. EndFunc
  2091.  
  2092. Func _winapi_formatmessage($iflags, $psource, $imessageid, $ilanguageid, ByRef $pbuffer, $isize, $varguments)
  2093.     Local $sbuffertype = "struct*"
  2094.     If IsString($pbuffer) Then $sbuffertype = "wstr"
  2095.     Local $aresult = DllCall("kernel32.dll", "dword", "FormatMessageW", "dword", $iflags, "struct*", $psource, "dword", $imessageid, "dword", $ilanguageid, $sbuffertype, $pbuffer, "dword", $isize, "ptr", $varguments)
  2096.     If @error OR NOT $aresult[0] Then Return SetError(@error + 10, @extended, 0)
  2097.     If $sbuffertype = "wstr" Then $pbuffer = $aresult[5]
  2098.     Return $aresult[0]
  2099. EndFunc
  2100.  
  2101. Func _winapi_framerect($hdc, $trect, $hbrush)
  2102.     Local $aresult = DllCall("user32.dll", "int", "FrameRect", "handle", $hdc, "struct*", $trect, "handle", $hbrush)
  2103.     If @error Then Return SetError(@error, @extended, False)
  2104.     Return $aresult[0]
  2105. EndFunc
  2106.  
  2107. Func _winapi_freelibrary($hmodule)
  2108.     Local $aresult = DllCall("kernel32.dll", "bool", "FreeLibrary", "handle", $hmodule)
  2109.     If @error Then Return SetError(@error, @extended, False)
  2110.     Return $aresult[0]
  2111. EndFunc
  2112.  
  2113. Func _winapi_getancestor($hwnd, $iflags = 1)
  2114.     Local $aresult = DllCall("user32.dll", "hwnd", "GetAncestor", "hwnd", $hwnd, "uint", $iflags)
  2115.     If @error Then Return SetError(@error, @extended, 0)
  2116.     Return $aresult[0]
  2117. EndFunc
  2118.  
  2119. Func _winapi_getasynckeystate($ikey)
  2120.     Local $aresult = DllCall("user32.dll", "short", "GetAsyncKeyState", "int", $ikey)
  2121.     If @error Then Return SetError(@error, @extended, 0)
  2122.     Return $aresult[0]
  2123. EndFunc
  2124.  
  2125. Func _winapi_getbkmode($hdc)
  2126.     Local $aresult = DllCall("gdi32.dll", "int", "GetBkMode", "handle", $hdc)
  2127.     If @error Then Return SetError(@error, @extended, 0)
  2128.     Return $aresult[0]
  2129. EndFunc
  2130.  
  2131. Func _winapi_getclassname($hwnd)
  2132.     If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
  2133.     Local $aresult = DllCall("user32.dll", "int", "GetClassNameW", "hwnd", $hwnd, "wstr", "", "int", 4096)
  2134.     If @error OR NOT $aresult[0] Then Return SetError(@error, @extended, "")
  2135.     Return SetExtended($aresult[0], $aresult[2])
  2136. EndFunc
  2137.  
  2138. Func _winapi_getclientheight($hwnd)
  2139.     Local $trect = _winapi_getclientrect($hwnd)
  2140.     If @error Then Return SetError(@error, @extended, 0)
  2141.     Return DllStructGetData($trect, "Bottom") - DllStructGetData($trect, "Top")
  2142. EndFunc
  2143.  
  2144. Func _winapi_getclientwidth($hwnd)
  2145.     Local $trect = _winapi_getclientrect($hwnd)
  2146.     If @error Then Return SetError(@error, @extended, 0)
  2147.     Return DllStructGetData($trect, "Right") - DllStructGetData($trect, "Left")
  2148. EndFunc
  2149.  
  2150. Func _winapi_getclientrect($hwnd)
  2151.     Local $trect = DllStructCreate($tagrect)
  2152.     Local $aret = DllCall("user32.dll", "bool", "GetClientRect", "hwnd", $hwnd, "struct*", $trect)
  2153.     If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
  2154.     Return $trect
  2155. EndFunc
  2156.  
  2157. Func _winapi_getcurrentprocess()
  2158.     Local $aresult = DllCall("kernel32.dll", "handle", "GetCurrentProcess")
  2159.     If @error Then Return SetError(@error, @extended, 0)
  2160.     Return $aresult[0]
  2161. EndFunc
  2162.  
  2163. Func _winapi_getcurrentprocessid()
  2164.     Local $aresult = DllCall("kernel32.dll", "dword", "GetCurrentProcessId")
  2165.     If @error Then Return SetError(@error, @extended, 0)
  2166.     Return $aresult[0]
  2167. EndFunc
  2168.  
  2169. Func _winapi_getcurrentthread()
  2170.     Local $aresult = DllCall("kernel32.dll", "handle", "GetCurrentThread")
  2171.     If @error Then Return SetError(@error, @extended, 0)
  2172.     Return $aresult[0]
  2173. EndFunc
  2174.  
  2175. Func _winapi_getcurrentthreadid()
  2176.     Local $aresult = DllCall("kernel32.dll", "dword", "GetCurrentThreadId")
  2177.     If @error Then Return SetError(@error, @extended, 0)
  2178.     Return $aresult[0]
  2179. EndFunc
  2180.  
  2181. Func _winapi_getcursorinfo()
  2182.     Local $tcursor = DllStructCreate($tagcursorinfo)
  2183.     Local $icursor = DllStructGetSize($tcursor)
  2184.     DllStructSetData($tcursor, "Size", $icursor)
  2185.     Local $aret = DllCall("user32.dll", "bool", "GetCursorInfo", "struct*", $tcursor)
  2186.     If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
  2187.     Local $acursor[5]
  2188.     $acursor[0] = True
  2189.     $acursor[1] = DllStructGetData($tcursor, "Flags") <> 0
  2190.     $acursor[2] = DllStructGetData($tcursor, "hCursor")
  2191.     $acursor[3] = DllStructGetData($tcursor, "X")
  2192.     $acursor[4] = DllStructGetData($tcursor, "Y")
  2193.     Return $acursor
  2194. EndFunc
  2195.  
  2196. Func _winapi_getdc($hwnd)
  2197.     Local $aresult = DllCall("user32.dll", "handle", "GetDC", "hwnd", $hwnd)
  2198.     If @error Then Return SetError(@error, @extended, 0)
  2199.     Return $aresult[0]
  2200. EndFunc
  2201.  
  2202. Func _winapi_getdesktopwindow()
  2203.     Local $aresult = DllCall("user32.dll", "hwnd", "GetDesktopWindow")
  2204.     If @error Then Return SetError(@error, @extended, 0)
  2205.     Return $aresult[0]
  2206. EndFunc
  2207.  
  2208. Func _winapi_getdevicecaps($hdc, $iindex)
  2209.     Local $aresult = DllCall("gdi32.dll", "int", "GetDeviceCaps", "handle", $hdc, "int", $iindex)
  2210.     If @error Then Return SetError(@error, @extended, 0)
  2211.     Return $aresult[0]
  2212. EndFunc
  2213.  
  2214. Func _winapi_getdibits($hdc, $hbitmap, $istartscan, $iscanlines, $pbits, $tbi, $iusage)
  2215.     Local $aresult = DllCall("gdi32.dll", "int", "GetDIBits", "handle", $hdc, "handle", $hbitmap, "uint", $istartscan, "uint", $iscanlines, "struct*", $pbits, "struct*", $tbi, "uint", $iusage)
  2216.     If @error Then Return SetError(@error, @extended, False)
  2217.     Return $aresult[0]
  2218. EndFunc
  2219.  
  2220. Func _winapi_getdlgctrlid($hwnd)
  2221.     Local $aresult = DllCall("user32.dll", "int", "GetDlgCtrlID", "hwnd", $hwnd)
  2222.     If @error Then Return SetError(@error, @extended, 0)
  2223.     Return $aresult[0]
  2224. EndFunc
  2225.  
  2226. Func _winapi_getdlgitem($hwnd, $iitemid)
  2227.     Local $aresult = DllCall("user32.dll", "hwnd", "GetDlgItem", "hwnd", $hwnd, "int", $iitemid)
  2228.     If @error Then Return SetError(@error, @extended, 0)
  2229.     Return $aresult[0]
  2230. EndFunc
  2231.  
  2232. Func _winapi_getfilesizeex($hfile)
  2233.     Local $aresult = DllCall("kernel32.dll", "bool", "GetFileSizeEx", "handle", $hfile, "int64*", 0)
  2234.     If @error OR NOT $aresult[0] Then Return SetError(@error, @extended, -1)
  2235.     Return $aresult[2]
  2236. EndFunc
  2237.  
  2238. Func _winapi_getfocus()
  2239.     Local $aresult = DllCall("user32.dll", "hwnd", "GetFocus")
  2240.     If @error Then Return SetError(@error, @extended, 0)
  2241.     Return $aresult[0]
  2242. EndFunc
  2243.  
  2244. Func _winapi_getforegroundwindow()
  2245.     Local $aresult = DllCall("user32.dll", "hwnd", "GetForegroundWindow")
  2246.     If @error Then Return SetError(@error, @extended, 0)
  2247.     Return $aresult[0]
  2248. EndFunc
  2249.  
  2250. Func _winapi_getguiresources($iflag = 0, $hprocess = -1)
  2251.     If $hprocess = -1 Then $hprocess = _winapi_getcurrentprocess()
  2252.     Local $aresult = DllCall("user32.dll", "dword", "GetGuiResources", "handle", $hprocess, "dword", $iflag)
  2253.     If @error Then Return SetError(@error, @extended, 0)
  2254.     Return $aresult[0]
  2255. EndFunc
  2256.  
  2257. Func _winapi_geticoninfo($hicon)
  2258.     Local $tinfo = DllStructCreate($tagiconinfo)
  2259.     Local $aret = DllCall("user32.dll", "bool", "GetIconInfo", "handle", $hicon, "struct*", $tinfo)
  2260.     If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
  2261.     Local $aicon[6]
  2262.     $aicon[0] = True
  2263.     $aicon[1] = DllStructGetData($tinfo, "Icon") <> 0
  2264.     $aicon[2] = DllStructGetData($tinfo, "XHotSpot")
  2265.     $aicon[3] = DllStructGetData($tinfo, "YHotSpot")
  2266.     $aicon[4] = DllStructGetData($tinfo, "hMask")
  2267.     $aicon[5] = DllStructGetData($tinfo, "hColor")
  2268.     Return $aicon
  2269. EndFunc
  2270.  
  2271. Func _winapi_getlasterrormessage()
  2272.     Local $ilasterror = _winapi_getlasterror()
  2273.     Local $tbufferptr = DllStructCreate("ptr")
  2274.     Local $ncount = _winapi_formatmessage(BitOR($format_message_allocate_buffer, $format_message_from_system), 0, $ilasterror, 0, $tbufferptr, 0, 0)
  2275.     If @error Then Return SetError(@error, 0, "")
  2276.     Local $stext = ""
  2277.     Local $pbuffer = DllStructGetData($tbufferptr, 1)
  2278.     If $pbuffer Then
  2279.         If $ncount > 0 Then
  2280.             Local $tbuffer = DllStructCreate("wchar[" & ($ncount + 1) & "]", $pbuffer)
  2281.             $stext = DllStructGetData($tbuffer, 1)
  2282.             If StringRight($stext, 2) = @CRLF Then $stext = StringTrimRight($stext, 2)
  2283.         EndIf
  2284.         _winapi_localfree($pbuffer)
  2285.     EndIf
  2286.     Return $stext
  2287. EndFunc
  2288.  
  2289. Func _winapi_getlayeredwindowattributes($hwnd, ByRef $itranscolor, ByRef $itransgui, $bcolorref = False)
  2290.     $itranscolor = -1
  2291.     $itransgui = -1
  2292.     Local $aresult = DllCall("user32.dll", "bool", "GetLayeredWindowAttributes", "hwnd", $hwnd, "INT*", $itranscolor, "byte*", $itransgui, "dword*", 0)
  2293.     If @error OR NOT $aresult[0] Then Return SetError(@error, @extended, 0)
  2294.     If NOT $bcolorref Then
  2295.         $aresult[2] = Int(BinaryMid($aresult[2], 3, 1) & BinaryMid($aresult[2], 2, 1) & BinaryMid($aresult[2], 1, 1))
  2296.     EndIf
  2297.     $itranscolor = $aresult[2]
  2298.     $itransgui = $aresult[3]
  2299.     Return $aresult[4]
  2300. EndFunc
  2301.  
  2302. Func _winapi_getmodulehandle($smodulename)
  2303.     Local $smodulenametype = "wstr"
  2304.     If $smodulename = "" Then
  2305.         $smodulename = 0
  2306.         $smodulenametype = "ptr"
  2307.     EndIf
  2308.     Local $aresult = DllCall("kernel32.dll", "handle", "GetModuleHandleW", $smodulenametype, $smodulename)
  2309.     If @error Then Return SetError(@error, @extended, 0)
  2310.     Return $aresult[0]
  2311. EndFunc
  2312.  
  2313. Func _winapi_getmousepos($btoclient = False, $hwnd = 0)
  2314.     Local $imode = Opt("MouseCoordMode", 1)
  2315.     Local $apos = MouseGetPos()
  2316.     Opt("MouseCoordMode", $imode)
  2317.     Local $tpoint = DllStructCreate($tagpoint)
  2318.     DllStructSetData($tpoint, "X", $apos[0])
  2319.     DllStructSetData($tpoint, "Y", $apos[1])
  2320.     If $btoclient AND NOT _winapi_screentoclient($hwnd, $tpoint) Then Return SetError(@error + 20, @extended, 0)
  2321.     Return $tpoint
  2322. EndFunc
  2323.  
  2324. Func _winapi_getmouseposx($btoclient = False, $hwnd = 0)
  2325.     Local $tpoint = _winapi_getmousepos($btoclient, $hwnd)
  2326.     If @error Then Return SetError(@error, @extended, 0)
  2327.     Return DllStructGetData($tpoint, "X")
  2328. EndFunc
  2329.  
  2330. Func _winapi_getmouseposy($btoclient = False, $hwnd = 0)
  2331.     Local $tpoint = _winapi_getmousepos($btoclient, $hwnd)
  2332.     If @error Then Return SetError(@error, @extended, 0)
  2333.     Return DllStructGetData($tpoint, "Y")
  2334. EndFunc
  2335.  
  2336. Func _winapi_getobject($hobject, $isize, $pobject)
  2337.     Local $aresult = DllCall("gdi32.dll", "int", "GetObjectW", "handle", $hobject, "int", $isize, "struct*", $pobject)
  2338.     If @error Then Return SetError(@error, @extended, 0)
  2339.     Return $aresult[0]
  2340. EndFunc
  2341.  
  2342. Func _winapi_getopenfilename($stitle = "", $sfilter = "All files (*.*)", $sinitaldir = ".", $sdefaultfile = "", $sdefaultext = "", $ifilterindex = 1, $iflags = 0, $iflagsex = 0, $hwndowner = 0)
  2343.     Local $ipathlen = 4096
  2344.     Local $inulls = 0
  2345.     Local $tofn = DllStructCreate($tagopenfilename)
  2346.     Local $afiles[1] = [0]
  2347.     Local $iflag = $iflags
  2348.     Local $asflines = StringSplit($sfilter, "|")
  2349.     Local $asfilter[$asflines[0] * 2 + 1]
  2350.     Local $istart, $ifinal, $tagfilter
  2351.     $asfilter[0] = $asflines[0] * 2
  2352.     For $i = 1 To $asflines[0]
  2353.         $istart = StringInStr($asflines[$i], "(", 0, 1)
  2354.         $ifinal = StringInStr($asflines[$i], ")", 0, -1)
  2355.         $asfilter[$i * 2 - 1] = StringStripWS(StringLeft($asflines[$i], $istart - 1), $str_stripleading + $str_striptrailing)
  2356.         $asfilter[$i * 2] = StringStripWS(StringTrimRight(StringTrimLeft($asflines[$i], $istart), StringLen($asflines[$i]) - $ifinal + 1), $str_stripleading + $str_striptrailing)
  2357.         $tagfilter &= "wchar[" & StringLen($asfilter[$i * 2 - 1]) + 1 & "];wchar[" & StringLen($asfilter[$i * 2]) + 1 & "];"
  2358.     Next
  2359.     Local $ttitle = DllStructCreate("wchar Title[" & StringLen($stitle) + 1 & "]")
  2360.     Local $tinitialdir = DllStructCreate("wchar InitDir[" & StringLen($sinitaldir) + 1 & "]")
  2361.     Local $tfilter = DllStructCreate($tagfilter & "wchar")
  2362.     Local $tpath = DllStructCreate("wchar Path[" & $ipathlen & "]")
  2363.     Local $textn = DllStructCreate("wchar Extension[" & StringLen($sdefaultext) + 1 & "]")
  2364.     For $i = 1 To $asfilter[0]
  2365.         DllStructSetData($tfilter, $i, $asfilter[$i])
  2366.     Next
  2367.     DllStructSetData($ttitle, "Title", $stitle)
  2368.     DllStructSetData($tinitialdir, "InitDir", $sinitaldir)
  2369.     DllStructSetData($tpath, "Path", $sdefaultfile)
  2370.     DllStructSetData($textn, "Extension", $sdefaultext)
  2371.     DllStructSetData($tofn, "StructSize", DllStructGetSize($tofn))
  2372.     DllStructSetData($tofn, "hwndOwner", $hwndowner)
  2373.     DllStructSetData($tofn, "lpstrFilter", DllStructGetPtr($tfilter))
  2374.     DllStructSetData($tofn, "nFilterIndex", $ifilterindex)
  2375.     DllStructSetData($tofn, "lpstrFile", DllStructGetPtr($tpath))
  2376.     DllStructSetData($tofn, "nMaxFile", $ipathlen)
  2377.     DllStructSetData($tofn, "lpstrInitialDir", DllStructGetPtr($tinitialdir))
  2378.     DllStructSetData($tofn, "lpstrTitle", DllStructGetPtr($ttitle))
  2379.     DllStructSetData($tofn, "Flags", $iflag)
  2380.     DllStructSetData($tofn, "lpstrDefExt", DllStructGetPtr($textn))
  2381.     DllStructSetData($tofn, "FlagsEx", $iflagsex)
  2382.     Local $ares = DllCall("comdlg32.dll", "bool", "GetOpenFileNameW", "struct*", $tofn)
  2383.     If @error OR NOT $ares[0] Then Return SetError(@error + 10, @extended, $afiles)
  2384.     If BitAND($iflags, $ofn_allowmultiselect) = $ofn_allowmultiselect AND BitAND($iflags, $ofn_explorer) = $ofn_explorer Then
  2385.         For $x = 1 To $ipathlen
  2386.             If DllStructGetData($tpath, "Path", $x) = Chr(0) Then
  2387.                 DllStructSetData($tpath, "Path", "|", $x)
  2388.                 $inulls += 1
  2389.             Else
  2390.                 $inulls = 0
  2391.             EndIf
  2392.             If $inulls = 2 Then ExitLoop
  2393.         Next
  2394.         DllStructSetData($tpath, "Path", Chr(0), $x - 1)
  2395.         $afiles = StringSplit(DllStructGetData($tpath, "Path"), "|")
  2396.         If $afiles[0] = 1 Then Return __winapi_parsefiledialogpath(DllStructGetData($tpath, "Path"))
  2397.         Return StringSplit(DllStructGetData($tpath, "Path"), "|")
  2398.     ElseIf BitAND($iflags, $ofn_allowmultiselect) = $ofn_allowmultiselect Then
  2399.         $afiles = StringSplit(DllStructGetData($tpath, "Path"), " ")
  2400.         If $afiles[0] = 1 Then Return __winapi_parsefiledialogpath(DllStructGetData($tpath, "Path"))
  2401.         Return StringSplit(StringReplace(DllStructGetData($tpath, "Path"), " ", "|"), "|")
  2402.     Else
  2403.         Return __winapi_parsefiledialogpath(DllStructGetData($tpath, "Path"))
  2404.     EndIf
  2405. EndFunc
  2406.  
  2407. Func _winapi_getoverlappedresult($hfile, $toverlapped, ByRef $ibytes, $bwait = False)
  2408.     Local $aresult = DllCall("kernel32.dll", "bool", "GetOverlappedResult", "handle", $hfile, "struct*", $toverlapped, "dword*", 0, "bool", $bwait)
  2409.     If @error OR NOT $aresult[0] Then Return SetError(@error, @extended, False)
  2410.     $ibytes = $aresult[3]
  2411.     Return $aresult[0]
  2412. EndFunc
  2413.  
  2414. Func _winapi_getparent($hwnd)
  2415.     Local $aresult = DllCall("user32.dll", "hwnd", "GetParent", "hwnd", $hwnd)
  2416.     If @error Then Return SetError(@error, @extended, 0)
  2417.     Return $aresult[0]
  2418. EndFunc
  2419.  
  2420. Func _winapi_getprocaddress($hmodule, $vname)
  2421.     Local $stype = "str"
  2422.     If IsNumber($vname) Then $stype = "word"
  2423.     Local $aresult = DllCall("kernel32.dll", "ptr", "GetProcAddress", "handle", $hmodule, $stype, $vname)
  2424.     If @error OR NOT $aresult[0] Then Return SetError(@error, @extended, 0)
  2425.     Return $aresult[0]
  2426. EndFunc
  2427.  
  2428. Func _winapi_getprocessaffinitymask($hprocess)
  2429.     Local $aresult = DllCall("kernel32.dll", "bool", "GetProcessAffinityMask", "handle", $hprocess, "dword_ptr*", 0, "dword_ptr*", 0)
  2430.     If @error OR NOT $aresult[0] Then Return SetError(@error + 10, @extended, 0)
  2431.     Local $amask[3]
  2432.     $amask[0] = True
  2433.     $amask[1] = $aresult[2]
  2434.     $amask[2] = $aresult[3]
  2435.     Return $amask
  2436. EndFunc
  2437.  
  2438. Func _winapi_getsavefilename($stitle = "", $sfilter = "All files (*.*)", $sinitaldir = ".", $sdefaultfile = "", $sdefaultext = "", $ifilterindex = 1, $iflags = 0, $iflagsex = 0, $hwndowner = 0)
  2439.     Local $ipathlen = 4096
  2440.     Local $tofn = DllStructCreate($tagopenfilename)
  2441.     Local $afiles[1] = [0]
  2442.     Local $iflag = $iflags
  2443.     Local $asflines = StringSplit($sfilter, "|")
  2444.     Local $asfilter[$asflines[0] * 2 + 1]
  2445.     Local $istart, $ifinal, $tagfilter
  2446.     $asfilter[0] = $asflines[0] * 2
  2447.     For $i = 1 To $asflines[0]
  2448.         $istart = StringInStr($asflines[$i], "(", 0, 1)
  2449.         $ifinal = StringInStr($asflines[$i], ")", 0, -1)
  2450.         $asfilter[$i * 2 - 1] = StringStripWS(StringLeft($asflines[$i], $istart - 1), $str_stripleading + $str_striptrailing)
  2451.         $asfilter[$i * 2] = StringStripWS(StringTrimRight(StringTrimLeft($asflines[$i], $istart), StringLen($asflines[$i]) - $ifinal + 1), $str_stripleading + $str_striptrailing)
  2452.         $tagfilter &= "wchar[" & StringLen($asfilter[$i * 2 - 1]) + 1 & "];wchar[" & StringLen($asfilter[$i * 2]) + 1 & "];"
  2453.     Next
  2454.     Local $ttitle = DllStructCreate("wchar Title[" & StringLen($stitle) + 1 & "]")
  2455.     Local $tinitialdir = DllStructCreate("wchar InitDir[" & StringLen($sinitaldir) + 1 & "]")
  2456.     Local $tfilter = DllStructCreate($tagfilter & "wchar")
  2457.     Local $tpath = DllStructCreate("wchar Path[" & $ipathlen & "]")
  2458.     Local $textn = DllStructCreate("wchar Extension[" & StringLen($sdefaultext) + 1 & "]")
  2459.     For $i = 1 To $asfilter[0]
  2460.         DllStructSetData($tfilter, $i, $asfilter[$i])
  2461.     Next
  2462.     DllStructSetData($ttitle, "Title", $stitle)
  2463.     DllStructSetData($tinitialdir, "InitDir", $sinitaldir)
  2464.     DllStructSetData($tpath, "Path", $sdefaultfile)
  2465.     DllStructSetData($textn, "Extension", $sdefaultext)
  2466.     DllStructSetData($tofn, "StructSize", DllStructGetSize($tofn))
  2467.     DllStructSetData($tofn, "hwndOwner", $hwndowner)
  2468.     DllStructSetData($tofn, "lpstrFilter", DllStructGetPtr($tfilter))
  2469.     DllStructSetData($tofn, "nFilterIndex", $ifilterindex)
  2470.     DllStructSetData($tofn, "lpstrFile", DllStructGetPtr($tpath))
  2471.     DllStructSetData($tofn, "nMaxFile", $ipathlen)
  2472.     DllStructSetData($tofn, "lpstrInitialDir", DllStructGetPtr($tinitialdir))
  2473.     DllStructSetData($tofn, "lpstrTitle", DllStructGetPtr($ttitle))
  2474.     DllStructSetData($tofn, "Flags", $iflag)
  2475.     DllStructSetData($tofn, "lpstrDefExt", DllStructGetPtr($textn))
  2476.     DllStructSetData($tofn, "FlagsEx", $iflagsex)
  2477.     Local $ares = DllCall("comdlg32.dll", "bool", "GetSaveFileNameW", "struct*", $tofn)
  2478.     If @error OR NOT $ares[0] Then Return SetError(@error + 10, @extended, $afiles)
  2479.     Return __winapi_parsefiledialogpath(DllStructGetData($tpath, "Path"))
  2480. EndFunc
  2481.  
  2482. Func _winapi_getstockobject($iobject)
  2483.     Local $aresult = DllCall("gdi32.dll", "handle", "GetStockObject", "int", $iobject)
  2484.     If @error Then Return SetError(@error, @extended, 0)
  2485.     Return $aresult[0]
  2486. EndFunc
  2487.  
  2488. Func _winapi_getstdhandle($istdhandle)
  2489.     If $istdhandle < 0 OR $istdhandle > 2 Then Return SetError(2, 0, -1)
  2490.     Local Const $ahandle[3] = [-10, -11, -12]
  2491.     Local $aresult = DllCall("kernel32.dll", "handle", "GetStdHandle", "dword", $ahandle[$istdhandle])
  2492.     If @error Then Return SetError(@error, @extended, -1)
  2493.     Return $aresult[0]
  2494. EndFunc
  2495.  
  2496. Func _winapi_getsyscolor($iindex)
  2497.     Local $aresult = DllCall("user32.dll", "INT", "GetSysColor", "int", $iindex)
  2498.     If @error Then Return SetError(@error, @extended, 0)
  2499.     Return $aresult[0]
  2500. EndFunc
  2501.  
  2502. Func _winapi_getsyscolorbrush($iindex)
  2503.     Local $aresult = DllCall("user32.dll", "handle", "GetSysColorBrush", "int", $iindex)
  2504.     If @error Then Return SetError(@error, @extended, 0)
  2505.     Return $aresult[0]
  2506. EndFunc
  2507.  
  2508. Func _winapi_getsystemmetrics($iindex)
  2509.     Local $aresult = DllCall("user32.dll", "int", "GetSystemMetrics", "int", $iindex)
  2510.     If @error Then Return SetError(@error, @extended, 0)
  2511.     Return $aresult[0]
  2512. EndFunc
  2513.  
  2514. Func _winapi_gettextextentpoint32($hdc, $stext)
  2515.     Local $tsize = DllStructCreate($tagsize)
  2516.     Local $isize = StringLen($stext)
  2517.     Local $aret = DllCall("gdi32.dll", "bool", "GetTextExtentPoint32W", "handle", $hdc, "wstr", $stext, "int", $isize, "struct*", $tsize)
  2518.     If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
  2519.     Return $tsize
  2520. EndFunc
  2521.  
  2522. Func _winapi_gettextmetrics($hdc)
  2523.     Local $ttextmetric = DllStructCreate($tagtextmetric)
  2524.     Local $aret = DllCall("gdi32.dll", "bool", "GetTextMetricsW", "handle", $hdc, "struct*", $ttextmetric)
  2525.     If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
  2526.     Return $ttextmetric
  2527. EndFunc
  2528.  
  2529. Func _winapi_getwindow($hwnd, $icmd)
  2530.     Local $aresult = DllCall("user32.dll", "hwnd", "GetWindow", "hwnd", $hwnd, "uint", $icmd)
  2531.     If @error Then Return SetError(@error, @extended, 0)
  2532.     Return $aresult[0]
  2533. EndFunc
  2534.  
  2535. Func _winapi_getwindowdc($hwnd)
  2536.     Local $aresult = DllCall("user32.dll", "handle", "GetWindowDC", "hwnd", $hwnd)
  2537.     If @error Then Return SetError(@error, @extended, 0)
  2538.     Return $aresult[0]
  2539. EndFunc
  2540.  
  2541. Func _winapi_getwindowheight($hwnd)
  2542.     Local $trect = _winapi_getwindowrect($hwnd)
  2543.     If @error Then Return SetError(@error, @extended, 0)
  2544.     Return DllStructGetData($trect, "Bottom") - DllStructGetData($trect, "Top")
  2545. EndFunc
  2546.  
  2547. Func _winapi_getwindowlong($hwnd, $iindex)
  2548.     Local $sfuncname = "GetWindowLongW"
  2549.     If @AutoItX64 Then $sfuncname = "GetWindowLongPtrW"
  2550.     Local $aresult = DllCall("user32.dll", "long_ptr", $sfuncname, "hwnd", $hwnd, "int", $iindex)
  2551.     If @error OR NOT $aresult[0] Then Return SetError(@error + 10, @extended, 0)
  2552.     Return $aresult[0]
  2553. EndFunc
  2554.  
  2555. Func _winapi_getwindowplacement($hwnd)
  2556.     Local $twindowplacement = DllStructCreate($tagwindowplacement)
  2557.     DllStructSetData($twindowplacement, "length", DllStructGetSize($twindowplacement))
  2558.     Local $aret = DllCall("user32.dll", "bool", "GetWindowPlacement", "hwnd", $hwnd, "struct*", $twindowplacement)
  2559.     If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
  2560.     Return $twindowplacement
  2561. EndFunc
  2562.  
  2563. Func _winapi_getwindowrect($hwnd)
  2564.     Local $trect = DllStructCreate($tagrect)
  2565.     Local $aret = DllCall("user32.dll", "bool", "GetWindowRect", "hwnd", $hwnd, "struct*", $trect)
  2566.     If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
  2567.     Return $trect
  2568. EndFunc
  2569.  
  2570. Func _winapi_getwindowrgn($hwnd, $hrgn)
  2571.     Local $aresult = DllCall("user32.dll", "int", "GetWindowRgn", "hwnd", $hwnd, "handle", $hrgn)
  2572.     If @error Then Return SetError(@error, @extended, 0)
  2573.     Return $aresult[0]
  2574. EndFunc
  2575.  
  2576. Func _winapi_getwindowtext($hwnd)
  2577.     Local $aresult = DllCall("user32.dll", "int", "GetWindowTextW", "hwnd", $hwnd, "wstr", "", "int", 4096)
  2578.     If @error OR NOT $aresult[0] Then Return SetError(@error + 10, @extended, "")
  2579.     Return SetExtended($aresult[0], $aresult[2])
  2580. EndFunc
  2581.  
  2582. Func _winapi_getwindowthreadprocessid($hwnd, ByRef $ipid)
  2583.     Local $aresult = DllCall("user32.dll", "dword", "GetWindowThreadProcessId", "hwnd", $hwnd, "dword*", 0)
  2584.     If @error Then Return SetError(@error, @extended, 0)
  2585.     $ipid = $aresult[2]
  2586.     Return $aresult[0]
  2587. EndFunc
  2588.  
  2589. Func _winapi_getwindowwidth($hwnd)
  2590.     Local $trect = _winapi_getwindowrect($hwnd)
  2591.     If @error Then Return SetError(@error, @extended, 0)
  2592.     Return DllStructGetData($trect, "Right") - DllStructGetData($trect, "Left")
  2593. EndFunc
  2594.  
  2595. Func _winapi_getxyfrompoint(ByRef $tpoint, ByRef $ix, ByRef $iy)
  2596.     $ix = DllStructGetData($tpoint, "X")
  2597.     $iy = DllStructGetData($tpoint, "Y")
  2598. EndFunc
  2599.  
  2600. Func _winapi_globalmemorystatus()
  2601.     Local $tmem = DllStructCreate($tagmemorystatusex)
  2602.     DllStructSetData($tmem, 1, DllStructGetSize($tmem))
  2603.     Local $aret = DllCall("kernel32.dll", "bool", "GlobalMemoryStatusEx", "struct*", $tmem)
  2604.     If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
  2605.     Local $amem[7]
  2606.     $amem[0] = DllStructGetData($tmem, 2)
  2607.     $amem[1] = DllStructGetData($tmem, 3)
  2608.     $amem[2] = DllStructGetData($tmem, 4)
  2609.     $amem[3] = DllStructGetData($tmem, 5)
  2610.     $amem[4] = DllStructGetData($tmem, 6)
  2611.     $amem[5] = DllStructGetData($tmem, 7)
  2612.     $amem[6] = DllStructGetData($tmem, 8)
  2613.     Return $amem
  2614. EndFunc
  2615.  
  2616. Func _winapi_guidfromstring($sguid)
  2617.     Local $tguid = DllStructCreate($tagguid)
  2618.     _winapi_guidfromstringex($sguid, $tguid)
  2619.     If @error Then Return SetError(@error + 10, @extended, 0)
  2620.     Return $tguid
  2621. EndFunc
  2622.  
  2623. Func _winapi_guidfromstringex($sguid, $tguid)
  2624.     Local $aresult = DllCall("ole32.dll", "long", "CLSIDFromString", "wstr", $sguid, "struct*", $tguid)
  2625.     If @error Then Return SetError(@error, @extended, False)
  2626.     Return $aresult[0]
  2627. EndFunc
  2628.  
  2629. Func _winapi_hiword($ilong)
  2630.     Return BitShift($ilong, 16)
  2631. EndFunc
  2632.  
  2633. Func _winapi_inprocess($hwnd, ByRef $hlastwnd)
  2634.     If $hwnd = $hlastwnd Then Return True
  2635.     For $ii = $__g_ainprocess_winapi[0][0] To 1 Step -1
  2636.         If $hwnd = $__g_ainprocess_winapi[$ii][0] Then
  2637.             If $__g_ainprocess_winapi[$ii][1] Then
  2638.                 $hlastwnd = $hwnd
  2639.                 Return True
  2640.             Else
  2641.                 Return False
  2642.             EndIf
  2643.         EndIf
  2644.     Next
  2645.     Local $ipid
  2646.     _winapi_getwindowthreadprocessid($hwnd, $ipid)
  2647.     Local $icount = $__g_ainprocess_winapi[0][0] + 1
  2648.     If $icount >= 64 Then $icount = 1
  2649.     $__g_ainprocess_winapi[0][0] = $icount
  2650.     $__g_ainprocess_winapi[$icount][0] = $hwnd
  2651.     $__g_ainprocess_winapi[$icount][1] = ($ipid = @AutoItPID)
  2652.     Return $__g_ainprocess_winapi[$icount][1]
  2653. EndFunc
  2654.  
  2655. Func _winapi_inttofloat($iint)
  2656.     Local $tint = DllStructCreate("int")
  2657.     Local $tfloat = DllStructCreate("float", DllStructGetPtr($tint))
  2658.     DllStructSetData($tint, 1, $iint)
  2659.     Return DllStructGetData($tfloat, 1)
  2660. EndFunc
  2661.  
  2662. Func _winapi_isclassname($hwnd, $sclassname)
  2663.     Local $sseparator = Opt("GUIDataSeparatorChar")
  2664.     Local $aclassname = StringSplit($sclassname, $sseparator)
  2665.     If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
  2666.     Local $sclasscheck = _winapi_getclassname($hwnd)
  2667.     For $x = 1 To UBound($aclassname) - 1
  2668.         If StringUpper(StringMid($sclasscheck, 1, StringLen($aclassname[$x]))) = StringUpper($aclassname[$x]) Then Return True
  2669.     Next
  2670.     Return False
  2671. EndFunc
  2672.  
  2673. Func _winapi_iswindow($hwnd)
  2674.     Local $aresult = DllCall("user32.dll", "bool", "IsWindow", "hwnd", $hwnd)
  2675.     If @error Then Return SetError(@error, @extended, 0)
  2676.     Return $aresult[0]
  2677. EndFunc
  2678.  
  2679. Func _winapi_iswindowvisible($hwnd)
  2680.     Local $aresult = DllCall("user32.dll", "bool", "IsWindowVisible", "hwnd", $hwnd)
  2681.     If @error Then Return SetError(@error, @extended, 0)
  2682.     Return $aresult[0]
  2683. EndFunc
  2684.  
  2685. Func _winapi_invalidaterect($hwnd, $trect = 0, $berase = True)
  2686.     Local $aresult = DllCall("user32.dll", "bool", "InvalidateRect", "hwnd", $hwnd, "struct*", $trect, "bool", $berase)
  2687.     If @error Then Return SetError(@error, @extended, False)
  2688.     Return $aresult[0]
  2689. EndFunc
  2690.  
  2691. Func _winapi_lineto($hdc, $ix, $iy)
  2692.     Local $aresult = DllCall("gdi32.dll", "bool", "LineTo", "handle", $hdc, "int", $ix, "int", $iy)
  2693.     If @error Then Return SetError(@error, @extended, False)
  2694.     Return $aresult[0]
  2695. EndFunc
  2696.  
  2697. Func _winapi_loadbitmap($hinstance, $sbitmap)
  2698.     Local $sbitmaptype = "int"
  2699.     If IsString($sbitmap) Then $sbitmaptype = "wstr"
  2700.     Local $aresult = DllCall("user32.dll", "handle", "LoadBitmapW", "handle", $hinstance, $sbitmaptype, $sbitmap)
  2701.     If @error Then Return SetError(@error, @extended, 0)
  2702.     Return $aresult[0]
  2703. EndFunc
  2704.  
  2705. Func _winapi_loadimage($hinstance, $simage, $itype, $ixdesired, $iydesired, $iload)
  2706.     Local $aresult, $simagetype = "int"
  2707.     If IsString($simage) Then $simagetype = "wstr"
  2708.     $aresult = DllCall("user32.dll", "handle", "LoadImageW", "handle", $hinstance, $simagetype, $simage, "uint", $itype, "int", $ixdesired, "int", $iydesired, "uint", $iload)
  2709.     If @error Then Return SetError(@error, @extended, 0)
  2710.     Return $aresult[0]
  2711. EndFunc
  2712.  
  2713. Func _winapi_loadlibrary($sfilename)
  2714.     Local $aresult = DllCall("kernel32.dll", "handle", "LoadLibraryW", "wstr", $sfilename)
  2715.     If @error Then Return SetError(@error, @extended, 0)
  2716.     Return $aresult[0]
  2717. EndFunc
  2718.  
  2719. Func _winapi_loadlibraryex($sfilename, $iflags = 0)
  2720.     Local $aresult = DllCall("kernel32.dll", "handle", "LoadLibraryExW", "wstr", $sfilename, "ptr", 0, "dword", $iflags)
  2721.     If @error Then Return SetError(@error, @extended, 0)
  2722.     Return $aresult[0]
  2723. EndFunc
  2724.  
  2725. Func _winapi_loadshell32icon($iiconid)
  2726.     Local $ticons = DllStructCreate("ptr Data")
  2727.     Local $iicons = _winapi_extracticonex("shell32.dll", $iiconid, 0, $ticons, 1)
  2728.     If @error Then Return SetError(@error, @extended, 0)
  2729.     If $iicons <= 0 Then Return SetError(10, 0, 0)
  2730.     Return DllStructGetData($ticons, "Data")
  2731. EndFunc
  2732.  
  2733. Func _winapi_loadstring($hinstance, $istringid)
  2734.     Local $aresult = DllCall("user32.dll", "int", "LoadStringW", "handle", $hinstance, "uint", $istringid, "wstr", "", "int", 4096)
  2735.     If @error OR NOT $aresult[0] Then Return SetError(@error + 10, @extended, "")
  2736.     Return SetExtended($aresult[0], $aresult[3])
  2737. EndFunc
  2738.  
  2739. Func _winapi_localfree($hmemory)
  2740.     Local $aresult = DllCall("kernel32.dll", "handle", "LocalFree", "handle", $hmemory)
  2741.     If @error Then Return SetError(@error, @extended, False)
  2742.     Return $aresult[0]
  2743. EndFunc
  2744.  
  2745. Func _winapi_loword($ilong)
  2746.     Return BitAND($ilong, 65535)
  2747. EndFunc
  2748.  
  2749. Func _winapi_makelangid($ilngidprimary, $ilngidsub)
  2750.     Return BitOR(BitShift($ilngidsub, -10), $ilngidprimary)
  2751. EndFunc
  2752.  
  2753. Func _winapi_makelcid($ilngid, $isortid)
  2754.     Return BitOR(BitShift($isortid, -16), $ilngid)
  2755. EndFunc
  2756.  
  2757. Func _winapi_makelong($ilo, $ihi)
  2758.     Return BitOR(BitShift($ihi, -16), BitAND($ilo, 65535))
  2759. EndFunc
  2760.  
  2761. Func _winapi_makeqword($ilodword, $ihidword)
  2762.     Local $tint64 = DllStructCreate("uint64")
  2763.     Local $tdwords = DllStructCreate("dword;dword", DllStructGetPtr($tint64))
  2764.     DllStructSetData($tdwords, 1, $ilodword)
  2765.     DllStructSetData($tdwords, 2, $ihidword)
  2766.     Return DllStructGetData($tint64, 1)
  2767. EndFunc
  2768.  
  2769. Func _winapi_messagebeep($itype = 1)
  2770.     Local $isound
  2771.     Switch $itype
  2772.         Case 1
  2773.             $isound = 0
  2774.         Case 2
  2775.             $isound = 16
  2776.         Case 3
  2777.             $isound = 32
  2778.         Case 4
  2779.             $isound = 48
  2780.         Case 5
  2781.             $isound = 64
  2782.         Case Else
  2783.             $isound = -1
  2784.     EndSwitch
  2785.     Local $aresult = DllCall("user32.dll", "bool", "MessageBeep", "uint", $isound)
  2786.     If @error Then Return SetError(@error, @extended, False)
  2787.     Return $aresult[0]
  2788. EndFunc
  2789.  
  2790. Func _winapi_msgbox($iflags, $stitle, $stext)
  2791.     BlockInput(0)
  2792.     MsgBox($iflags, $stitle, $stext & "      ")
  2793. EndFunc
  2794.  
  2795. Func _winapi_mouse_event($iflags, $ix = 0, $iy = 0, $idata = 0, $iextrainfo = 0)
  2796.     DllCall("user32.dll", "none", "mouse_event", "dword", $iflags, "dword", $ix, "dword", $iy, "dword", $idata, "ulong_ptr", $iextrainfo)
  2797.     If @error Then Return SetError(@error, @extended)
  2798. EndFunc
  2799.  
  2800. Func _winapi_moveto($hdc, $ix, $iy)
  2801.     Local $aresult = DllCall("gdi32.dll", "bool", "MoveToEx", "handle", $hdc, "int", $ix, "int", $iy, "ptr", 0)
  2802.     If @error Then Return SetError(@error, @extended, False)
  2803.     Return $aresult[0]
  2804. EndFunc
  2805.  
  2806. Func _winapi_movewindow($hwnd, $ix, $iy, $iwidth, $iheight, $brepaint = True)
  2807.     Local $aresult = DllCall("user32.dll", "bool", "MoveWindow", "hwnd", $hwnd, "int", $ix, "int", $iy, "int", $iwidth, "int", $iheight, "bool", $brepaint)
  2808.     If @error Then Return SetError(@error, @extended, False)
  2809.     Return $aresult[0]
  2810. EndFunc
  2811.  
  2812. Func _winapi_muldiv($inumber, $inumerator, $idenominator)
  2813.     Local $aresult = DllCall("kernel32.dll", "int", "MulDiv", "int", $inumber, "int", $inumerator, "int", $idenominator)
  2814.     If @error Then Return SetError(@error, @extended, -1)
  2815.     Return $aresult[0]
  2816. EndFunc
  2817.  
  2818. Func _winapi_multibytetowidechar($vtext, $icodepage = 0, $iflags = 0, $bretstring = False)
  2819.     Local $stexttype = "str"
  2820.     If NOT IsString($vtext) Then $stexttype = "struct*"
  2821.     Local $aresult = DllCall("kernel32.dll", "int", "MultiByteToWideChar", "uint", $icodepage, "dword", $iflags, $stexttype, $vtext, "int", -1, "ptr", 0, "int", 0)
  2822.     If @error OR NOT $aresult[0] Then Return SetError(@error + 10, @extended, 0)
  2823.     Local $iout = $aresult[0]
  2824.     Local $tout = DllStructCreate("wchar[" & $iout & "]")
  2825.     $aresult = DllCall("kernel32.dll", "int", "MultiByteToWideChar", "uint", $icodepage, "dword", $iflags, $stexttype, $vtext, "int", -1, "struct*", $tout, "int", $iout)
  2826.     If @error OR NOT $aresult[0] Then Return SetError(@error + 20, @extended, 0)
  2827.     If $bretstring Then Return DllStructGetData($tout, 1)
  2828.     Return $tout
  2829. EndFunc
  2830.  
  2831. Func _winapi_multibytetowidecharex($stext, $ptext, $icodepage = 0, $iflags = 0)
  2832.     Local $aresult = DllCall("kernel32.dll", "int", "MultiByteToWideChar", "uint", $icodepage, "dword", $iflags, "STR", $stext, "int", -1, "struct*", $ptext, "int", (StringLen($stext) + 1) * 2)
  2833.     If @error Then Return SetError(@error, @extended, False)
  2834.     Return $aresult[0]
  2835. EndFunc
  2836.  
  2837. Func _winapi_openprocess($iaccess, $binherit, $ipid, $bdebugpriv = False)
  2838.     Local $aresult = DllCall("kernel32.dll", "handle", "OpenProcess", "dword", $iaccess, "bool", $binherit, "dword", $ipid)
  2839.     If @error Then Return SetError(@error, @extended, 0)
  2840.     If $aresult[0] Then Return $aresult[0]
  2841.     If NOT $bdebugpriv Then Return SetError(100, 0, 0)
  2842.     Local $htoken = _security__openthreadtokenex(BitOR($token_adjust_privileges, $token_query))
  2843.     If @error Then Return SetError(@error + 10, @extended, 0)
  2844.     _security__setprivilege($htoken, "SeDebugPrivilege", True)
  2845.     Local $ierror = @error
  2846.     Local $iextended = @extended
  2847.     Local $iret = 0
  2848.     If NOT @error Then
  2849.         $aresult = DllCall("kernel32.dll", "handle", "OpenProcess", "dword", $iaccess, "bool", $binherit, "dword", $ipid)
  2850.         $ierror = @error
  2851.         $iextended = @extended
  2852.         If $aresult[0] Then $iret = $aresult[0]
  2853.         _security__setprivilege($htoken, "SeDebugPrivilege", False)
  2854.         If @error Then
  2855.             $ierror = @error + 20
  2856.             $iextended = @extended
  2857.         EndIf
  2858.     Else
  2859.         $ierror = @error + 30
  2860.     EndIf
  2861.     _winapi_closehandle($htoken)
  2862.     Return SetError($ierror, $iextended, $iret)
  2863. EndFunc
  2864.  
  2865. Func __winapi_parsefiledialogpath($spath)
  2866.     Local $afiles[3]
  2867.     $afiles[0] = 2
  2868.     Local $stemp = StringMid($spath, 1, StringInStr($spath, "\", 0, -1) - 1)
  2869.     $afiles[1] = $stemp
  2870.     $afiles[2] = StringMid($spath, StringInStr($spath, "\", 0, -1) + 1)
  2871.     Return $afiles
  2872. EndFunc
  2873.  
  2874. Func _winapi_pathfindonpath(Const $sfilepath, $aextrapaths = "", Const $spathdelimiter = @LF)
  2875.     Local $iextracount = 0
  2876.     If IsString($aextrapaths) Then
  2877.         If StringLen($aextrapaths) Then
  2878.             $aextrapaths = StringSplit($aextrapaths, $spathdelimiter, $str_entiresplit + $str_nocount)
  2879.             $iextracount = UBound($aextrapaths, $ubound_rows)
  2880.         EndIf
  2881.     ElseIf IsArray($aextrapaths) Then
  2882.         $iextracount = UBound($aextrapaths)
  2883.     EndIf
  2884.     Local $tpaths, $tpathptrs
  2885.     If $iextracount Then
  2886.         Local $tagstruct = ""
  2887.         For $path In $aextrapaths
  2888.             $tagstruct &= "wchar[" & StringLen($path) + 1 & "];"
  2889.         Next
  2890.         $tpaths = DllStructCreate($tagstruct)
  2891.         $tpathptrs = DllStructCreate("ptr[" & $iextracount + 1 & "]")
  2892.         For $i = 1 To $iextracount
  2893.             DllStructSetData($tpaths, $i, $aextrapaths[$i - 1])
  2894.             DllStructSetData($tpathptrs, 1, DllStructGetPtr($tpaths, $i), $i)
  2895.         Next
  2896.         DllStructSetData($tpathptrs, 1, Ptr(0), $iextracount + 1)
  2897.     EndIf
  2898.     Local $aresult = DllCall("shlwapi.dll", "bool", "PathFindOnPathW", "wstr", $sfilepath, "struct*", $tpathptrs)
  2899.     If @error OR NOT $aresult[0] Then Return SetError(@error + 10, @extended, $sfilepath)
  2900.     Return $aresult[1]
  2901. EndFunc
  2902.  
  2903. Func _winapi_pointfromrect(ByRef $trect, $bcenter = True)
  2904.     Local $ix1 = DllStructGetData($trect, "Left")
  2905.     Local $iy1 = DllStructGetData($trect, "Top")
  2906.     Local $ix2 = DllStructGetData($trect, "Right")
  2907.     Local $iy2 = DllStructGetData($trect, "Bottom")
  2908.     If $bcenter Then
  2909.         $ix1 = $ix1 + (($ix2 - $ix1) / 2)
  2910.         $iy1 = $iy1 + (($iy2 - $iy1) / 2)
  2911.     EndIf
  2912.     Local $tpoint = DllStructCreate($tagpoint)
  2913.     DllStructSetData($tpoint, "X", $ix1)
  2914.     DllStructSetData($tpoint, "Y", $iy1)
  2915.     Return $tpoint
  2916. EndFunc
  2917.  
  2918. Func _winapi_postmessage($hwnd, $imsg, $wparam, $lparam)
  2919.     Local $aresult = DllCall("user32.dll", "bool", "PostMessage", "hwnd", $hwnd, "uint", $imsg, "wparam", $wparam, "lparam", $lparam)
  2920.     If @error Then Return SetError(@error, @extended, False)
  2921.     Return $aresult[0]
  2922. EndFunc
  2923.  
  2924. Func _winapi_primarylangid($ilngid)
  2925.     Return BitAND($ilngid, 1023)
  2926. EndFunc
  2927.  
  2928. Func _winapi_ptinrect(ByRef $trect, ByRef $tpoint)
  2929.     Local $aresult = DllCall("user32.dll", "bool", "PtInRect", "struct*", $trect, "struct", $tpoint)
  2930.     If @error Then Return SetError(@error, @extended, False)
  2931.     Return $aresult[0]
  2932. EndFunc
  2933.  
  2934. Func _winapi_readfile($hfile, $pbuffer, $itoread, ByRef $iread, $toverlapped = 0)
  2935.     Local $aresult = DllCall("kernel32.dll", "bool", "ReadFile", "handle", $hfile, "struct*", $pbuffer, "dword", $itoread, "dword*", 0, "struct*", $toverlapped)
  2936.     If @error Then Return SetError(@error, @extended, False)
  2937.     $iread = $aresult[4]
  2938.     Return $aresult[0]
  2939. EndFunc
  2940.  
  2941. Func _winapi_readprocessmemory($hprocess, $pbaseaddress, $pbuffer, $isize, ByRef $iread)
  2942.     Local $aresult = DllCall("kernel32.dll", "bool", "ReadProcessMemory", "handle", $hprocess, "ptr", $pbaseaddress, "struct*", $pbuffer, "ulong_ptr", $isize, "ulong_ptr*", 0)
  2943.     If @error Then Return SetError(@error, @extended, False)
  2944.     $iread = $aresult[5]
  2945.     Return $aresult[0]
  2946. EndFunc
  2947.  
  2948. Func _winapi_rectisempty(ByRef $trect)
  2949.     Return (DllStructGetData($trect, "Left") = 0) AND (DllStructGetData($trect, "Top") = 0) AND (DllStructGetData($trect, "Right") = 0) AND (DllStructGetData($trect, "Bottom") = 0)
  2950. EndFunc
  2951.  
  2952. Func _winapi_redrawwindow($hwnd, $trect = 0, $hregion = 0, $iflags = 5)
  2953.     Local $aresult = DllCall("user32.dll", "bool", "RedrawWindow", "hwnd", $hwnd, "struct*", $trect, "handle", $hregion, "uint", $iflags)
  2954.     If @error Then Return SetError(@error, @extended, False)
  2955.     Return $aresult[0]
  2956. EndFunc
  2957.  
  2958. Func _winapi_registerwindowmessage($smessage)
  2959.     Local $aresult = DllCall("user32.dll", "uint", "RegisterWindowMessageW", "wstr", $smessage)
  2960.     If @error Then Return SetError(@error, @extended, 0)
  2961.     Return $aresult[0]
  2962. EndFunc
  2963.  
  2964. Func _winapi_releasecapture()
  2965.     Local $aresult = DllCall("user32.dll", "bool", "ReleaseCapture")
  2966.     If @error Then Return SetError(@error, @extended, False)
  2967.     Return $aresult[0]
  2968. EndFunc
  2969.  
  2970. Func _winapi_releasedc($hwnd, $hdc)
  2971.     Local $aresult = DllCall("user32.dll", "int", "ReleaseDC", "hwnd", $hwnd, "handle", $hdc)
  2972.     If @error Then Return SetError(@error, @extended, False)
  2973.     Return $aresult[0]
  2974. EndFunc
  2975.  
  2976. Func _winapi_screentoclient($hwnd, ByRef $tpoint)
  2977.     Local $aresult = DllCall("user32.dll", "bool", "ScreenToClient", "hwnd", $hwnd, "struct*", $tpoint)
  2978.     If @error Then Return SetError(@error, @extended, False)
  2979.     Return $aresult[0]
  2980. EndFunc
  2981.  
  2982. Func _winapi_selectobject($hdc, $hgdiobj)
  2983.     Local $aresult = DllCall("gdi32.dll", "handle", "SelectObject", "handle", $hdc, "handle", $hgdiobj)
  2984.     If @error Then Return SetError(@error, @extended, False)
  2985.     Return $aresult[0]
  2986. EndFunc
  2987.  
  2988. Func _winapi_setbkcolor($hdc, $icolor)
  2989.     Local $aresult = DllCall("gdi32.dll", "INT", "SetBkColor", "handle", $hdc, "INT", $icolor)
  2990.     If @error Then Return SetError(@error, @extended, -1)
  2991.     Return $aresult[0]
  2992. EndFunc
  2993.  
  2994. Func _winapi_setbkmode($hdc, $ibkmode)
  2995.     Local $aresult = DllCall("gdi32.dll", "int", "SetBkMode", "handle", $hdc, "int", $ibkmode)
  2996.     If @error Then Return SetError(@error, @extended, 0)
  2997.     Return $aresult[0]
  2998. EndFunc
  2999.  
  3000. Func _winapi_setcapture($hwnd)
  3001.     Local $aresult = DllCall("user32.dll", "hwnd", "SetCapture", "hwnd", $hwnd)
  3002.     If @error Then Return SetError(@error, @extended, 0)
  3003.     Return $aresult[0]
  3004. EndFunc
  3005.  
  3006. Func _winapi_setcursor($hcursor)
  3007.     Local $aresult = DllCall("user32.dll", "handle", "SetCursor", "handle", $hcursor)
  3008.     If @error Then Return SetError(@error, @extended, 0)
  3009.     Return $aresult[0]
  3010. EndFunc
  3011.  
  3012. Func _winapi_setdefaultprinter($sprinter)
  3013.     Local $aresult = DllCall("winspool.drv", "bool", "SetDefaultPrinterW", "wstr", $sprinter)
  3014.     If @error Then Return SetError(@error, @extended, False)
  3015.     Return $aresult[0]
  3016. EndFunc
  3017.  
  3018. Func _winapi_setdibits($hdc, $hbitmap, $istartscan, $iscanlines, $pbits, $tbmi, $icoloruse = 0)
  3019.     Local $aresult = DllCall("gdi32.dll", "int", "SetDIBits", "handle", $hdc, "handle", $hbitmap, "uint", $istartscan, "uint", $iscanlines, "struct*", $pbits, "struct*", $tbmi, "INT", $icoloruse)
  3020.     If @error Then Return SetError(@error, @extended, False)
  3021.     Return $aresult[0]
  3022. EndFunc
  3023.  
  3024. Func _winapi_setendoffile($hfile)
  3025.     Local $aresult = DllCall("kernel32.dll", "bool", "SetEndOfFile", "handle", $hfile)
  3026.     If @error Then Return SetError(@error, @extended, False)
  3027.     Return $aresult[0]
  3028. EndFunc
  3029.  
  3030. Func _winapi_setevent($hevent)
  3031.     Local $aresult = DllCall("kernel32.dll", "bool", "SetEvent", "handle", $hevent)
  3032.     If @error Then Return SetError(@error, @extended, False)
  3033.     Return $aresult[0]
  3034. EndFunc
  3035.  
  3036. Func _winapi_setfilepointer($hfile, $ipos, $imethod = 0)
  3037.     Local $aresult = DllCall("kernel32.dll", "INT", "SetFilePointer", "handle", $hfile, "long", $ipos, "ptr", 0, "long", $imethod)
  3038.     If @error Then Return SetError(@error, @extended, -1)
  3039.     Return $aresult[0]
  3040. EndFunc
  3041.  
  3042. Func _winapi_setfocus($hwnd)
  3043.     Local $aresult = DllCall("user32.dll", "hwnd", "SetFocus", "hwnd", $hwnd)
  3044.     If @error Then Return SetError(@error, @extended, 0)
  3045.     Return $aresult[0]
  3046. EndFunc
  3047.  
  3048. Func _winapi_setfont($hwnd, $hfont, $bredraw = True)
  3049.     _sendmessage($hwnd, $__winapiconstant_wm_setfont, $hfont, $bredraw, 0, "hwnd")
  3050. EndFunc
  3051.  
  3052. Func _winapi_sethandleinformation($hobject, $imask, $iflags)
  3053.     Local $aresult = DllCall("kernel32.dll", "bool", "SetHandleInformation", "handle", $hobject, "dword", $imask, "dword", $iflags)
  3054.     If @error Then Return SetError(@error, @extended, False)
  3055.     Return $aresult[0]
  3056. EndFunc
  3057.  
  3058. Func _winapi_setlayeredwindowattributes($hwnd, $itranscolor, $itransgui = 255, $iflags = 3, $bcolorref = False)
  3059.     If $iflags = Default OR $iflags = "" OR $iflags < 0 Then $iflags = 3
  3060.     If NOT $bcolorref Then
  3061.         $itranscolor = Int(BinaryMid($itranscolor, 3, 1) & BinaryMid($itranscolor, 2, 1) & BinaryMid($itranscolor, 1, 1))
  3062.     EndIf
  3063.     Local $aresult = DllCall("user32.dll", "bool", "SetLayeredWindowAttributes", "hwnd", $hwnd, "INT", $itranscolor, "byte", $itransgui, "dword", $iflags)
  3064.     If @error Then Return SetError(@error, @extended, False)
  3065.     Return $aresult[0]
  3066. EndFunc
  3067.  
  3068. Func _winapi_setparent($hwndchild, $hwndparent)
  3069.     Local $aresult = DllCall("user32.dll", "hwnd", "SetParent", "hwnd", $hwndchild, "hwnd", $hwndparent)
  3070.     If @error Then Return SetError(@error, @extended, 0)
  3071.     Return $aresult[0]
  3072. EndFunc
  3073.  
  3074. Func _winapi_setprocessaffinitymask($hprocess, $imask)
  3075.     Local $aresult = DllCall("kernel32.dll", "bool", "SetProcessAffinityMask", "handle", $hprocess, "ulong_ptr", $imask)
  3076.     If @error Then Return SetError(@error, @extended, False)
  3077.     Return $aresult[0]
  3078. EndFunc
  3079.  
  3080. Func _winapi_setsyscolors($velements, $vcolors)
  3081.     Local $bisearray = IsArray($velements), $biscarray = IsArray($vcolors)
  3082.     Local $ielementnum
  3083.     If NOT $biscarray AND NOT $bisearray Then
  3084.         $ielementnum = 1
  3085.     ElseIf $biscarray OR $bisearray Then
  3086.         If NOT $biscarray OR NOT $bisearray Then Return SetError(-1, -1, False)
  3087.         If UBound($velements) <> UBound($vcolors) Then Return SetError(-1, -1, False)
  3088.         $ielementnum = UBound($velements)
  3089.     EndIf
  3090.     Local $telements = DllStructCreate("int Element[" & $ielementnum & "]")
  3091.     Local $tcolors = DllStructCreate("INT NewColor[" & $ielementnum & "]")
  3092.     If NOT $bisearray Then
  3093.         DllStructSetData($telements, "Element", $velements, 1)
  3094.     Else
  3095.         For $x = 0 To $ielementnum - 1
  3096.             DllStructSetData($telements, "Element", $velements[$x], $x + 1)
  3097.         Next
  3098.     EndIf
  3099.     If NOT $biscarray Then
  3100.         DllStructSetData($tcolors, "NewColor", $vcolors, 1)
  3101.     Else
  3102.         For $x = 0 To $ielementnum - 1
  3103.             DllStructSetData($tcolors, "NewColor", $vcolors[$x], $x + 1)
  3104.         Next
  3105.     EndIf
  3106.     Local $aresult = DllCall("user32.dll", "bool", "SetSysColors", "int", $ielementnum, "struct*", $telements, "struct*", $tcolors)
  3107.     If @error Then Return SetError(@error, @extended, False)
  3108.     Return $aresult[0]
  3109. EndFunc
  3110.  
  3111. Func _winapi_settextcolor($hdc, $icolor)
  3112.     Local $aresult = DllCall("gdi32.dll", "INT", "SetTextColor", "handle", $hdc, "INT", $icolor)
  3113.     If @error Then Return SetError(@error, @extended, -1)
  3114.     Return $aresult[0]
  3115. EndFunc
  3116.  
  3117. Func _winapi_setwindowlong($hwnd, $iindex, $ivalue)
  3118.     _winapi_setlasterror(0)
  3119.     Local $sfuncname = "SetWindowLongW"
  3120.     If @AutoItX64 Then $sfuncname = "SetWindowLongPtrW"
  3121.     Local $aresult = DllCall("user32.dll", "long_ptr", $sfuncname, "hwnd", $hwnd, "int", $iindex, "long_ptr", $ivalue)
  3122.     If @error Then Return SetError(@error, @extended, 0)
  3123.     Return $aresult[0]
  3124. EndFunc
  3125.  
  3126. Func _winapi_setwindowplacement($hwnd, $twindowplacement)
  3127.     Local $aresult = DllCall("user32.dll", "bool", "SetWindowPlacement", "hwnd", $hwnd, "struct*", $twindowplacement)
  3128.     If @error Then Return SetError(@error, @extended, False)
  3129.     Return $aresult[0]
  3130. EndFunc
  3131.  
  3132. Func _winapi_setwindowpos($hwnd, $hafter, $ix, $iy, $icx, $icy, $iflags)
  3133.     Local $aresult = DllCall("user32.dll", "bool", "SetWindowPos", "hwnd", $hwnd, "hwnd", $hafter, "int", $ix, "int", $iy, "int", $icx, "int", $icy, "uint", $iflags)
  3134.     If @error Then Return SetError(@error, @extended, False)
  3135.     Return $aresult[0]
  3136. EndFunc
  3137.  
  3138. Func _winapi_setwindowrgn($hwnd, $hrgn, $bredraw = True)
  3139.     Local $aresult = DllCall("user32.dll", "int", "SetWindowRgn", "hwnd", $hwnd, "handle", $hrgn, "bool", $bredraw)
  3140.     If @error Then Return SetError(@error, @extended, False)
  3141.     Return $aresult[0]
  3142. EndFunc
  3143.  
  3144. Func _winapi_setwindowshookex($ihook, $pproc, $hdll, $ithreadid = 0)
  3145.     Local $aresult = DllCall("user32.dll", "handle", "SetWindowsHookEx", "int", $ihook, "ptr", $pproc, "handle", $hdll, "dword", $ithreadid)
  3146.     If @error Then Return SetError(@error, @extended, 0)
  3147.     Return $aresult[0]
  3148. EndFunc
  3149.  
  3150. Func _winapi_setwindowtext($hwnd, $stext)
  3151.     Local $aresult = DllCall("user32.dll", "bool", "SetWindowTextW", "hwnd", $hwnd, "wstr", $stext)
  3152.     If @error Then Return SetError(@error, @extended, False)
  3153.     Return $aresult[0]
  3154. EndFunc
  3155.  
  3156. Func _winapi_showcursor($bshow)
  3157.     Local $aresult = DllCall("user32.dll", "int", "ShowCursor", "bool", $bshow)
  3158.     If @error Then Return SetError(@error, @extended, 0)
  3159.     Return $aresult[0]
  3160. EndFunc
  3161.  
  3162. Func _winapi_showerror($stext, $bexit = True)
  3163.     _winapi_msgbox($mb_systemmodal, "Error", $stext)
  3164.     If $bexit Then Exit
  3165. EndFunc
  3166.  
  3167. Func _winapi_showmsg($stext)
  3168.     _winapi_msgbox($mb_systemmodal, "Information", $stext)
  3169. EndFunc
  3170.  
  3171. Func _winapi_showwindow($hwnd, $icmdshow = 5)
  3172.     Local $aresult = DllCall("user32.dll", "bool", "ShowWindow", "hwnd", $hwnd, "int", $icmdshow)
  3173.     If @error Then Return SetError(@error, @extended, False)
  3174.     Return $aresult[0]
  3175. EndFunc
  3176.  
  3177. Func _winapi_stringfromguid($tguid)
  3178.     Local $aresult = DllCall("ole32.dll", "int", "StringFromGUID2", "struct*", $tguid, "wstr", "", "int", 40)
  3179.     If @error OR NOT $aresult[0] Then Return SetError(@error, @extended, "")
  3180.     Return SetExtended($aresult[0], $aresult[2])
  3181. EndFunc
  3182.  
  3183. Func _winapi_stringlena(Const ByRef $tstring)
  3184.     Local $aresult = DllCall("kernel32.dll", "int", "lstrlenA", "struct*", $tstring)
  3185.     If @error Then Return SetError(@error, @extended, 0)
  3186.     Return $aresult[0]
  3187. EndFunc
  3188.  
  3189. Func _winapi_stringlenw(Const ByRef $tstring)
  3190.     Local $aresult = DllCall("kernel32.dll", "int", "lstrlenW", "struct*", $tstring)
  3191.     If @error Then Return SetError(@error, @extended, 0)
  3192.     Return $aresult[0]
  3193. EndFunc
  3194.  
  3195. Func _winapi_sublangid($ilngid)
  3196.     Return BitShift($ilngid, 10)
  3197. EndFunc
  3198.  
  3199. Func _winapi_systemparametersinfo($iaction, $iparam = 0, $vparam = 0, $iwinini = 0)
  3200.     Local $aresult = DllCall("user32.dll", "bool", "SystemParametersInfoW", "uint", $iaction, "uint", $iparam, "struct*", $vparam, "uint", $iwinini)
  3201.     If @error Then Return SetError(@error, @extended, False)
  3202.     Return $aresult[0]
  3203. EndFunc
  3204.  
  3205. Func _winapi_twipsperpixelx()
  3206.     Local $hdc, $itwipsperpixelx
  3207.     $hdc = _winapi_getdc(0)
  3208.     $itwipsperpixelx = 1440 / _winapi_getdevicecaps($hdc, $__winapiconstant_logpixelsx)
  3209.     _winapi_releasedc(0, $hdc)
  3210.     Return $itwipsperpixelx
  3211. EndFunc
  3212.  
  3213. Func _winapi_twipsperpixely()
  3214.     Local $hdc, $itwipsperpixely
  3215.     $hdc = _winapi_getdc(0)
  3216.     $itwipsperpixely = 1440 / _winapi_getdevicecaps($hdc, $__winapiconstant_logpixelsy)
  3217.     _winapi_releasedc(0, $hdc)
  3218.     Return $itwipsperpixely
  3219. EndFunc
  3220.  
  3221. Func _winapi_unhookwindowshookex($hhook)
  3222.     Local $aresult = DllCall("user32.dll", "bool", "UnhookWindowsHookEx", "handle", $hhook)
  3223.     If @error Then Return SetError(@error, @extended, False)
  3224.     Return $aresult[0]
  3225. EndFunc
  3226.  
  3227. Func _winapi_updatelayeredwindow($hwnd, $hdestdc, $tptdest, $tsize, $hsrcdc, $tptsrce, $irgb, $tblend, $iflags)
  3228.     Local $aresult = DllCall("user32.dll", "bool", "UpdateLayeredWindow", "hwnd", $hwnd, "handle", $hdestdc, "struct*", $tptdest, "struct*", $tsize, "handle", $hsrcdc, "struct*", $tptsrce, "dword", $irgb, "struct*", $tblend, "dword", $iflags)
  3229.     If @error Then Return SetError(@error, @extended, False)
  3230.     Return $aresult[0]
  3231. EndFunc
  3232.  
  3233. Func _winapi_updatewindow($hwnd)
  3234.     Local $aresult = DllCall("user32.dll", "bool", "UpdateWindow", "hwnd", $hwnd)
  3235.     If @error Then Return SetError(@error, @extended, False)
  3236.     Return $aresult[0]
  3237. EndFunc
  3238.  
  3239. Func _winapi_waitforinputidle($hprocess, $itimeout = -1)
  3240.     Local $aresult = DllCall("user32.dll", "dword", "WaitForInputIdle", "handle", $hprocess, "dword", $itimeout)
  3241.     If @error Then Return SetError(@error, @extended, False)
  3242.     Return $aresult[0]
  3243. EndFunc
  3244.  
  3245. Func _winapi_waitformultipleobjects($icount, $pahandles, $bwaitall = False, $itimeout = -1)
  3246.     Local $aresult = DllCall("kernel32.dll", "INT", "WaitForMultipleObjects", "dword", $icount, "struct*", $pahandles, "bool", $bwaitall, "dword", $itimeout)
  3247.     If @error Then Return SetError(@error, @extended, -1)
  3248.     Return $aresult[0]
  3249. EndFunc
  3250.  
  3251. Func _winapi_waitforsingleobject($hhandle, $itimeout = -1)
  3252.     Local $aresult = DllCall("kernel32.dll", "INT", "WaitForSingleObject", "handle", $hhandle, "dword", $itimeout)
  3253.     If @error Then Return SetError(@error, @extended, -1)
  3254.     Return $aresult[0]
  3255. EndFunc
  3256.  
  3257. Func _winapi_widechartomultibyte($vunicode, $icodepage = 0, $bretstring = True)
  3258.     Local $sunicodetype = "wstr"
  3259.     If NOT IsString($vunicode) Then $sunicodetype = "struct*"
  3260.     Local $aresult = DllCall("kernel32.dll", "int", "WideCharToMultiByte", "uint", $icodepage, "dword", 0, $sunicodetype, $vunicode, "int", -1, "ptr", 0, "int", 0, "ptr", 0, "ptr", 0)
  3261.     If @error OR NOT $aresult[0] Then Return SetError(@error + 20, @extended, "")
  3262.     Local $tmultibyte = DllStructCreate("char[" & $aresult[0] & "]")
  3263.     $aresult = DllCall("kernel32.dll", "int", "WideCharToMultiByte", "uint", $icodepage, "dword", 0, $sunicodetype, $vunicode, "int", -1, "struct*", $tmultibyte, "int", $aresult[0], "ptr", 0, "ptr", 0)
  3264.     If @error OR NOT $aresult[0] Then Return SetError(@error + 10, @extended, "")
  3265.     If $bretstring Then Return DllStructGetData($tmultibyte, 1)
  3266.     Return $tmultibyte
  3267. EndFunc
  3268.  
  3269. Func _winapi_windowfrompoint(ByRef $tpoint)
  3270.     Local $aresult = DllCall("user32.dll", "hwnd", "WindowFromPoint", "struct", $tpoint)
  3271.     If @error Then Return SetError(@error, @extended, 0)
  3272.     Return $aresult[0]
  3273. EndFunc
  3274.  
  3275. Func _winapi_writeconsole($hconsole, $stext)
  3276.     Local $aresult = DllCall("kernel32.dll", "bool", "WriteConsoleW", "handle", $hconsole, "wstr", $stext, "dword", StringLen($stext), "dword*", 0, "ptr", 0)
  3277.     If @error Then Return SetError(@error, @extended, False)
  3278.     Return $aresult[0]
  3279. EndFunc
  3280.  
  3281. Func _winapi_writefile($hfile, $pbuffer, $itowrite, ByRef $iwritten, $toverlapped = 0)
  3282.     Local $aresult = DllCall("kernel32.dll", "bool", "WriteFile", "handle", $hfile, "struct*", $pbuffer, "dword", $itowrite, "dword*", 0, "struct*", $toverlapped)
  3283.     If @error Then Return SetError(@error, @extended, False)
  3284.     $iwritten = $aresult[4]
  3285.     Return $aresult[0]
  3286. EndFunc
  3287.  
  3288. Func _winapi_writeprocessmemory($hprocess, $pbaseaddress, $pbuffer, $isize, ByRef $iwritten, $sbuffer = "ptr")
  3289.     Local $aresult = DllCall("kernel32.dll", "bool", "WriteProcessMemory", "handle", $hprocess, "ptr", $pbaseaddress, $sbuffer, $pbuffer, "ulong_ptr", $isize, "ulong_ptr*", 0)
  3290.     If @error Then Return SetError(@error, @extended, False)
  3291.     $iwritten = $aresult[5]
  3292.     Return $aresult[0]
  3293. EndFunc
  3294.  
  3295. Global Const $_udf_globalids_offset = 2
  3296. Global Const $_udf_globalid_max_win = 16
  3297. Global Const $_udf_startid = 10000
  3298. Global Const $_udf_globalid_max_ids = 55535
  3299. Global Const $__udfguiconstant_ws_tabstop = 65536
  3300. Global Const $__udfguiconstant_ws_visible = 268435456
  3301. Global Const $__udfguiconstant_ws_child = 1073741824
  3302. Global $__g_audf_globalids_used[$_udf_globalid_max_win][$_udf_globalid_max_ids + $_udf_globalids_offset + 1]
  3303.  
  3304. Func __udf_getnextglobalid($hwnd)
  3305.     Local $nctrlid, $iusedindex = -1, $ballused = True
  3306.     If NOT WinExists($hwnd) Then Return SetError(-1, -1, 0)
  3307.     For $iindex = 0 To $_udf_globalid_max_win - 1
  3308.         If $__g_audf_globalids_used[$iindex][0] <> 0 Then
  3309.             If NOT WinExists($__g_audf_globalids_used[$iindex][0]) Then
  3310.                 For $x = 0 To UBound($__g_audf_globalids_used, $ubound_columns) - 1
  3311.                     $__g_audf_globalids_used[$iindex][$x] = 0
  3312.                 Next
  3313.                 $__g_audf_globalids_used[$iindex][1] = $_udf_startid
  3314.                 $ballused = False
  3315.             EndIf
  3316.         EndIf
  3317.     Next
  3318.     For $iindex = 0 To $_udf_globalid_max_win - 1
  3319.         If $__g_audf_globalids_used[$iindex][0] = $hwnd Then
  3320.             $iusedindex = $iindex
  3321.             ExitLoop
  3322.         EndIf
  3323.     Next
  3324.     If $iusedindex = -1 Then
  3325.         For $iindex = 0 To $_udf_globalid_max_win - 1
  3326.             If $__g_audf_globalids_used[$iindex][0] = 0 Then
  3327.                 $__g_audf_globalids_used[$iindex][0] = $hwnd
  3328.                 $__g_audf_globalids_used[$iindex][1] = $_udf_startid
  3329.                 $ballused = False
  3330.                 $iusedindex = $iindex
  3331.                 ExitLoop
  3332.             EndIf
  3333.         Next
  3334.     EndIf
  3335.     If $iusedindex = -1 AND $ballused Then Return SetError(16, 0, 0)
  3336.     If $__g_audf_globalids_used[$iusedindex][1] = $_udf_startid + $_udf_globalid_max_ids Then
  3337.         For $iidindex = $_udf_globalids_offset To UBound($__g_audf_globalids_used, $ubound_columns) - 1
  3338.             If $__g_audf_globalids_used[$iusedindex][$iidindex] = 0 Then
  3339.                 $nctrlid = ($iidindex - $_udf_globalids_offset) + 10000
  3340.                 $__g_audf_globalids_used[$iusedindex][$iidindex] = $nctrlid
  3341.                 Return $nctrlid
  3342.             EndIf
  3343.         Next
  3344.         Return SetError(-1, $_udf_globalid_max_ids, 0)
  3345.     EndIf
  3346.     $nctrlid = $__g_audf_globalids_used[$iusedindex][1]
  3347.     $__g_audf_globalids_used[$iusedindex][1] += 1
  3348.     $__g_audf_globalids_used[$iusedindex][($nctrlid - 10000) + $_udf_globalids_offset] = $nctrlid
  3349.     Return $nctrlid
  3350. EndFunc
  3351.  
  3352. Func __udf_freeglobalid($hwnd, $iglobalid)
  3353.     If $iglobalid - $_udf_startid < 0 OR $iglobalid - $_udf_startid > $_udf_globalid_max_ids Then Return SetError(-1, 0, False)
  3354.     For $iindex = 0 To $_udf_globalid_max_win - 1
  3355.         If $__g_audf_globalids_used[$iindex][0] = $hwnd Then
  3356.             For $x = $_udf_globalids_offset To UBound($__g_audf_globalids_used, $ubound_columns) - 1
  3357.                 If $__g_audf_globalids_used[$iindex][$x] = $iglobalid Then
  3358.                     $__g_audf_globalids_used[$iindex][$x] = 0
  3359.                     Return True
  3360.                 EndIf
  3361.             Next
  3362.             Return SetError(-3, 0, False)
  3363.         EndIf
  3364.     Next
  3365.     Return SetError(-2, 0, False)
  3366. EndFunc
  3367.  
  3368. Global $__g_hsblastwnd
  3369. Global Const $__statusbarconstant_classname = "msctls_statusbar32"
  3370. Global Const $__statusbarconstant_wm_size = 5
  3371. Global Const $__statusbarconstant_clr_default = -16777216
  3372. Global Const $tagborders = "int BX;int BY;int RX"
  3373.  
  3374. Func _guictrlstatusbar_create($hwnd, $vpartedge = -1, $vparttext = "", $istyles = -1, $iexstyles = 0)
  3375.     If NOT IsHWnd($hwnd) Then Return SetError(1, 0, 0)
  3376.     Local $istyle = BitOR($__udfguiconstant_ws_child, $__udfguiconstant_ws_visible)
  3377.     If $istyles = -1 Then $istyles = 0
  3378.     If $iexstyles = -1 Then $iexstyles = 0
  3379.     Local $apartwidth[1], $aparttext[1]
  3380.     If @NumParams > 1 Then
  3381.         If IsArray($vpartedge) Then
  3382.             $apartwidth = $vpartedge
  3383.         Else
  3384.             $apartwidth[0] = $vpartedge
  3385.         EndIf
  3386.         If @NumParams = 2 Then
  3387.             ReDim $aparttext[UBound($apartwidth)]
  3388.         Else
  3389.             If IsArray($vparttext) Then
  3390.                 $aparttext = $vparttext
  3391.             Else
  3392.                 $aparttext[0] = $vparttext
  3393.             EndIf
  3394.             If UBound($apartwidth) <> UBound($aparttext) Then
  3395.                 Local $ilast
  3396.                 If UBound($apartwidth) > UBound($aparttext) Then
  3397.                     $ilast = UBound($aparttext)
  3398.                     ReDim $aparttext[UBound($apartwidth)]
  3399.                 Else
  3400.                     $ilast = UBound($apartwidth)
  3401.                     ReDim $apartwidth[UBound($aparttext)]
  3402.                     For $x = $ilast To UBound($apartwidth) - 1
  3403.                         $apartwidth[$x] = $apartwidth[$x - 1] + 75
  3404.                     Next
  3405.                     $apartwidth[UBound($aparttext) - 1] = -1
  3406.                 EndIf
  3407.             EndIf
  3408.         EndIf
  3409.         If NOT IsHWnd($hwnd) Then $hwnd = HWnd($hwnd)
  3410.         If @NumParams > 3 Then $istyle = BitOR($istyle, $istyles)
  3411.     EndIf
  3412.     Local $nctrlid = __udf_getnextglobalid($hwnd)
  3413.     If @error Then Return SetError(@error, @extended, 0)
  3414.     Local $hwndsbar = _winapi_createwindowex($iexstyles, $__statusbarconstant_classname, "", $istyle, 0, 0, 0, 0, $hwnd, $nctrlid)
  3415.     If @error Then Return SetError(@error, @extended, 0)
  3416.     If @NumParams > 1 Then
  3417.         _guictrlstatusbar_setparts($hwndsbar, UBound($apartwidth), $apartwidth)
  3418.         For $x = 0 To UBound($aparttext) - 1
  3419.             _guictrlstatusbar_settext($hwndsbar, $aparttext[$x], $x)
  3420.         Next
  3421.     EndIf
  3422.     Return $hwndsbar
  3423. EndFunc
  3424.  
  3425. Func _guictrlstatusbar_destroy(ByRef $hwnd)
  3426.     If NOT _winapi_isclassname($hwnd, $__statusbarconstant_classname) Then Return SetError(2, 2, False)
  3427.     Local $idestroyed = 0
  3428.     If IsHWnd($hwnd) Then
  3429.         If _winapi_inprocess($hwnd, $__g_hsblastwnd) Then
  3430.             Local $nctrlid = _winapi_getdlgctrlid($hwnd)
  3431.             Local $hparent = _winapi_getparent($hwnd)
  3432.             $idestroyed = _winapi_destroywindow($hwnd)
  3433.             Local $iret = __udf_freeglobalid($hparent, $nctrlid)
  3434.             If NOT $iret Then
  3435.             EndIf
  3436.         Else
  3437.             Return SetError(1, 1, False)
  3438.         EndIf
  3439.     EndIf
  3440.     If $idestroyed Then $hwnd = 0
  3441.     Return $idestroyed <> 0
  3442. EndFunc
  3443.  
  3444. Func _guictrlstatusbar_embedcontrol($hwnd, $ipart, $hcontrol, $ifit = 4)
  3445.     Local $arect = _guictrlstatusbar_getrect($hwnd, $ipart)
  3446.     Local $ibarx = $arect[0]
  3447.     Local $ibary = $arect[1]
  3448.     Local $ibarw = $arect[2] - $ibarx
  3449.     Local $ibarh = $arect[3] - $ibary
  3450.     Local $iconx = $ibarx
  3451.     Local $icony = $ibary
  3452.     Local $iconw = _winapi_getwindowwidth($hcontrol)
  3453.     Local $iconh = _winapi_getwindowheight($hcontrol)
  3454.     If $iconw > $ibarw Then $iconw = $ibarw
  3455.     If $iconh > $ibarh Then $iconh = $ibarh
  3456.     Local $ipadx = ($ibarw - $iconw) / 2
  3457.     Local $ipady = ($ibarh - $iconh) / 2
  3458.     If $ipadx < 0 Then $ipadx = 0
  3459.     If $ipady < 0 Then $ipady = 0
  3460.     If BitAND($ifit, 1) = 1 Then $iconx = $ibarx + $ipadx
  3461.     If BitAND($ifit, 2) = 2 Then $icony = $ibary + $ipady
  3462.     If BitAND($ifit, 4) = 4 Then
  3463.         $ipadx = _guictrlstatusbar_getbordersrect($hwnd)
  3464.         $ipady = _guictrlstatusbar_getbordersvert($hwnd)
  3465.         $iconx = $ibarx
  3466.         If _guictrlstatusbar_issimple($hwnd) Then $iconx += $ipadx
  3467.         $icony = $ibary + $ipady
  3468.         $iconw = $ibarw - ($ipadx * 2)
  3469.         $iconh = $ibarh - ($ipady * 2)
  3470.     EndIf
  3471.     _winapi_setparent($hcontrol, $hwnd)
  3472.     _winapi_movewindow($hcontrol, $iconx, $icony, $iconw, $iconh)
  3473. EndFunc
  3474.  
  3475. Func _guictrlstatusbar_getborders($hwnd)
  3476.     Local $tborders = DllStructCreate($tagborders)
  3477.     Local $iret
  3478.     If _winapi_inprocess($hwnd, $__g_hsblastwnd) Then
  3479.         $iret = _sendmessage($hwnd, $sb_getborders, 0, $tborders, 0, "wparam", "struct*")
  3480.     Else
  3481.         Local $isize = DllStructGetSize($tborders)
  3482.         Local $tmemmap
  3483.         Local $pmemory = _meminit($hwnd, $isize, $tmemmap)
  3484.         $iret = _sendmessage($hwnd, $sb_getborders, 0, $pmemory, 0, "wparam", "ptr")
  3485.         _memread($tmemmap, $pmemory, $tborders, $isize)
  3486.         _memfree($tmemmap)
  3487.     EndIf
  3488.     Local $aborders[3]
  3489.     If $iret = 0 Then Return SetError(-1, -1, $aborders)
  3490.     $aborders[0] = DllStructGetData($tborders, "BX")
  3491.     $aborders[1] = DllStructGetData($tborders, "BY")
  3492.     $aborders[2] = DllStructGetData($tborders, "RX")
  3493.     Return $aborders
  3494. EndFunc
  3495.  
  3496. Func _guictrlstatusbar_getbordershorz($hwnd)
  3497.     Local $aborders = _guictrlstatusbar_getborders($hwnd)
  3498.     Return SetError(@error, @extended, $aborders[0])
  3499. EndFunc
  3500.  
  3501. Func _guictrlstatusbar_getbordersrect($hwnd)
  3502.     Local $aborders = _guictrlstatusbar_getborders($hwnd)
  3503.     Return SetError(@error, @extended, $aborders[2])
  3504. EndFunc
  3505.  
  3506. Func _guictrlstatusbar_getbordersvert($hwnd)
  3507.     Local $aborders = _guictrlstatusbar_getborders($hwnd)
  3508.     Return SetError(@error, @extended, $aborders[1])
  3509. EndFunc
  3510.  
  3511. Func _guictrlstatusbar_getcount($hwnd)
  3512.     Return _sendmessage($hwnd, $sb_getparts)
  3513. EndFunc
  3514.  
  3515. Func _guictrlstatusbar_getheight($hwnd)
  3516.     Local $trect = _guictrlstatusbar_getrectex($hwnd, 0)
  3517.     Return DllStructGetData($trect, "Bottom") - DllStructGetData($trect, "Top") - (_guictrlstatusbar_getbordersvert($hwnd) * 2)
  3518. EndFunc
  3519.  
  3520. Func _guictrlstatusbar_geticon($hwnd, $iindex = 0)
  3521.     Return _sendmessage($hwnd, $sb_geticon, $iindex, 0, 0, "wparam", "lparam", "handle")
  3522. EndFunc
  3523.  
  3524. Func _guictrlstatusbar_getparts($hwnd)
  3525.     Local $icount = _guictrlstatusbar_getcount($hwnd)
  3526.     Local $tparts = DllStructCreate("int[" & $icount & "]")
  3527.     Local $aparts[$icount + 1]
  3528.     If _winapi_inprocess($hwnd, $__g_hsblastwnd) Then
  3529.         $aparts[0] = _sendmessage($hwnd, $sb_getparts, $icount, $tparts, 0, "wparam", "struct*")
  3530.     Else
  3531.         Local $iparts = DllStructGetSize($tparts)
  3532.         Local $tmemmap
  3533.         Local $pmemory = _meminit($hwnd, $iparts, $tmemmap)
  3534.         $aparts[0] = _sendmessage($hwnd, $sb_getparts, $icount, $pmemory, 0, "wparam", "ptr")
  3535.         _memread($tmemmap, $pmemory, $tparts, $iparts)
  3536.         _memfree($tmemmap)
  3537.     EndIf
  3538.     For $ii = 1 To $icount
  3539.         $aparts[$ii] = DllStructGetData($tparts, 1, $ii)
  3540.     Next
  3541.     Return $aparts
  3542. EndFunc
  3543.  
  3544. Func _guictrlstatusbar_getrect($hwnd, $ipart)
  3545.     Local $trect = _guictrlstatusbar_getrectex($hwnd, $ipart)
  3546.     If @error Then Return SetError(@error, 0, 0)
  3547.     Local $arect[4]
  3548.     $arect[0] = DllStructGetData($trect, "Left")
  3549.     $arect[1] = DllStructGetData($trect, "Top")
  3550.     $arect[2] = DllStructGetData($trect, "Right")
  3551.     $arect[3] = DllStructGetData($trect, "Bottom")
  3552.     Return $arect
  3553. EndFunc
  3554.  
  3555. Func _guictrlstatusbar_getrectex($hwnd, $ipart)
  3556.     Local $trect = DllStructCreate($tagrect)
  3557.     Local $iret
  3558.     If _winapi_inprocess($hwnd, $__g_hsblastwnd) Then
  3559.         $iret = _sendmessage($hwnd, $sb_getrect, $ipart, $trect, 0, "wparam", "struct*")
  3560.     Else
  3561.         Local $irect = DllStructGetSize($trect)
  3562.         Local $tmemmap
  3563.         Local $pmemory = _meminit($hwnd, $irect, $tmemmap)
  3564.         $iret = _sendmessage($hwnd, $sb_getrect, $ipart, $pmemory, 0, "wparam", "ptr")
  3565.         _memread($tmemmap, $pmemory, $trect, $irect)
  3566.         _memfree($tmemmap)
  3567.     EndIf
  3568.     Return SetError($iret = 0, 0, $trect)
  3569. EndFunc
  3570.  
  3571. Func _guictrlstatusbar_gettext($hwnd, $ipart)
  3572.     Local $bunicode = _guictrlstatusbar_getunicodeformat($hwnd)
  3573.     Local $ibuffer = _guictrlstatusbar_gettextlength($hwnd, $ipart) + 1
  3574.     If $ibuffer = 1 Then Return SetError(1, 0, "")
  3575.     Local $tbuffer
  3576.     If $bunicode Then
  3577.         $tbuffer = DllStructCreate("wchar Text[" & $ibuffer & "]")
  3578.         $ibuffer *= 2
  3579.     Else
  3580.         $tbuffer = DllStructCreate("char Text[" & $ibuffer & "]")
  3581.     EndIf
  3582.     If _winapi_inprocess($hwnd, $__g_hsblastwnd) Then
  3583.         _sendmessage($hwnd, $sb_gettextw, $ipart, $tbuffer, 0, "wparam", "struct*")
  3584.     Else
  3585.         Local $tmemmap
  3586.         Local $pmemory = _meminit($hwnd, $ibuffer, $tmemmap)
  3587.         If $bunicode Then
  3588.             _sendmessage($hwnd, $sb_gettextw, $ipart, $pmemory, 0, "wparam", "ptr")
  3589.         Else
  3590.             _sendmessage($hwnd, $sb_gettext, $ipart, $pmemory, 0, "wparam", "ptr")
  3591.         EndIf
  3592.         _memread($tmemmap, $pmemory, $tbuffer, $ibuffer)
  3593.         _memfree($tmemmap)
  3594.     EndIf
  3595.     Return DllStructGetData($tbuffer, "Text")
  3596. EndFunc
  3597.  
  3598. Func _guictrlstatusbar_gettextflags($hwnd, $ipart)
  3599.     If _guictrlstatusbar_getunicodeformat($hwnd) Then
  3600.         Return _sendmessage($hwnd, $sb_gettextlengthw, $ipart)
  3601.     Else
  3602.         Return _sendmessage($hwnd, $sb_gettextlength, $ipart)
  3603.     EndIf
  3604. EndFunc
  3605.  
  3606. Func _guictrlstatusbar_gettextlength($hwnd, $ipart)
  3607.     Return _winapi_loword(_guictrlstatusbar_gettextflags($hwnd, $ipart))
  3608. EndFunc
  3609.  
  3610. Func _guictrlstatusbar_gettextlengthex($hwnd, $ipart)
  3611.     Return _winapi_hiword(_guictrlstatusbar_gettextflags($hwnd, $ipart))
  3612. EndFunc
  3613.  
  3614. Func _guictrlstatusbar_gettiptext($hwnd, $ipart)
  3615.     Local $bunicode = _guictrlstatusbar_getunicodeformat($hwnd)
  3616.     Local $tbuffer
  3617.     If $bunicode Then
  3618.         $tbuffer = DllStructCreate("wchar Text[4096]")
  3619.     Else
  3620.         $tbuffer = DllStructCreate("char Text[4096]")
  3621.     EndIf
  3622.     If _winapi_inprocess($hwnd, $__g_hsblastwnd) Then
  3623.         _sendmessage($hwnd, $sb_gettiptextw, _winapi_makelong($ipart, 4096), $tbuffer, 0, "wparam", "struct*")
  3624.     Else
  3625.         Local $tmemmap
  3626.         Local $pmemory = _meminit($hwnd, 4096, $tmemmap)
  3627.         If $bunicode Then
  3628.             _sendmessage($hwnd, $sb_gettiptextw, _winapi_makelong($ipart, 4096), $pmemory, 0, "wparam", "ptr")
  3629.         Else
  3630.             _sendmessage($hwnd, $sb_gettiptexta, _winapi_makelong($ipart, 4096), $pmemory, 0, "wparam", "ptr")
  3631.         EndIf
  3632.         _memread($tmemmap, $pmemory, $tbuffer, 4096)
  3633.         _memfree($tmemmap)
  3634.     EndIf
  3635.     Return DllStructGetData($tbuffer, "Text")
  3636. EndFunc
  3637.  
  3638. Func _guictrlstatusbar_getunicodeformat($hwnd)
  3639.     Return _sendmessage($hwnd, $sb_getunicodeformat) <> 0
  3640. EndFunc
  3641.  
  3642. Func _guictrlstatusbar_getwidth($hwnd, $ipart)
  3643.     Local $trect = _guictrlstatusbar_getrectex($hwnd, $ipart)
  3644.     Return DllStructGetData($trect, "Right") - DllStructGetData($trect, "Left") - (_guictrlstatusbar_getbordershorz($hwnd) * 2)
  3645. EndFunc
  3646.  
  3647. Func _guictrlstatusbar_issimple($hwnd)
  3648.     Return _sendmessage($hwnd, $sb_issimple) <> 0
  3649. EndFunc
  3650.  
  3651. Func _guictrlstatusbar_resize($hwnd)
  3652.     _sendmessage($hwnd, $__statusbarconstant_wm_size)
  3653. EndFunc
  3654.  
  3655. Func _guictrlstatusbar_setbkcolor($hwnd, $icolor)
  3656.     $icolor = _sendmessage($hwnd, $sb_setbkcolor, 0, $icolor)
  3657.     If $icolor = $__statusbarconstant_clr_default Then Return "0x" & Hex($__statusbarconstant_clr_default)
  3658.     Return $icolor
  3659. EndFunc
  3660.  
  3661. Func _guictrlstatusbar_seticon($hwnd, $ipart, $hicon = -1, $siconfile = "")
  3662.     If $hicon = -1 Then Return _sendmessage($hwnd, $sb_seticon, $ipart, $hicon, 0, "wparam", "handle") <> 0
  3663.     If StringLen($siconfile) <= 0 Then Return _sendmessage($hwnd, $sb_seticon, $ipart, $hicon) <> 0
  3664.     Local $ticon = DllStructCreate("handle")
  3665.     Local $vresult = DllCall("shell32.dll", "uint", "ExtractIconExW", "wstr", $siconfile, "int", $hicon, "ptr", 0, "struct*", $ticon, "uint", 1)
  3666.     If @error Then Return SetError(@error, @extended, False)
  3667.     $vresult = $vresult[0]
  3668.     If $vresult > 0 Then $vresult = _sendmessage($hwnd, $sb_seticon, $ipart, DllStructGetData($ticon, 1), 0, "wparam", "handle")
  3669.     DllCall("user32.dll", "bool", "DestroyIcon", "handle", DllStructGetData($ticon, 1))
  3670.     Return $vresult
  3671. EndFunc
  3672.  
  3673. Func _guictrlstatusbar_setminheight($hwnd, $iminheight)
  3674.     _sendmessage($hwnd, $sb_setminheight, $iminheight)
  3675.     _guictrlstatusbar_resize($hwnd)
  3676. EndFunc
  3677.  
  3678. Func _guictrlstatusbar_setparts($hwnd, $aparts = -1, $apartwidth = 25)
  3679.     Local $tparts, $iparts = 1
  3680.     If IsArray($aparts) <> 0 Then
  3681.         $aparts[UBound($aparts) - 1] = -1
  3682.         $iparts = UBound($aparts)
  3683.         $tparts = DllStructCreate("int[" & $iparts & "]")
  3684.         For $x = 0 To $iparts - 2
  3685.             DllStructSetData($tparts, 1, $aparts[$x], $x + 1)
  3686.         Next
  3687.         DllStructSetData($tparts, 1, -1, $iparts)
  3688.     ElseIf IsArray($apartwidth) <> 0 Then
  3689.         $iparts = UBound($apartwidth)
  3690.         $tparts = DllStructCreate("int[" & $iparts & "]")
  3691.         For $x = 0 To $iparts - 2
  3692.             DllStructSetData($tparts, 1, $apartwidth[$x], $x + 1)
  3693.         Next
  3694.         DllStructSetData($tparts, 1, -1, $iparts)
  3695.     ElseIf $aparts > 1 Then
  3696.         $iparts = $aparts
  3697.         $tparts = DllStructCreate("int[" & $iparts & "]")
  3698.         For $x = 1 To $iparts - 1
  3699.             DllStructSetData($tparts, 1, $apartwidth * $x, $x)
  3700.         Next
  3701.         DllStructSetData($tparts, 1, -1, $iparts)
  3702.     Else
  3703.         $tparts = DllStructCreate("int")
  3704.         DllStructSetData($tparts, $iparts, -1)
  3705.     EndIf
  3706.     If _winapi_inprocess($hwnd, $__g_hsblastwnd) Then
  3707.         _sendmessage($hwnd, $sb_setparts, $iparts, $tparts, 0, "wparam", "struct*")
  3708.     Else
  3709.         Local $isize = DllStructGetSize($tparts)
  3710.         Local $tmemmap
  3711.         Local $pmemory = _meminit($hwnd, $isize, $tmemmap)
  3712.         _memwrite($tmemmap, $tparts)
  3713.         _sendmessage($hwnd, $sb_setparts, $iparts, $pmemory, 0, "wparam", "ptr")
  3714.         _memfree($tmemmap)
  3715.     EndIf
  3716.     _guictrlstatusbar_resize($hwnd)
  3717.     Return True
  3718. EndFunc
  3719.  
  3720. Func _guictrlstatusbar_setsimple($hwnd, $bsimple = True)
  3721.     _sendmessage($hwnd, $sb_simple, $bsimple)
  3722. EndFunc
  3723.  
  3724. Func _guictrlstatusbar_settext($hwnd, $stext = "", $ipart = 0, $iuflag = 0)
  3725.     Local $bunicode = _guictrlstatusbar_getunicodeformat($hwnd)
  3726.     Local $ibuffer = StringLen($stext) + 1
  3727.     Local $ttext
  3728.     If $bunicode Then
  3729.         $ttext = DllStructCreate("wchar Text[" & $ibuffer & "]")
  3730.         $ibuffer *= 2
  3731.     Else
  3732.         $ttext = DllStructCreate("char Text[" & $ibuffer & "]")
  3733.     EndIf
  3734.     DllStructSetData($ttext, "Text", $stext)
  3735.     If _guictrlstatusbar_issimple($hwnd) Then $ipart = $sb_simpleid
  3736.     Local $iret
  3737.     If _winapi_inprocess($hwnd, $__g_hsblastwnd) Then
  3738.         $iret = _sendmessage($hwnd, $sb_settextw, BitOR($ipart, $iuflag), $ttext, 0, "wparam", "struct*")
  3739.     Else
  3740.         Local $tmemmap
  3741.         Local $pmemory = _meminit($hwnd, $ibuffer, $tmemmap)
  3742.         _memwrite($tmemmap, $ttext)
  3743.         If $bunicode Then
  3744.             $iret = _sendmessage($hwnd, $sb_settextw, BitOR($ipart, $iuflag), $pmemory, 0, "wparam", "ptr")
  3745.         Else
  3746.             $iret = _sendmessage($hwnd, $sb_settext, BitOR($ipart, $iuflag), $pmemory, 0, "wparam", "ptr")
  3747.         EndIf
  3748.         _memfree($tmemmap)
  3749.     EndIf
  3750.     Return $iret <> 0
  3751. EndFunc
  3752.  
  3753. Func _guictrlstatusbar_settiptext($hwnd, $ipart, $stext)
  3754.     Local $bunicode = _guictrlstatusbar_getunicodeformat($hwnd)
  3755.     Local $ibuffer = StringLen($stext) + 1
  3756.     Local $ttext
  3757.     If $bunicode Then
  3758.         $ttext = DllStructCreate("wchar TipText[" & $ibuffer & "]")
  3759.         $ibuffer *= 2
  3760.     Else
  3761.         $ttext = DllStructCreate("char TipText[" & $ibuffer & "]")
  3762.     EndIf
  3763.     DllStructSetData($ttext, "TipText", $stext)
  3764.     If _winapi_inprocess($hwnd, $__g_hsblastwnd) Then
  3765.         _sendmessage($hwnd, $sb_settiptextw, $ipart, $ttext, 0, "wparam", "struct*")
  3766.     Else
  3767.         Local $tmemmap
  3768.         Local $pmemory = _meminit($hwnd, $ibuffer, $tmemmap)
  3769.         _memwrite($tmemmap, $ttext, $pmemory, $ibuffer)
  3770.         If $bunicode Then
  3771.             _sendmessage($hwnd, $sb_settiptextw, $ipart, $pmemory, 0, "wparam", "ptr")
  3772.         Else
  3773.             _sendmessage($hwnd, $sb_settiptexta, $ipart, $pmemory, 0, "wparam", "ptr")
  3774.         EndIf
  3775.         _memfree($tmemmap)
  3776.     EndIf
  3777. EndFunc
  3778.  
  3779. Func _guictrlstatusbar_setunicodeformat($hwnd, $bunicode = True)
  3780.     Return _sendmessage($hwnd, $sb_setunicodeformat, $bunicode)
  3781. EndFunc
  3782.  
  3783. Func _guictrlstatusbar_showhide($hwnd, $istate)
  3784.     If $istate <> @SW_HIDE AND $istate <> @SW_SHOW Then Return SetError(1, 1, False)
  3785.     Return _winapi_showwindow($hwnd, $istate)
  3786. EndFunc
  3787.  
  3788. Global Const $ss_left = 0
  3789. Global Const $ss_center = 1
  3790. Global Const $ss_right = 2
  3791. Global Const $ss_icon = 3
  3792. Global Const $ss_blackrect = 4
  3793. Global Const $ss_grayrect = 5
  3794. Global Const $ss_whiterect = 6
  3795. Global Const $ss_blackframe = 7
  3796. Global Const $ss_grayframe = 8
  3797. Global Const $ss_whiteframe = 9
  3798. Global Const $ss_simple = 11
  3799. Global Const $ss_leftnowordwrap = 12
  3800. Global Const $ss_bitmap = 14
  3801. Global Const $ss_enhmetafile = 15
  3802. Global Const $ss_etchedhorz = 16
  3803. Global Const $ss_etchedvert = 17
  3804. Global Const $ss_etchedframe = 18
  3805. Global Const $ss_realsizecontrol = 64
  3806. Global Const $ss_noprefix = 128
  3807. Global Const $ss_notify = 256
  3808. Global Const $ss_centerimage = 512
  3809. Global Const $ss_rightjust = 1024
  3810. Global Const $ss_sunken = 4096
  3811. Global Const $gui_ss_default_label = 0
  3812. Global Const $gui_ss_default_graphic = 0
  3813. Global Const $gui_ss_default_icon = $ss_notify
  3814. Global Const $gui_ss_default_pic = $ss_notify
  3815. Global Const $stm_seticon = 368
  3816. Global Const $stm_geticon = 369
  3817. Global Const $stm_setimage = 370
  3818. Global Const $stm_getimage = 371
  3819. Global Const $wc_animate = "SysAnimate32"
  3820. Global Const $wc_button = "Button"
  3821. Global Const $wc_combobox = "ComboBox"
  3822. Global Const $wc_comboboxex = "ComboBoxEx32"
  3823. Global Const $wc_datetimepick = "SysDateTimePick32"
  3824. Global Const $wc_edit = "Edit"
  3825. Global Const $wc_header = "SysHeader32"
  3826. Global Const $wc_hotkey = "msctls_hotkey32"
  3827. Global Const $wc_ipaddress = "SysIPAddress32"
  3828. Global Const $wc_link = "SysLink"
  3829. Global Const $wc_listbox = "ListBox"
  3830. Global Const $wc_listview = "SysListView32"
  3831. Global Const $wc_monthcal = "SysMonthCal32"
  3832. Global Const $wc_nativefontctl = "NativeFontCtl"
  3833. Global Const $wc_pagescroller = "SysPager"
  3834. Global Const $wc_progress = "msctls_progress32"
  3835. Global Const $wc_rebar = "ReBarWindow32"
  3836. Global Const $wc_scrollbar = "ScrollBar"
  3837. Global Const $wc_static = "Static"
  3838. Global Const $wc_statusbar = "msctls_statusbar32"
  3839. Global Const $wc_tabcontrol = "SysTabControl32"
  3840. Global Const $wc_toolbar = "ToolbarWindow32"
  3841. Global Const $wc_tooltips = "tooltips_class32"
  3842. Global Const $wc_trackbar = "msctls_trackbar32"
  3843. Global Const $wc_treeview = "SysTreeView32"
  3844. Global Const $wc_updown = "msctls_updown32"
  3845. Global Const $ws_overlapped = 0
  3846. Global Const $ws_tiled = $ws_overlapped
  3847. Global Const $ws_maximizebox = 65536
  3848. Global Const $ws_minimizebox = 131072
  3849. Global Const $ws_tabstop = 65536
  3850. Global Const $ws_group = 131072
  3851. Global Const $ws_sizebox = 262144
  3852. Global Const $ws_thickframe = $ws_sizebox
  3853. Global Const $ws_sysmenu = 524288
  3854. Global Const $ws_hscroll = 1048576
  3855. Global Const $ws_vscroll = 2097152
  3856. Global Const $ws_dlgframe = 4194304
  3857. Global Const $ws_border = 8388608
  3858. Global Const $ws_caption = 12582912
  3859. Global Const $ws_overlappedwindow = BitOR($ws_caption, $ws_maximizebox, $ws_minimizebox, $ws_overlapped, $ws_sysmenu, $ws_thickframe)
  3860. Global Const $ws_tiledwindow = $ws_overlappedwindow
  3861. Global Const $ws_maximize = 16777216
  3862. Global Const $ws_clipchildren = 33554432
  3863. Global Const $ws_clipsiblings = 67108864
  3864. Global Const $ws_disabled = 134217728
  3865. Global Const $ws_visible = 268435456
  3866. Global Const $ws_minimize = 536870912
  3867. Global Const $ws_iconic = $ws_minimize
  3868. Global Const $ws_child = 1073741824
  3869. Global Const $ws_childwindow = $ws_child
  3870. Global Const $ws_popup = -2147483648
  3871. Global Const $ws_popupwindow = -2138570752
  3872. Global Const $ds_3dlook = 4
  3873. Global Const $ds_absalign = 1
  3874. Global Const $ds_center = 2048
  3875. Global Const $ds_centermouse = 4096
  3876. Global Const $ds_contexthelp = 8192
  3877. Global Const $ds_control = 1024
  3878. Global Const $ds_fixedsys = 8
  3879. Global Const $ds_localedit = 32
  3880. Global Const $ds_modalframe = 128
  3881. Global Const $ds_nofailcreate = 16
  3882. Global Const $ds_noidlemsg = 256
  3883. Global Const $ds_setfont = 64
  3884. Global Const $ds_setforeground = 512
  3885. Global Const $ds_shellfont = BitOR($ds_fixedsys, $ds_setfont)
  3886. Global Const $ds_sysmodal = 2
  3887. Global Const $ws_ex_acceptfiles = 16
  3888. Global Const $ws_ex_appwindow = 262144
  3889. Global Const $ws_ex_composited = 33554432
  3890. Global Const $ws_ex_controlparent = 65536
  3891. Global Const $ws_ex_clientedge = 512
  3892. Global Const $ws_ex_contexthelp = 1024
  3893. Global Const $ws_ex_dlgmodalframe = 1
  3894. Global Const $ws_ex_layered = 524288
  3895. Global Const $ws_ex_layoutrtl = 4194304
  3896. Global Const $ws_ex_left = 0
  3897. Global Const $ws_ex_leftscrollbar = 16384
  3898. Global Const $ws_ex_ltrreading = 0
  3899. Global Const $ws_ex_mdichild = 64
  3900. Global Const $ws_ex_noactivate = 134217728
  3901. Global Const $ws_ex_noinheritlayout = 1048576
  3902. Global Const $ws_ex_noparentnotify = 4
  3903. Global Const $ws_ex_right = 4096
  3904. Global Const $ws_ex_rightscrollbar = 0
  3905. Global Const $ws_ex_rtlreading = 8192
  3906. Global Const $ws_ex_staticedge = 131072
  3907. Global Const $ws_ex_toolwindow = 128
  3908. Global Const $ws_ex_topmost = 8
  3909. Global Const $ws_ex_transparent = 32
  3910. Global Const $ws_ex_windowedge = 256
  3911. Global Const $ws_ex_overlappedwindow = BitOR($ws_ex_clientedge, $ws_ex_windowedge)
  3912. Global Const $ws_ex_palettewindow = BitOR($ws_ex_toolwindow, $ws_ex_topmost, $ws_ex_windowedge)
  3913. Global Const $wm_null = 0
  3914. Global Const $wm_create = 1
  3915. Global Const $wm_destroy = 2
  3916. Global Const $wm_move = 3
  3917. Global Const $wm_sizewait = 4
  3918. Global Const $wm_size = 5
  3919. Global Const $wm_activate = 6
  3920. Global Const $wm_setfocus = 7
  3921. Global Const $wm_killfocus = 8
  3922. Global Const $wm_setvisible = 9
  3923. Global Const $wm_enable = 10
  3924. Global Const $wm_setredraw = 11
  3925. Global Const $wm_settext = 12
  3926. Global Const $wm_gettext = 13
  3927. Global Const $wm_gettextlength = 14
  3928. Global Const $wm_paint = 15
  3929. Global Const $wm_close = 16
  3930. Global Const $wm_queryendsession = 17
  3931. Global Const $wm_quit = 18
  3932. Global Const $wm_erasebkgnd = 20
  3933. Global Const $wm_queryopen = 19
  3934. Global Const $wm_syscolorchange = 21
  3935. Global Const $wm_endsession = 22
  3936. Global Const $wm_systemerror = 23
  3937. Global Const $wm_showwindow = 24
  3938. Global Const $wm_ctlcolor = 25
  3939. Global Const $wm_settingchange = 26
  3940. Global Const $wm_wininichange = 26
  3941. Global Const $wm_devmodechange = 27
  3942. Global Const $wm_activateapp = 28
  3943. Global Const $wm_fontchange = 29
  3944. Global Const $wm_timechange = 30
  3945. Global Const $wm_cancelmode = 31
  3946. Global Const $wm_setcursor = 32
  3947. Global Const $wm_mouseactivate = 33
  3948. Global Const $wm_childactivate = 34
  3949. Global Const $wm_queuesync = 35
  3950. Global Const $wm_getminmaxinfo = 36
  3951. Global Const $wm_logoff = 37
  3952. Global Const $wm_painticon = 38
  3953. Global Const $wm_iconerasebkgnd = 39
  3954. Global Const $wm_nextdlgctl = 40
  3955. Global Const $wm_alttabactive = 41
  3956. Global Const $wm_spoolerstatus = 42
  3957. Global Const $wm_drawitem = 43
  3958. Global Const $wm_measureitem = 44
  3959. Global Const $wm_deleteitem = 45
  3960. Global Const $wm_vkeytoitem = 46
  3961. Global Const $wm_chartoitem = 47
  3962. Global Const $wm_setfont = 48
  3963. Global Const $wm_getfont = 49
  3964. Global Const $wm_sethotkey = 50
  3965. Global Const $wm_gethotkey = 51
  3966. Global Const $wm_filesyschange = 52
  3967. Global Const $wm_isactiveicon = 53
  3968. Global Const $wm_queryparkicon = 54
  3969. Global Const $wm_querydragicon = 55
  3970. Global Const $wm_winhelp = 56
  3971. Global Const $wm_compareitem = 57
  3972. Global Const $wm_fullscreen = 58
  3973. Global Const $wm_clientshutdown = 59
  3974. Global Const $wm_ddemlevent = 60
  3975. Global Const $wm_getobject = 61
  3976. Global Const $wm_calcscroll = 63
  3977. Global Const $wm_testing = 64
  3978. Global Const $wm_compacting = 65
  3979. Global Const $wm_otherwindowcreated = 66
  3980. Global Const $wm_otherwindowdestroyed = 67
  3981. Global Const $wm_commnotify = 68
  3982. Global Const $wm_mediastatuschange = 69
  3983. Global Const $wm_windowposchanging = 70
  3984. Global Const $wm_windowposchanged = 71
  3985. Global Const $wm_power = 72
  3986. Global Const $wm_copyglobaldata = 73
  3987. Global Const $wm_copydata = 74
  3988. Global Const $wm_canceljournal = 75
  3989. Global Const $wm_logonnotify = 76
  3990. Global Const $wm_keyf1 = 77
  3991. Global Const $wm_notify = 78
  3992. Global Const $wm_access_window = 79
  3993. Global Const $wm_inputlangchangerequest = 80
  3994. Global Const $wm_inputlangchange = 81
  3995. Global Const $wm_tcard = 82
  3996. Global Const $wm_help = 83
  3997. Global Const $wm_userchanged = 84
  3998. Global Const $wm_notifyformat = 85
  3999. Global Const $wm_qm_activate = 96
  4000. Global Const $wm_hook_do_callback = 97
  4001. Global Const $wm_syscopydata = 98
  4002. Global Const $wm_finaldestroy = 112
  4003. Global Const $wm_measureitem_clientdata = 113
  4004. Global Const $wm_contextmenu = 123
  4005. Global Const $wm_stylechanging = 124
  4006. Global Const $wm_stylechanged = 125
  4007. Global Const $wm_displaychange = 126
  4008. Global Const $wm_geticon = 127
  4009. Global Const $wm_seticon = 128
  4010. Global Const $wm_nccreate = 129
  4011. Global Const $wm_ncdestroy = 130
  4012. Global Const $wm_nccalcsize = 131
  4013. Global Const $wm_nchittest = 132
  4014. Global Const $wm_ncpaint = 133
  4015. Global Const $wm_ncactivate = 134
  4016. Global Const $wm_getdlgcode = 135
  4017. Global Const $wm_syncpaint = 136
  4018. Global Const $wm_synctask = 137
  4019. Global Const $wm_kludgeminrect = 139
  4020. Global Const $wm_lpkdrawswitchwnd = 140
  4021. Global Const $wm_uahdestroywindow = 144
  4022. Global Const $wm_uahdrawmenu = 145
  4023. Global Const $wm_uahdrawmenuitem = 146
  4024. Global Const $wm_uahinitmenu = 147
  4025. Global Const $wm_uahmeasuremenuitem = 148
  4026. Global Const $wm_uahncpaintmenupopup = 149
  4027. Global Const $wm_ncmousemove = 160
  4028. Global Const $wm_nclbuttondown = 161
  4029. Global Const $wm_nclbuttonup = 162
  4030. Global Const $wm_nclbuttondblclk = 163
  4031. Global Const $wm_ncrbuttondown = 164
  4032. Global Const $wm_ncrbuttonup = 165
  4033. Global Const $wm_ncrbuttondblclk = 166
  4034. Global Const $wm_ncmbuttondown = 167
  4035. Global Const $wm_ncmbuttonup = 168
  4036. Global Const $wm_ncmbuttondblclk = 169
  4037. Global Const $wm_ncxbuttondown = 171
  4038. Global Const $wm_ncxbuttonup = 172
  4039. Global Const $wm_ncxbuttondblclk = 173
  4040. Global Const $wm_ncuahdrawcaption = 174
  4041. Global Const $wm_ncuahdrawframe = 175
  4042. Global Const $wm_input_device_change = 254
  4043. Global Const $wm_input = 255
  4044. Global Const $wm_keydown = 256
  4045. Global Const $wm_keyfirst = 256
  4046. Global Const $wm_keyup = 257
  4047. Global Const $wm_char = 258
  4048. Global Const $wm_deadchar = 259
  4049. Global Const $wm_syskeydown = 260
  4050. Global Const $wm_syskeyup = 261
  4051. Global Const $wm_syschar = 262
  4052. Global Const $wm_sysdeadchar = 263
  4053. Global Const $wm_yomichar = 264
  4054. Global Const $wm_keylast = 265
  4055. Global Const $wm_unichar = 265
  4056. Global Const $wm_convertrequest = 266
  4057. Global Const $wm_convertresult = 267
  4058. Global Const $wm_im_info = 268
  4059. Global Const $wm_ime_startcomposition = 269
  4060. Global Const $wm_ime_endcomposition = 270
  4061. Global Const $wm_ime_composition = 271
  4062. Global Const $wm_ime_keylast = 271
  4063. Global Const $wm_initdialog = 272
  4064. Global Const $wm_command = 273
  4065. Global Const $wm_syscommand = 274
  4066. Global Const $wm_timer = 275
  4067. Global Const $wm_hscroll = 276
  4068. Global Const $wm_vscroll = 277
  4069. Global Const $wm_initmenu = 278
  4070. Global Const $wm_initmenupopup = 279
  4071. Global Const $wm_systimer = 280
  4072. Global Const $wm_gesture = 281
  4073. Global Const $wm_gesturenotify = 282
  4074. Global Const $wm_gestureinput = 283
  4075. Global Const $wm_gesturenotified = 284
  4076. Global Const $wm_menuselect = 287
  4077. Global Const $wm_menuchar = 288
  4078. Global Const $wm_enteridle = 289
  4079. Global Const $wm_menurbuttonup = 290
  4080. Global Const $wm_menudrag = 291
  4081. Global Const $wm_menugetobject = 292
  4082. Global Const $wm_uninitmenupopup = 293
  4083. Global Const $wm_menucommand = 294
  4084. Global Const $wm_changeuistate = 295
  4085. Global Const $wm_updateuistate = 296
  4086. Global Const $wm_queryuistate = 297
  4087. Global Const $wm_lbtrackpoint = 305
  4088. Global Const $wm_ctlcolormsgbox = 306
  4089. Global Const $wm_ctlcoloredit = 307
  4090. Global Const $wm_ctlcolorlistbox = 308
  4091. Global Const $wm_ctlcolorbtn = 309
  4092. Global Const $wm_ctlcolordlg = 310
  4093. Global Const $wm_ctlcolorscrollbar = 311
  4094. Global Const $wm_ctlcolorstatic = 312
  4095. Global Const $mn_gethmenu = 481
  4096. Global Const $wm_parentnotify = 528
  4097. Global Const $wm_entermenuloop = 529
  4098. Global Const $wm_exitmenuloop = 530
  4099. Global Const $wm_nextmenu = 531
  4100. Global Const $wm_sizing = 532
  4101. Global Const $wm_capturechanged = 533
  4102. Global Const $wm_moving = 534
  4103. Global Const $wm_powerbroadcast = 536
  4104. Global Const $wm_devicechange = 537
  4105. Global Const $wm_mdicreate = 544
  4106. Global Const $wm_mdidestroy = 545
  4107. Global Const $wm_mdiactivate = 546
  4108. Global Const $wm_mdirestore = 547
  4109. Global Const $wm_mdinext = 548
  4110. Global Const $wm_mdimaximize = 549
  4111. Global Const $wm_mditile = 550
  4112. Global Const $wm_mdicascade = 551
  4113. Global Const $wm_mdiiconarrange = 552
  4114. Global Const $wm_mdigetactive = 553
  4115. Global Const $wm_dropobject = 554
  4116. Global Const $wm_querydropobject = 555
  4117. Global Const $wm_begindrag = 556
  4118. Global Const $wm_dragloop = 557
  4119. Global Const $wm_dragselect = 558
  4120. Global Const $wm_dragmove = 559
  4121. Global Const $wm_mdisetmenu = 560
  4122. Global Const $wm_entersizemove = 561
  4123. Global Const $wm_exitsizemove = 562
  4124. Global Const $wm_dropfiles = 563
  4125. Global Const $wm_mdirefreshmenu = 564
  4126. Global Const $wm_touch = 576
  4127. Global Const $wm_ime_setcontext = 641
  4128. Global Const $wm_ime_notify = 642
  4129. Global Const $wm_ime_control = 643
  4130. Global Const $wm_ime_compositionfull = 644
  4131. Global Const $wm_ime_select = 645
  4132. Global Const $wm_ime_char = 646
  4133. Global Const $wm_ime_system = 647
  4134. Global Const $wm_ime_request = 648
  4135. Global Const $wm_ime_keydown = 656
  4136. Global Const $wm_ime_keyup = 657
  4137. Global Const $wm_ncmousehover = 672
  4138. Global Const $wm_mousehover = 673
  4139. Global Const $wm_ncmouseleave = 674
  4140. Global Const $wm_mouseleave = 675
  4141. Global Const $wm_wtssession_change = 689
  4142. Global Const $wm_tablet_first = 704
  4143. Global Const $wm_tablet_last = 735
  4144. Global Const $wm_cut = 768
  4145. Global Const $wm_copy = 769
  4146. Global Const $wm_paste = 770
  4147. Global Const $wm_clear = 771
  4148. Global Const $wm_undo = 772
  4149. Global Const $wm_paletteischanging = 784
  4150. Global Const $wm_hotkey = 786
  4151. Global Const $wm_palettechanged = 785
  4152. Global Const $wm_sysmenu = 787
  4153. Global Const $wm_hookmsg = 788
  4154. Global Const $wm_exitprocess = 789
  4155. Global Const $wm_wakethread = 790
  4156. Global Const $wm_print = 791
  4157. Global Const $wm_printclient = 792
  4158. Global Const $wm_appcommand = 793
  4159. Global Const $wm_querynewpalette = 783
  4160. Global Const $wm_themechanged = 794
  4161. Global Const $wm_uahinit = 795
  4162. Global Const $wm_desktopnotify = 796
  4163. Global Const $wm_clipboardupdate = 797
  4164. Global Const $wm_dwmcompositionchanged = 798
  4165. Global Const $wm_dwmncrenderingchanged = 799
  4166. Global Const $wm_dwmcolorizationcolorchanged = 800
  4167. Global Const $wm_dwmwindowmaximizedchange = 801
  4168. Global Const $wm_dwmexileframe = 802
  4169. Global Const $wm_dwmsendiconicthumbnail = 803
  4170. Global Const $wm_magnification_started = 804
  4171. Global Const $wm_magnification_ended = 805
  4172. Global Const $wm_dwmsendiconiclivepreviewbitmap = 806
  4173. Global Const $wm_dwmthumbnailsizechanged = 807
  4174. Global Const $wm_magnification_output = 808
  4175. Global Const $wm_measurecontrol = 816
  4176. Global Const $wm_getactiontext = 817
  4177. Global Const $wm_forwardkeydown = 819
  4178. Global Const $wm_forwardkeyup = 820
  4179. Global Const $wm_gettitlebarinfoex = 831
  4180. Global Const $wm_notifywow = 832
  4181. Global Const $wm_handheldfirst = 856
  4182. Global Const $wm_handheldlast = 863
  4183. Global Const $wm_afxfirst = 864
  4184. Global Const $wm_afxlast = 895
  4185. Global Const $wm_penwinfirst = 896
  4186. Global Const $wm_penwinlast = 911
  4187. Global Const $wm_dde_initiate = 992
  4188. Global Const $wm_dde_terminate = 993
  4189. Global Const $wm_dde_advise = 994
  4190. Global Const $wm_dde_unadvise = 995
  4191. Global Const $wm_dde_ack = 996
  4192. Global Const $wm_dde_data = 997
  4193. Global Const $wm_dde_request = 998
  4194. Global Const $wm_dde_poke = 999
  4195. Global Const $wm_dde_execute = 1000
  4196. Global Const $wm_dbnotification = 1021
  4197. Global Const $wm_netconnect = 1022
  4198. Global Const $wm_hibernate = 1023
  4199. Global Const $wm_user = 1024
  4200. Global Const $wm_app = 32768
  4201. Global Const $nm_first = 0
  4202. Global Const $nm_outofmemory = $nm_first - 1
  4203. Global Const $nm_click = $nm_first - 2
  4204. Global Const $nm_dblclk = $nm_first - 3
  4205. Global Const $nm_return = $nm_first - 4
  4206. Global Const $nm_rclick = $nm_first - 5
  4207. Global Const $nm_rdblclk = $nm_first - 6
  4208. Global Const $nm_setfocus = $nm_first - 7
  4209. Global Const $nm_killfocus = $nm_first - 8
  4210. Global Const $nm_customdraw = $nm_first - 12
  4211. Global Const $nm_hover = $nm_first - 13
  4212. Global Const $nm_nchittest = $nm_first - 14
  4213. Global Const $nm_keydown = $nm_first - 15
  4214. Global Const $nm_releasedcapture = $nm_first - 16
  4215. Global Const $nm_setcursor = $nm_first - 17
  4216. Global Const $nm_char = $nm_first - 18
  4217. Global Const $nm_tooltipscreated = $nm_first - 19
  4218. Global Const $nm_ldown = $nm_first - 20
  4219. Global Const $nm_rdown = $nm_first - 21
  4220. Global Const $nm_themechanged = $nm_first - 22
  4221. Global Const $wm_mousefirst = 512
  4222. Global Const $wm_mousemove = 512
  4223. Global Const $wm_lbuttondown = 513
  4224. Global Const $wm_lbuttonup = 514
  4225. Global Const $wm_lbuttondblclk = 515
  4226. Global Const $wm_rbuttondown = 516
  4227. Global Const $wm_rbuttonup = 517
  4228. Global Const $wm_rbuttondblclk = 518
  4229. Global Const $wm_mbuttondown = 519
  4230. Global Const $wm_mbuttonup = 520
  4231. Global Const $wm_mbuttondblclk = 521
  4232. Global Const $wm_mousewheel = 522
  4233. Global Const $wm_xbuttondown = 523
  4234. Global Const $wm_xbuttonup = 524
  4235. Global Const $wm_xbuttondblclk = 525
  4236. Global Const $wm_mousehwheel = 526
  4237. Global Const $ps_solid = 0
  4238. Global Const $ps_dash = 1
  4239. Global Const $ps_dot = 2
  4240. Global Const $ps_dashdot = 3
  4241. Global Const $ps_dashdotdot = 4
  4242. Global Const $ps_null = 5
  4243. Global Const $ps_insideframe = 6
  4244. Global Const $ps_userstyle = 7
  4245. Global Const $ps_alternate = 8
  4246. Global Const $ps_endcap_round = 0
  4247. Global Const $ps_endcap_square = 256
  4248. Global Const $ps_endcap_flat = 512
  4249. Global Const $ps_join_bevel = 4096
  4250. Global Const $ps_join_miter = 8192
  4251. Global Const $ps_join_round = 0
  4252. Global Const $ps_geometric = 65536
  4253. Global Const $ps_cosmetic = 0
  4254. Global Const $lwa_alpha = 2
  4255. Global Const $lwa_colorkey = 1
  4256. Global Const $rgn_and = 1
  4257. Global Const $rgn_or = 2
  4258. Global Const $rgn_xor = 3
  4259. Global Const $rgn_diff = 4
  4260. Global Const $rgn_copy = 5
  4261. Global Const $errorregion = 0
  4262. Global Const $nullregion = 1
  4263. Global Const $simpleregion = 2
  4264. Global Const $complexregion = 3
  4265. Global Const $transparent = 1
  4266. Global Const $opaque = 2
  4267. Global Const $ccm_first = 8192
  4268. Global Const $ccm_getunicodeformat = ($ccm_first + 6)
  4269. Global Const $ccm_setunicodeformat = ($ccm_first + 5)
  4270. Global Const $ccm_setbkcolor = $ccm_first + 1
  4271. Global Const $ccm_setcolorscheme = $ccm_first + 2
  4272. Global Const $ccm_getcolorscheme = $ccm_first + 3
  4273. Global Const $ccm_getdroptarget = $ccm_first + 4
  4274. Global Const $ccm_setwindowtheme = $ccm_first + 11
  4275. Global Const $ga_parent = 1
  4276. Global Const $ga_root = 2
  4277. Global Const $ga_rootowner = 3
  4278. Global Const $sm_cxscreen = 0
  4279. Global Const $sm_cyscreen = 1
  4280. Global Const $sm_cxvscroll = 2
  4281. Global Const $sm_cyhscroll = 3
  4282. Global Const $sm_cycaption = 4
  4283. Global Const $sm_cxborder = 5
  4284. Global Const $sm_cyborder = 6
  4285. Global Const $sm_cxdlgframe = 7
  4286. Global Const $sm_cydlgframe = 8
  4287. Global Const $sm_cyvthumb = 9
  4288. Global Const $sm_cxhthumb = 10
  4289. Global Const $sm_cxicon = 11
  4290. Global Const $sm_cyicon = 12
  4291. Global Const $sm_cxcursor = 13
  4292. Global Const $sm_cycursor = 14
  4293. Global Const $sm_cymenu = 15
  4294. Global Const $sm_cxfullscreen = 16
  4295. Global Const $sm_cyfullscreen = 17
  4296. Global Const $sm_cykanjiwindow = 18
  4297. Global Const $sm_mousepresent = 19
  4298. Global Const $sm_cyvscroll = 20
  4299. Global Const $sm_cxhscroll = 21
  4300. Global Const $sm_debug = 22
  4301. Global Const $sm_swapbutton = 23
  4302. Global Const $sm_reserved1 = 24
  4303. Global Const $sm_reserved2 = 25
  4304. Global Const $sm_reserved3 = 26
  4305. Global Const $sm_reserved4 = 27
  4306. Global Const $sm_cxmin = 28
  4307. Global Const $sm_cymin = 29
  4308. Global Const $sm_cxsize = 30
  4309. Global Const $sm_cysize = 31
  4310. Global Const $sm_cxframe = 32
  4311. Global Const $sm_cyframe = 33
  4312. Global Const $sm_cxmintrack = 34
  4313. Global Const $sm_cymintrack = 35
  4314. Global Const $sm_cxdoubleclk = 36
  4315. Global Const $sm_cydoubleclk = 37
  4316. Global Const $sm_cxiconspacing = 38
  4317. Global Const $sm_cyiconspacing = 39
  4318. Global Const $sm_menudropalignment = 40
  4319. Global Const $sm_penwindows = 41
  4320. Global Const $sm_dbcsenabled = 42
  4321. Global Const $sm_cmousebuttons = 43
  4322. Global Const $sm_secure = 44
  4323. Global Const $sm_cxedge = 45
  4324. Global Const $sm_cyedge = 46
  4325. Global Const $sm_cxminspacing = 47
  4326. Global Const $sm_cyminspacing = 48
  4327. Global Const $sm_cxsmicon = 49
  4328. Global Const $sm_cysmicon = 50
  4329. Global Const $sm_cysmcaption = 51
  4330. Global Const $sm_cxsmsize = 52
  4331. Global Const $sm_cysmsize = 53
  4332. Global Const $sm_cxmenusize = 54
  4333. Global Const $sm_cymenusize = 55
  4334. Global Const $sm_arrange = 56
  4335. Global Const $sm_cxminimized = 57
  4336. Global Const $sm_cyminimized = 58
  4337. Global Const $sm_cxmaxtrack = 59
  4338. Global Const $sm_cymaxtrack = 60
  4339. Global Const $sm_cxmaximized = 61
  4340. Global Const $sm_cymaximized = 62
  4341. Global Const $sm_network = 63
  4342. Global Const $sm_cleanboot = 67
  4343. Global Const $sm_cxdrag = 68
  4344. Global Const $sm_cydrag = 69
  4345. Global Const $sm_showsounds = 70
  4346. Global Const $sm_cxmenucheck = 71
  4347. Global Const $sm_cymenucheck = 72
  4348. Global Const $sm_slowmachine = 73
  4349. Global Const $sm_mideastenabled = 74
  4350. Global Const $sm_mousewheelpresent = 75
  4351. Global Const $sm_xvirtualscreen = 76
  4352. Global Const $sm_yvirtualscreen = 77
  4353. Global Const $sm_cxvirtualscreen = 78
  4354. Global Const $sm_cyvirtualscreen = 79
  4355. Global Const $sm_cmonitors = 80
  4356. Global Const $sm_samedisplayformat = 81
  4357. Global Const $sm_immenabled = 82
  4358. Global Const $sm_cxfocusborder = 83
  4359. Global Const $sm_cyfocusborder = 84
  4360. Global Const $sm_tabletpc = 86
  4361. Global Const $sm_mediacenter = 87
  4362. Global Const $sm_starter = 88
  4363. Global Const $sm_serverr2 = 89
  4364. Global Const $sm_cmetrics = 90
  4365. Global Const $sm_remotesession = 4096
  4366. Global Const $sm_shuttingdown = 8192
  4367. Global Const $sm_remotecontrol = 8193
  4368. Global Const $sm_caretblinkingenabled = 8194
  4369. Global Const $blackness = 66
  4370. Global Const $captureblt = 1073741824
  4371. Global Const $dstinvert = 5570569
  4372. Global Const $mergecopy = 12583114
  4373. Global Const $mergepaint = 12255782
  4374. Global Const $nomirrorbitmap = -2147483648
  4375. Global Const $notsrccopy = 3342344
  4376. Global Const $notsrcerase = 1114278
  4377. Global Const $patcopy = 15728673
  4378. Global Const $patinvert = 5898313
  4379. Global Const $patpaint = 16452105
  4380. Global Const $srcand = 8913094
  4381. Global Const $srccopy = 13369376
  4382. Global Const $srcerase = 4457256
  4383. Global Const $srcinvert = 6684742
  4384. Global Const $srcpaint = 15597702
  4385. Global Const $whiteness = 16711778
  4386. Global Const $dt_bottom = 8
  4387. Global Const $dt_calcrect = 1024
  4388. Global Const $dt_center = 1
  4389. Global Const $dt_editcontrol = 8192
  4390. Global Const $dt_end_ellipsis = 32768
  4391. Global Const $dt_expandtabs = 64
  4392. Global Const $dt_externalleading = 512
  4393. Global Const $dt_hideprefix = 1048576
  4394. Global Const $dt_internal = 4096
  4395. Global Const $dt_left = 0
  4396. Global Const $dt_modifystring = 65536
  4397. Global Const $dt_noclip = 256
  4398. Global Const $dt_nofullwidthcharbreak = 524288
  4399. Global Const $dt_noprefix = 2048
  4400. Global Const $dt_path_ellipsis = 16384
  4401. Global Const $dt_prefixonly = 2097152
  4402. Global Const $dt_right = 2
  4403. Global Const $dt_rtlreading = 131072
  4404. Global Const $dt_singleline = 32
  4405. Global Const $dt_tabstop = 128
  4406. Global Const $dt_top = 0
  4407. Global Const $dt_vcenter = 4
  4408. Global Const $dt_wordbreak = 16
  4409. Global Const $dt_word_ellipsis = 262144
  4410. Global Const $rdw_erase = 4
  4411. Global Const $rdw_frame = 1024
  4412. Global Const $rdw_internalpaint = 2
  4413. Global Const $rdw_invalidate = 1
  4414. Global Const $rdw_noerase = 32
  4415. Global Const $rdw_noframe = 2048
  4416. Global Const $rdw_nointernalpaint = 16
  4417. Global Const $rdw_validate = 8
  4418. Global Const $rdw_erasenow = 512
  4419. Global Const $rdw_updatenow = 256
  4420. Global Const $rdw_allchildren = 128
  4421. Global Const $rdw_nochildren = 64
  4422. Global Const $wm_renderformat = 773
  4423. Global Const $wm_renderallformats = 774
  4424. Global Const $wm_destroyclipboard = 775
  4425. Global Const $wm_drawclipboard = 776
  4426. Global Const $wm_paintclipboard = 777
  4427. Global Const $wm_vscrollclipboard = 778
  4428. Global Const $wm_sizeclipboard = 779
  4429. Global Const $wm_askcbformatname = 780
  4430. Global Const $wm_changecbchain = 781
  4431. Global Const $wm_hscrollclipboard = 782
  4432. Global Const $hterror = -2
  4433. Global Const $httransparent = -1
  4434. Global Const $htnowhere = 0
  4435. Global Const $htclient = 1
  4436. Global Const $htcaption = 2
  4437. Global Const $htsysmenu = 3
  4438. Global Const $htgrowbox = 4
  4439. Global Const $htsize = $htgrowbox
  4440. Global Const $htmenu = 5
  4441. Global Const $hthscroll = 6
  4442. Global Const $htvscroll = 7
  4443. Global Const $htminbutton = 8
  4444. Global Const $htmaxbutton = 9
  4445. Global Const $htleft = 10
  4446. Global Const $htright = 11
  4447. Global Const $httop = 12
  4448. Global Const $httopleft = 13
  4449. Global Const $httopright = 14
  4450. Global Const $htbottom = 15
  4451. Global Const $htbottomleft = 16
  4452. Global Const $htbottomright = 17
  4453. Global Const $htborder = 18
  4454. Global Const $htreduce = $htminbutton
  4455. Global Const $htzoom = $htmaxbutton
  4456. Global Const $htsizefirst = $htleft
  4457. Global Const $htsizelast = $htbottomright
  4458. Global Const $htobject = 19
  4459. Global Const $htclose = 20
  4460. Global Const $hthelp = 21
  4461. Global Const $color_scrollbar = 0
  4462. Global Const $color_background = 1
  4463. Global Const $color_activecaption = 2
  4464. Global Const $color_inactivecaption = 3
  4465. Global Const $color_menu = 4
  4466. Global Const $color_window = 5
  4467. Global Const $color_windowframe = 6
  4468. Global Const $color_menutext = 7
  4469. Global Const $color_windowtext = 8
  4470. Global Const $color_captiontext = 9
  4471. Global Const $color_activeborder = 10
  4472. Global Const $color_inactiveborder = 11
  4473. Global Const $color_appworkspace = 12
  4474. Global Const $color_highlight = 13
  4475. Global Const $color_highlighttext = 14
  4476. Global Const $color_btnface = 15
  4477. Global Const $color_btnshadow = 16
  4478. Global Const $color_graytext = 17
  4479. Global Const $color_btntext = 18
  4480. Global Const $color_inactivecaptiontext = 19
  4481. Global Const $color_btnhighlight = 20
  4482. Global Const $color_3ddkshadow = 21
  4483. Global Const $color_3dlight = 22
  4484. Global Const $color_infotext = 23
  4485. Global Const $color_infobk = 24
  4486. Global Const $color_hotlight = 26
  4487. Global Const $color_gradientactivecaption = 27
  4488. Global Const $color_gradientinactivecaption = 28
  4489. Global Const $color_menuhilight = 29
  4490. Global Const $color_menubar = 30
  4491. Global Const $color_desktop = 1
  4492. Global Const $color_3dface = 15
  4493. Global Const $color_3dshadow = 16
  4494. Global Const $color_3dhighlight = 20
  4495. Global Const $color_3dhilight = 20
  4496. Global Const $color_btnhilight = 20
  4497. Global Const $hinst_commctrl = -1
  4498. Global Const $idb_std_small_color = 0
  4499. Global Const $idb_std_large_color = 1
  4500. Global Const $idb_view_small_color = 4
  4501. Global Const $idb_view_large_color = 5
  4502. Global Const $idb_hist_small_color = 8
  4503. Global Const $idb_hist_large_color = 9
  4504. Global Const $startf_forceofffeedback = 128
  4505. Global Const $startf_forceonfeedback = 64
  4506. Global Const $startf_preventpinning = 8192
  4507. Global Const $startf_runfullscreen = 32
  4508. Global Const $startf_titleisappid = 4096
  4509. Global Const $startf_titleislinkname = 2048
  4510. Global Const $startf_usecountchars = 8
  4511. Global Const $startf_usefillattribute = 16
  4512. Global Const $startf_usehotkey = 512
  4513. Global Const $startf_useposition = 4
  4514. Global Const $startf_useshowwindow = 1
  4515. Global Const $startf_usesize = 2
  4516. Global Const $startf_usestdhandles = 256
  4517. Global Const $cdds_prepaint = 1
  4518. Global Const $cdds_postpaint = 2
  4519. Global Const $cdds_preerase = 3
  4520. Global Const $cdds_posterase = 4
  4521. Global Const $cdds_item = 65536
  4522. Global Const $cdds_itemprepaint = 65537
  4523. Global Const $cdds_itempostpaint = 65538
  4524. Global Const $cdds_itempreerase = 65539
  4525. Global Const $cdds_itemposterase = 65540
  4526. Global Const $cdds_subitem = 131072
  4527. Global Const $cdis_selected = 1
  4528. Global Const $cdis_grayed = 2
  4529. Global Const $cdis_disabled = 4
  4530. Global Const $cdis_checked = 8
  4531. Global Const $cdis_focus = 16
  4532. Global Const $cdis_default = 32
  4533. Global Const $cdis_hot = 64
  4534. Global Const $cdis_marked = 128
  4535. Global Const $cdis_indeterminate = 256
  4536. Global Const $cdis_showkeyboardcues = 512
  4537. Global Const $cdis_nearhot = 1024
  4538. Global Const $cdis_othersidehot = 2048
  4539. Global Const $cdis_drophilited = 4096
  4540. Global Const $cdrf_dodefault = 0
  4541. Global Const $cdrf_newfont = 2
  4542. Global Const $cdrf_skipdefault = 4
  4543. Global Const $cdrf_notifypostpaint = 16
  4544. Global Const $cdrf_notifyitemdraw = 32
  4545. Global Const $cdrf_notifysubitemdraw = 32
  4546. Global Const $cdrf_notifyposterase = 64
  4547. Global Const $cdrf_doerase = 8
  4548. Global Const $cdrf_skippostpaint = 256
  4549. Global Const $gui_ss_default_gui = BitOR($ws_minimizebox, $ws_caption, $ws_popup, $ws_sysmenu)
  4550. Global Const $prov_rsa_full = 1
  4551. Global Const $prov_rsa_aes = 24
  4552. Global Const $crypt_verifycontext = -268435456
  4553. Global Const $hp_hashsize = 4
  4554. Global Const $hp_hashval = 2
  4555. Global Const $crypt_exportable = 1
  4556. Global Const $crypt_userdata = 1
  4557. Global Const $calg_md2 = 32769
  4558. Global Const $calg_md4 = 32770
  4559. Global Const $calg_md5 = 32771
  4560. Global Const $calg_sha1 = 32772
  4561. Global Const $calg_3des = 26115
  4562. Global Const $calg_aes_128 = 26126
  4563. Global Const $calg_aes_192 = 26127
  4564. Global Const $calg_aes_256 = 26128
  4565. Global Const $calg_des = 26113
  4566. Global Const $calg_rc2 = 26114
  4567. Global Const $calg_rc4 = 26625
  4568. Global Const $calg_userkey = 0
  4569. Global Const $kp_algid = 7
  4570. Global $__g_acryptinternaldata[3]
  4571.  
  4572. Func _crypt_startup()
  4573.     If __crypt_refcount() = 0 Then
  4574.         Local $hadvapi32 = DllOpen("Advapi32.dll")
  4575.         If $hadvapi32 = -1 Then Return SetError(1, 0, False)
  4576.         __crypt_dllhandleset($hadvapi32)
  4577.         Local $iproviderid = $prov_rsa_aes
  4578.         Local $aret = DllCall(__crypt_dllhandle(), "bool", "CryptAcquireContext", "handle*", 0, "ptr", 0, "ptr", 0, "dword", $iproviderid, "dword", $crypt_verifycontext)
  4579.         If @error OR NOT $aret[0] Then
  4580.             Local $ierror = @error + 10, $iextended = @extended
  4581.             DllClose(__crypt_dllhandle())
  4582.             Return SetError($ierror, $iextended, False)
  4583.         Else
  4584.             __crypt_contextset($aret[1])
  4585.         EndIf
  4586.     EndIf
  4587.     __crypt_refcountinc()
  4588.     Return True
  4589. EndFunc
  4590.  
  4591. Func _crypt_shutdown()
  4592.     __crypt_refcountdec()
  4593.     If __crypt_refcount() = 0 Then
  4594.         DllCall(__crypt_dllhandle(), "bool", "CryptReleaseContext", "handle", __crypt_context(), "dword", 0)
  4595.         DllClose(__crypt_dllhandle())
  4596.     EndIf
  4597. EndFunc
  4598.  
  4599. Func _crypt_derivekey($vpassword, $ialgid, $ihashalgid = $calg_md5)
  4600.     Local $aret = 0, $hbuff = 0, $hcrypthash = 0, $ierror = 0, $iextended = 0, $vreturn = 0
  4601.     _crypt_startup()
  4602.     Do
  4603.         $aret = DllCall(__crypt_dllhandle(), "bool", "CryptCreateHash", "handle", __crypt_context(), "uint", $ihashalgid, "ptr", 0, "dword", 0, "handle*", 0)
  4604.         If @error OR NOT $aret[0] Then
  4605.             $ierror = @error + 10
  4606.             $iextended = @extended
  4607.             $vreturn = -1
  4608.             ExitLoop
  4609.         EndIf
  4610.         $hcrypthash = $aret[5]
  4611.         $hbuff = DllStructCreate("byte[" & BinaryLen($vpassword) & "]")
  4612.         DllStructSetData($hbuff, 1, $vpassword)
  4613.         $aret = DllCall(__crypt_dllhandle(), "bool", "CryptHashData", "handle", $hcrypthash, "struct*", $hbuff, "dword", DllStructGetSize($hbuff), "dword", $crypt_userdata)
  4614.         If @error OR NOT $aret[0] Then
  4615.             $ierror = @error + 20
  4616.             $iextended = @extended
  4617.             $vreturn = -1
  4618.             ExitLoop
  4619.         EndIf
  4620.         $aret = DllCall(__crypt_dllhandle(), "bool", "CryptDeriveKey", "handle", __crypt_context(), "uint", $ialgid, "handle", $hcrypthash, "dword", $crypt_exportable, "handle*", 0)
  4621.         If @error OR NOT $aret[0] Then
  4622.             $ierror = @error + 30
  4623.             $iextended = @extended
  4624.             $vreturn = -1
  4625.             ExitLoop
  4626.         EndIf
  4627.         $vreturn = $aret[5]
  4628.     Until True
  4629.     If $hcrypthash <> 0 Then DllCall(__crypt_dllhandle(), "bool", "CryptDestroyHash", "handle", $hcrypthash)
  4630.     Return SetError($ierror, $iextended, $vreturn)
  4631. EndFunc
  4632.  
  4633. Func _crypt_destroykey($hcryptkey)
  4634.     Local $aret = DllCall(__crypt_dllhandle(), "bool", "CryptDestroyKey", "handle", $hcryptkey)
  4635.     Local $ierror = @error, $iextended = @extended
  4636.     _crypt_shutdown()
  4637.     If $ierror OR NOT $aret[0] Then
  4638.         Return SetError($ierror + 10, $iextended, False)
  4639.     Else
  4640.         Return True
  4641.     EndIf
  4642. EndFunc
  4643.  
  4644. Func _crypt_encryptdata($vdata, $vcryptkey, $ialgid, $bfinal = True)
  4645.     Switch $ialgid
  4646.         Case $calg_userkey
  4647.             Local $icalgused = __crypt_getcalgfromcryptkey($vcryptkey)
  4648.             If @error Then Return SetError(@error, -1, @extended)
  4649.             If $icalgused = $calg_rc4 Then ContinueCase
  4650.         Case $calg_rc4
  4651.             If BinaryLen($vdata) = 0 Then Return SetError(0, 0, Binary(""))
  4652.     EndSwitch
  4653.     Local $ireqbuffsize = 0, $aret = 0, $hbuff = 0, $ierror = 0, $iextended = 0, $vreturn = 0
  4654.     _crypt_startup()
  4655.     Do
  4656.         If $ialgid <> $calg_userkey Then
  4657.             $vcryptkey = _crypt_derivekey($vcryptkey, $ialgid)
  4658.             If @error Then
  4659.                 $ierror = @error + 100
  4660.                 $iextended = @extended
  4661.                 $vreturn = -1
  4662.                 ExitLoop
  4663.             EndIf
  4664.         EndIf
  4665.         $aret = DllCall(__crypt_dllhandle(), "bool", "CryptEncrypt", "handle", $vcryptkey, "handle", 0, "bool", $bfinal, "dword", 0, "ptr", 0, "dword*", BinaryLen($vdata), "dword", 0)
  4666.         If @error OR NOT $aret[0] Then
  4667.             $ierror = @error + 20
  4668.             $iextended = @extended
  4669.             $vreturn = -1
  4670.             ExitLoop
  4671.         EndIf
  4672.         $ireqbuffsize = $aret[6]
  4673.         $hbuff = DllStructCreate("byte[" & $ireqbuffsize + 1 & "]")
  4674.         DllStructSetData($hbuff, 1, $vdata)
  4675.         $aret = DllCall(__crypt_dllhandle(), "bool", "CryptEncrypt", "handle", $vcryptkey, "handle", 0, "bool", $bfinal, "dword", 0, "struct*", $hbuff, "dword*", BinaryLen($vdata), "dword", DllStructGetSize($hbuff) - 1)
  4676.         If @error OR NOT $aret[0] Then
  4677.             $ierror = @error + 30
  4678.             $iextended = @extended
  4679.             $vreturn = -1
  4680.             ExitLoop
  4681.         EndIf
  4682.         $vreturn = BinaryMid(DllStructGetData($hbuff, 1), 1, $ireqbuffsize)
  4683.     Until True
  4684.     If $ialgid <> $calg_userkey Then _crypt_destroykey($vcryptkey)
  4685.     _crypt_shutdown()
  4686.     Return SetError($ierror, $iextended, $vreturn)
  4687. EndFunc
  4688.  
  4689. Func _crypt_decryptdata($vdata, $vcryptkey, $ialgid, $bfinal = True)
  4690.     Switch $ialgid
  4691.         Case $calg_userkey
  4692.             Local $icalgused = __crypt_getcalgfromcryptkey($vcryptkey)
  4693.             If @error Then Return SetError(@error, -1, @extended)
  4694.             If $icalgused = $calg_rc4 Then ContinueCase
  4695.         Case $calg_rc4
  4696.             If BinaryLen($vdata) = 0 Then Return SetError(0, 0, Binary(""))
  4697.     EndSwitch
  4698.     Local $aret = 0, $hbuff = 0, $htempstruct = 0, $ierror = 0, $iextended = 0, $iplaintextsize = 0, $vreturn = 0
  4699.     _crypt_startup()
  4700.     Do
  4701.         If $ialgid <> $calg_userkey Then
  4702.             $vcryptkey = _crypt_derivekey($vcryptkey, $ialgid)
  4703.             If @error Then
  4704.                 $ierror = @error + 100
  4705.                 $iextended = @extended
  4706.                 $vreturn = -1
  4707.                 ExitLoop
  4708.             EndIf
  4709.         EndIf
  4710.         $hbuff = DllStructCreate("byte[" & BinaryLen($vdata) + 1000 & "]")
  4711.         If BinaryLen($vdata) > 0 Then DllStructSetData($hbuff, 1, $vdata)
  4712.         $aret = DllCall(__crypt_dllhandle(), "bool", "CryptDecrypt", "handle", $vcryptkey, "handle", 0, "bool", $bfinal, "dword", 0, "struct*", $hbuff, "dword*", BinaryLen($vdata))
  4713.         If @error OR NOT $aret[0] Then
  4714.             $ierror = @error + 20
  4715.             $iextended = @extended
  4716.             $vreturn = -1
  4717.             ExitLoop
  4718.         EndIf
  4719.         $iplaintextsize = $aret[6]
  4720.         $htempstruct = DllStructCreate("byte[" & $iplaintextsize + 1 & "]", DllStructGetPtr($hbuff))
  4721.         $vreturn = BinaryMid(DllStructGetData($htempstruct, 1), 1, $iplaintextsize)
  4722.     Until True
  4723.     If $ialgid <> $calg_userkey Then _crypt_destroykey($vcryptkey)
  4724.     _crypt_shutdown()
  4725.     Return SetError($ierror, $iextended, $vreturn)
  4726. EndFunc
  4727.  
  4728. Func _crypt_hashdata($vdata, $ialgid, $bfinal = True, $hcrypthash = 0)
  4729.     Local $aret = 0, $hbuff = 0, $ierror = 0, $iextended = 0, $ihashsize = 0, $vreturn = 0
  4730.     _crypt_startup()
  4731.     Do
  4732.         If $hcrypthash = 0 Then
  4733.             $aret = DllCall(__crypt_dllhandle(), "bool", "CryptCreateHash", "handle", __crypt_context(), "uint", $ialgid, "ptr", 0, "dword", 0, "handle*", 0)
  4734.             If @error OR NOT $aret[0] Then
  4735.                 $ierror = @error + 10
  4736.                 $iextended = @extended
  4737.                 $vreturn = -1
  4738.                 ExitLoop
  4739.             EndIf
  4740.             $hcrypthash = $aret[5]
  4741.         EndIf
  4742.         $hbuff = DllStructCreate("byte[" & BinaryLen($vdata) & "]")
  4743.         DllStructSetData($hbuff, 1, $vdata)
  4744.         $aret = DllCall(__crypt_dllhandle(), "bool", "CryptHashData", "handle", $hcrypthash, "struct*", $hbuff, "dword", DllStructGetSize($hbuff), "dword", $crypt_userdata)
  4745.         If @error OR NOT $aret[0] Then
  4746.             $ierror = @error + 20
  4747.             $iextended = @extended
  4748.             $vreturn = -1
  4749.             ExitLoop
  4750.         EndIf
  4751.         If $bfinal Then
  4752.             $aret = DllCall(__crypt_dllhandle(), "bool", "CryptGetHashParam", "handle", $hcrypthash, "dword", $hp_hashsize, "dword*", 0, "dword*", 4, "dword", 0)
  4753.             If @error OR NOT $aret[0] Then
  4754.                 $ierror = @error + 30
  4755.                 $iextended = @extended
  4756.                 $vreturn = -1
  4757.                 ExitLoop
  4758.             EndIf
  4759.             $ihashsize = $aret[3]
  4760.             $hbuff = DllStructCreate("byte[" & $ihashsize & "]")
  4761.             $aret = DllCall(__crypt_dllhandle(), "bool", "CryptGetHashParam", "handle", $hcrypthash, "dword", $hp_hashval, "struct*", $hbuff, "dword*", DllStructGetSize($hbuff), "dword", 0)
  4762.             If @error OR NOT $aret[0] Then
  4763.                 $ierror = @error + 40
  4764.                 $iextended = @extended
  4765.                 $vreturn = -1
  4766.                 ExitLoop
  4767.             EndIf
  4768.             $vreturn = DllStructGetData($hbuff, 1)
  4769.         Else
  4770.             $vreturn = $hcrypthash
  4771.         EndIf
  4772.     Until True
  4773.     If $hcrypthash <> 0 AND $bfinal Then DllCall(__crypt_dllhandle(), "bool", "CryptDestroyHash", "handle", $hcrypthash)
  4774.     _crypt_shutdown()
  4775.     Return SetError($ierror, $iextended, $vreturn)
  4776. EndFunc
  4777.  
  4778. Func _crypt_hashfile($sfilepath, $ialgid)
  4779.     Local $btempdata = 0, $hfile = 0, $hhashobject = 0, $ierror = 0, $iextended = 0, $vreturn = 0
  4780.     _crypt_startup()
  4781.     Do
  4782.         $hfile = FileOpen($sfilepath, $fo_binary)
  4783.         If $hfile = -1 Then
  4784.             $ierror = 1
  4785.             $vreturn = -1
  4786.             ExitLoop
  4787.         EndIf
  4788.         Do
  4789.             $btempdata = FileRead($hfile, 512 * 1024)
  4790.             If @error Then
  4791.                 $vreturn = _crypt_hashdata($btempdata, $ialgid, True, $hhashobject)
  4792.                 If @error Then
  4793.                     $ierror = @error
  4794.                     $iextended = @extended
  4795.                     $vreturn = -1
  4796.                     ExitLoop 2
  4797.                 EndIf
  4798.                 ExitLoop 2
  4799.             Else
  4800.                 $hhashobject = _crypt_hashdata($btempdata, $ialgid, False, $hhashobject)
  4801.                 If @error Then
  4802.                     $ierror = @error + 100
  4803.                     $iextended = @extended
  4804.                     $vreturn = -1
  4805.                     ExitLoop 2
  4806.                 EndIf
  4807.             EndIf
  4808.         Until False
  4809.     Until True
  4810.     _crypt_shutdown()
  4811.     If $hfile <> -1 Then FileClose($hfile)
  4812.     Return SetError($ierror, $iextended, $vreturn)
  4813. EndFunc
  4814.  
  4815. Func _crypt_encryptfile($ssourcefile, $sdestinationfile, $vcryptkey, $ialgid)
  4816.     Local $btempdata = 0, $hinfile = 0, $houtfile = 0, $ierror = 0, $iextended = 0, $ifilesize = FileGetSize($ssourcefile), $iread = 0, $breturn = True
  4817.     _crypt_startup()
  4818.     Do
  4819.         If $ialgid <> $calg_userkey Then
  4820.             $vcryptkey = _crypt_derivekey($vcryptkey, $ialgid)
  4821.             If @error Then
  4822.                 $ierror = @error
  4823.                 $iextended = @extended
  4824.                 $breturn = False
  4825.                 ExitLoop
  4826.             EndIf
  4827.         EndIf
  4828.         $hinfile = FileOpen($ssourcefile, $fo_binary)
  4829.         If @error Then
  4830.             $ierror = 2
  4831.             $breturn = False
  4832.             ExitLoop
  4833.         EndIf
  4834.         $houtfile = FileOpen($sdestinationfile, $fo_overwrite + $fo_createpath + $fo_binary)
  4835.         If @error Then
  4836.             $ierror = 3
  4837.             $breturn = False
  4838.             ExitLoop
  4839.         EndIf
  4840.         Do
  4841.             $btempdata = FileRead($hinfile, 1024 * 1024)
  4842.             $iread += BinaryLen($btempdata)
  4843.             If $iread = $ifilesize Then
  4844.                 $btempdata = _crypt_encryptdata($btempdata, $vcryptkey, $calg_userkey, True)
  4845.                 If @error Then
  4846.                     $ierror = @error + 400
  4847.                     $iextended = @extended
  4848.                     $breturn = False
  4849.                 EndIf
  4850.                 FileWrite($houtfile, $btempdata)
  4851.                 ExitLoop 2
  4852.             Else
  4853.                 $btempdata = _crypt_encryptdata($btempdata, $vcryptkey, $calg_userkey, False)
  4854.                 If @error Then
  4855.                     $ierror = @error + 500
  4856.                     $iextended = @extended
  4857.                     $breturn = False
  4858.                     ExitLoop 2
  4859.                 EndIf
  4860.                 FileWrite($houtfile, $btempdata)
  4861.             EndIf
  4862.         Until False
  4863.     Until True
  4864.     If $ialgid <> $calg_userkey Then _crypt_destroykey($vcryptkey)
  4865.     _crypt_shutdown()
  4866.     If $hinfile <> -1 Then FileClose($hinfile)
  4867.     If $houtfile <> -1 Then FileClose($houtfile)
  4868.     Return SetError($ierror, $iextended, $breturn)
  4869. EndFunc
  4870.  
  4871. Func _crypt_decryptfile($ssourcefile, $sdestinationfile, $vcryptkey, $ialgid)
  4872.     Local $btempdata = 0, $hinfile = 0, $houtfile = 0, $ierror = 0, $iextended = 0, $ifilesize = FileGetSize($ssourcefile), $iread = 0, $breturn = True
  4873.     _crypt_startup()
  4874.     Do
  4875.         If $ialgid <> $calg_userkey Then
  4876.             $vcryptkey = _crypt_derivekey($vcryptkey, $ialgid)
  4877.             If @error Then
  4878.                 $ierror = @error
  4879.                 $iextended = @extended
  4880.                 $breturn = False
  4881.                 ExitLoop
  4882.             EndIf
  4883.         EndIf
  4884.         $hinfile = FileOpen($ssourcefile, $fo_binary)
  4885.         If @error Then
  4886.             $ierror = 2
  4887.             $breturn = False
  4888.             ExitLoop
  4889.         EndIf
  4890.         $houtfile = FileOpen($sdestinationfile, $fo_overwrite + $fo_createpath + $fo_binary)
  4891.         If @error Then
  4892.             $ierror = 3
  4893.             $breturn = False
  4894.             ExitLoop
  4895.         EndIf
  4896.         Do
  4897.             $btempdata = FileRead($hinfile, 1024 * 1024)
  4898.             $iread += BinaryLen($btempdata)
  4899.             If $iread = $ifilesize Then
  4900.                 $btempdata = _crypt_decryptdata($btempdata, $vcryptkey, $calg_userkey, True)
  4901.                 If @error Then
  4902.                     $ierror = @error + 400
  4903.                     $iextended = @extended
  4904.                     $breturn = False
  4905.                 EndIf
  4906.                 FileWrite($houtfile, $btempdata)
  4907.                 ExitLoop 2
  4908.             Else
  4909.                 $btempdata = _crypt_decryptdata($btempdata, $vcryptkey, $calg_userkey, False)
  4910.                 If @error Then
  4911.                     $ierror = @error + 500
  4912.                     $iextended = @extended
  4913.                     $breturn = False
  4914.                     ExitLoop 2
  4915.                 EndIf
  4916.                 FileWrite($houtfile, $btempdata)
  4917.             EndIf
  4918.         Until False
  4919.     Until True
  4920.     If $ialgid <> $calg_userkey Then _crypt_destroykey($vcryptkey)
  4921.     _crypt_shutdown()
  4922.     If $hinfile <> -1 Then FileClose($hinfile)
  4923.     If $houtfile <> -1 Then FileClose($houtfile)
  4924.     Return SetError($ierror, $iextended, $breturn)
  4925. EndFunc
  4926.  
  4927. Func _crypt_genrandom($pbuffer, $isize)
  4928.     _crypt_startup()
  4929.     Local $aret = DllCall(__crypt_dllhandle(), "bool", "CryptGenRandom", "handle", __crypt_context(), "dword", $isize, "struct*", $pbuffer)
  4930.     Local $ierror = @error, $iextended = @extended
  4931.     _crypt_shutdown()
  4932.     If $ierror OR (NOT $aret[0]) Then
  4933.         Return SetError($ierror + 10, $iextended, False)
  4934.     Else
  4935.         Return True
  4936.     EndIf
  4937. EndFunc
  4938.  
  4939. Func __crypt_refcount()
  4940.     Return $__g_acryptinternaldata[0]
  4941. EndFunc
  4942.  
  4943. Func __crypt_refcountinc()
  4944.     $__g_acryptinternaldata[0] += 1
  4945. EndFunc
  4946.  
  4947. Func __crypt_refcountdec()
  4948.     If $__g_acryptinternaldata[0] > 0 Then $__g_acryptinternaldata[0] -= 1
  4949. EndFunc
  4950.  
  4951. Func __crypt_dllhandle()
  4952.     Return $__g_acryptinternaldata[1]
  4953. EndFunc
  4954.  
  4955. Func __crypt_dllhandleset($hadvapi32)
  4956.     $__g_acryptinternaldata[1] = $hadvapi32
  4957. EndFunc
  4958.  
  4959. Func __crypt_context()
  4960.     Return $__g_acryptinternaldata[2]
  4961. EndFunc
  4962.  
  4963. Func __crypt_contextset($hcryptcontext)
  4964.     $__g_acryptinternaldata[2] = $hcryptcontext
  4965. EndFunc
  4966.  
  4967. Func __crypt_getcalgfromcryptkey($vcryptkey)
  4968.     Local $talgid = DllStructCreate("uint;dword")
  4969.     DllStructSetData($talgid, 2, 4)
  4970.     Local $aret = DllCall(__crypt_dllhandle(), "bool", "CryptGetKeyParam", "handle", $vcryptkey, "dword", $kp_algid, "ptr", DllStructGetPtr($talgid, 1), "dword*", DllStructGetPtr($talgid, 2), "dword", 0)
  4971.     If @error OR NOT $aret[0] Then
  4972.         Return SetError(@error, @extended, $crypt_userdata)
  4973.     Else
  4974.         Return DllStructGetData($talgid, 1)
  4975.     EndIf
  4976. EndFunc
  4977.  
  4978. Global Const $tcs_ex_flatseparators = 1
  4979. Global Const $tcs_ex_registerdrop = 2
  4980. Global Const $tcht_nowhere = 1
  4981. Global Const $tcht_onitemicon = 2
  4982. Global Const $tcht_onitemlabel = 4
  4983. Global Const $tcht_onitem = 6
  4984. Global Const $tcif_text = 1
  4985. Global Const $tcif_image = 2
  4986. Global Const $tcif_rtlreading = 4
  4987. Global Const $tcif_param = 8
  4988. Global Const $tcif_state = 16
  4989. Global Const $tcif_alldata = 27
  4990. Global Const $tcis_buttonpressed = 1
  4991. Global Const $tcis_highlighted = 2
  4992. Global Const $tc_err = -1
  4993. Global Const $tcs_bottom = 2
  4994. Global Const $tcs_buttons = 256
  4995. Global Const $tcs_fixedwidth = 1024
  4996. Global Const $tcs_flatbuttons = 8
  4997. Global Const $tcs_focusnever = 32768
  4998. Global Const $tcs_focusonbuttondown = 4096
  4999. Global Const $tcs_forceiconleft = 16
  5000. Global Const $tcs_forcelabelleft = 32
  5001. Global Const $tcs_hottrack = 64
  5002. Global Const $tcs_multiline = 512
  5003. Global Const $tcs_multiselect = 4
  5004. Global Const $tcs_ownerdrawfixed = 8192
  5005. Global Const $tcs_raggedright = 2048
  5006. Global Const $tcs_right = 2
  5007. Global Const $tcs_rightjustify = 0
  5008. Global Const $tcs_scrollopposite = 1
  5009. Global Const $tcs_singleline = 0
  5010. Global Const $tcs_tabs = 0
  5011. Global Const $tcs_tooltips = 16384
  5012. Global Const $tcs_vertical = 128
  5013. Global Const $gui_ss_default_tab = 0
  5014. Global Const $tcm_first = 4864
  5015. Global Const $tccm_first = 8192
  5016. Global Const $tcm_adjustrect = ($tcm_first + 40)
  5017. Global Const $tcm_deleteallitems = ($tcm_first + 9)
  5018. Global Const $tcm_deleteitem = ($tcm_first + 8)
  5019. Global Const $tcm_deselectall = ($tcm_first + 50)
  5020. Global Const $tcm_getcurfocus = ($tcm_first + 47)
  5021. Global Const $tcm_getcursel = ($tcm_first + 11)
  5022. Global Const $tcm_getextendedstyle = ($tcm_first + 53)
  5023. Global Const $tcm_getimagelist = ($tcm_first + 2)
  5024. Global Const $tcm_getitema = ($tcm_first + 5)
  5025. Global Const $tcm_getitemw = ($tcm_first + 60)
  5026. Global Const $tcm_getitemcount = ($tcm_first + 4)
  5027. Global Const $tcm_getitemrect = ($tcm_first + 10)
  5028. Global Const $tcm_getrowcount = ($tcm_first + 44)
  5029. Global Const $tcm_gettooltips = ($tcm_first + 45)
  5030. Global Const $tccm_getunicodeformat = ($tccm_first + 6)
  5031. Global Const $tcm_getunicodeformat = $tccm_getunicodeformat
  5032. Global Const $tcm_highlightitem = ($tcm_first + 51)
  5033. Global Const $tcm_hittest = ($tcm_first + 13)
  5034. Global Const $tcm_insertitema = ($tcm_first + 7)
  5035. Global Const $tcm_insertitemw = ($tcm_first + 62)
  5036. Global Const $tcm_removeimage = ($tcm_first + 42)
  5037. Global Const $tcm_setitema = ($tcm_first + 6)
  5038. Global Const $tcm_setitemw = ($tcm_first + 61)
  5039. Global Const $tcm_setitemextra = ($tcm_first + 14)
  5040. Global Const $tcm_setitemsize = $tcm_first + 41
  5041. Global Const $tcm_setcurfocus = ($tcm_first + 48)
  5042. Global Const $tcm_setcursel = ($tcm_first + 12)
  5043. Global Const $tcm_setextendedstyle = ($tcm_first + 52)
  5044. Global Const $tcm_setimagelist = $tcm_first + 3
  5045. Global Const $tcm_setmintabwidth = ($tcm_first + 49)
  5046. Global Const $tcm_setpadding = ($tcm_first + 43)
  5047. Global Const $tcm_settooltips = ($tcm_first + 46)
  5048. Global Const $tccm_setunicodeformat = ($tccm_first + 5)
  5049. Global Const $tcm_setunicodeformat = $tccm_setunicodeformat
  5050. Global Const $tcn_first = -550
  5051. Global Const $tcn_focuschange = ($tcn_first - 4)
  5052. Global Const $tcn_getobject = ($tcn_first - 3)
  5053. Global Const $tcn_keydown = ($tcn_first + 0)
  5054. Global Const $tcn_selchange = ($tcn_first - 1)
  5055. Global Const $tcn_selchanging = ($tcn_first - 2)
  5056. Global Const $hgifdll__kernel32 = DllOpen("kernel32.dll")
  5057. Global Const $hgifdll__user32 = DllOpen("user32.dll")
  5058. Global Const $hgifdll__gdi32 = DllOpen("gdi32.dll")
  5059. Global Const $hgifdll__comctl32 = DllOpen("comctl32.dll")
  5060. Global Const $hgifdll__ole32 = DllOpen("ole32.dll")
  5061. Global Const $hgifdll__gdiplus = DllOpen("gdiplus.dll")
  5062. Global $sgif__assocstring_internal = ";"
  5063.  
  5064. Func _gif_deletegif($igifid, $fdelctrl = True)
  5065.     Local $pgif = _gif_getgifassoc($igifid)
  5066.     Local $tgif = DllStructCreate("handle GIFThread;" & "ptr CodeBuffer;" & "hwnd ControlHandle;" & "handle ImageList;" & "bool ExitFlag;", $pgif)
  5067.     Local $hgifthread = DllStructGetData($tgif, "GIFThread")
  5068.     If $hgifthread Then
  5069.         _gif_resumethread($hgifthread)
  5070.         DllStructSetData($tgif, "ExitFlag", 1)
  5071.         _gif_waitforsingleobject($hgifthread)
  5072.         _gif_closehandle($hgifthread)
  5073.     EndIf
  5074.     Local $pcodebuffer = DllStructGetData($tgif, "CodeBuffer")
  5075.     If $pcodebuffer Then _gif_memglobalfree($pcodebuffer)
  5076.     Local $himagelist = DllStructGetData($tgif, "ImageList")
  5077.     If $himagelist Then _gif_imagelist_destroy($himagelist)
  5078.     _gif_memglobalfree($pgif)
  5079.     _gif_deleteobject(GUICtrlSendMsg($igifid, 370, 0, 0))
  5080.     If $fdelctrl Then GUICtrlDelete($igifid)
  5081.     $sgif__assocstring_internal = StringReplace($sgif__assocstring_internal, $igifid & "|" & $pgif & ";", "")
  5082.     Return 1
  5083. EndFunc
  5084.  
  5085. Func _gif_exitanimation($igifid)
  5086.     Local $pgif = _gif_getgifassoc($igifid)
  5087.     Local $tgif = DllStructCreate("handle GIFThread;" & "ptr CodeBuffer;" & "hwnd ControlHandle;" & "handle ImageList;" & "bool ExitFlag;" & "bool Transparent;" & "dword CurrentFrame;", $pgif)
  5088.     Local $hgifthread = DllStructGetData($tgif, "GIFThread")
  5089.     If $hgifthread Then
  5090.         _gif_resumethread($hgifthread)
  5091.         DllStructSetData($tgif, "ExitFlag", 1)
  5092.         _gif_waitforsingleobject($hgifthread)
  5093.         _gif_closehandle($hgifthread)
  5094.         DllStructSetData($tgif, "GIFThread", 0)
  5095.     EndIf
  5096.     Local $pcodebuffer = DllStructGetData($tgif, "CodeBuffer")
  5097.     If $pcodebuffer Then _gif_memglobalfree($pcodebuffer)
  5098.     DllStructSetData($tgif, "CodeBuffer", 0)
  5099.     Local $himagelist = DllStructGetData($tgif, "ImageList")
  5100.     If $himagelist Then _gif_imagelist_destroy($himagelist)
  5101.     DllStructSetData($tgif, "ImageList", 0)
  5102.     DllStructSetData($tgif, "CurrentFrame", 0)
  5103.     GUICtrlSetState($igifid, GUICtrlGetState($igifid))
  5104.     Return 1
  5105. EndFunc
  5106.  
  5107. Func _gif_getcurrentframe($igifid)
  5108.     Local $pgif = _gif_getgifassoc($igifid)
  5109.     Local $tgif = DllStructCreate("handle GIFThread;" & "ptr CodeBuffer;" & "hwnd ControlHandle;" & "handle ImageList;" & "bool ExitFlag;" & "bool Transparent;" & "dword CurrentFrame;", $pgif)
  5110.     Return DllStructGetData($tgif, "CurrentFrame")
  5111. EndFunc
  5112.  
  5113. Func _gif_getdimension($vgif, $vadditionaldata = "")
  5114.     Local $aout[2] = [0, 0]
  5115.     Local $vdata
  5116.     If IsBinary($vgif) Then
  5117.         $vdata = $vgif
  5118.     Else
  5119.         If $vadditionaldata Then
  5120.             Local $adata = StringSplit($vadditionaldata, ";", 2)
  5121.             If UBound($adata) < 3 Then ReDim $adata[3]
  5122.             $vdata = _gif_resourcegetasraw($vgif, $adata[0], $adata[1], $adata[2])
  5123.             If @error Then
  5124.                 $vdata = $vgif
  5125.             Else
  5126.                 If $adata[0] = 2 Then $vdata = _gif_makebitmapfromrt_bitmap($vdata)
  5127.             EndIf
  5128.         Else
  5129.             $vdata = $vgif
  5130.         EndIf
  5131.     EndIf
  5132.     Local $hgdip
  5133.     Local $hmemglobal
  5134.     Local $pbitmap, $iwidth, $iheight
  5135.     If IsString($vdata) Then
  5136.         $pbitmap = _gif_createbitmapfromfile($hgdip, $vdata, $iwidth, $iheight)
  5137.         If @error Then $pbitmap = _gif_createbitmapfrombinaryimage($hgdip, $hmemglobal, Binary($vdata), $iwidth, $iheight)
  5138.         If @error Then
  5139.             $vdata = FileRead($vdata)
  5140.             $pbitmap = _gif_createbitmapfrombinaryimage($hgdip, $hmemglobal, $vdata, $iwidth, $iheight)
  5141.         EndIf
  5142.     Else
  5143.         $pbitmap = _gif_createbitmapfrombinaryimage($hgdip, $hmemglobal, $vdata, $iwidth, $iheight)
  5144.     EndIf
  5145.     If @error Then Return SetError(1, 0, $aout)
  5146.     _gif_freegdipandmem($pbitmap, $hgdip, $hmemglobal)
  5147.     $aout[0] = $iwidth
  5148.     $aout[1] = $iheight
  5149.     Return $aout
  5150. EndFunc
  5151.  
  5152. Func _gif_getsize($igifid)
  5153.     Local $pgif = _gif_getgifassoc($igifid)
  5154.     Local $aout[2] = [0, 0]
  5155.     Local $tgif = DllStructCreate("handle GIFThread;" & "ptr CodeBuffer;" & "hwnd ControlHandle;" & "handle ImageList;", $pgif)
  5156.     Local $himagelist = DllStructGetData($tgif, "ImageList")
  5157.     If $himagelist Then Return _gif_imagelist_geticonsize($himagelist)
  5158.     Local $hcontrol = DllStructGetData($tgif, "ControlHandle")
  5159.     If NOT $hcontrol Then Return SetError(1, 0, $aout)
  5160.     Local $aarray = WinGetPos($hcontrol)
  5161.     If @error Then Return SetError(1, 0, $aout)
  5162.     $aout[0] = $aarray[2]
  5163.     $aout[1] = $aarray[3]
  5164.     Return $aout
  5165. EndFunc
  5166.  
  5167. Func _gif_pauseanimation($igifid)
  5168.     Local $pgif = _gif_getgifassoc($igifid)
  5169.     Local $tgif = DllStructCreate("handle GIFThread;", $pgif)
  5170.     Local $hgifthread = DllStructGetData($tgif, "GIFThread")
  5171.     If NOT $hgifthread Then Return SetExtended(1, 1)
  5172.     If _gif_suspendthread($hgifthread) Then _gif_resumethread($hgifthread)
  5173.     Return 1
  5174. EndFunc
  5175.  
  5176. Func _gif_refreshgif($igifid)
  5177.     Local $pgif = _gif_getgifassoc($igifid)
  5178.     Local $tgif = DllStructCreate("handle GIFThread;" & "ptr CodeBuffer;" & "hwnd ControlHandle;" & "handle ImageList;" & "bool ExitFlag;" & "bool Transparent;" & "dword CurrentFrame;", $pgif)
  5179.     If @error Then Return SetError(1, 0, 0)
  5180.     If NOT DllStructGetData($tgif, "ImageList") Then Return 1
  5181.     Local $hdc = _gif_getdc(DllStructGetData($tgif, "ControlHandle"))
  5182.     If @error Then Return SetError(2, 0, 0)
  5183.     Local $icolorref = -1
  5184.     If DllStructGetData($tgif, "Transparent") Then $icolorref = _gif_getunderlyingcolor(DllStructGetData($tgif, "ControlHandle"))
  5185.     _gif_imagelist_drawex(DllStructGetData($tgif, "ImageList"), DllStructGetData($tgif, "CurrentFrame"), $hdc, 0, 0, 0, 0, $icolorref, -1, 0)
  5186.     _gif_releasedc(0, $hdc)
  5187.     Return 1
  5188. EndFunc
  5189.  
  5190. Func _gif_resumeanimation($igifid)
  5191.     Local $pgif = _gif_getgifassoc($igifid)
  5192.     Local $tgif = DllStructCreate("handle GIFThread;", $pgif)
  5193.     Local $hgifthread = DllStructGetData($tgif, "GIFThread")
  5194.     If NOT $hgifthread Then Return SetExtended(1, 1)
  5195.     If _gif_resumethread($hgifthread) = 2 Then _gif_suspendthread($hgifthread)
  5196.     Return 1
  5197. EndFunc
  5198.  
  5199. Func _gif_validategif($igifid)
  5200.     Local $pgif = _gif_getgifassoc($igifid)
  5201.     Local $tgif = DllStructCreate("handle GIFThread;" & "ptr CodeBuffer;" & "hwnd ControlHandle;" & "handle ImageList;" & "bool ExitFlag;" & "bool Transparent;" & "dword CurrentFrame;" & "dword NumberOfFrames;", $pgif)
  5202.     If @error Then Return SetError(1, 0, 0)
  5203.     If DllStructGetData($tgif, "NumberOfFrames") < 2 Then Return 1
  5204.     If NOT DllStructGetData($tgif, "GIFThread") Then Return 1
  5205.     _gif_redrawwindow(DllStructGetData($tgif, "ControlHandle"), 0, 0, 1280)
  5206.     _gif_refreshgif($igifid)
  5207.     Return 1
  5208. EndFunc
  5209.  
  5210. Func _guictrlcreategif($vgif, $vadditionaldata, $ileft, $itop, $iwidth = Default, $iheight = Default, $irenderingstyle = Default, $iforcedargb = Default, $hgifcontrol = 0)
  5211.     If $iwidth = -1 Then $iwidth = Default
  5212.     If $iheight = -1 Then $iheight = Default
  5213.     Local $vdata
  5214.     If IsBinary($vgif) Then
  5215.         $vdata = $vgif
  5216.     Else
  5217.         If $vadditionaldata Then
  5218.             Local $adata = StringSplit($vadditionaldata, ";", 2)
  5219.             If UBound($adata) < 3 Then ReDim $adata[3]
  5220.             $vdata = _gif_resourcegetasraw($vgif, $adata[0], $adata[1], $adata[2])
  5221.             If @error Then
  5222.                 $vdata = $vgif
  5223.             Else
  5224.                 If $adata[0] = 2 Then $vdata = _gif_makebitmapfromrt_bitmap($vdata)
  5225.             EndIf
  5226.         Else
  5227.             $vdata = $vgif
  5228.         EndIf
  5229.     EndIf
  5230.     Local $iwidthdef, $iheightdef
  5231.     If NOT IsKeyword($iwidthdef) = 1 Then $iwidthdef = $iwidth
  5232.     If NOT IsKeyword($iheightdef) = 1 Then $iheightdef = $iheight
  5233.     Local $pgif = _gif_create_pgif($vdata, $iwidthdef, $iheightdef, $hgifcontrol, $ileft, $itop, $iforcedargb)
  5234.     If @error Then
  5235.         $vdata = FileRead($vdata)
  5236.         $pgif = _gif_create_pgif($vdata, $iwidthdef, $iheightdef, $hgifcontrol, $ileft, $itop, $iforcedargb)
  5237.         If @error Then
  5238.             $pgif = _gif_create_pgif(Binary($vgif), $iwidthdef, $iheightdef, $hgifcontrol, $ileft, $itop, $iforcedargb)
  5239.             If @error Then Return SetError(1, @extended = True, 0)
  5240.         EndIf
  5241.     EndIf
  5242.     Local $tgif = DllStructCreate("handle GIFThread;" & "ptr CodeBuffer;" & "hwnd ControlHandle;" & "handle ImageList;" & "bool ExitFlag;" & "bool Transparent;" & "dword CurrentFrame;" & "dword NumberOfFrames;", $pgif)
  5243.     Local $iframecount = DllStructGetData($tgif, "NumberOfFrames")
  5244.     $tgif = DllStructCreate("handle GIFThread;" & "ptr CodeBuffer;" & "hwnd ControlHandle;" & "handle ImageList;" & "bool ExitFlag;" & "bool Transparent;" & "dword CurrentFrame;" & "dword NumberOfFrames;" & "dword FrameDelay[" & $iframecount & "];", $pgif)
  5245.     GUICtrlSetResizing($hgifcontrol, 802)
  5246.     DllStructSetData($tgif, "ControlHandle", GUICtrlGetHandle($hgifcontrol))
  5247.     If $iframecount = 1 Then
  5248.         $sgif__assocstring_internal &= $hgifcontrol & "|" & $pgif & ";"
  5249.         Return SetExtended(1, $hgifcontrol)
  5250.     EndIf
  5251.     Local $isizecodebuffer = 157
  5252.     If @AutoItX64 Then $isizecodebuffer = 220
  5253.     Local $pcodebuffer = _gif_memglobalalloc($isizecodebuffer, 64)
  5254.     If @error Then Return SetError(2, 0, $hgifcontrol)
  5255.     DllStructSetData($tgif, "CodeBuffer", $pcodebuffer)
  5256.     _gif_virtualprotect($pcodebuffer, $isizecodebuffer, 64)
  5257.     If @error Then Return SetError(3, 0, $hgifcontrol)
  5258.     Local $tcodebuffer = DllStructCreate("byte[" & $isizecodebuffer & "]", $pcodebuffer)
  5259.     Local $pimagelist_drawex = _gif_getaddress(_gif_getmodulehandle("comctl32.dll"), "ImageList_DrawEx")
  5260.     If @error Then Return SetError(4, 1, $hgifcontrol)
  5261.     Local $psleep = _gif_getaddress(_gif_getmodulehandle("kernel32.dll"), "Sleep")
  5262.     If @error Then Return SetError(4, 2, $hgifcontrol)
  5263.     Local $pgetpixel = _gif_getaddress(_gif_getmodulehandle("gdi32.dll"), "GetPixel")
  5264.     If @error Then Return SetError(4, 3, $hgifcontrol)
  5265.     Local $huser32 = _gif_getmodulehandle("user32.dll")
  5266.     Local $pgetdc = _gif_getaddress($huser32, "GetDC")
  5267.     If @error Then Return SetError(4, 4, $hgifcontrol)
  5268.     Local $preleasedc = _gif_getaddress($huser32, "ReleaseDC")
  5269.     If @error Then Return SetError(4, 5, $hgifcontrol)
  5270.     Local $himagelist = DllStructGetData($tgif, "ImageList")
  5271.     Local $hcontrol = DllStructGetData($tgif, "ControlHandle")
  5272.     Local $istyle
  5273.     If $irenderingstyle = Default Then
  5274.         $istyle = 1
  5275.         If DllStructGetData($tgif, "Transparent") Then $istyle = 0
  5276.     Else
  5277.         $istyle = $irenderingstyle
  5278.     EndIf
  5279.     If @AutoItX64 Then
  5280.         DllStructSetData($tcodebuffer, 1, "0x" & "4883EC" & _gif_swapendian(88, 1) & "" & "4831F6" & "" & "" & "8BC6" & "A3" & _gif_swapendian(DllStructGetPtr($tgif, "CurrentFrame"), 8) & "" & "48B9" & _gif_swapendian($hcontrol, 8) & "48B8" & _gif_swapendian($pgetdc, 8) & "FFD0" & "" & "4889C3" & "" & "49C7C0" & _gif_swapendian(0, 4) & "BA" & _gif_swapendian(0, 4) & "4889C1" & "48B8" & _gif_swapendian($pgetpixel, 8) & "FFD0" & "" & "3D" & _gif_swapendian(-1, 4) & "75" & _gif_swapendian(2, 1) & "8BC7" & "" & "8BF8" & "" & "89442438" & "B8" & _gif_swapendian($istyle, 4) & "89442448" & "4989D8" & "49C7C1" & _gif_swapendian(0, 4) & "89F2" & "48B9" & _gif_swapendian($himagelist, 8) & "" & "48B8" & _gif_swapendian($pimagelist_drawex, 8) & "FFD0" & "" & "4889DA" & "48B9" & _gif_swapendian($hcontrol, 8) & "48B8" & _gif_swapendian($preleasedc, 8) & "FFD0" & "" & "A1" & _gif_swapendian(DllStructGetPtr($tgif, "ExitFlag"), 8) & "85C0" & "75" & _gif_swapendian(46, 1) & "" & "48BB" & _gif_swapendian(DllStructGetPtr($tgif, "FrameDelay"), 8) & "488B0CB3" & "48B8" & _gif_swapendian($psleep, 8) & "FFD0" & "" & "FFC6" & "" & "81FE" & _gif_swapendian($iframecount, 4) & "" & "74" & _gif_swapendian(5, 1) & "E9" & _gif_swapendian(-200, 4) & "E9" & _gif_swapendian(-208, 4) & "" & "4831C0" & "4883C4" & _gif_swapendian(88, 1) & "C3")
  5281.     Else
  5282.         DllStructSetData($tcodebuffer, 1, "0x" & "" & "33F6" & "" & "" & "8BC6" & "A3" & _gif_swapendian(DllStructGetPtr($tgif, "CurrentFrame"), 4) & "68" & _gif_swapendian($istyle, 4) & "68" & _gif_swapendian(-1, 4) & "" & "68" & _gif_swapendian($hcontrol, 4) & "B8" & _gif_swapendian($pgetdc, 4) & "FFD0" & "" & "8BD8" & "" & "68" & _gif_swapendian(0, 4) & "68" & _gif_swapendian(0, 4) & "53" & "B8" & _gif_swapendian($pgetpixel, 4) & "FFD0" & "" & "3D" & _gif_swapendian(-1, 4) & "75" & _gif_swapendian(2, 1) & "8BC7" & "" & "8BF8" & "" & "50" & "68" & _gif_swapendian(0, 4) & "68" & _gif_swapendian(0, 4) & "68" & _gif_swapendian(0, 4) & "68" & _gif_swapendian(0, 4) & "53" & "56" & "68" & _gif_swapendian($himagelist, 4) & "" & "B8" & _gif_swapendian($pimagelist_drawex, 4) & "FFD0" & "" & "53" & "68" & _gif_swapendian($hcontrol, 4) & "B8" & _gif_swapendian($preleasedc, 4) & "FFD0" & "" & "A1" & _gif_swapendian(DllStructGetPtr($tgif, "ExitFlag"), 4) & "85C0" & "75" & _gif_swapendian(35, 1) & "" & "BB" & _gif_swapendian(DllStructGetPtr($tgif, "FrameDelay"), 4) & "8B0CB3" & "51" & "B8" & _gif_swapendian($psleep, 4) & "FFD0" & "" & "46" & "" & "81FE" & _gif_swapendian($iframecount, 4) & "" & "74" & _gif_swapendian(5, 1) & "E9" & _gif_swapendian(-147, 4) & "E9" & _gif_swapendian(-154, 4) & "" & "33C0" & "C3")
  5283.     EndIf
  5284.     Local $hthread = _gif_createthread($pcodebuffer)
  5285.     If @error Then Return SetError(5, 0, $hgifcontrol)
  5286.     DllStructSetData($tgif, "GIFThread", $hthread)
  5287.     _gif_invalidaterect(_gif_getparent($hcontrol))
  5288.     $sgif__assocstring_internal &= $hgifcontrol & "|" & $pgif & ";"
  5289.     Return $hgifcontrol
  5290. EndFunc
  5291.  
  5292. Func _guictrlsetgif($icontrold, $vgif, $vadditionaldata = Default, $irenderingstyle = Default, $iforcedargb = Default)
  5293.     Local $actrlpos = WinGetPos(GUICtrlGetHandle($icontrold))
  5294.     If @error Then Return SetError(6, 0, False)
  5295.     If $vadditionaldata = Default Then $vadditionaldata = ""
  5296.     If $actrlpos[2] = 0 Then $actrlpos[2] = Default
  5297.     If $actrlpos[3] = 0 Then $actrlpos[3] = Default
  5298.     _gif_deletegif($icontrold, False)
  5299.     _guictrlcreategif($vgif, $vadditionaldata, $actrlpos[0], $actrlpos[1], $actrlpos[2], $actrlpos[3], $irenderingstyle, $iforcedargb, $icontrold)
  5300.     Return SetError(@error, @extended, NOT @error)
  5301. EndFunc
  5302.  
  5303. Func _gif_closehandle($hhandle)
  5304.     Local $acall = DllCall($hgifdll__kernel32, "bool", "CloseHandle", "handle", $hhandle)
  5305.     If @error OR NOT $acall[0] Then Return SetError(1, 0, 0)
  5306.     Return 1
  5307. EndFunc
  5308.  
  5309. Func _gif_waitforsingleobject($hhandle, $imilisec = -1)
  5310.     Local $acall = DllCall($hgifdll__kernel32, "dword", "WaitForSingleObject", "handle", $hhandle, "dword", $imilisec)
  5311.     If @error Then Return SetError(1, 0, 0)
  5312.     Return $acall[0]
  5313. EndFunc
  5314.  
  5315. Func _gif_createthread($paddress)
  5316.     Local $acall = DllCall($hgifdll__kernel32, "handle", "CreateThread", "ptr", 0, "dword_ptr", 0, "ptr", $paddress, "ptr", 0, "dword", 0, "dword*", 0)
  5317.     If @error OR NOT $acall[0] Then Return SetError(1, 0, 0)
  5318.     Return $acall[0]
  5319. EndFunc
  5320.  
  5321. Func _gif_suspendthread($htread)
  5322.     Local $acall = DllCall($hgifdll__kernel32, "dword", "SuspendThread", "handle", $htread)
  5323.     If @error OR $acall[0] = -1 Then Return SetError(1, 0, -1)
  5324.     Return $acall[0]
  5325. EndFunc
  5326.  
  5327. Func _gif_resumethread($htread)
  5328.     Local $acall = DllCall($hgifdll__kernel32, "dword", "ResumeThread", "handle", $htread)
  5329.     If @error OR $acall[0] = -1 Then Return SetError(1, 0, -1)
  5330.     Return $acall[0]
  5331. EndFunc
  5332.  
  5333. Func _gif_virtualprotect($paddress, $isize, $iprotection)
  5334.     Local $acall = DllCall($hgifdll__kernel32, "bool", "VirtualProtect", "ptr", $paddress, "dword_ptr", $isize, "dword", $iprotection, "dword*", 0)
  5335.     If @error OR NOT $acall[0] Then Return SetError(1, 0, 0)
  5336.     Return 1
  5337. EndFunc
  5338.  
  5339. Func _gif_getaddress($hmodule, $vfuncname)
  5340.     Local $stype = "str"
  5341.     If IsNumber($vfuncname) Then $stype = "int"
  5342.     Local $acall = DllCall($hgifdll__kernel32, "ptr", "GetProcAddress", "handle", $hmodule, $stype, $vfuncname)
  5343.     If @error OR NOT $acall[0] Then Return SetError(1, 0, 0)
  5344.     Return $acall[0]
  5345. EndFunc
  5346.  
  5347. Func _gif_getmodulehandle($vmodule = 0)
  5348.     Local $stype = "wstr"
  5349.     If NOT $vmodule Then $stype = "ptr"
  5350.     Local $acall = DllCall($hgifdll__kernel32, "ptr", "GetModuleHandleW", $stype, $vmodule)
  5351.     If @error OR NOT $acall[0] Then Return SetError(1, 0, 0)
  5352.     Return $acall[0]
  5353. EndFunc
  5354.  
  5355. Func _gif_getbkcolor($hwnd)
  5356.     Local $hdc = _gif_getdc($hwnd)
  5357.     If @error Then Return SetError(1, 0, -1)
  5358.     Local $acall = DllCall($hgifdll__gdi32, "dword", "GetBkColor", "handle", $hdc)
  5359.     If @error OR $acall[0] = -1 Then
  5360.         _gif_releasedc($hwnd, $hdc)
  5361.         Return SetError(2, 0, -1)
  5362.     EndIf
  5363.     _gif_releasedc($hwnd, $hdc)
  5364.     Return $acall[0]
  5365. EndFunc
  5366.  
  5367. Func _gif_getdc($hwnd)
  5368.     Local $acall = DllCall($hgifdll__user32, "handle", "GetDC", "hwnd", $hwnd)
  5369.     If @error OR NOT $acall[0] Then Return SetError(1, 0, 0)
  5370.     Return $acall[0]
  5371. EndFunc
  5372.  
  5373. Func _gif_releasedc($hwnd, $hdc)
  5374.     Local $acall = DllCall($hgifdll__user32, "int", "ReleaseDC", "hwnd", $hwnd, "handle", $hdc)
  5375.     If @error OR NOT $acall[0] Then Return SetError(1, 0, 0)
  5376.     Return 1
  5377. EndFunc
  5378.  
  5379. Func _gif_invalidaterect($hwnd, $prect = 0, $ferase = True)
  5380.     Local $acall = DllCall($hgifdll__user32, "bool", "InvalidateRect", "hwnd", $hwnd, "ptr", $prect, "bool", $ferase)
  5381.     If @error OR NOT $acall[0] Then Return SetError(1, 0, 0)
  5382.     Return 1
  5383. EndFunc
  5384.  
  5385. Func _gif_validaterect($hwnd, $prect = 0)
  5386.     Local $acall = DllCall($hgifdll__user32, "bool", "ValidateRect", "hwnd", $hwnd, "ptr", $prect)
  5387.     If @error OR NOT $acall[0] Then Return SetError(1, 0, 0)
  5388.     Return 1
  5389. EndFunc
  5390.  
  5391. Func _gif_redrawwindow($hwnd, $prect, $hregion, $iflags)
  5392.     Local $acall = DllCall($hgifdll__user32, "bool", "RedrawWindow", "hwnd", $hwnd, "ptr", $prect, "handle", $hregion, "dword", $iflags)
  5393.     If @error OR NOT $acall[0] Then Return SetError(1, 0, 0)
  5394.     Return $acall[0]
  5395. EndFunc
  5396.  
  5397. Func _gif_getunderlyingcolor($hwnd)
  5398.     Local $hparent = _gif_getparent($hwnd)
  5399.     If @error Then Return SetError(1, 0, -1)
  5400.     Local $icolor = _gif_getbkcolor($hparent)
  5401.     Return SetError(@error, 0, $icolor)
  5402. EndFunc
  5403.  
  5404. Func _gif_getparent($hwnd)
  5405.     Local $acall = DllCall($hgifdll__user32, "hwnd", "GetParent", "hwnd", $hwnd)
  5406.     If @error OR NOT $acall[0] Then Return SetError(1, 0, 0)
  5407.     Return $acall[0]
  5408. EndFunc
  5409.  
  5410. Func _gif_create_pgif($bbinary, ByRef $iwidth, ByRef $iheight, ByRef $hgifcontrol, $ileft = 0, $itop = 0, $iargb = Default)
  5411.     If $iargb = Default Then $iargb = -16777216
  5412.     Local $hgdip
  5413.     Local $hmemglobal
  5414.     Local $pbitmap, $iwidthreal, $iheightreal
  5415.     If IsBinary($bbinary) Then
  5416.         $pbitmap = _gif_createbitmapfrombinaryimage($hgdip, $hmemglobal, $bbinary, $iwidthreal, $iheightreal)
  5417.     Else
  5418.         $pbitmap = _gif_createbitmapfromfile($hgdip, $bbinary, $iwidthreal, $iheightreal)
  5419.     EndIf
  5420.     If @error Then
  5421.         Local $ierr = @error
  5422.         _gif_freegdipandmem($pbitmap, $hgdip, $hmemglobal)
  5423.         Return SetError(1, $ierr, 0)
  5424.     EndIf
  5425.     Local $fdoresize
  5426.     If $iwidth = Default Then
  5427.         $iwidth = $iwidthreal
  5428.     Else
  5429.         $fdoresize = True
  5430.     EndIf
  5431.     If $iheight = Default Then
  5432.         $iheight = $iheightreal
  5433.     Else
  5434.         $fdoresize = True
  5435.     EndIf
  5436.     Local $iframedimensionscount = _gif_gdipimagegetframedimensionscount($pbitmap)
  5437.     If @error Then
  5438.         _gif_freegdipandmem($pbitmap, $hgdip, $hmemglobal)
  5439.         Return SetError(2, 0, 0)
  5440.     EndIf
  5441.     Local $tguid = DllStructCreate("dword;word;word;byte[8]")
  5442.     Local $pguid = DllStructGetPtr($tguid)
  5443.     _gif_gdipimagegetframedimensionslist($pbitmap, $pguid, $iframedimensionscount)
  5444.     If @error Then
  5445.         _gif_freegdipandmem($pbitmap, $hgdip, $hmemglobal)
  5446.         Return SetError(3, 0, 0)
  5447.     EndIf
  5448.     Local $iframecount = _gif_gdipimagegetframecount($pbitmap, $pguid)
  5449.     If @error Then
  5450.         _gif_freegdipandmem($pbitmap, $hgdip, $hmemglobal)
  5451.         Return SetError(4, 0, 0)
  5452.     EndIf
  5453.     Local $pgif = _gif_memglobalalloc(4 * (8 + 4 * @AutoItX64 + $iframecount), 64)
  5454.     If @error Then
  5455.         _gif_freegdipandmem($pbitmap, $hgdip, $hmemglobal)
  5456.         Return SetError(3, 0, 0)
  5457.     EndIf
  5458.     Local $tgif = DllStructCreate("handle GIFThread;" & "ptr CodeBuffer;" & "hwnd ControlHandle;" & "handle ImageList;" & "bool ExitFlag;" & "bool Transparent;" & "dword CurrentFrame;" & "dword NumberOfFrames;" & "dword FrameDelay[" & $iframecount & "];", $pgif)
  5459.     DllStructSetData($tgif, "GIFThread", 0)
  5460.     DllStructSetData($tgif, "ControlHandle", 0)
  5461.     DllStructSetData($tgif, "ExitFlag", 0)
  5462.     DllStructSetData($tgif, "CurrentFrame", 0)
  5463.     DllStructSetData($tgif, "NumberOfFrames", $iframecount)
  5464.     Local $fnewcontrol = False
  5465.     If NOT $hgifcontrol Then
  5466.         $fnewcontrol = True
  5467.         $hgifcontrol = GUICtrlCreatePic("", $ileft, $itop, $iwidth, $iheight)
  5468.     EndIf
  5469.     If $iframecount = 1 Then
  5470.         Local $hgifbitmap = _gif_gdipcreatehbitmapfrombitmap($pbitmap, $iargb)
  5471.         If $fdoresize Then _gif_resizebitmap($hgifbitmap, $iwidth, $iheight)
  5472.         _gif_freegdipandmem($pbitmap, $hgdip, $hmemglobal)
  5473.         _gif_deleteobject(GUICtrlSendMsg($hgifcontrol, 370, 0, $hgifbitmap))
  5474.         _gif_deleteobject($hgifbitmap)
  5475.         Return $pgif
  5476.     EndIf
  5477.     Local $himagelist = _gif_imagelist_create($iwidth, $iheight, 32, $iframecount)
  5478.     If @error Then
  5479.         If $fnewcontrol Then GUICtrlDelete($hgifcontrol)
  5480.         _gif_freegdipandmem($pbitmap, $hgdip, $hmemglobal, $pgif)
  5481.         Return SetError(4, 0, 0)
  5482.     EndIf
  5483.     DllStructSetData($tgif, "ImageList", $himagelist)
  5484.     Local $hbitmap
  5485.     For $j = 0 To $iframecount - 1
  5486.         _gif_gdipimageselectactiveframe($pbitmap, $pguid, $j)
  5487.         If @error Then ContinueLoop
  5488.         $hbitmap = _gif_gdipcreatehbitmapfrombitmap($pbitmap, $iargb)
  5489.         If $fdoresize Then _gif_resizebitmap($hbitmap, $iwidth, $iheight)
  5490.         _gif_imagelist_add($himagelist, $hbitmap)
  5491.         If $j = 0 Then
  5492.             _gif_deleteobject(GUICtrlSendMsg($hgifcontrol, 370, 0, $hbitmap))
  5493.             _gif_deleteobject($hbitmap)
  5494.         EndIf
  5495.         _gif_deleteobject($hbitmap)
  5496.     Next
  5497.     Local $ipropertyitemsize = _gif_gdipgetpropertyitemsize($pbitmap, 20736)
  5498.     If @error Then
  5499.         If $fnewcontrol Then GUICtrlDelete($hgifcontrol)
  5500.         _gif_freegdipandmem($pbitmap, $hgdip, $hmemglobal, $pgif)
  5501.         Return SetError(5, 0, 0)
  5502.     EndIf
  5503.     Local $trawpropitem = DllStructCreate("byte[" & $ipropertyitemsize & "]")
  5504.     _gif_gdipgetpropertyitem($pbitmap, 20736, $ipropertyitemsize, DllStructGetPtr($trawpropitem))
  5505.     If @error Then
  5506.         If $fnewcontrol Then GUICtrlDelete($hgifcontrol)
  5507.         _gif_freegdipandmem($pbitmap, $hgdip, $hmemglobal, $pgif)
  5508.         Return SetError(6, 0, 0)
  5509.     EndIf
  5510.     Local $tpropitem = DllStructCreate("int Id;" & "dword Length;" & "word Type;" & "ptr Value", DllStructGetPtr($trawpropitem))
  5511.     Local $isize = DllStructGetData($tpropitem, "Length") / 4
  5512.     Local $tpropertydata = DllStructCreate("dword[" & $isize & "]", DllStructGetData($tpropitem, "Value"))
  5513.     Local $idelay
  5514.     For $j = 1 To $iframecount
  5515.         $idelay = DllStructGetData($tpropertydata, 1, $j) * 10
  5516.         If NOT $idelay Then $idelay = 130
  5517.         If $idelay < 50 Then $idelay = 50
  5518.         DllStructSetData($tgif, "FrameDelay", $idelay, $j)
  5519.     Next
  5520.     Local $ftransparent = True
  5521.     Local $ipixelcolor = _gif_gdipbitmapgetpixel($pbitmap, 0, 0)
  5522.     If BitShift($ipixelcolor, 24) Then $ftransparent = False
  5523.     DllStructSetData($tgif, "Transparent", $ftransparent)
  5524.     _gif_freegdipandmem($pbitmap, $hgdip, $hmemglobal)
  5525.     Return $pgif
  5526. EndFunc
  5527.  
  5528. Func _gif_createstreamonhglobal($hglobal, $iflag = 1)
  5529.     Local $acall = DllCall($hgifdll__ole32, "long", "CreateStreamOnHGlobal", "handle", $hglobal, "int", $iflag, "ptr*", 0)
  5530.     If @error OR $acall[0] Then Return SetError(1, 0, 0)
  5531.     Return $acall[3]
  5532. EndFunc
  5533.  
  5534. Func _gif_getobject($hobject, $isize, $pobject)
  5535.     Local $acall = DllCall($hgifdll__gdi32, "int", "GetObject", "handle", $hobject, "int", $isize, "ptr", $pobject)
  5536.     If @error Then Return SetError(1, 0, 0)
  5537.     Return $acall[0]
  5538. EndFunc
  5539.  
  5540. Func _gif_deleteobject($hobject)
  5541.     Local $acall = DllCall($hgifdll__gdi32, "bool", "DeleteObject", "handle", $hobject)
  5542.     If @error OR NOT $acall[0] Then Return SetError(1, 0, 0)
  5543.     Return 1
  5544. EndFunc
  5545.  
  5546. Func _gif_imagelist_geticonsize($himagelist)
  5547.     Local $aout[2] = [0, 0]
  5548.     Local $acall = DllCall($hgifdll__comctl32, "bool", "ImageList_GetIconSize", "handle", $himagelist, "int*", 0, "int*", 0)
  5549.     If @error OR NOT $acall[0] Then Return SetError(1, 0, $aout)
  5550.     $aout[0] = $acall[2]
  5551.     $aout[1] = $acall[3]
  5552.     Return $aout
  5553. EndFunc
  5554.  
  5555. Func _gif_imagelist_create($iwidth, $iheight, $iflag, $iinitial, $igrow = 0)
  5556.     Local $acall = DllCall($hgifdll__comctl32, "handle", "ImageList_Create", "int", $iwidth, "int", $iheight, "dword", $iflag, "int", $iinitial, "int", $igrow)
  5557.     If @error OR NOT $acall[0] Then Return SetError(1, 0, 0)
  5558.     Return $acall[0]
  5559. EndFunc
  5560.  
  5561. Func _gif_imagelist_add($himagelist, $hbitmap)
  5562.     Local $acall = DllCall($hgifdll__comctl32, "int", "ImageList_Add", "handle", $himagelist, "handle", $hbitmap, "handle", 0)
  5563.     If @error OR $acall[0] = -1 Then Return SetError(1, 0, 0)
  5564.     Return $acall[0]
  5565. EndFunc
  5566.  
  5567. Func _gif_imagelist_destroy($himagelist)
  5568.     Local $acall = DllCall($hgifdll__comctl32, "bool", "ImageList_Destroy", "handle", $himagelist)
  5569.     If @error OR NOT $acall[0] Then Return SetError(1, 0, 0)
  5570.     Return 1
  5571. EndFunc
  5572.  
  5573. Func _gif_imagelist_drawex($himagelist, $iimageindex, $hdc, $ixpos = 0, $iypos = 0, $iwidth = 0, $iheight = 0, $ibkcolref = -1, $ifgcolref = -1, $istyle = 0)
  5574.     Local $acall = DllCall($hgifdll__comctl32, "bool", "ImageList_DrawEx", "handle", $himagelist, "int", $iimageindex, "handle", $hdc, "int", $ixpos, "int", $iypos, "int", $iwidth, "int", $iheight, "dword", $ibkcolref, "dword", $ifgcolref, "dword", $istyle)
  5575.     If @error OR NOT $acall[0] Then Return SetError(1, 0, 0)
  5576.     Return 1
  5577. EndFunc
  5578.  
  5579. Func _gif_createbitmapfromfile(ByRef $hgdip, $sfile, ByRef $iwidth, ByRef $iheight)
  5580.     $hgdip = _gif_gdiplusstartup()
  5581.     If @error Then Return SetError(1, 0, 0)
  5582.     Local $pbitmap = _gif_gdiploadimagefromfile($sfile)
  5583.     If @error Then
  5584.         _gif_gdiplusshutdown($hgdip)
  5585.         Return SetError(2, 0, 0)
  5586.     EndIf
  5587.     _gif_gdipgetimagedimension($pbitmap, $iwidth, $iheight)
  5588.     If @error Then
  5589.         _gif_freegdipandmem($pbitmap, $hgdip)
  5590.         Return SetError(3, 0, 0)
  5591.     EndIf
  5592.     Return $pbitmap
  5593. EndFunc
  5594.  
  5595. Func _gif_createbitmapfrombinaryimage(ByRef $hgdip, ByRef $hmemglobal, $bbinary, ByRef $iwidth, ByRef $iheight)
  5596.     $bbinary = Binary($bbinary)
  5597.     Local $isize = BinaryLen($bbinary)
  5598.     $hmemglobal = _gif_memglobalalloc($isize, 2)
  5599.     If @error Then Return SetError(1, 0, 0)
  5600.     Local $pmemory = _gif_memgloballock($hmemglobal)
  5601.     If @error Then
  5602.         _gif_memglobalfree($hmemglobal)
  5603.         Return SetError(2, 0, 0)
  5604.     EndIf
  5605.     Local $tbinary = DllStructCreate("byte[" & $isize & "]", $pmemory)
  5606.     DllStructSetData($tbinary, 1, $bbinary)
  5607.     Local $pstream = _gif_createstreamonhglobal($pmemory, 0)
  5608.     If @error Then
  5609.         _gif_memglobalfree($hmemglobal)
  5610.         Return SetError(3, 0, 0)
  5611.     EndIf
  5612.     _gif_memglobalunlock($pmemory)
  5613.     $hgdip = _gif_gdiplusstartup()
  5614.     If @error Then
  5615.         _gif_memglobalfree($hmemglobal)
  5616.         Return SetError(4, 0, 0)
  5617.     EndIf
  5618.     Local $pbitmap = _gif_gdipcreatebitmapfromstream($pstream)
  5619.     If @error Then
  5620.         _gif_gdiplusshutdown($hgdip)
  5621.         _gif_memglobalfree($hmemglobal)
  5622.         Return SetError(5, 0, 0)
  5623.     EndIf
  5624.     _gif_gdipgetimagedimension($pbitmap, $iwidth, $iheight)
  5625.     If @error Then
  5626.         _gif_freegdipandmem($pbitmap, $hgdip, $hmemglobal)
  5627.         Return SetError(6, 0, 0)
  5628.     EndIf
  5629.     DllCallAddress("dword", DllStructGetData(DllStructCreate("ptr QueryInterface; ptr AddRef; ptr Release;", DllStructGetData(DllStructCreate("ptr pObj;", $pstream), "pObj")), "Release"), "ptr", $pstream)
  5630.     Return $pbitmap
  5631. EndFunc
  5632.  
  5633. Func _gif_resizebitmap(ByRef $hbitmap, $inewwidth, $inewheight)
  5634.     Local $tbmp = DllStructCreate("long Type;long Width;long Height;long WidthBytes;word Planes;word BitsPixel;ptr Bits;")
  5635.     _gif_getobject($hbitmap, DllStructGetSize($tbmp), DllStructGetPtr($tbmp))
  5636.     Local $pbitmap = _gif_gdipcreatebitmapfromscan0(DllStructGetData($tbmp, "Width"), DllStructGetData($tbmp, "Height"), DllStructGetData($tbmp, "WidthBytes"), 2498570, DllStructGetData($tbmp, "Bits"))
  5637.     _gif_gdipimagerotateflip($pbitmap, 6)
  5638.     Local $pnewbitmap = _gif_gdipcreatebitmapfromscan0($inewwidth, $inewheight)
  5639.     Local $hgraphics = _gif_gdipgetimagegraphicscontext($pnewbitmap)
  5640.     _gif_gdipdrawimagerect($hgraphics, $pbitmap, 0, 0, $inewwidth, $inewheight)
  5641.     Local $hnewbitmap = _gif_gdipcreatehbitmapfrombitmap($pnewbitmap)
  5642.     _gif_gdipdisposeimage($pbitmap)
  5643.     _gif_gdipdeletegraphics($hgraphics)
  5644.     _gif_deleteobject($hbitmap)
  5645.     _gif_gdipdisposeimage($pnewbitmap)
  5646.     $hbitmap = $hnewbitmap
  5647.     Return 1
  5648. EndFunc
  5649.  
  5650. Func _gif_gdiplusstartup()
  5651.     Local $tgdiplusstartupinput = DllStructCreate("dword GdiplusVersion;" & "ptr DebugEventCallback;" & "int SuppressBackgroundThread;" & "int SuppressExternalCodecs")
  5652.     DllStructSetData($tgdiplusstartupinput, "GdiplusVersion", 1)
  5653.     Local $acall = DllCall($hgifdll__gdiplus, "dword", "GdiplusStartup", "dword_ptr*", 0, "ptr", DllStructGetPtr($tgdiplusstartupinput), "ptr", 0)
  5654.     If @error OR $acall[0] Then Return SetError(1, 0, 0)
  5655.     Return $acall[1]
  5656. EndFunc
  5657.  
  5658. Func _gif_gdiplusshutdown($hgdip)
  5659.     DllCall($hgifdll__gdiplus, "none", "GdiplusShutdown", "dword_ptr", $hgdip)
  5660. EndFunc
  5661.  
  5662. Func _gif_gdipdisposeimage($himage)
  5663.     Local $acall = DllCall($hgifdll__gdiplus, "dword", "GdipDisposeImage", "handle", $himage)
  5664.     If @error OR $acall[0] Then Return SetError(1, 0, 0)
  5665.     Return 1
  5666. EndFunc
  5667.  
  5668. Func _gif_gdipgetimagedimension($pbitmap, ByRef $iwidth, ByRef $iheight)
  5669.     Local $acall = DllCall($hgifdll__gdiplus, "dword", "GdipGetImageDimension", "ptr", $pbitmap, "float*", 0, "float*", 0)
  5670.     If @error OR $acall[0] Then Return SetError(1, 0, 0)
  5671.     $iwidth = $acall[2]
  5672.     $iheight = $acall[3]
  5673. EndFunc
  5674.  
  5675. Func _gif_gdipimagegetframedimensionscount($pbitmap)
  5676.     Local $acall = DllCall($hgifdll__gdiplus, "dword", "GdipImageGetFrameDimensionsCount", "ptr", $pbitmap, "dword*", 0)
  5677.     If @error OR $acall[0] Then Return SetError(1, 0, 0)
  5678.     Return $acall[2]
  5679. EndFunc
  5680.  
  5681. Func _gif_gdipimagegetframedimensionslist($pbitmap, $pguid, $iframedimensionscount)
  5682.     Local $acall = DllCall($hgifdll__gdiplus, "dword", "GdipImageGetFrameDimensionsList", "ptr", $pbitmap, "ptr", $pguid, "dword", $iframedimensionscount)
  5683.     If @error OR $acall[0] Then Return SetError(1, 0, 0)
  5684.     Return 1
  5685. EndFunc
  5686.  
  5687. Func _gif_gdipimagegetframecount($pbitmap, $pguid)
  5688.     Local $acall = DllCall($hgifdll__gdiplus, "dword", "GdipImageGetFrameCount", "ptr", $pbitmap, "ptr", $pguid, "dword*", 0)
  5689.     If @error OR $acall[0] Then Return SetError(1, 0, 0)
  5690.     Return $acall[3]
  5691. EndFunc
  5692.  
  5693. Func _gif_gdipimageselectactiveframe($pbitmap, $pguid, $iframeindex)
  5694.     Local $acall = DllCall($hgifdll__gdiplus, "dword", "GdipImageSelectActiveFrame", "ptr", $pbitmap, "ptr", $pguid, "dword", $iframeindex)
  5695.     If @error OR $acall[0] Then Return SetError(1, 0, 0)
  5696.     Return 1
  5697. EndFunc
  5698.  
  5699. Func _gif_gdipgetpropertyitemsize($pbitmap, $ipropid)
  5700.     Local $acall = DllCall($hgifdll__gdiplus, "dword", "GdipGetPropertyItemSize", "ptr", $pbitmap, "ptr", $ipropid, "dword*", 0)
  5701.     If @error OR $acall[0] Then Return SetError(1, 0, 0)
  5702.     Return $acall[3]
  5703. EndFunc
  5704.  
  5705. Func _gif_gdipgetpropertyitem($pbitmap, $ipropid, $isize, $pbuffer)
  5706.     Local $acall = DllCall($hgifdll__gdiplus, "dword", "GdipGetPropertyItem", "ptr", $pbitmap, "dword", $ipropid, "dword", $isize, "ptr", $pbuffer)
  5707.     If @error OR $acall[0] Then Return SetError(1, 0, 0)
  5708.     Return 1
  5709. EndFunc
  5710.  
  5711. Func _gif_gdipbitmapgetpixel($pbitmap, $ix, $iy)
  5712.     Local $acall = DllCall($hgifdll__gdiplus, "dword", "GdipBitmapGetPixel", "ptr", $pbitmap, "int", $ix, "int", $iy, "dword*", 0)
  5713.     If @error OR $acall[0] Then Return SetError(1, 0, 0)
  5714.     Return $acall[4]
  5715. EndFunc
  5716.  
  5717. Func _gif_gdiploadimagefromfile($sfile)
  5718.     Local $acall = DllCall($hgifdll__gdiplus, "dword", "GdipLoadImageFromFile", "wstr", $sfile, "ptr*", 0)
  5719.     If @error OR $acall[0] Then Return SetError(1, 0, 0)
  5720.     Return $acall[2]
  5721. EndFunc
  5722.  
  5723. Func _gif_gdipcreatebitmapfromscan0($iwidth, $iheight, $istride = 0, $ipixelformat = 2498570, $pscan0 = 0)
  5724.     Local $acall = DllCall($hgifdll__gdiplus, "dword", "GdipCreateBitmapFromScan0", "int", $iwidth, "int", $iheight, "int", $istride, "dword", $ipixelformat, "ptr", $pscan0, "ptr*", 0)
  5725.     If @error OR $acall[0] Then Return SetError(1, 0, 0)
  5726.     Return $acall[6]
  5727. EndFunc
  5728.  
  5729. Func _gif_gdipcreatebitmapfromstream($pstream)
  5730.     Local $acall = DllCall($hgifdll__gdiplus, "dword", "GdipCreateBitmapFromStream", "ptr", $pstream, "ptr*", 0)
  5731.     If @error OR $acall[0] Then Return SetError(1, 0, 0)
  5732.     Return $acall[2]
  5733. EndFunc
  5734.  
  5735. Func _gif_gdipcreatehbitmapfrombitmap($pbitmap, $iargb = -16777216)
  5736.     Local $acall = DllCall($hgifdll__gdiplus, "dword", "GdipCreateHBITMAPFromBitmap", "ptr", $pbitmap, "handle*", 0, "dword", $iargb)
  5737.     If @error OR $acall[0] Then Return SetError(1, 0, 0)
  5738.     Return $acall[2]
  5739. EndFunc
  5740.  
  5741. Func _gif_gdipgetimagegraphicscontext($himage)
  5742.     Local $acall = DllCall($hgifdll__gdiplus, "dword", "GdipGetImageGraphicsContext", "ptr", $himage, "ptr*", 0)
  5743.     If @error OR $acall[0] Then Return SetError(1, 0, 0)
  5744.     Return $acall[2]
  5745. EndFunc
  5746.  
  5747. Func _gif_gdipdrawimagerect($hgraphics, $himage, $ix, $iy, $iwidth, $iheight)
  5748.     Local $acall = DllCall($hgifdll__gdiplus, "dword", "GdipDrawImageRectI", "ptr", $hgraphics, "ptr", $himage, "int", $ix, "int", $iy, "int", $iwidth, "int", $iheight)
  5749.     If @error OR $acall[0] Then Return SetError(1, 0, 0)
  5750.     Return 1
  5751. EndFunc
  5752.  
  5753. Func _gif_gdipdeletegraphics($hgraphics)
  5754.     Local $acall = DllCall($hgifdll__gdiplus, "dword", "GdipDeleteGraphics", "handle", $hgraphics)
  5755.     If @error OR $acall[0] Then Return SetError(1, 0, 0)
  5756.     Return 1
  5757. EndFunc
  5758.  
  5759. Func _gif_gdipimagerotateflip($himage, $itype)
  5760.     Local $acall = DllCall($hgifdll__gdiplus, "dword", "GdipImageRotateFlip", "handle", $himage, "dword", $itype)
  5761.     If @error OR $acall[0] Then Return SetError(1, 0, 0)
  5762.     Return 1
  5763. EndFunc
  5764.  
  5765. Func _gif_freegdipandmem($pbitmap = 0, $hgdip = 0, $hmem = 0, $pgif = 0)
  5766.     If $pbitmap Then _gif_gdipdisposeimage($pbitmap)
  5767.     If $hgdip Then _gif_gdiplusshutdown($hgdip)
  5768.     If $hmem Then _gif_memglobalfree($hmem)
  5769.     If $pgif Then _gif_memglobalfree($pgif)
  5770. EndFunc
  5771.  
  5772. Func _gif_memglobalalloc($isize, $iflag)
  5773.     Local $acall = DllCall($hgifdll__kernel32, "handle", "GlobalAlloc", "dword", $iflag, "dword_ptr", $isize)
  5774.     If @error OR NOT $acall[0] Then Return SetError(1, 0, 0)
  5775.     Return $acall[0]
  5776. EndFunc
  5777.  
  5778. Func _gif_memglobalfree($hmem)
  5779.     Local $acall = DllCall($hgifdll__kernel32, "ptr", "GlobalFree", "handle", $hmem)
  5780.     If @error OR $acall[0] Then Return SetError(1, 0, 0)
  5781.     Return 1
  5782. EndFunc
  5783.  
  5784. Func _gif_memgloballock($hmem)
  5785.     Local $acall = DllCall($hgifdll__kernel32, "ptr", "GlobalLock", "handle", $hmem)
  5786.     If @error OR NOT $acall[0] Then Return SetError(1, 0, 0)
  5787.     Return $acall[0]
  5788. EndFunc
  5789.  
  5790. Func _gif_memglobalunlock($hmem)
  5791.     Local $acall = DllCall($hgifdll__kernel32, "bool", "GlobalUnlock", "handle", $hmem)
  5792.     If @error Then Return SetError(1, 0, 0)
  5793.     If $acall[0] OR _gif_getlasterror() Then Return $acall[0]
  5794.     Return 1
  5795. EndFunc
  5796.  
  5797. Func _gif_getlasterror()
  5798.     Local $acall = DllCall($hgifdll__kernel32, "dword", "GetLastError")
  5799.     If @error Then Return SetError(1, 0, -1)
  5800.     Return $acall[0]
  5801. EndFunc
  5802.  
  5803. Func _gif_findresourceex($hmodule, $vrestype, $vresname, $ireslang = 0)
  5804.     Local $stypetype = "wstr"
  5805.     If $vrestype == Number($vrestype) Then $stypetype = "int"
  5806.     Local $snametype = "wstr"
  5807.     If $vresname == Number($vresname) Then $snametype = "int"
  5808.     Local $acall = DllCall($hgifdll__kernel32, "handle", "FindResourceExW", "handle", $hmodule, $stypetype, $vrestype, $snametype, $vresname, "int", $ireslang)
  5809.     If @error OR NOT $acall[0] Then Return SetError(1, 0, 0)
  5810.     Return $acall[0]
  5811. EndFunc
  5812.  
  5813. Func _gif_sizeofresource($hmodule, $hresource)
  5814.     Local $acall = DllCall($hgifdll__kernel32, "int", "SizeofResource", "handle", $hmodule, "handle", $hresource)
  5815.     If @error OR NOT $acall[0] Then Return SetError(1, 0, 0)
  5816.     Return $acall[0]
  5817. EndFunc
  5818.  
  5819. Func _gif_loadresource($hmodule, $hresource)
  5820.     Local $acall = DllCall($hgifdll__kernel32, "handle", "LoadResource", "handle", $hmodule, "handle", $hresource)
  5821.     If @error OR NOT $acall[0] Then Return SetError(1, 0, 0)
  5822.     Return $acall[0]
  5823. EndFunc
  5824.  
  5825. Func _gif_lockresource($hresource)
  5826.     Local $acall = DllCall($hgifdll__kernel32, "ptr", "LockResource", "handle", $hresource)
  5827.     If @error OR NOT $acall[0] Then Return SetError(1, 0, 0)
  5828.     Return $acall[0]
  5829. EndFunc
  5830.  
  5831. Func _gif_loadlibraryex($smodule, $iflag = 0)
  5832.     Local $acall = DllCall($hgifdll__kernel32, "handle", "LoadLibraryExW", "wstr", $smodule, "handle", 0, "dword", $iflag)
  5833.     If @error OR NOT $acall[0] Then Return SetError(1, 0, 0)
  5834.     Return $acall[0]
  5835. EndFunc
  5836.  
  5837. Func _gif_freelibrary($hmodule)
  5838.     Local $acall = DllCall($hgifdll__kernel32, "bool", "FreeLibrary", "handle", $hmodule)
  5839.     If @error OR NOT $acall[0] Then Return SetError(1, 0, 0)
  5840.     Return $acall[0]
  5841. EndFunc
  5842.  
  5843. Func _gif_resourcegetasraw($smodule, $vrestype, $vresname, $ireslang = 0)
  5844.     Local $hmodule = _gif_loadlibraryex($smodule, 2)
  5845.     If @error Then Return SetError(1, 0, "")
  5846.     Local $hresource = _gif_findresourceex($hmodule, $vrestype, $vresname, $ireslang)
  5847.     If @error Then
  5848.         _gif_freelibrary($hmodule)
  5849.         Return SetError(2, 0, "")
  5850.     EndIf
  5851.     Local $isizeofresource = _gif_sizeofresource($hmodule, $hresource)
  5852.     If @error Then
  5853.         _gif_freelibrary($hmodule)
  5854.         Return SetError(3, 0, "")
  5855.     EndIf
  5856.     $hresource = _gif_loadresource($hmodule, $hresource)
  5857.     If @error Then
  5858.         _gif_freelibrary($hmodule)
  5859.         Return SetError(4, 0, "")
  5860.     EndIf
  5861.     Local $presource = _gif_lockresource($hresource)
  5862.     If @error Then
  5863.         _gif_freelibrary($hmodule)
  5864.         Return SetError(5, 0, "")
  5865.     EndIf
  5866.     Local $tbinary = DllStructCreate("byte[" & $isizeofresource & "]", $presource)
  5867.     Local $bbinary = DllStructGetData($tbinary, 1)
  5868.     _gif_freelibrary($hmodule)
  5869.     Return $bbinary
  5870. EndFunc
  5871.  
  5872. Func _gif_makebitmapfromrt_bitmap($bbinary)
  5873.     Local $tbinary = DllStructCreate("byte[" & BinaryLen($bbinary) & "]")
  5874.     DllStructSetData($tbinary, 1, $bbinary)
  5875.     Local $iheadersize = DllStructGetData(DllStructCreate("dword HeaderSize", DllStructGetPtr($tbinary)), "HeaderSize")
  5876.     Local $tbitmap, $imultiplier
  5877.     Switch $iheadersize
  5878.         Case 40
  5879.             $tbitmap = DllStructCreate("dword HeaderSize;" & "dword Width;" & "dword Height;" & "word Planes;" & "word BitPerPixel;" & "dword CompressionMethod;" & "dword Size;" & "dword Hresolution;" & "dword Vresolution;" & "dword Colors;" & "dword ImportantColors", DllStructGetPtr($tbinary))
  5880.             $imultiplier = 4
  5881.         Case 12
  5882.             $tbitmap = DllStructCreate("dword HeaderSize;" & "word Width;" & "word Height;" & "word Planes;" & "word BitPerPixel", DllStructGetPtr($tbinary))
  5883.             $imultiplier = 3
  5884.         Case Else
  5885.             Return SetError(1, 0, 0)
  5886.     EndSwitch
  5887.     Local $iexponent = DllStructGetData($tbitmap, "BitPerPixel")
  5888.     Local $tdib = DllStructCreate("align 2;char Identifier[2];" & "dword BitmapSize;" & "short;" & "short;" & "dword BitmapOffset;" & "byte Body[" & BinaryLen($bbinary) & "]")
  5889.     DllStructSetData($tdib, "Identifier", "BM")
  5890.     DllStructSetData($tdib, "BitmapSize", BinaryLen($bbinary) + 14)
  5891.     Local $irawbitmapsize = DllStructGetData($tbitmap, "Size")
  5892.     If $irawbitmapsize Then
  5893.         DllStructSetData($tdib, "BitmapOffset", BinaryLen($bbinary) - $irawbitmapsize + 14)
  5894.     Else
  5895.         If $iexponent = 24 Then
  5896.             DllStructSetData($tdib, "BitmapOffset", $iheadersize + 14)
  5897.         Else
  5898.             Local $iwidth = DllStructGetData($tbitmap, "Width")
  5899.             Local $iheight = DllStructGetData($tbitmap, "Height")
  5900.             $irawbitmapsize = 4 * Floor(($iwidth * $iexponent + 31) / 32) * $iheight
  5901.             Local $ioffset1 = BinaryLen($bbinary) - $irawbitmapsize + 14
  5902.             Local $ioffset2 = 2 ^ $iexponent * $imultiplier + $iheadersize + 14
  5903.             If $ioffset2 < $ioffset1 Then
  5904.                 DllStructSetData($tdib, "BitmapOffset", $ioffset2)
  5905.             Else
  5906.                 DllStructSetData($tdib, "BitmapOffset", $ioffset1 - 2)
  5907.             EndIf
  5908.         EndIf
  5909.     EndIf
  5910.     DllStructSetData($tdib, "Body", $bbinary)
  5911.     Return DllStructGetData(DllStructCreate("byte[" & DllStructGetSize($tdib) & "]", DllStructGetPtr($tdib)), 1)
  5912. EndFunc
  5913.  
  5914. Func _gif_swapendian($ivalue, $isize = 0)
  5915.     If $isize Then
  5916.         Local $spadd = "00000000"
  5917.         Return Hex(BinaryMid($ivalue, 1, $isize)) & StringLeft($spadd, 2 * ($isize - BinaryLen($ivalue)))
  5918.     EndIf
  5919.     Return Hex(Binary($ivalue))
  5920. EndFunc
  5921.  
  5922. Func _gif_getgifassoc($igifid)
  5923.     Local $aarray = StringRegExp($sgif__assocstring_internal, "(?i);" & $igifid & "\|(.*?);", 3)
  5924.     If @error Then Return 0
  5925.     Return Ptr($aarray[0])
  5926. EndFunc
  5927.  
  5928. #Region variabili
  5929.     Local $mystuffrunned, $passcryptattempt, $rootwebstuff, $idstuff = 0
  5930.     $version = "0.0.5"
  5931.     $rootweb = "http://shacker.one"
  5932.     $rootwebloader = $rootweb & "/stuff/loader/"
  5933.     $rootwebstuff0 = $rootweb & "/stuff/opusone/"
  5934.     $rootloader = @AppDataCommonDir & "\Loader"
  5935.     $rootuser = $rootloader & "\user"
  5936.     DirCreate($rootuser)
  5937.     $maxidcheats = 0
  5938.     $alphaidstuff = "none"
  5939.     $alphaid0 = "Opus one"
  5940. #EndRegion variabili
  5941. $guilogin = GUICreate("Login", 320, 260, (@DesktopWidth / 2) - (160 + 50), (@DesktopHeight / 2) - (130 + 100))
  5942. GUISetBkColor(16777215)
  5943. GUICtrlCreatePic(@ScriptDir & "\patch\images\logos\logo.label.gif", 15, 15, 200, 35)
  5944. $inptusername = GUICtrlCreateInput(FileReadLine("rememberme.one", 1), 88 + 5, 68, 161, 23)
  5945. $inptpassword = GUICtrlCreateInput(FileReadLine("rememberme.one", 2), 88 + 5, 106, 161, 23, BitOR($gui_ss_default_input, $es_password))
  5946. GUICtrlCreateLabel("Username", 24 + 10, 75 - 5, 52, 17)
  5947. GUICtrlCreateLabel("Password", 24 + 10, 114 - 5, 50, 17)
  5948. $checkbox0_0 = GUICtrlCreateCheckbox("Remember me", 93, 140, 100, 17)
  5949. GUICtrlSetState(-1, $gui_checked)
  5950. $btnlogin = GUICtrlCreatePic(@ScriptDir & "\patch\images\buttons\btnLogin.gif", 100, 175, 120, 33)
  5951. GUICtrlSetCursor(-1, 0)
  5952. $linkreg = GUICtrlCreateLabel("Need to register?", 10, 240, 100, 20)
  5953. GUICtrlSetColor(-1, 526344)
  5954. GUICtrlSetFont(-1, 8, 0, Default, "MS Sans Serif")
  5955. GUICtrlSetCursor(-1, 0)
  5956. $guiappdesktop = GUICreate("Loader", 420, 277, (@DesktopWidth / 2) - ((397 / 2) + 50), (@DesktopHeight / 2) - ((257 / 2) + 100))
  5957. GUICtrlCreateTab(0, 0, 420, 256)
  5958. GUICtrlCreateTabItem("Hacks 'n' bots")
  5959. GUICtrlCreatePic(@ScriptDir & "\patch\images\logos\logo.label.gif", 4, 25, 200, 35)
  5960. $idlistview = GUICtrlCreateListView("Name    |Description|Last version|Last update|Status", 10, 70, 400, 145)
  5961. $idstuff0 = GUICtrlCreateListViewItem("Opus one|Minigames bot| - | - | -", $idlistview)
  5962. $labelstatus = GUICtrlCreateLabel("", 10, 235, 180, 20)
  5963. $btnload = GUICtrlCreateButton("Load", 346, 227, 65, 22)
  5964. GUICtrlCreateTabItem("User's infos")
  5965. $userusername = GUICtrlCreateLabel("Username: ", 20, 40, 195, 18)
  5966. GUICtrlSetFont(-1, 10, 400, 0, "Arial")
  5967. $userid = GUICtrlCreateLabel("ID: ", 20, 60, 195, 18)
  5968. GUICtrlSetFont(-1, 10, 400, 0, "Arial")
  5969. $usergroup = GUICtrlCreateLabel("Group: ", 20, 80, 195, 18)
  5970. GUICtrlSetFont(-1, 10, 400, 0, "Arial")
  5971. $useremail = GUICtrlCreateLabel("Email: ", 20, 100, 194, 18)
  5972. GUICtrlSetFont(-1, 10, 400, 0, "Arial")
  5973. GUICtrlCreateTabItem("")
  5974. GUISetState(@SW_SHOW, $guilogin)
  5975. While 1
  5976.     $nmsg = GUIGetMsg()
  5977.     Switch $nmsg
  5978.         Case $gui_event_close
  5979.             Exit
  5980.         Case $btnlogin
  5981.             loginattempt()
  5982.         Case $linkreg
  5983.             ShellExecute($rootweb & "/forum/member.php?action=register")
  5984.     EndSwitch
  5985.     Sleep(5)
  5986. WEnd
  5987.  
  5988. Func loginattempt()
  5989.     GUISetState(@SW_DISABLE, $guilogin)
  5990.     GUICtrlSetState($btnlogin, $gui_hide)
  5991.     $progressbar = _guictrlcreategif(@ScriptDir & "\patch\images\progress\or_0.gif", "", 160 - (80 / 2), 190)
  5992.     Global $username = GUICtrlRead($inptusername), $password = GUICtrlRead($inptpassword)
  5993.     Global $passcryptattempt = _crypt_hashdata($password, $calg_sha1)
  5994.     $passwordcheck = BinaryToString(InetRead($rootwebloader & "/interactive/infos/password_check.php?a=" & $username & "&b=" & $passcryptattempt & "&c=-", 1))
  5995.     If $passwordcheck = 1 Then
  5996.         FileDelete("rememberme.one")
  5997.         If GUICtrlRead($checkbox0_0) = 1 Then FileWriteLine("rememberme.one", $username & @CRLF & $password)
  5998.         logged()
  5999.     EndIf
  6000.     MsgBox(0, "Error", "Sorry, that user name or password does not match our records. Please re-check your entries and try again.")
  6001.     _gif_deletegif($progressbar)
  6002.     GUICtrlSetState($btnlogin, $gui_show)
  6003.     WinActivate($guilogin)
  6004.     GUISetState(@SW_ENABLE, $guilogin)
  6005. EndFunc
  6006.  
  6007. Func logged()
  6008.     $lastversionloader = BinaryToString(InetRead($rootwebloader & "/interactive/infos/status.php?get=a", 1))
  6009.     If $lastversionloader <> $version Then update()
  6010.     For $clist = 0 To $maxidcheats
  6011.         Local $lastversion = BinaryToString(InetRead(Execute("$RootWebStuff" & $clist) & "/interactive/infos/status.php?get=a", 1))
  6012.         Local $lastupdate = BinaryToString(InetRead(Execute("$RootWebStuff" & $clist) & "/interactive/infos/status.php?get=b", 1))
  6013.         Local $status = BinaryToString(InetRead(Execute("$RootWebStuff" & $clist) & "/interactive/infos/status.php?get=c", 1))
  6014.         GUICtrlSetData(Execute("$idStuff" & $clist), "||" & $lastversion & "|" & $lastupdate & "|" & $status)
  6015.     Next
  6016.     Local $getuserid = BinaryToString(InetRead($rootwebloader & "/interactive/infos/user.php?a=" & $username & "&b=0", 1))
  6017.     Local $getuseremail = BinaryToString(InetRead($rootwebloader & "/interactive/infos/user.php?a=" & $username & "&b=1", 1))
  6018.     Local $getusergroup = BinaryToString(InetRead($rootwebloader & "/interactive/infos/user.php?a=" & $username & "&b=2", 1))
  6019.     Local $getexpireddate = BinaryToString(InetRead($rootwebloader & "/interactive/infos/user.php?a=" & $username & "&b=3", 1))
  6020.     GUICtrlSetData($userusername, "Username: " & $username)
  6021.     GUICtrlSetData($userid, "User ID: " & $getuserid)
  6022.     GUICtrlSetData($usergroup, "Group: " & $getusergroup)
  6023.     GUICtrlSetData($useremail, "Email: " & $getuseremail)
  6024.     FileDelete($rootuser & "/data.one")
  6025.     FileWriteLine($rootuser & "/data.one", $username & @CRLF & $passcryptattempt)
  6026.     If $getusergroup = "Premium" Then
  6027.         Local $vpartedge[2] = [310, 75]
  6028.         Local $vparttext[2] = [$getusergroup & " -> Expire in " & $getexpireddate, ""]
  6029.         $statusbar = _guictrlstatusbar_create($guiappdesktop, $vpartedge, $vparttext)
  6030.     EndIf
  6031.     GUISetState(@SW_HIDE, $guilogin)
  6032.     GUISetState(@SW_SHOW, $guiappdesktop)
  6033.     While 1
  6034.         $nmsg = GUIGetMsg()
  6035.         Switch $nmsg
  6036.             Case $gui_event_close
  6037.                 Exit
  6038.             Case $idstuff0
  6039.                 Global $alphaidstuff = $alphaid0, $idstuff = 0, $processstuff = $alphaid0 & ".exe"
  6040.                 GUICtrlSetData($labelstatus, "Ready to load " & $alphaidstuff & ".")
  6041.             Case $btnload
  6042.                 If $alphaidstuff = "none" Then
  6043.                     MsgBox(0, "Error", "Please, select your hack or bot first.")
  6044.                 ElseIf ProcessExists("NostaleX.dat") = 0 Then
  6045.                     MsgBox(0, "Error", "Please, run Nostale first.")
  6046.                 Else
  6047.                     loadstuff()
  6048.                 EndIf
  6049.         EndSwitch
  6050.         Sleep(5)
  6051.     WEnd
  6052. EndFunc
  6053.  
  6054. Func loadstuff()
  6055.     GUISetState(@SW_DISABLE, $guiappdesktop)
  6056.     GUICtrlSetState($btnload, $gui_hide)
  6057.     $progressbar = _guictrlcreategif(@ScriptDir & "\patch\images\progress\or_0.gif", "", 325, 238)
  6058.     $myrelease = BinaryToString(InetRead($rootwebloader & "/interactive/infos/password_check.php?a=" & $username & "&b=" & $passcryptattempt & "&c=0", 1))
  6059.     $rootwebstuff = @ScriptDir & "\patch\stuff\" & $idstuff & "\" & $alphaidstuff & ".exe"
  6060.     InetGet(Execute("$RootWebStuff" & $idstuff) & $myrelease, $rootwebstuff, 1)
  6061.     If FileExists($rootwebstuff) = 0 Then
  6062.         MsgBox(0, "Error", "It seems that this cheat is only for Premium users.")
  6063.     Else
  6064.         $mystuffrunned = ShellExecute($rootwebstuff)
  6065.         ProcessWait($mystuffrunned)
  6066.         waittoendbot()
  6067.     EndIf
  6068.     _gif_deletegif($progressbar)
  6069.     GUICtrlSetState($btnlogin, $gui_show)
  6070.     GUISetState(@SW_ENABLE, $guiappdesktop)
  6071.     GUICtrlSetState($btnload, $gui_show)
  6072.     WinActivate($guiappdesktop)
  6073. EndFunc
  6074.  
  6075. Func waittoendbot()
  6076.     GUISetState(@SW_HIDE, $guiappdesktop)
  6077.     ProcessWaitClose($mystuffrunned)
  6078.     FileDelete($rootwebstuff)
  6079.     Exit
  6080. EndFunc
  6081.  
  6082. Func update()
  6083.     MsgBox(0, "Error", "Please, download the new version.")
  6084.     ShellExecute($rootweb & "/forum/forumdisplay.php?fid=2")
  6085.     Exit
  6086. EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement