SHARE
TWEET

Untitled

a guest Dec 30th, 2018 210 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #Region
  2.     #AutoIt3Wrapper_Icon=icon.ico
  3. #EndRegion
  4. Global Const $gui_event_single = 0
  5. Global Const $gui_event_array = 1
  6. Global Const $gui_event_none = 0
  7. Global Const $gui_event_close = -3
  8. Global Const $gui_event_minimize = -4
  9. Global Const $gui_event_restore = -5
  10. Global Const $gui_event_maximize = -6
  11. Global Const $gui_event_primarydown = -7
  12. Global Const $gui_event_primaryup = -8
  13. Global Const $gui_event_secondarydown = -9
  14. Global Const $gui_event_secondaryup = -10
  15. Global Const $gui_event_mousemove = -11
  16. Global Const $gui_event_resized = -12
  17. Global Const $gui_event_dropped = -13
  18. Global Const $gui_rundefmsg = "GUI_RUNDEFMSG"
  19. Global Const $gui_avistop = 0
  20. Global Const $gui_avistart = 1
  21. Global Const $gui_aviclose = 2
  22. Global Const $gui_checked = 1
  23. Global Const $gui_indeterminate = 2
  24. Global Const $gui_unchecked = 4
  25. Global Const $gui_dropaccepted = 8
  26. Global Const $gui_nodropaccepted = 4096
  27. Global Const $gui_acceptfiles = $gui_dropaccepted
  28. Global Const $gui_show = 16
  29. Global Const $gui_hide = 32
  30. Global Const $gui_enable = 64
  31. Global Const $gui_disable = 128
  32. Global Const $gui_focus = 256
  33. Global Const $gui_nofocus = 8192
  34. Global Const $gui_defbutton = 512
  35. Global Const $gui_expand = 1024
  36. Global Const $gui_ontop = 2048
  37. Global Const $gui_fontnormal = 0
  38. Global Const $gui_fontitalic = 2
  39. Global Const $gui_fontunder = 4
  40. Global Const $gui_fontstrike = 8
  41. Global Const $gui_dockauto = 1
  42. Global Const $gui_dockleft = 2
  43. Global Const $gui_dockright = 4
  44. Global Const $gui_dockhcenter = 8
  45. Global Const $gui_docktop = 32
  46. Global Const $gui_dockbottom = 64
  47. Global Const $gui_dockvcenter = 128
  48. Global Const $gui_dockwidth = 256
  49. Global Const $gui_dockheight = 512
  50. Global Const $gui_docksize = 768
  51. Global Const $gui_dockmenubar = 544
  52. Global Const $gui_dockstatebar = 576
  53. Global Const $gui_dockall = 802
  54. Global Const $gui_dockborders = 102
  55. Global Const $gui_gr_close = 1
  56. Global Const $gui_gr_line = 2
  57. Global Const $gui_gr_bezier = 4
  58. Global Const $gui_gr_move = 6
  59. Global Const $gui_gr_color = 8
  60. Global Const $gui_gr_rect = 10
  61. Global Const $gui_gr_ellipse = 12
  62. Global Const $gui_gr_pie = 14
  63. Global Const $gui_gr_dot = 16
  64. Global Const $gui_gr_pixel = 18
  65. Global Const $gui_gr_hint = 20
  66. Global Const $gui_gr_refresh = 22
  67. Global Const $gui_gr_pensize = 24
  68. Global Const $gui_gr_nobkcolor = -2
  69. Global Const $gui_bkcolor_default = -1
  70. Global Const $gui_bkcolor_transparent = -2
  71. Global Const $gui_bkcolor_lv_alternate = -33554432
  72. Global Const $gui_read_default = 0
  73. Global Const $gui_read_extended = 1
  74. Global Const $gui_cursor_nooverride = 0
  75. Global Const $gui_cursor_override = 1
  76. Global Const $gui_ws_ex_parentdrag = 1048576
  77. Global Const $wc_animate = "SysAnimate32"
  78. Global Const $wc_button = "Button"
  79. Global Const $wc_combobox = "ComboBox"
  80. Global Const $wc_comboboxex = "ComboBoxEx32"
  81. Global Const $wc_datetimepick = "SysDateTimePick32"
  82. Global Const $wc_edit = "Edit"
  83. Global Const $wc_header = "SysHeader32"
  84. Global Const $wc_hotkey = "msctls_hotkey32"
  85. Global Const $wc_ipaddress = "SysIPAddress32"
  86. Global Const $wc_link = "SysLink"
  87. Global Const $wc_listbox = "ListBox"
  88. Global Const $wc_listview = "SysListView32"
  89. Global Const $wc_monthcal = "SysMonthCal32"
  90. Global Const $wc_nativefontctl = "NativeFontCtl"
  91. Global Const $wc_pagescroller = "SysPager"
  92. Global Const $wc_progress = "msctls_progress32"
  93. Global Const $wc_rebar = "ReBarWindow32"
  94. Global Const $wc_scrollbar = "ScrollBar"
  95. Global Const $wc_static = "Static"
  96. Global Const $wc_statusbar = "msctls_statusbar32"
  97. Global Const $wc_tabcontrol = "SysTabControl32"
  98. Global Const $wc_toolbar = "ToolbarWindow32"
  99. Global Const $wc_tooltips = "tooltips_class32"
  100. Global Const $wc_trackbar = "msctls_trackbar32"
  101. Global Const $wc_treeview = "SysTreeView32"
  102. Global Const $wc_updown = "msctls_updown32"
  103. Global Const $ws_overlapped = 0
  104. Global Const $ws_tiled = $ws_overlapped
  105. Global Const $ws_maximizebox = 65536
  106. Global Const $ws_minimizebox = 131072
  107. Global Const $ws_tabstop = 65536
  108. Global Const $ws_group = 131072
  109. Global Const $ws_sizebox = 262144
  110. Global Const $ws_thickframe = $ws_sizebox
  111. Global Const $ws_sysmenu = 524288
  112. Global Const $ws_hscroll = 1048576
  113. Global Const $ws_vscroll = 2097152
  114. Global Const $ws_dlgframe = 4194304
  115. Global Const $ws_border = 8388608
  116. Global Const $ws_caption = 12582912
  117. Global Const $ws_overlappedwindow = BitOR($ws_caption, $ws_maximizebox, $ws_minimizebox, $ws_overlapped, $ws_sysmenu, $ws_thickframe)
  118. Global Const $ws_tiledwindow = $ws_overlappedwindow
  119. Global Const $ws_maximize = 16777216
  120. Global Const $ws_clipchildren = 33554432
  121. Global Const $ws_clipsiblings = 67108864
  122. Global Const $ws_disabled = 134217728
  123. Global Const $ws_visible = 268435456
  124. Global Const $ws_minimize = 536870912
  125. Global Const $ws_iconic = $ws_minimize
  126. Global Const $ws_child = 1073741824
  127. Global Const $ws_childwindow = $ws_child
  128. Global Const $ws_popup = -2147483648
  129. Global Const $ws_popupwindow = -2138570752
  130. Global Const $ds_3dlook = 4
  131. Global Const $ds_absalign = 1
  132. Global Const $ds_center = 2048
  133. Global Const $ds_centermouse = 4096
  134. Global Const $ds_contexthelp = 8192
  135. Global Const $ds_control = 1024
  136. Global Const $ds_fixedsys = 8
  137. Global Const $ds_localedit = 32
  138. Global Const $ds_modalframe = 128
  139. Global Const $ds_nofailcreate = 16
  140. Global Const $ds_noidlemsg = 256
  141. Global Const $ds_setfont = 64
  142. Global Const $ds_setforeground = 512
  143. Global Const $ds_shellfont = BitOR($ds_fixedsys, $ds_setfont)
  144. Global Const $ds_sysmodal = 2
  145. Global Const $ws_ex_acceptfiles = 16
  146. Global Const $ws_ex_appwindow = 262144
  147. Global Const $ws_ex_composited = 33554432
  148. Global Const $ws_ex_controlparent = 65536
  149. Global Const $ws_ex_clientedge = 512
  150. Global Const $ws_ex_contexthelp = 1024
  151. Global Const $ws_ex_dlgmodalframe = 1
  152. Global Const $ws_ex_layered = 524288
  153. Global Const $ws_ex_layoutrtl = 4194304
  154. Global Const $ws_ex_left = 0
  155. Global Const $ws_ex_leftscrollbar = 16384
  156. Global Const $ws_ex_ltrreading = 0
  157. Global Const $ws_ex_mdichild = 64
  158. Global Const $ws_ex_noactivate = 134217728
  159. Global Const $ws_ex_noinheritlayout = 1048576
  160. Global Const $ws_ex_noparentnotify = 4
  161. Global Const $ws_ex_right = 4096
  162. Global Const $ws_ex_rightscrollbar = 0
  163. Global Const $ws_ex_rtlreading = 8192
  164. Global Const $ws_ex_staticedge = 131072
  165. Global Const $ws_ex_toolwindow = 128
  166. Global Const $ws_ex_topmost = 8
  167. Global Const $ws_ex_transparent = 32
  168. Global Const $ws_ex_windowedge = 256
  169. Global Const $ws_ex_overlappedwindow = BitOR($ws_ex_clientedge, $ws_ex_windowedge)
  170. Global Const $ws_ex_palettewindow = BitOR($ws_ex_toolwindow, $ws_ex_topmost, $ws_ex_windowedge)
  171. Global Const $wm_null = 0
  172. Global Const $wm_create = 1
  173. Global Const $wm_destroy = 2
  174. Global Const $wm_move = 3
  175. Global Const $wm_sizewait = 4
  176. Global Const $wm_size = 5
  177. Global Const $wm_activate = 6
  178. Global Const $wm_setfocus = 7
  179. Global Const $wm_killfocus = 8
  180. Global Const $wm_setvisible = 9
  181. Global Const $wm_enable = 10
  182. Global Const $wm_setredraw = 11
  183. Global Const $wm_settext = 12
  184. Global Const $wm_gettext = 13
  185. Global Const $wm_gettextlength = 14
  186. Global Const $wm_paint = 15
  187. Global Const $wm_close = 16
  188. Global Const $wm_queryendsession = 17
  189. Global Const $wm_quit = 18
  190. Global Const $wm_erasebkgnd = 20
  191. Global Const $wm_queryopen = 19
  192. Global Const $wm_syscolorchange = 21
  193. Global Const $wm_endsession = 22
  194. Global Const $wm_systemerror = 23
  195. Global Const $wm_showwindow = 24
  196. Global Const $wm_ctlcolor = 25
  197. Global Const $wm_settingchange = 26
  198. Global Const $wm_wininichange = 26
  199. Global Const $wm_devmodechange = 27
  200. Global Const $wm_activateapp = 28
  201. Global Const $wm_fontchange = 29
  202. Global Const $wm_timechange = 30
  203. Global Const $wm_cancelmode = 31
  204. Global Const $wm_setcursor = 32
  205. Global Const $wm_mouseactivate = 33
  206. Global Const $wm_childactivate = 34
  207. Global Const $wm_queuesync = 35
  208. Global Const $wm_getminmaxinfo = 36
  209. Global Const $wm_logoff = 37
  210. Global Const $wm_painticon = 38
  211. Global Const $wm_iconerasebkgnd = 39
  212. Global Const $wm_nextdlgctl = 40
  213. Global Const $wm_alttabactive = 41
  214. Global Const $wm_spoolerstatus = 42
  215. Global Const $wm_drawitem = 43
  216. Global Const $wm_measureitem = 44
  217. Global Const $wm_deleteitem = 45
  218. Global Const $wm_vkeytoitem = 46
  219. Global Const $wm_chartoitem = 47
  220. Global Const $wm_setfont = 48
  221. Global Const $wm_getfont = 49
  222. Global Const $wm_sethotkey = 50
  223. Global Const $wm_gethotkey = 51
  224. Global Const $wm_filesyschange = 52
  225. Global Const $wm_isactiveicon = 53
  226. Global Const $wm_queryparkicon = 54
  227. Global Const $wm_querydragicon = 55
  228. Global Const $wm_winhelp = 56
  229. Global Const $wm_compareitem = 57
  230. Global Const $wm_fullscreen = 58
  231. Global Const $wm_clientshutdown = 59
  232. Global Const $wm_ddemlevent = 60
  233. Global Const $wm_getobject = 61
  234. Global Const $wm_calcscroll = 63
  235. Global Const $wm_testing = 64
  236. Global Const $wm_compacting = 65
  237. Global Const $wm_otherwindowcreated = 66
  238. Global Const $wm_otherwindowdestroyed = 67
  239. Global Const $wm_commnotify = 68
  240. Global Const $wm_mediastatuschange = 69
  241. Global Const $wm_windowposchanging = 70
  242. Global Const $wm_windowposchanged = 71
  243. Global Const $wm_power = 72
  244. Global Const $wm_copyglobaldata = 73
  245. Global Const $wm_copydata = 74
  246. Global Const $wm_canceljournal = 75
  247. Global Const $wm_logonnotify = 76
  248. Global Const $wm_keyf1 = 77
  249. Global Const $wm_notify = 78
  250. Global Const $wm_access_window = 79
  251. Global Const $wm_inputlangchangerequest = 80
  252. Global Const $wm_inputlangchange = 81
  253. Global Const $wm_tcard = 82
  254. Global Const $wm_help = 83
  255. Global Const $wm_userchanged = 84
  256. Global Const $wm_notifyformat = 85
  257. Global Const $wm_qm_activate = 96
  258. Global Const $wm_hook_do_callback = 97
  259. Global Const $wm_syscopydata = 98
  260. Global Const $wm_finaldestroy = 112
  261. Global Const $wm_measureitem_clientdata = 113
  262. Global Const $wm_contextmenu = 123
  263. Global Const $wm_stylechanging = 124
  264. Global Const $wm_stylechanged = 125
  265. Global Const $wm_displaychange = 126
  266. Global Const $wm_geticon = 127
  267. Global Const $wm_seticon = 128
  268. Global Const $wm_nccreate = 129
  269. Global Const $wm_ncdestroy = 130
  270. Global Const $wm_nccalcsize = 131
  271. Global Const $wm_nchittest = 132
  272. Global Const $wm_ncpaint = 133
  273. Global Const $wm_ncactivate = 134
  274. Global Const $wm_getdlgcode = 135
  275. Global Const $wm_syncpaint = 136
  276. Global Const $wm_synctask = 137
  277. Global Const $wm_kludgeminrect = 139
  278. Global Const $wm_lpkdrawswitchwnd = 140
  279. Global Const $wm_uahdestroywindow = 144
  280. Global Const $wm_uahdrawmenu = 145
  281. Global Const $wm_uahdrawmenuitem = 146
  282. Global Const $wm_uahinitmenu = 147
  283. Global Const $wm_uahmeasuremenuitem = 148
  284. Global Const $wm_uahncpaintmenupopup = 149
  285. Global Const $wm_ncmousemove = 160
  286. Global Const $wm_nclbuttondown = 161
  287. Global Const $wm_nclbuttonup = 162
  288. Global Const $wm_nclbuttondblclk = 163
  289. Global Const $wm_ncrbuttondown = 164
  290. Global Const $wm_ncrbuttonup = 165
  291. Global Const $wm_ncrbuttondblclk = 166
  292. Global Const $wm_ncmbuttondown = 167
  293. Global Const $wm_ncmbuttonup = 168
  294. Global Const $wm_ncmbuttondblclk = 169
  295. Global Const $wm_ncxbuttondown = 171
  296. Global Const $wm_ncxbuttonup = 172
  297. Global Const $wm_ncxbuttondblclk = 173
  298. Global Const $wm_ncuahdrawcaption = 174
  299. Global Const $wm_ncuahdrawframe = 175
  300. Global Const $wm_input_device_change = 254
  301. Global Const $wm_input = 255
  302. Global Const $wm_keydown = 256
  303. Global Const $wm_keyfirst = 256
  304. Global Const $wm_keyup = 257
  305. Global Const $wm_char = 258
  306. Global Const $wm_deadchar = 259
  307. Global Const $wm_syskeydown = 260
  308. Global Const $wm_syskeyup = 261
  309. Global Const $wm_syschar = 262
  310. Global Const $wm_sysdeadchar = 263
  311. Global Const $wm_yomichar = 264
  312. Global Const $wm_keylast = 265
  313. Global Const $wm_unichar = 265
  314. Global Const $wm_convertrequest = 266
  315. Global Const $wm_convertresult = 267
  316. Global Const $wm_im_info = 268
  317. Global Const $wm_ime_startcomposition = 269
  318. Global Const $wm_ime_endcomposition = 270
  319. Global Const $wm_ime_composition = 271
  320. Global Const $wm_ime_keylast = 271
  321. Global Const $wm_initdialog = 272
  322. Global Const $wm_command = 273
  323. Global Const $wm_syscommand = 274
  324. Global Const $wm_timer = 275
  325. Global Const $wm_hscroll = 276
  326. Global Const $wm_vscroll = 277
  327. Global Const $wm_initmenu = 278
  328. Global Const $wm_initmenupopup = 279
  329. Global Const $wm_systimer = 280
  330. Global Const $wm_gesture = 281
  331. Global Const $wm_gesturenotify = 282
  332. Global Const $wm_gestureinput = 283
  333. Global Const $wm_gesturenotified = 284
  334. Global Const $wm_menuselect = 287
  335. Global Const $wm_menuchar = 288
  336. Global Const $wm_enteridle = 289
  337. Global Const $wm_menurbuttonup = 290
  338. Global Const $wm_menudrag = 291
  339. Global Const $wm_menugetobject = 292
  340. Global Const $wm_uninitmenupopup = 293
  341. Global Const $wm_menucommand = 294
  342. Global Const $wm_changeuistate = 295
  343. Global Const $wm_updateuistate = 296
  344. Global Const $wm_queryuistate = 297
  345. Global Const $wm_lbtrackpoint = 305
  346. Global Const $wm_ctlcolormsgbox = 306
  347. Global Const $wm_ctlcoloredit = 307
  348. Global Const $wm_ctlcolorlistbox = 308
  349. Global Const $wm_ctlcolorbtn = 309
  350. Global Const $wm_ctlcolordlg = 310
  351. Global Const $wm_ctlcolorscrollbar = 311
  352. Global Const $wm_ctlcolorstatic = 312
  353. Global Const $mn_gethmenu = 481
  354. Global Const $wm_parentnotify = 528
  355. Global Const $wm_entermenuloop = 529
  356. Global Const $wm_exitmenuloop = 530
  357. Global Const $wm_nextmenu = 531
  358. Global Const $wm_sizing = 532
  359. Global Const $wm_capturechanged = 533
  360. Global Const $wm_moving = 534
  361. Global Const $wm_powerbroadcast = 536
  362. Global Const $wm_devicechange = 537
  363. Global Const $wm_mdicreate = 544
  364. Global Const $wm_mdidestroy = 545
  365. Global Const $wm_mdiactivate = 546
  366. Global Const $wm_mdirestore = 547
  367. Global Const $wm_mdinext = 548
  368. Global Const $wm_mdimaximize = 549
  369. Global Const $wm_mditile = 550
  370. Global Const $wm_mdicascade = 551
  371. Global Const $wm_mdiiconarrange = 552
  372. Global Const $wm_mdigetactive = 553
  373. Global Const $wm_dropobject = 554
  374. Global Const $wm_querydropobject = 555
  375. Global Const $wm_begindrag = 556
  376. Global Const $wm_dragloop = 557
  377. Global Const $wm_dragselect = 558
  378. Global Const $wm_dragmove = 559
  379. Global Const $wm_mdisetmenu = 560
  380. Global Const $wm_entersizemove = 561
  381. Global Const $wm_exitsizemove = 562
  382. Global Const $wm_dropfiles = 563
  383. Global Const $wm_mdirefreshmenu = 564
  384. Global Const $wm_touch = 576
  385. Global Const $wm_ime_setcontext = 641
  386. Global Const $wm_ime_notify = 642
  387. Global Const $wm_ime_control = 643
  388. Global Const $wm_ime_compositionfull = 644
  389. Global Const $wm_ime_select = 645
  390. Global Const $wm_ime_char = 646
  391. Global Const $wm_ime_system = 647
  392. Global Const $wm_ime_request = 648
  393. Global Const $wm_ime_keydown = 656
  394. Global Const $wm_ime_keyup = 657
  395. Global Const $wm_ncmousehover = 672
  396. Global Const $wm_mousehover = 673
  397. Global Const $wm_ncmouseleave = 674
  398. Global Const $wm_mouseleave = 675
  399. Global Const $wm_wtssession_change = 689
  400. Global Const $wm_tablet_first = 704
  401. Global Const $wm_tablet_last = 735
  402. Global Const $wm_cut = 768
  403. Global Const $wm_copy = 769
  404. Global Const $wm_paste = 770
  405. Global Const $wm_clear = 771
  406. Global Const $wm_undo = 772
  407. Global Const $wm_paletteischanging = 784
  408. Global Const $wm_hotkey = 786
  409. Global Const $wm_palettechanged = 785
  410. Global Const $wm_sysmenu = 787
  411. Global Const $wm_hookmsg = 788
  412. Global Const $wm_exitprocess = 789
  413. Global Const $wm_wakethread = 790
  414. Global Const $wm_print = 791
  415. Global Const $wm_printclient = 792
  416. Global Const $wm_appcommand = 793
  417. Global Const $wm_querynewpalette = 783
  418. Global Const $wm_themechanged = 794
  419. Global Const $wm_uahinit = 795
  420. Global Const $wm_desktopnotify = 796
  421. Global Const $wm_clipboardupdate = 797
  422. Global Const $wm_dwmcompositionchanged = 798
  423. Global Const $wm_dwmncrenderingchanged = 799
  424. Global Const $wm_dwmcolorizationcolorchanged = 800
  425. Global Const $wm_dwmwindowmaximizedchange = 801
  426. Global Const $wm_dwmexileframe = 802
  427. Global Const $wm_dwmsendiconicthumbnail = 803
  428. Global Const $wm_magnification_started = 804
  429. Global Const $wm_magnification_ended = 805
  430. Global Const $wm_dwmsendiconiclivepreviewbitmap = 806
  431. Global Const $wm_dwmthumbnailsizechanged = 807
  432. Global Const $wm_magnification_output = 808
  433. Global Const $wm_measurecontrol = 816
  434. Global Const $wm_getactiontext = 817
  435. Global Const $wm_forwardkeydown = 819
  436. Global Const $wm_forwardkeyup = 820
  437. Global Const $wm_gettitlebarinfoex = 831
  438. Global Const $wm_notifywow = 832
  439. Global Const $wm_handheldfirst = 856
  440. Global Const $wm_handheldlast = 863
  441. Global Const $wm_afxfirst = 864
  442. Global Const $wm_afxlast = 895
  443. Global Const $wm_penwinfirst = 896
  444. Global Const $wm_penwinlast = 911
  445. Global Const $wm_dde_initiate = 992
  446. Global Const $wm_dde_terminate = 993
  447. Global Const $wm_dde_advise = 994
  448. Global Const $wm_dde_unadvise = 995
  449. Global Const $wm_dde_ack = 996
  450. Global Const $wm_dde_data = 997
  451. Global Const $wm_dde_request = 998
  452. Global Const $wm_dde_poke = 999
  453. Global Const $wm_dde_execute = 1000
  454. Global Const $wm_dbnotification = 1021
  455. Global Const $wm_netconnect = 1022
  456. Global Const $wm_hibernate = 1023
  457. Global Const $wm_user = 1024
  458. Global Const $wm_app = 32768
  459. Global Const $nm_first = 0
  460. Global Const $nm_outofmemory = $nm_first - 1
  461. Global Const $nm_click = $nm_first - 2
  462. Global Const $nm_dblclk = $nm_first - 3
  463. Global Const $nm_return = $nm_first - 4
  464. Global Const $nm_rclick = $nm_first - 5
  465. Global Const $nm_rdblclk = $nm_first - 6
  466. Global Const $nm_setfocus = $nm_first - 7
  467. Global Const $nm_killfocus = $nm_first - 8
  468. Global Const $nm_customdraw = $nm_first - 12
  469. Global Const $nm_hover = $nm_first - 13
  470. Global Const $nm_nchittest = $nm_first - 14
  471. Global Const $nm_keydown = $nm_first - 15
  472. Global Const $nm_releasedcapture = $nm_first - 16
  473. Global Const $nm_setcursor = $nm_first - 17
  474. Global Const $nm_char = $nm_first - 18
  475. Global Const $nm_tooltipscreated = $nm_first - 19
  476. Global Const $nm_ldown = $nm_first - 20
  477. Global Const $nm_rdown = $nm_first - 21
  478. Global Const $nm_themechanged = $nm_first - 22
  479. Global Const $wm_mousefirst = 512
  480. Global Const $wm_mousemove = 512
  481. Global Const $wm_lbuttondown = 513
  482. Global Const $wm_lbuttonup = 514
  483. Global Const $wm_lbuttondblclk = 515
  484. Global Const $wm_rbuttondown = 516
  485. Global Const $wm_rbuttonup = 517
  486. Global Const $wm_rbuttondblclk = 518
  487. Global Const $wm_mbuttondown = 519
  488. Global Const $wm_mbuttonup = 520
  489. Global Const $wm_mbuttondblclk = 521
  490. Global Const $wm_mousewheel = 522
  491. Global Const $wm_xbuttondown = 523
  492. Global Const $wm_xbuttonup = 524
  493. Global Const $wm_xbuttondblclk = 525
  494. Global Const $wm_mousehwheel = 526
  495. Global Const $ps_solid = 0
  496. Global Const $ps_dash = 1
  497. Global Const $ps_dot = 2
  498. Global Const $ps_dashdot = 3
  499. Global Const $ps_dashdotdot = 4
  500. Global Const $ps_null = 5
  501. Global Const $ps_insideframe = 6
  502. Global Const $ps_userstyle = 7
  503. Global Const $ps_alternate = 8
  504. Global Const $ps_endcap_round = 0
  505. Global Const $ps_endcap_square = 256
  506. Global Const $ps_endcap_flat = 512
  507. Global Const $ps_join_bevel = 4096
  508. Global Const $ps_join_miter = 8192
  509. Global Const $ps_join_round = 0
  510. Global Const $ps_geometric = 65536
  511. Global Const $ps_cosmetic = 0
  512. Global Const $lwa_alpha = 2
  513. Global Const $lwa_colorkey = 1
  514. Global Const $rgn_and = 1
  515. Global Const $rgn_or = 2
  516. Global Const $rgn_xor = 3
  517. Global Const $rgn_diff = 4
  518. Global Const $rgn_copy = 5
  519. Global Const $errorregion = 0
  520. Global Const $nullregion = 1
  521. Global Const $simpleregion = 2
  522. Global Const $complexregion = 3
  523. Global Const $transparent = 1
  524. Global Const $opaque = 2
  525. Global Const $ccm_first = 8192
  526. Global Const $ccm_getunicodeformat = ($ccm_first + 6)
  527. Global Const $ccm_setunicodeformat = ($ccm_first + 5)
  528. Global Const $ccm_setbkcolor = $ccm_first + 1
  529. Global Const $ccm_setcolorscheme = $ccm_first + 2
  530. Global Const $ccm_getcolorscheme = $ccm_first + 3
  531. Global Const $ccm_getdroptarget = $ccm_first + 4
  532. Global Const $ccm_setwindowtheme = $ccm_first + 11
  533. Global Const $ga_parent = 1
  534. Global Const $ga_root = 2
  535. Global Const $ga_rootowner = 3
  536. Global Const $sm_cxscreen = 0
  537. Global Const $sm_cyscreen = 1
  538. Global Const $sm_cxvscroll = 2
  539. Global Const $sm_cyhscroll = 3
  540. Global Const $sm_cycaption = 4
  541. Global Const $sm_cxborder = 5
  542. Global Const $sm_cyborder = 6
  543. Global Const $sm_cxfixedframe = 7
  544. Global Const $sm_cxdlgframe = $sm_cxfixedframe
  545. Global Const $sm_cyfixedframe = 8
  546. Global Const $sm_cydlgframe = $sm_cyfixedframe
  547. Global Const $sm_cyvthumb = 9
  548. Global Const $sm_cxhthumb = 10
  549. Global Const $sm_cxicon = 11
  550. Global Const $sm_cyicon = 12
  551. Global Const $sm_cxcursor = 13
  552. Global Const $sm_cycursor = 14
  553. Global Const $sm_cymenu = 15
  554. Global Const $sm_cxfullscreen = 16
  555. Global Const $sm_cyfullscreen = 17
  556. Global Const $sm_cykanjiwindow = 18
  557. Global Const $sm_mousepresent = 19
  558. Global Const $sm_cyvscroll = 20
  559. Global Const $sm_cxhscroll = 21
  560. Global Const $sm_debug = 22
  561. Global Const $sm_swapbutton = 23
  562. Global Const $sm_reserved1 = 24
  563. Global Const $sm_reserved2 = 25
  564. Global Const $sm_reserved3 = 26
  565. Global Const $sm_reserved4 = 27
  566. Global Const $sm_cxmin = 28
  567. Global Const $sm_cymin = 29
  568. Global Const $sm_cxsize = 30
  569. Global Const $sm_cysize = 31
  570. Global Const $sm_cxsizeframe = 32
  571. Global Const $sm_cxframe = $sm_cxsizeframe
  572. Global Const $sm_cysizeframe = 33
  573. Global Const $sm_cyframe = $sm_cysizeframe
  574. Global Const $sm_cxmintrack = 34
  575. Global Const $sm_cymintrack = 35
  576. Global Const $sm_cxdoubleclk = 36
  577. Global Const $sm_cydoubleclk = 37
  578. Global Const $sm_cxiconspacing = 38
  579. Global Const $sm_cyiconspacing = 39
  580. Global Const $sm_menudropalignment = 40
  581. Global Const $sm_penwindows = 41
  582. Global Const $sm_dbcsenabled = 42
  583. Global Const $sm_cmousebuttons = 43
  584. Global Const $sm_secure = 44
  585. Global Const $sm_cxedge = 45
  586. Global Const $sm_cyedge = 46
  587. Global Const $sm_cxminspacing = 47
  588. Global Const $sm_cyminspacing = 48
  589. Global Const $sm_cxsmicon = 49
  590. Global Const $sm_cysmicon = 50
  591. Global Const $sm_cysmcaption = 51
  592. Global Const $sm_cxsmsize = 52
  593. Global Const $sm_cysmsize = 53
  594. Global Const $sm_cxmenusize = 54
  595. Global Const $sm_cymenusize = 55
  596. Global Const $sm_arrange = 56
  597. Global Const $sm_cxminimized = 57
  598. Global Const $sm_cyminimized = 58
  599. Global Const $sm_cxmaxtrack = 59
  600. Global Const $sm_cymaxtrack = 60
  601. Global Const $sm_cxmaximized = 61
  602. Global Const $sm_cymaximized = 62
  603. Global Const $sm_network = 63
  604. Global Const $sm_cleanboot = 67
  605. Global Const $sm_cxdrag = 68
  606. Global Const $sm_cydrag = 69
  607. Global Const $sm_showsounds = 70
  608. Global Const $sm_cxmenucheck = 71
  609. Global Const $sm_cymenucheck = 72
  610. Global Const $sm_slowmachine = 73
  611. Global Const $sm_mideastenabled = 74
  612. Global Const $sm_mousewheelpresent = 75
  613. Global Const $sm_xvirtualscreen = 76
  614. Global Const $sm_yvirtualscreen = 77
  615. Global Const $sm_cxvirtualscreen = 78
  616. Global Const $sm_cyvirtualscreen = 79
  617. Global Const $sm_cmonitors = 80
  618. Global Const $sm_samedisplayformat = 81
  619. Global Const $sm_immenabled = 82
  620. Global Const $sm_cxfocusborder = 83
  621. Global Const $sm_cyfocusborder = 84
  622. Global Const $sm_tabletpc = 86
  623. Global Const $sm_mediacenter = 87
  624. Global Const $sm_starter = 88
  625. Global Const $sm_serverr2 = 89
  626. Global Const $sm_cmetrics = 90
  627. Global Const $sm_remotesession = 4096
  628. Global Const $sm_shuttingdown = 8192
  629. Global Const $sm_remotecontrol = 8193
  630. Global Const $sm_caretblinkingenabled = 8194
  631. Global Const $blackness = 66
  632. Global Const $captureblt = 1073741824
  633. Global Const $dstinvert = 5570569
  634. Global Const $mergecopy = 12583114
  635. Global Const $mergepaint = 12255782
  636. Global Const $nomirrorbitmap = -2147483648
  637. Global Const $notsrccopy = 3342344
  638. Global Const $notsrcerase = 1114278
  639. Global Const $patcopy = 15728673
  640. Global Const $patinvert = 5898313
  641. Global Const $patpaint = 16452105
  642. Global Const $srcand = 8913094
  643. Global Const $srccopy = 13369376
  644. Global Const $srcerase = 4457256
  645. Global Const $srcinvert = 6684742
  646. Global Const $srcpaint = 15597702
  647. Global Const $whiteness = 16711778
  648. Global Const $dt_bottom = 8
  649. Global Const $dt_calcrect = 1024
  650. Global Const $dt_center = 1
  651. Global Const $dt_editcontrol = 8192
  652. Global Const $dt_end_ellipsis = 32768
  653. Global Const $dt_expandtabs = 64
  654. Global Const $dt_externalleading = 512
  655. Global Const $dt_hideprefix = 1048576
  656. Global Const $dt_internal = 4096
  657. Global Const $dt_left = 0
  658. Global Const $dt_modifystring = 65536
  659. Global Const $dt_noclip = 256
  660. Global Const $dt_nofullwidthcharbreak = 524288
  661. Global Const $dt_noprefix = 2048
  662. Global Const $dt_path_ellipsis = 16384
  663. Global Const $dt_prefixonly = 2097152
  664. Global Const $dt_right = 2
  665. Global Const $dt_rtlreading = 131072
  666. Global Const $dt_singleline = 32
  667. Global Const $dt_tabstop = 128
  668. Global Const $dt_top = 0
  669. Global Const $dt_vcenter = 4
  670. Global Const $dt_wordbreak = 16
  671. Global Const $dt_word_ellipsis = 262144
  672. Global Const $rdw_erase = 4
  673. Global Const $rdw_frame = 1024
  674. Global Const $rdw_internalpaint = 2
  675. Global Const $rdw_invalidate = 1
  676. Global Const $rdw_noerase = 32
  677. Global Const $rdw_noframe = 2048
  678. Global Const $rdw_nointernalpaint = 16
  679. Global Const $rdw_validate = 8
  680. Global Const $rdw_erasenow = 512
  681. Global Const $rdw_updatenow = 256
  682. Global Const $rdw_allchildren = 128
  683. Global Const $rdw_nochildren = 64
  684. Global Const $wm_renderformat = 773
  685. Global Const $wm_renderallformats = 774
  686. Global Const $wm_destroyclipboard = 775
  687. Global Const $wm_drawclipboard = 776
  688. Global Const $wm_paintclipboard = 777
  689. Global Const $wm_vscrollclipboard = 778
  690. Global Const $wm_sizeclipboard = 779
  691. Global Const $wm_askcbformatname = 780
  692. Global Const $wm_changecbchain = 781
  693. Global Const $wm_hscrollclipboard = 782
  694. Global Const $hterror = -2
  695. Global Const $httransparent = -1
  696. Global Const $htnowhere = 0
  697. Global Const $htclient = 1
  698. Global Const $htcaption = 2
  699. Global Const $htsysmenu = 3
  700. Global Const $htgrowbox = 4
  701. Global Const $htsize = $htgrowbox
  702. Global Const $htmenu = 5
  703. Global Const $hthscroll = 6
  704. Global Const $htvscroll = 7
  705. Global Const $htminbutton = 8
  706. Global Const $htmaxbutton = 9
  707. Global Const $htleft = 10
  708. Global Const $htright = 11
  709. Global Const $httop = 12
  710. Global Const $httopleft = 13
  711. Global Const $httopright = 14
  712. Global Const $htbottom = 15
  713. Global Const $htbottomleft = 16
  714. Global Const $htbottomright = 17
  715. Global Const $htborder = 18
  716. Global Const $htreduce = $htminbutton
  717. Global Const $htzoom = $htmaxbutton
  718. Global Const $htsizefirst = $htleft
  719. Global Const $htsizelast = $htbottomright
  720. Global Const $htobject = 19
  721. Global Const $htclose = 20
  722. Global Const $hthelp = 21
  723. Global Const $color_scrollbar = 0
  724. Global Const $color_background = 1
  725. Global Const $color_activecaption = 2
  726. Global Const $color_inactivecaption = 3
  727. Global Const $color_menu = 4
  728. Global Const $color_window = 5
  729. Global Const $color_windowframe = 6
  730. Global Const $color_menutext = 7
  731. Global Const $color_windowtext = 8
  732. Global Const $color_captiontext = 9
  733. Global Const $color_activeborder = 10
  734. Global Const $color_inactiveborder = 11
  735. Global Const $color_appworkspace = 12
  736. Global Const $color_highlight = 13
  737. Global Const $color_highlighttext = 14
  738. Global Const $color_btnface = 15
  739. Global Const $color_btnshadow = 16
  740. Global Const $color_graytext = 17
  741. Global Const $color_btntext = 18
  742. Global Const $color_inactivecaptiontext = 19
  743. Global Const $color_btnhighlight = 20
  744. Global Const $color_3ddkshadow = 21
  745. Global Const $color_3dlight = 22
  746. Global Const $color_infotext = 23
  747. Global Const $color_infobk = 24
  748. Global Const $color_hotlight = 26
  749. Global Const $color_gradientactivecaption = 27
  750. Global Const $color_gradientinactivecaption = 28
  751. Global Const $color_menuhilight = 29
  752. Global Const $color_menubar = 30
  753. Global Const $color_desktop = 1
  754. Global Const $color_3dface = 15
  755. Global Const $color_3dshadow = 16
  756. Global Const $color_3dhighlight = 20
  757. Global Const $color_3dhilight = 20
  758. Global Const $color_btnhilight = 20
  759. Global Const $hinst_commctrl = -1
  760. Global Const $idb_std_small_color = 0
  761. Global Const $idb_std_large_color = 1
  762. Global Const $idb_view_small_color = 4
  763. Global Const $idb_view_large_color = 5
  764. Global Const $idb_hist_small_color = 8
  765. Global Const $idb_hist_large_color = 9
  766. Global Const $startf_forceofffeedback = 128
  767. Global Const $startf_forceonfeedback = 64
  768. Global Const $startf_preventpinning = 8192
  769. Global Const $startf_runfullscreen = 32
  770. Global Const $startf_titleisappid = 4096
  771. Global Const $startf_titleislinkname = 2048
  772. Global Const $startf_usecountchars = 8
  773. Global Const $startf_usefillattribute = 16
  774. Global Const $startf_usehotkey = 512
  775. Global Const $startf_useposition = 4
  776. Global Const $startf_useshowwindow = 1
  777. Global Const $startf_usesize = 2
  778. Global Const $startf_usestdhandles = 256
  779. Global Const $cdds_prepaint = 1
  780. Global Const $cdds_postpaint = 2
  781. Global Const $cdds_preerase = 3
  782. Global Const $cdds_posterase = 4
  783. Global Const $cdds_item = 65536
  784. Global Const $cdds_itemprepaint = 65537
  785. Global Const $cdds_itempostpaint = 65538
  786. Global Const $cdds_itempreerase = 65539
  787. Global Const $cdds_itemposterase = 65540
  788. Global Const $cdds_subitem = 131072
  789. Global Const $cdis_selected = 1
  790. Global Const $cdis_grayed = 2
  791. Global Const $cdis_disabled = 4
  792. Global Const $cdis_checked = 8
  793. Global Const $cdis_focus = 16
  794. Global Const $cdis_default = 32
  795. Global Const $cdis_hot = 64
  796. Global Const $cdis_marked = 128
  797. Global Const $cdis_indeterminate = 256
  798. Global Const $cdis_showkeyboardcues = 512
  799. Global Const $cdis_nearhot = 1024
  800. Global Const $cdis_othersidehot = 2048
  801. Global Const $cdis_drophilited = 4096
  802. Global Const $cdrf_dodefault = 0
  803. Global Const $cdrf_newfont = 2
  804. Global Const $cdrf_skipdefault = 4
  805. Global Const $cdrf_notifypostpaint = 16
  806. Global Const $cdrf_notifyitemdraw = 32
  807. Global Const $cdrf_notifysubitemdraw = 32
  808. Global Const $cdrf_notifyposterase = 64
  809. Global Const $cdrf_doerase = 8
  810. Global Const $cdrf_skippostpaint = 256
  811. Global Const $gui_ss_default_gui = BitOR($ws_minimizebox, $ws_caption, $ws_popup, $ws_sysmenu)
  812. Global Const $opt_coordsrelative = 0
  813. Global Const $opt_coordsabsolute = 1
  814. Global Const $opt_coordsclient = 2
  815. Global Const $opt_errorsilent = 0
  816. Global Const $opt_errorfatal = 1
  817. Global Const $opt_capsnostore = 0
  818. Global Const $opt_capsstore = 1
  819. Global Const $opt_matchstart = 1
  820. Global Const $opt_matchany = 2
  821. Global Const $opt_matchexact = 3
  822. Global Const $opt_matchadvanced = 4
  823. Global Const $ccs_top = 1
  824. Global Const $ccs_nomovey = 2
  825. Global Const $ccs_bottom = 3
  826. Global Const $ccs_noresize = 4
  827. Global Const $ccs_noparentalign = 8
  828. Global Const $ccs_nohilite = 16
  829. Global Const $ccs_adjustable = 32
  830. Global Const $ccs_nodivider = 64
  831. Global Const $ccs_vert = 128
  832. Global Const $ccs_left = 129
  833. Global Const $ccs_nomovex = 130
  834. Global Const $ccs_right = 131
  835. Global Const $dt_drivetype = 1
  836. Global Const $dt_ssdstatus = 2
  837. Global Const $dt_bustype = 3
  838. Global Const $proxy_ie = 0
  839. Global Const $proxy_none = 1
  840. Global Const $proxy_specified = 2
  841. Global Const $objid_window = 0
  842. Global Const $objid_titlebar = -2
  843. Global Const $objid_sizegrip = -7
  844. Global Const $objid_caret = -8
  845. Global Const $objid_cursor = -9
  846. Global Const $objid_alert = -10
  847. Global Const $objid_sound = -11
  848. Global Const $dlg_centerontop = 0
  849. Global Const $dlg_notitle = 1
  850. Global Const $dlg_notontop = 2
  851. Global Const $dlg_textleft = 4
  852. Global Const $dlg_textright = 8
  853. Global Const $dlg_moveable = 16
  854. Global Const $dlg_textvcenter = 32
  855. Global Const $idc_unknown = 0
  856. Global Const $idc_appstarting = 1
  857. Global Const $idc_arrow = 2
  858. Global Const $idc_cross = 3
  859. Global Const $idc_hand = 32649
  860. Global Const $idc_help = 4
  861. Global Const $idc_ibeam = 5
  862. Global Const $idc_icon = 6
  863. Global Const $idc_no = 7
  864. Global Const $idc_size = 8
  865. Global Const $idc_sizeall = 9
  866. Global Const $idc_sizenesw = 10
  867. Global Const $idc_sizens = 11
  868. Global Const $idc_sizenwse = 12
  869. Global Const $idc_sizewe = 13
  870. Global Const $idc_uparrow = 14
  871. Global Const $idc_wait = 15
  872. Global Const $idi_application = 32512
  873. Global Const $idi_asterisk = 32516
  874. Global Const $idi_exclamation = 32515
  875. Global Const $idi_hand = 32513
  876. Global Const $idi_question = 32514
  877. Global Const $idi_winlogo = 32517
  878. Global Const $idi_shield = 32518
  879. Global Const $idi_error = $idi_hand
  880. Global Const $idi_information = $idi_asterisk
  881. Global Const $idi_warning = $idi_exclamation
  882. Global Const $sd_logoff = 0
  883. Global Const $sd_shutdown = 1
  884. Global Const $sd_reboot = 2
  885. Global Const $sd_force = 4
  886. Global Const $sd_powerdown = 8
  887. Global Const $sd_forcehung = 16
  888. Global Const $sd_standby = 32
  889. Global Const $sd_hibernate = 64
  890. Global Const $stdin_child = 1
  891. Global Const $stdout_child = 2
  892. Global Const $stderr_child = 4
  893. Global Const $stderr_merged = 8
  894. Global Const $stdio_inherit_parent = 16
  895. Global Const $run_create_new_console = 65536
  896. Global Const $ubound_dimensions = 0
  897. Global Const $ubound_rows = 1
  898. Global Const $ubound_columns = 2
  899. Global Const $mouseeventf_absolute = 32768
  900. Global Const $mouseeventf_move = 1
  901. Global Const $mouseeventf_leftdown = 2
  902. Global Const $mouseeventf_leftup = 4
  903. Global Const $mouseeventf_rightdown = 8
  904. Global Const $mouseeventf_rightup = 16
  905. Global Const $mouseeventf_middledown = 32
  906. Global Const $mouseeventf_middleup = 64
  907. Global Const $mouseeventf_wheel = 2048
  908. Global Const $mouseeventf_xdown = 128
  909. Global Const $mouseeventf_xup = 256
  910. Global Const $reg_none = 0
  911. Global Const $reg_sz = 1
  912. Global Const $reg_expand_sz = 2
  913. Global Const $reg_binary = 3
  914. Global Const $reg_dword = 4
  915. Global Const $reg_dword_little_endian = 4
  916. Global Const $reg_dword_big_endian = 5
  917. Global Const $reg_link = 6
  918. Global Const $reg_multi_sz = 7
  919. Global Const $reg_resource_list = 8
  920. Global Const $reg_full_resource_descriptor = 9
  921. Global Const $reg_resource_requirements_list = 10
  922. Global Const $reg_qword = 11
  923. Global Const $reg_qword_little_endian = 11
  924. Global Const $hwnd_bottom = 1
  925. Global Const $hwnd_notopmost = -2
  926. Global Const $hwnd_top = 0
  927. Global Const $hwnd_topmost = -1
  928. Global Const $swp_nosize = 1
  929. Global Const $swp_nomove = 2
  930. Global Const $swp_nozorder = 4
  931. Global Const $swp_noredraw = 8
  932. Global Const $swp_noactivate = 16
  933. Global Const $swp_framechanged = 32
  934. Global Const $swp_drawframe = 32
  935. Global Const $swp_showwindow = 64
  936. Global Const $swp_hidewindow = 128
  937. Global Const $swp_nocopybits = 256
  938. Global Const $swp_noownerzorder = 512
  939. Global Const $swp_noreposition = 512
  940. Global Const $swp_nosendchanging = 1024
  941. Global Const $swp_defererase = 8192
  942. Global Const $swp_asyncwindowpos = 16384
  943. Global Const $keyword_default = 1
  944. Global Const $keyword_null = 2
  945. Global Const $declared_local = -1
  946. Global Const $declared_unknown = 0
  947. Global Const $declared_global = 1
  948. Global Const $assign_create = 0
  949. Global Const $assign_forcelocal = 1
  950. Global Const $assign_forceglobal = 2
  951. Global Const $assign_existfail = 4
  952. Global Const $bi_enable = 0
  953. Global Const $bi_disable = 1
  954. Global Const $break_enable = 1
  955. Global Const $break_disable = 0
  956. Global Const $cdtray_open = "open"
  957. Global Const $cdtray_closed = "closed"
  958. Global Const $send_default = 0
  959. Global Const $send_raw = 1
  960. Global Const $dir_default = 0
  961. Global Const $dir_extended = 1
  962. Global Const $dir_norecurse = 2
  963. Global Const $dir_remove = 1
  964. Global Const $dt_all = "ALL"
  965. Global Const $dt_cdrom = "CDROM"
  966. Global Const $dt_removable = "REMOVABLE"
  967. Global Const $dt_fixed = "FIXED"
  968. Global Const $dt_network = "NETWORK"
  969. Global Const $dt_ramdisk = "RAMDISK"
  970. Global Const $dt_unknown = "UNKNOWN"
  971. Global Const $dt_undefined = 1
  972. Global Const $dt_fat = "FAT"
  973. Global Const $dt_fat32 = "FAT32"
  974. Global Const $dt_exfat = "exFAT"
  975. Global Const $dt_ntfs = "NTFS"
  976. Global Const $dt_nwfs = "NWFS"
  977. Global Const $dt_cdfs = "CDFS"
  978. Global Const $dt_udf = "UDF"
  979. Global Const $dma_default = 0
  980. Global Const $dma_persistent = 1
  981. Global Const $dma_authentication = 8
  982. Global Const $ds_unknown = "UNKNOWN"
  983. Global Const $ds_ready = "READY"
  984. Global Const $ds_notready = "NOTREADY"
  985. Global Const $ds_invalid = "INVALID"
  986. Global Const $mouse_click_left = "left"
  987. Global Const $mouse_click_right = "right"
  988. Global Const $mouse_click_middle = "middle"
  989. Global Const $mouse_click_main = "main"
  990. Global Const $mouse_click_menu = "menu"
  991. Global Const $mouse_click_primary = "primary"
  992. Global Const $mouse_click_secondary = "secondary"
  993. Global Const $mouse_wheel_up = "up"
  994. Global Const $mouse_wheel_down = "down"
  995. Global Const $number_auto = 0
  996. Global Const $number_32bit = 1
  997. Global Const $number_64bit = 2
  998. Global Const $number_double = 3
  999. Global Const $obj_name = 1
  1000. Global Const $obj_string = 2
  1001. Global Const $obj_progid = 3
  1002. Global Const $obj_file = 4
  1003. Global Const $obj_module = 5
  1004. Global Const $obj_clsid = 6
  1005. Global Const $obj_iid = 7
  1006. Global Const $exitclose_normal = 0
  1007. Global Const $exitclose_byexit = 1
  1008. Global Const $exitclose_byclick = 2
  1009. Global Const $exitclose_bylogoff = 3
  1010. Global Const $exitclose_byshutdown = 4
  1011. Global Const $process_stats_memory = 0
  1012. Global Const $process_stats_io = 1
  1013. Global Const $process_low = 0
  1014. Global Const $process_belownormal = 1
  1015. Global Const $process_normal = 2
  1016. Global Const $process_abovenormal = 3
  1017. Global Const $process_high = 4
  1018. Global Const $process_realtime = 5
  1019. Global Const $run_logon_noprofile = 0
  1020. Global Const $run_logon_profile = 1
  1021. Global Const $run_logon_network = 2
  1022. Global Const $run_logon_inherit = 4
  1023. Global Const $sound_nowait = 0
  1024. Global Const $sound_wait = 1
  1025. Global Const $shex_open = "open"
  1026. Global Const $shex_edit = "edit"
  1027. Global Const $shex_print = "print"
  1028. Global Const $shex_properties = "properties"
  1029. Global Const $tcp_data_default = 0
  1030. Global Const $tcp_data_binary = 1
  1031. Global Const $udp_open_default = 0
  1032. Global Const $udp_open_broadcast = 1
  1033. Global Const $udp_data_default = 0
  1034. Global Const $udp_data_binary = 1
  1035. Global Const $udp_data_array = 2
  1036. Global Const $tip_noicon = 0
  1037. Global Const $tip_infoicon = 1
  1038. Global Const $tip_warningicon = 2
  1039. Global Const $tip_erroricon = 3
  1040. Global Const $tip_balloon = 1
  1041. Global Const $tip_center = 2
  1042. Global Const $tip_forcevisible = 4
  1043. Global Const $windows_noontop = 0
  1044. Global Const $windows_ontop = 1
  1045. Global Const $win_state_exists = 1
  1046. Global Const $win_state_visible = 2
  1047. Global Const $win_state_enabled = 4
  1048. Global Const $win_state_active = 8
  1049. Global Const $win_state_minimized = 16
  1050. Global Const $win_state_maximized = 32
  1051. Global Const $fc_nooverwrite = 0
  1052. Global Const $fc_overwrite = 1
  1053. Global Const $fc_createpath = 8
  1054. Global Const $ft_modified = 0
  1055. Global Const $ft_created = 1
  1056. Global Const $ft_accessed = 2
  1057. Global Const $ft_array = 0
  1058. Global Const $ft_string = 1
  1059. Global Const $fsf_createbutton = 1
  1060. Global Const $fsf_newdialog = 2
  1061. Global Const $fsf_editcontrol = 4
  1062. Global Const $ft_nonrecursive = 0
  1063. Global Const $ft_recursive = 1
  1064. Global Const $fo_read = 0
  1065. Global Const $fo_append = 1
  1066. Global Const $fo_overwrite = 2
  1067. Global Const $fo_createpath = 8
  1068. Global Const $fo_binary = 16
  1069. Global Const $fo_unicode = 32
  1070. Global Const $fo_utf16_le = 32
  1071. Global Const $fo_utf16_be = 64
  1072. Global Const $fo_utf8 = 128
  1073. Global Const $fo_utf8_nobom = 256
  1074. Global Const $fo_ansi = 512
  1075. Global Const $fo_utf16_le_nobom = 1024
  1076. Global Const $fo_utf16_be_nobom = 2048
  1077. Global Const $fo_utf8_full = 16384
  1078. Global Const $fo_fullfile_detect = 16384
  1079. Global Const $eof = -1
  1080. Global Const $fd_filemustexist = 1
  1081. Global Const $fd_pathmustexist = 2
  1082. Global Const $fd_multiselect = 4
  1083. Global Const $fd_promptcreatenew = 8
  1084. Global Const $fd_promptoverwrite = 16
  1085. Global Const $create_new = 1
  1086. Global Const $create_always = 2
  1087. Global Const $open_existing = 3
  1088. Global Const $open_always = 4
  1089. Global Const $truncate_existing = 5
  1090. Global Const $invalid_set_file_pointer = -1
  1091. Global Const $file_begin = 0
  1092. Global Const $file_current = 1
  1093. Global Const $file_end = 2
  1094. Global Const $file_attribute_readonly = 1
  1095. Global Const $file_attribute_hidden = 2
  1096. Global Const $file_attribute_system = 4
  1097. Global Const $file_attribute_directory = 16
  1098. Global Const $file_attribute_archive = 32
  1099. Global Const $file_attribute_device = 64
  1100. Global Const $file_attribute_normal = 128
  1101. Global Const $file_attribute_temporary = 256
  1102. Global Const $file_attribute_sparse_file = 512
  1103. Global Const $file_attribute_reparse_point = 1024
  1104. Global Const $file_attribute_compressed = 2048
  1105. Global Const $file_attribute_offline = 4096
  1106. Global Const $file_attribute_not_content_indexed = 8192
  1107. Global Const $file_attribute_encrypted = 16384
  1108. Global Const $file_share_read = 1
  1109. Global Const $file_share_write = 2
  1110. Global Const $file_share_delete = 4
  1111. Global Const $file_share_readwrite = BitOR($file_share_read, $file_share_write)
  1112. Global Const $file_share_any = BitOR($file_share_read, $file_share_write, $file_share_delete)
  1113. Global Const $generic_all = 268435456
  1114. Global Const $generic_execute = 536870912
  1115. Global Const $generic_write = 1073741824
  1116. Global Const $generic_read = -2147483648
  1117. Global Const $generic_readwrite = BitOR($generic_read, $generic_write)
  1118. Global Const $file_encoding_utf16le = 32
  1119. Global Const $fe_entire_utf8 = 1
  1120. Global Const $fe_partialfirst_utf8 = 2
  1121. Global Const $fn_fullpath = 0
  1122. Global Const $fn_relativepath = 1
  1123. Global Const $fv_comments = "Comments"
  1124. Global Const $fv_companyname = "CompanyName"
  1125. Global Const $fv_filedescription = "FileDescription"
  1126. Global Const $fv_fileversion = "FileVersion"
  1127. Global Const $fv_internalname = "InternalName"
  1128. Global Const $fv_legalcopyright = "LegalCopyright"
  1129. Global Const $fv_legaltrademarks = "LegalTrademarks"
  1130. Global Const $fv_originalfilename = "OriginalFilename"
  1131. Global Const $fv_productname = "ProductName"
  1132. Global Const $fv_productversion = "ProductVersion"
  1133. Global Const $fv_privatebuild = "PrivateBuild"
  1134. Global Const $fv_specialbuild = "SpecialBuild"
  1135. Global Const $frta_nocount = 0
  1136. Global Const $frta_count = 1
  1137. Global Const $frta_intarrays = 2
  1138. Global Const $frta_entiresplit = 4
  1139. Global Const $flta_filesfolders = 0
  1140. Global Const $flta_files = 1
  1141. Global Const $flta_folders = 2
  1142. Global Const $fltar_filesfolders = 0
  1143. Global Const $fltar_files = 1
  1144. Global Const $fltar_folders = 2
  1145. Global Const $fltar_nohidden = 4
  1146. Global Const $fltar_nosystem = 8
  1147. Global Const $fltar_nolink = 16
  1148. Global Const $fltar_norecur = 0
  1149. Global Const $fltar_recur = 1
  1150. Global Const $fltar_nosort = 0
  1151. Global Const $fltar_sort = 1
  1152. Global Const $fltar_fastsort = 2
  1153. Global Const $fltar_nopath = 0
  1154. Global Const $fltar_relpath = 1
  1155. Global Const $fltar_fullpath = 2
  1156. Global Const $path_original = 0
  1157. Global Const $path_drive = 1
  1158. Global Const $path_directory = 2
  1159. Global Const $path_filename = 3
  1160. Global Const $path_extension = 4
  1161. Global Const $mb_ok = 0
  1162. Global Const $mb_okcancel = 1
  1163. Global Const $mb_abortretryignore = 2
  1164. Global Const $mb_yesnocancel = 3
  1165. Global Const $mb_yesno = 4
  1166. Global Const $mb_retrycancel = 5
  1167. Global Const $mb_canceltrycontinue = 6
  1168. Global Const $mb_help = 16384
  1169. Global Const $mb_iconstop = 16
  1170. Global Const $mb_iconerror = 16
  1171. Global Const $mb_iconhand = 16
  1172. Global Const $mb_iconquestion = 32
  1173. Global Const $mb_iconexclamation = 48
  1174. Global Const $mb_iconwarning = 48
  1175. Global Const $mb_iconinformation = 64
  1176. Global Const $mb_iconasterisk = 64
  1177. Global Const $mb_usericon = 128
  1178. Global Const $mb_defbutton1 = 0
  1179. Global Const $mb_defbutton2 = 256
  1180. Global Const $mb_defbutton3 = 512
  1181. Global Const $mb_defbutton4 = 768
  1182. Global Const $mb_applmodal = 0
  1183. Global Const $mb_systemmodal = 4096
  1184. Global Const $mb_taskmodal = 8192
  1185. Global Const $mb_default_desktop_only = 131072
  1186. Global Const $mb_right = 524288
  1187. Global Const $mb_rtlreading = 1048576
  1188. Global Const $mb_setforeground = 65536
  1189. Global Const $mb_topmost = 262144
  1190. Global Const $mb_service_notification = 2097152
  1191. Global Const $mb_rightjustified = $mb_right
  1192. Global Const $idtimeout = -1
  1193. Global Const $idok = 1
  1194. Global Const $idcancel = 2
  1195. Global Const $idabort = 3
  1196. Global Const $idretry = 4
  1197. Global Const $idignore = 5
  1198. Global Const $idyes = 6
  1199. Global Const $idno = 7
  1200. Global Const $idclose = 8
  1201. Global Const $idhelp = 9
  1202. Global Const $idtryagain = 10
  1203. Global Const $idcontinue = 11
  1204. Global Const $se_assignprimarytoken_name = "SeAssignPrimaryTokenPrivilege"
  1205. Global Const $se_audit_name = "SeAuditPrivilege"
  1206. Global Const $se_backup_name = "SeBackupPrivilege"
  1207. Global Const $se_change_notify_name = "SeChangeNotifyPrivilege"
  1208. Global Const $se_create_global_name = "SeCreateGlobalPrivilege"
  1209. Global Const $se_create_pagefile_name = "SeCreatePagefilePrivilege"
  1210. Global Const $se_create_permanent_name = "SeCreatePermanentPrivilege"
  1211. Global Const $se_create_symbolic_link_name = "SeCreateSymbolicLinkPrivilege"
  1212. Global Const $se_create_token_name = "SeCreateTokenPrivilege"
  1213. Global Const $se_debug_name = "SeDebugPrivilege"
  1214. Global Const $se_enable_delegation_name = "SeEnableDelegationPrivilege"
  1215. Global Const $se_impersonate_name = "SeImpersonatePrivilege"
  1216. Global Const $se_inc_base_priority_name = "SeIncreaseBasePriorityPrivilege"
  1217. Global Const $se_inc_working_set_name = "SeIncreaseWorkingSetPrivilege"
  1218. Global Const $se_increase_quota_name = "SeIncreaseQuotaPrivilege"
  1219. Global Const $se_load_driver_name = "SeLoadDriverPrivilege"
  1220. Global Const $se_lock_memory_name = "SeLockMemoryPrivilege"
  1221. Global Const $se_machine_account_name = "SeMachineAccountPrivilege"
  1222. Global Const $se_manage_volume_name = "SeManageVolumePrivilege"
  1223. Global Const $se_prof_single_process_name = "SeProfileSingleProcessPrivilege"
  1224. Global Const $se_relabel_name = "SeRelabelPrivilege"
  1225. Global Const $se_remote_shutdown_name = "SeRemoteShutdownPrivilege"
  1226. Global Const $se_restore_name = "SeRestorePrivilege"
  1227. Global Const $se_security_name = "SeSecurityPrivilege"
  1228. Global Const $se_shutdown_name = "SeShutdownPrivilege"
  1229. Global Const $se_sync_agent_name = "SeSyncAgentPrivilege"
  1230. Global Const $se_system_environment_name = "SeSystemEnvironmentPrivilege"
  1231. Global Const $se_system_profile_name = "SeSystemProfilePrivilege"
  1232. Global Const $se_systemtime_name = "SeSystemtimePrivilege"
  1233. Global Const $se_take_ownership_name = "SeTakeOwnershipPrivilege"
  1234. Global Const $se_tcb_name = "SeTcbPrivilege"
  1235. Global Const $se_time_zone_name = "SeTimeZonePrivilege"
  1236. Global Const $se_trusted_credman_access_name = "SeTrustedCredManAccessPrivilege"
  1237. Global Const $se_unsolicited_input_name = "SeUnsolicitedInputPrivilege"
  1238. Global Const $se_undock_name = "SeUndockPrivilege"
  1239. Global Const $se_privilege_enabled_by_default = 1
  1240. Global Const $se_privilege_enabled = 2
  1241. Global Const $se_privilege_removed = 4
  1242. Global Const $se_privilege_used_for_access = -2147483648
  1243. Global Const $se_group_mandatory = 1
  1244. Global Const $se_group_enabled_by_default = 2
  1245. Global Const $se_group_enabled = 4
  1246. Global Const $se_group_owner = 8
  1247. Global Const $se_group_use_for_deny_only = 16
  1248. Global Const $se_group_integrity = 32
  1249. Global Const $se_group_integrity_enabled = 64
  1250. Global Const $se_group_resource = 536870912
  1251. Global Const $se_group_logon_id = -1073741824
  1252. Global Enum $tokenprimary = 1, $tokenimpersonation
  1253. Global Enum $securityanonymous = 0, $securityidentification, $securityimpersonation, $securitydelegation
  1254. 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
  1255. Global Const $token_assign_primary = 1
  1256. Global Const $token_duplicate = 2
  1257. Global Const $token_impersonate = 4
  1258. Global Const $token_query = 8
  1259. Global Const $token_query_source = 16
  1260. Global Const $token_adjust_privileges = 32
  1261. Global Const $token_adjust_groups = 64
  1262. Global Const $token_adjust_default = 128
  1263. Global Const $token_adjust_sessionid = 256
  1264. Global Const $token_all_access = 983551
  1265. Global Const $token_read = 131080
  1266. Global Const $token_write = 131296
  1267. Global Const $token_execute = 131072
  1268. Global Const $token_has_traverse_privilege = 1
  1269. Global Const $token_has_backup_privilege = 2
  1270. Global Const $token_has_restore_privilege = 4
  1271. Global Const $token_has_admin_group = 8
  1272. Global Const $token_is_restricted = 16
  1273. Global Const $token_session_not_referenced = 32
  1274. Global Const $token_sandbox_inert = 64
  1275. Global Const $token_has_impersonate_privilege = 128
  1276. Global Const $rights_delete = 65536
  1277. Global Const $read_control = 131072
  1278. Global Const $write_dac = 262144
  1279. Global Const $write_owner = 524288
  1280. Global Const $synchronize = 1048576
  1281. Global Const $access_system_security = 16777216
  1282. Global Const $standard_rights_required = 983040
  1283. Global Const $standard_rights_read = $read_control
  1284. Global Const $standard_rights_write = $read_control
  1285. Global Const $standard_rights_execute = $read_control
  1286. Global Const $standard_rights_all = 2031616
  1287. Global Const $specific_rights_all = 65535
  1288. Global Enum $not_used_access = 0, $grant_access, $set_access, $deny_access, $revoke_access, $set_audit_success, $set_audit_failure
  1289. 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
  1290. Global Const $logon_with_profile = 1
  1291. Global Const $logon_netcredentials_only = 2
  1292. Global Enum $sidtypeuser = 1, $sidtypegroup, $sidtypedomain, $sidtypealias, $sidtypewellknowngroup, $sidtypedeletedaccount, $sidtypeinvalid, $sidtypeunknown, $sidtypecomputer, $sidtypelabel
  1293. Global Const $sid_administrators = "S-1-5-32-544"
  1294. Global Const $sid_users = "S-1-5-32-545"
  1295. Global Const $sid_guests = "S-1-5-32-546"
  1296. Global Const $sid_account_operators = "S-1-5-32-548"
  1297. Global Const $sid_server_operators = "S-1-5-32-549"
  1298. Global Const $sid_print_operators = "S-1-5-32-550"
  1299. Global Const $sid_backup_operators = "S-1-5-32-551"
  1300. Global Const $sid_replicator = "S-1-5-32-552"
  1301. Global Const $sid_owner = "S-1-3-0"
  1302. Global Const $sid_everyone = "S-1-1-0"
  1303. Global Const $sid_network = "S-1-5-2"
  1304. Global Const $sid_interactive = "S-1-5-4"
  1305. Global Const $sid_system = "S-1-5-18"
  1306. Global Const $sid_authenticated_users = "S-1-5-11"
  1307. Global Const $sid_schannel_authentication = "S-1-5-64-14"
  1308. Global Const $sid_digest_authentication = "S-1-5-64-21"
  1309. Global Const $sid_nt_service = "S-1-5-80"
  1310. Global Const $sid_untrusted_mandatory_level = "S-1-16-0"
  1311. Global Const $sid_low_mandatory_level = "S-1-16-4096"
  1312. Global Const $sid_medium_mandatory_level = "S-1-16-8192"
  1313. Global Const $sid_medium_plus_mandatory_level = "S-1-16-8448"
  1314. Global Const $sid_high_mandatory_level = "S-1-16-12288"
  1315. Global Const $sid_system_mandatory_level = "S-1-16-16384"
  1316. Global Const $sid_protected_process_mandatory_level = "S-1-16-20480"
  1317. Global Const $sid_secure_process_mandatory_level = "S-1-16-28672"
  1318. Global Const $sid_all_services = "S-1-5-80-0"
  1319. Global Const $str_nocasesense = 0
  1320. Global Const $str_casesense = 1
  1321. Global Const $str_nocasesensebasic = 2
  1322. Global Const $str_stripleading = 1
  1323. Global Const $str_striptrailing = 2
  1324. Global Const $str_stripspaces = 4
  1325. Global Const $str_stripall = 8
  1326. Global Const $str_chrsplit = 0
  1327. Global Const $str_entiresplit = 1
  1328. Global Const $str_nocount = 2
  1329. Global Const $str_regexpmatch = 0
  1330. Global Const $str_regexparraymatch = 1
  1331. Global Const $str_regexparrayfullmatch = 2
  1332. Global Const $str_regexparrayglobalmatch = 3
  1333. Global Const $str_regexparrayglobalfullmatch = 4
  1334. Global Const $str_endisstart = 0
  1335. Global Const $str_endnotstart = 1
  1336. Global Const $sb_ansi = 1
  1337. Global Const $sb_utf16le = 2
  1338. Global Const $sb_utf16be = 3
  1339. Global Const $sb_utf8 = 4
  1340. Global Const $se_utf16 = 0
  1341. Global Const $se_ansi = 1
  1342. Global Const $se_utf8 = 2
  1343. Global Const $str_utf16 = 0
  1344. Global Const $str_ucs2 = 1
  1345. #Region Global Variables and Constants
  1346.     Global Const $format_message_allocate_buffer = 256
  1347.     Global Const $format_message_ignore_inserts = 512
  1348.     Global Const $format_message_from_string = 1024
  1349.     Global Const $format_message_from_hmodule = 2048
  1350.     Global Const $format_message_from_system = 4096
  1351.     Global Const $format_message_argument_array = 8192
  1352. #EndRegion Global Variables and Constants
  1353.  
  1354. Func _winapi_beep($ifreq = 500, $iduration = 1000)
  1355.     Local $aresult = DllCall("kernel32.dll", "bool", "Beep", "dword", $ifreq, "dword", $iduration)
  1356.     If @error Then Return SetError(@error, @extended, False)
  1357.     Return $aresult[0]
  1358. EndFunc
  1359.  
  1360. Func _winapi_formatmessage($iflags, $psource, $imessageid, $ilanguageid, ByRef $pbuffer, $isize, $varguments)
  1361.     Local $sbuffertype = "struct*"
  1362.     If IsString($pbuffer) Then $sbuffertype = "wstr"
  1363.     Local $aresult = DllCall("kernel32.dll", "dword", "FormatMessageW", "dword", $iflags, "struct*", $psource, "dword", $imessageid, "dword", $ilanguageid, $sbuffertype, $pbuffer, "dword", $isize, "ptr", $varguments)
  1364.     If @error OR NOT $aresult[0] Then Return SetError(@error + 10, @extended, 0)
  1365.     If $sbuffertype = "wstr" Then $pbuffer = $aresult[5]
  1366.     Return $aresult[0]
  1367. EndFunc
  1368.  
  1369. Func _winapi_geterrormessage($icode, $ilanguage = 0, Const $_icurrenterror = @error, Const $_icurrentextended = @extended)
  1370.     Local $aret = DllCall("kernel32.dll", "dword", "FormatMessageW", "dword", 4096, "ptr", 0, "dword", $icode, "dword", $ilanguage, "wstr", "", "dword", 4096, "ptr", 0)
  1371.     If @error OR NOT $aret[0] Then Return SetError(@error, @extended, "")
  1372.     Return SetError($_icurrenterror, $_icurrentextended, StringRegExpReplace($aret[5], "[" & @LF & "," & @CR & "]*\Z", ""))
  1373. EndFunc
  1374.  
  1375. Func _winapi_getlasterror(Const $_icurrenterror = @error, Const $_icurrentextended = @extended)
  1376.     Local $aresult = DllCall("kernel32.dll", "dword", "GetLastError")
  1377.     Return SetError($_icurrenterror, $_icurrentextended, $aresult[0])
  1378. EndFunc
  1379.  
  1380. Func _winapi_getlasterrormessage(Const $_icurrenterror = @error, Const $_icurrentextended = @extended)
  1381.     Local $ilasterror = _winapi_getlasterror()
  1382.     Local $tbufferptr = DllStructCreate("ptr")
  1383.     Local $ncount = _winapi_formatmessage(BitOR($format_message_allocate_buffer, $format_message_from_system), 0, $ilasterror, 0, $tbufferptr, 0, 0)
  1384.     If @error Then Return SetError(-@error, @extended, "")
  1385.     Local $stext = ""
  1386.     Local $pbuffer = DllStructGetData($tbufferptr, 1)
  1387.     If $pbuffer Then
  1388.         If $ncount > 0 Then
  1389.             Local $tbuffer = DllStructCreate("wchar[" & ($ncount + 1) & "]", $pbuffer)
  1390.             $stext = DllStructGetData($tbuffer, 1)
  1391.             If StringRight($stext, 2) = @CRLF Then $stext = StringTrimRight($stext, 2)
  1392.         EndIf
  1393.         DllCall("kernel32.dll", "handle", "LocalFree", "handle", $pbuffer)
  1394.     EndIf
  1395.     Return SetError($_icurrenterror, $_icurrentextended, $stext)
  1396. EndFunc
  1397.  
  1398. Func _winapi_messagebeep($itype = 1)
  1399.     Local $isound
  1400.     Switch $itype
  1401.         Case 1
  1402.             $isound = 0
  1403.         Case 2
  1404.             $isound = 16
  1405.         Case 3
  1406.             $isound = 32
  1407.         Case 4
  1408.             $isound = 48
  1409.         Case 5
  1410.             $isound = 64
  1411.         Case Else
  1412.             $isound = -1
  1413.     EndSwitch
  1414.     Local $aresult = DllCall("user32.dll", "bool", "MessageBeep", "uint", $isound)
  1415.     If @error Then Return SetError(@error, @extended, False)
  1416.     Return $aresult[0]
  1417. EndFunc
  1418.  
  1419. Func _winapi_msgbox($iflags, $stitle, $stext)
  1420.     BlockInput(0)
  1421.     MsgBox($iflags, $stitle, $stext & "      ")
  1422. EndFunc
  1423.  
  1424. Func _winapi_setlasterror($ierrorcode, Const $_icurrenterror = @error, Const $_icurrentextended = @extended)
  1425.     DllCall("kernel32.dll", "none", "SetLastError", "dword", $ierrorcode)
  1426.     Return SetError($_icurrenterror, $_icurrentextended, NULL )
  1427. EndFunc
  1428.  
  1429. Func _winapi_showerror($stext, $bexit = True)
  1430.     BlockInput(0)
  1431.     MsgBox($mb_systemmodal, "Error", $stext & "      ")
  1432.     If $bexit Then Exit
  1433. EndFunc
  1434.  
  1435. Func _winapi_showlasterror($stext = "", $babort = False, $ilanguage = 0, Const $_icurrenterror = @error, Const $_icurrentextended = @extended)
  1436.     Local $serror
  1437.     Local $ilasterror = _winapi_getlasterror()
  1438.     While 1
  1439.         $serror = _winapi_geterrormessage($ilasterror, $ilanguage)
  1440.         If @error AND $ilanguage Then
  1441.             $ilanguage = 0
  1442.         Else
  1443.             ExitLoop
  1444.         EndIf
  1445.     WEnd
  1446.     If StringStripWS($stext, $str_stripleading + $str_striptrailing) Then
  1447.         $stext &= @CRLF & @CRLF
  1448.     Else
  1449.         $stext = ""
  1450.     EndIf
  1451.     _winapi_msgbox(BitOR(262144, BitShift(16, -2 * (NOT $ilasterror))), $ilasterror, $stext & $serror)
  1452.     If $ilasterror Then
  1453.         _winapi_setlasterror($ilasterror)
  1454.         If $babort Then
  1455.             Exit $ilasterror
  1456.         EndIf
  1457.     EndIf
  1458.     Return SetError($_icurrenterror, $_icurrentextended, 1)
  1459. EndFunc
  1460.  
  1461. Func _winapi_showmsg($stext)
  1462.     _winapi_msgbox($mb_systemmodal, "Information", $stext)
  1463. EndFunc
  1464.  
  1465. Func __comerrorformating(ByRef $ocomerror, $sprefix = @TAB)
  1466.     Local Const $str_striptrailing = 2
  1467.     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)
  1468.     Return $serror
  1469. EndFunc
  1470.  
  1471. Func _security__adjusttokenprivileges($htoken, $bdisableall, $tnewstate, $ibufferlen, $tprevstate = 0, $prequired = 0)
  1472.     Local $acall = DllCall("advapi32.dll", "bool", "AdjustTokenPrivileges", "handle", $htoken, "bool", $bdisableall, "struct*", $tnewstate, "dword", $ibufferlen, "struct*", $tprevstate, "struct*", $prequired)
  1473.     If @error Then Return SetError(@error, @extended, False)
  1474.     Return NOT ($acall[0] = 0)
  1475. EndFunc
  1476.  
  1477. Func _security__createprocesswithtoken($htoken, $ilogonflags, $scommandline, $icreationflags, $scurdir, $tstartupinfo, $tprocess_information)
  1478.     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)
  1479.     If @error OR NOT $acall[0] Then Return SetError(@error, @extended, False)
  1480.     Return True
  1481. EndFunc
  1482.  
  1483. Func _security__duplicatetokenex($hexistingtoken, $idesiredaccess, $iimpersonationlevel, $itokentype)
  1484.     Local $acall = DllCall("advapi32.dll", "bool", "DuplicateTokenEx", "handle", $hexistingtoken, "dword", $idesiredaccess, "struct*", 0, "int", $iimpersonationlevel, "int", $itokentype, "handle*", 0)
  1485.     If @error OR NOT $acall[0] Then Return SetError(@error, @extended, 0)
  1486.     Return $acall[6]
  1487. EndFunc
  1488.  
  1489. Func _security__getaccountsid($saccount, $ssystem = "")
  1490.     Local $aacct = _security__lookupaccountname($saccount, $ssystem)
  1491.     If @error Then Return SetError(@error, @extended, 0)
  1492.     If IsArray($aacct) Then Return _security__stringsidtosid($aacct[0])
  1493.     Return ""
  1494. EndFunc
  1495.  
  1496. Func _security__getlengthsid($psid)
  1497.     If NOT _security__isvalidsid($psid) Then Return SetError(@error + 10, @extended, 0)
  1498.     Local $acall = DllCall("advapi32.dll", "dword", "GetLengthSid", "struct*", $psid)
  1499.     If @error Then Return SetError(@error, @extended, 0)
  1500.     Return $acall[0]
  1501. EndFunc
  1502.  
  1503. Func _security__gettokeninformation($htoken, $iclass)
  1504.     Local $acall = DllCall("advapi32.dll", "bool", "GetTokenInformation", "handle", $htoken, "int", $iclass, "struct*", 0, "dword", 0, "dword*", 0)
  1505.     If @error OR NOT $acall[5] Then Return SetError(@error + 10, @extended, 0)
  1506.     Local $ilen = $acall[5]
  1507.     Local $tbuffer = DllStructCreate("byte[" & $ilen & "]")
  1508.     $acall = DllCall("advapi32.dll", "bool", "GetTokenInformation", "handle", $htoken, "int", $iclass, "struct*", $tbuffer, "dword", DllStructGetSize($tbuffer), "dword*", 0)
  1509.     If @error OR NOT $acall[0] Then Return SetError(@error, @extended, 0)
  1510.     Return $tbuffer
  1511. EndFunc
  1512.  
  1513. Func _security__impersonateself($ilevel = $securityimpersonation)
  1514.     Local $acall = DllCall("advapi32.dll", "bool", "ImpersonateSelf", "int", $ilevel)
  1515.     If @error Then Return SetError(@error, @extended, False)
  1516.     Return NOT ($acall[0] = 0)
  1517. EndFunc
  1518.  
  1519. Func _security__isvalidsid($psid)
  1520.     Local $acall = DllCall("advapi32.dll", "bool", "IsValidSid", "struct*", $psid)
  1521.     If @error Then Return SetError(@error, @extended, False)
  1522.     Return NOT ($acall[0] = 0)
  1523. EndFunc
  1524.  
  1525. Func _security__lookupaccountname($saccount, $ssystem = "")
  1526.     Local $tdata = DllStructCreate("byte SID[256]")
  1527.     Local $acall = DllCall("advapi32.dll", "bool", "LookupAccountNameW", "wstr", $ssystem, "wstr", $saccount, "struct*", $tdata, "dword*", DllStructGetSize($tdata), "wstr", "", "dword*", DllStructGetSize($tdata), "int*", 0)
  1528.     If @error OR NOT $acall[0] Then Return SetError(@error, @extended, 0)
  1529.     Local $aacct[3]
  1530.     $aacct[0] = _security__sidtostringsid(DllStructGetPtr($tdata, "SID"))
  1531.     $aacct[1] = $acall[5]
  1532.     $aacct[2] = $acall[7]
  1533.     Return $aacct
  1534. EndFunc
  1535.  
  1536. Func _security__lookupaccountsid($vsid, $ssystem = "")
  1537.     Local $psid, $aacct[3]
  1538.     If IsString($vsid) Then
  1539.         $psid = _security__stringsidtosid($vsid)
  1540.     Else
  1541.         $psid = $vsid
  1542.     EndIf
  1543.     If NOT _security__isvalidsid($psid) Then Return SetError(@error + 10, @extended, 0)
  1544.     Local $stypesystem = "ptr"
  1545.     If $ssystem Then $stypesystem = "wstr"
  1546.     Local $acall = DllCall("advapi32.dll", "bool", "LookupAccountSidW", $stypesystem, $ssystem, "struct*", $psid, "wstr", "", "dword*", 65536, "wstr", "", "dword*", 65536, "int*", 0)
  1547.     If @error OR NOT $acall[0] Then Return SetError(@error, @extended, 0)
  1548.     Local $aacct[3]
  1549.     $aacct[0] = $acall[3]
  1550.     $aacct[1] = $acall[5]
  1551.     $aacct[2] = $acall[7]
  1552.     Return $aacct
  1553. EndFunc
  1554.  
  1555. Func _security__lookupprivilegevalue($ssystem, $sname)
  1556.     Local $acall = DllCall("advapi32.dll", "bool", "LookupPrivilegeValueW", "wstr", $ssystem, "wstr", $sname, "int64*", 0)
  1557.     If @error OR NOT $acall[0] Then Return SetError(@error, @extended, 0)
  1558.     Return $acall[3]
  1559. EndFunc
  1560.  
  1561. Func _security__openprocesstoken($hprocess, $iaccess)
  1562.     Local $acall = DllCall("advapi32.dll", "bool", "OpenProcessToken", "handle", $hprocess, "dword", $iaccess, "handle*", 0)
  1563.     If @error OR NOT $acall[0] Then Return SetError(@error, @extended, 0)
  1564.     Return $acall[3]
  1565. EndFunc
  1566.  
  1567. Func _security__openthreadtoken($iaccess, $hthread = 0, $bopenasself = False)
  1568.     If $hthread = 0 Then
  1569.         Local $aresult = DllCall("kernel32.dll", "handle", "GetCurrentThread")
  1570.         If @error Then Return SetError(@error + 10, @extended, 0)
  1571.         $hthread = $aresult[0]
  1572.     EndIf
  1573.     Local $acall = DllCall("advapi32.dll", "bool", "OpenThreadToken", "handle", $hthread, "dword", $iaccess, "bool", $bopenasself, "handle*", 0)
  1574.     If @error OR NOT $acall[0] Then Return SetError(@error, @extended, 0)
  1575.     Return $acall[4]
  1576. EndFunc
  1577.  
  1578. Func _security__openthreadtokenex($iaccess, $hthread = 0, $bopenasself = False)
  1579.     Local $htoken = _security__openthreadtoken($iaccess, $hthread, $bopenasself)
  1580.     If $htoken = 0 Then
  1581.         Local Const $error_no_token = 1008
  1582.         If _winapi_getlasterror() <> $error_no_token Then Return SetError(20, _winapi_getlasterror(), 0)
  1583.         If NOT _security__impersonateself() Then Return SetError(@error + 10, _winapi_getlasterror(), 0)
  1584.         $htoken = _security__openthreadtoken($iaccess, $hthread, $bopenasself)
  1585.         If $htoken = 0 Then Return SetError(@error, _winapi_getlasterror(), 0)
  1586.     EndIf
  1587.     Return $htoken
  1588. EndFunc
  1589.  
  1590. Func _security__setprivilege($htoken, $sprivilege, $benable)
  1591.     Local $iluid = _security__lookupprivilegevalue("", $sprivilege)
  1592.     If $iluid = 0 Then Return SetError(@error + 10, @extended, False)
  1593.     Local Const $tagtoken_privileges = "dword Count;align 4;int64 LUID;dword Attributes"
  1594.     Local $tcurrstate = DllStructCreate($tagtoken_privileges)
  1595.     Local $icurrstate = DllStructGetSize($tcurrstate)
  1596.     Local $tprevstate = DllStructCreate($tagtoken_privileges)
  1597.     Local $iprevstate = DllStructGetSize($tprevstate)
  1598.     Local $trequired = DllStructCreate("int Data")
  1599.     DllStructSetData($tcurrstate, "Count", 1)
  1600.     DllStructSetData($tcurrstate, "LUID", $iluid)
  1601.     If NOT _security__adjusttokenprivileges($htoken, False, $tcurrstate, $icurrstate, $tprevstate, $trequired) Then Return SetError(2, @error, False)
  1602.     DllStructSetData($tprevstate, "Count", 1)
  1603.     DllStructSetData($tprevstate, "LUID", $iluid)
  1604.     Local $iattributes = DllStructGetData($tprevstate, "Attributes")
  1605.     If $benable Then
  1606.         $iattributes = BitOR($iattributes, $se_privilege_enabled)
  1607.     Else
  1608.         $iattributes = BitAND($iattributes, BitNOT($se_privilege_enabled))
  1609.     EndIf
  1610.     DllStructSetData($tprevstate, "Attributes", $iattributes)
  1611.     If NOT _security__adjusttokenprivileges($htoken, False, $tprevstate, $iprevstate, $tcurrstate, $trequired) Then Return SetError(3, @error, False)
  1612.     Return True
  1613. EndFunc
  1614.  
  1615. Func _security__settokeninformation($htoken, $itokeninformation, $vtokeninformation, $itokeninformationlength)
  1616.     Local $acall = DllCall("advapi32.dll", "bool", "SetTokenInformation", "handle", $htoken, "int", $itokeninformation, "struct*", $vtokeninformation, "dword", $itokeninformationlength)
  1617.     If @error OR NOT $acall[0] Then Return SetError(@error, @extended, False)
  1618.     Return True
  1619. EndFunc
  1620.  
  1621. Func _security__sidtostringsid($psid)
  1622.     If NOT _security__isvalidsid($psid) Then Return SetError(@error + 10, 0, "")
  1623.     Local $acall = DllCall("advapi32.dll", "bool", "ConvertSidToStringSidW", "struct*", $psid, "ptr*", 0)
  1624.     If @error OR NOT $acall[0] Then Return SetError(@error, @extended, "")
  1625.     Local $pstringsid = $acall[2]
  1626.     Local $alen = DllCall("kernel32.dll", "int", "lstrlenW", "struct*", $pstringsid)
  1627.     Local $ssid = DllStructGetData(DllStructCreate("wchar Text[" & $alen[0] + 1 & "]", $pstringsid), "Text")
  1628.     DllCall("kernel32.dll", "handle", "LocalFree", "handle", $pstringsid)
  1629.     Return $ssid
  1630. EndFunc
  1631.  
  1632. Func _security__sidtypestr($itype)
  1633.     Switch $itype
  1634.         Case $sidtypeuser
  1635.             Return "User"
  1636.         Case $sidtypegroup
  1637.             Return "Group"
  1638.         Case $sidtypedomain
  1639.             Return "Domain"
  1640.         Case $sidtypealias
  1641.             Return "Alias"
  1642.         Case $sidtypewellknowngroup
  1643.             Return "Well Known Group"
  1644.         Case $sidtypedeletedaccount
  1645.             Return "Deleted Account"
  1646.         Case $sidtypeinvalid
  1647.             Return "Invalid"
  1648.         Case $sidtypeunknown
  1649.             Return "Unknown Type"
  1650.         Case $sidtypecomputer
  1651.             Return "Computer"
  1652.         Case $sidtypelabel
  1653.             Return "A mandatory integrity label SID"
  1654.         Case Else
  1655.             Return "Unknown SID Type"
  1656.     EndSwitch
  1657. EndFunc
  1658.  
  1659. Func _security__stringsidtosid($ssid)
  1660.     Local $acall = DllCall("advapi32.dll", "bool", "ConvertStringSidToSidW", "wstr", $ssid, "ptr*", 0)
  1661.     If @error OR NOT $acall[0] Then Return SetError(@error, @extended, 0)
  1662.     Local $psid = $acall[2]
  1663.     Local $tbuffer = DllStructCreate("byte Data[" & _security__getlengthsid($psid) & "]", $psid)
  1664.     Local $tsid = DllStructCreate("byte Data[" & DllStructGetSize($tbuffer) & "]")
  1665.     DllStructSetData($tsid, "Data", DllStructGetData($tbuffer, "Data"))
  1666.     DllCall("kernel32.dll", "handle", "LocalFree", "handle", $psid)
  1667.     Return $tsid
  1668. EndFunc
  1669.  
  1670. Func _sendmessage($hwnd, $imsg, $wparam = 0, $lparam = 0, $ireturn = 0, $wparamtype = "wparam", $lparamtype = "lparam", $sreturntype = "lresult")
  1671.     Local $aresult = DllCall("user32.dll", $sreturntype, "SendMessageW", "hwnd", $hwnd, "uint", $imsg, $wparamtype, $wparam, $lparamtype, $lparam)
  1672.     If @error Then Return SetError(@error, @extended, "")
  1673.     If $ireturn >= 0 AND $ireturn <= 4 Then Return $aresult[$ireturn]
  1674.     Return $aresult
  1675. EndFunc
  1676.  
  1677. Func _sendmessagea($hwnd, $imsg, $wparam = 0, $lparam = 0, $ireturn = 0, $wparamtype = "wparam", $lparamtype = "lparam", $sreturntype = "lresult")
  1678.     Local $aresult = DllCall("user32.dll", $sreturntype, "SendMessageA", "hwnd", $hwnd, "uint", $imsg, $wparamtype, $wparam, $lparamtype, $lparam)
  1679.     If @error Then Return SetError(@error, @extended, "")
  1680.     If $ireturn >= 0 AND $ireturn <= 4 Then Return $aresult[$ireturn]
  1681.     Return $aresult
  1682. EndFunc
  1683.  
  1684. Global Const $tagpoint = "struct;long X;long Y;endstruct"
  1685. Global Const $tagrect = "struct;long Left;long Top;long Right;long Bottom;endstruct"
  1686. Global Const $tagsize = "struct;long X;long Y;endstruct"
  1687. Global Const $tagmargins = "int cxLeftWidth;int cxRightWidth;int cyTopHeight;int cyBottomHeight"
  1688. Global Const $tagfiletime = "struct;dword Lo;dword Hi;endstruct"
  1689. Global Const $tagsystemtime = "struct;word Year;word Month;word Dow;word Day;word Hour;word Minute;word Second;word MSeconds;endstruct"
  1690. 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"
  1691. Global Const $tagnmhdr = "struct;hwnd hWndFrom;uint_ptr IDFrom;INT Code;endstruct"
  1692. Global Const $tagcomboboxexitem = "uint Mask;int_ptr Item;ptr Text;int TextMax;int Image;int SelectedImage;int OverlayImage;" & "int Indent;lparam Param"
  1693. Global Const $tagnmcbedragbegin = $tagnmhdr & ";int ItemID;wchar szText[260]"
  1694. Global Const $tagnmcbeendedit = $tagnmhdr & ";bool fChanged;int NewSelection;wchar szText[260];int Why"
  1695. Global Const $tagnmcomboboxex = $tagnmhdr & ";uint Mask;int_ptr Item;ptr Text;int TextMax;int Image;" & "int SelectedImage;int OverlayImage;int Indent;lparam Param"
  1696. 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"
  1697. Global Const $tagnmdatetimechange = $tagnmhdr & ";dword Flag;" & $tagsystemtime
  1698. Global Const $tagnmdatetimeformat = $tagnmhdr & ";ptr Format;" & $tagsystemtime & ";ptr pDisplay;wchar Display[64]"
  1699. Global Const $tagnmdatetimeformatquery = $tagnmhdr & ";ptr Format;struct;long SizeX;long SizeY;endstruct"
  1700. Global Const $tagnmdatetimekeydown = $tagnmhdr & ";int VirtKey;ptr Format;" & $tagsystemtime
  1701. Global Const $tagnmdatetimestring = $tagnmhdr & ";ptr UserString;" & $tagsystemtime & ";dword Flags"
  1702. 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"
  1703. Global Const $taggdip_effectparams_blur = "float Radius; bool ExpandEdge"
  1704. Global Const $taggdip_effectparams_brightnesscontrast = "int BrightnessLevel; int ContrastLevel"
  1705. Global Const $taggdip_effectparams_colorbalance = "int CyanRed; int MagentaGreen; int YellowBlue"
  1706. Global Const $taggdip_effectparams_colorcurve = "int Adjustment; int Channel; int AdjustValue"
  1707. Global Const $taggdip_effectparams_colorlut = "byte LutB[256]; byte LutG[256]; byte LutR[256]; byte LutA[256]"
  1708. Global Const $taggdip_effectparams_huesaturationlightness = "int HueLevel; int SaturationLevel; int LightnessLevel"
  1709. Global Const $taggdip_effectparams_levels = "int Highlight; int Midtone; int Shadow"
  1710. Global Const $taggdip_effectparams_redeyecorrection = "uint NumberOfAreas; ptr Areas"
  1711. Global Const $taggdip_effectparams_sharpen = "float Radius; float Amount"
  1712. Global Const $taggdip_effectparams_tint = "int Hue; int Amount"
  1713. Global Const $taggdipbitmapdata = "uint Width;uint Height;int Stride;int Format;ptr Scan0;uint_ptr Reserved"
  1714. Global Const $taggdipcolormatrix = "float m[25]"
  1715. Global Const $taggdipencoderparam = "struct;byte GUID[16];ulong NumberOfValues;ulong Type;ptr Values;endstruct"
  1716. Global Const $taggdipencoderparams = "uint Count;" & $taggdipencoderparam
  1717. Global Const $taggdiprectf = "struct;float X;float Y;float Width;float Height;endstruct"
  1718. Global Const $taggdipstartupinput = "uint Version;ptr Callback;bool NoThread;bool NoCodecs"
  1719. Global Const $taggdipstartupoutput = "ptr HookProc;ptr UnhookProc"
  1720. 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"
  1721. Global Const $taggdippencoderparams = "uint Count;byte Params[1]"
  1722. 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"
  1723. Global Const $tagnmhddispinfo = $tagnmhdr & ";int Item;uint Mask;ptr Text;int TextMax;int Image;lparam lParam"
  1724. Global Const $tagnmhdfilterbtnclick = $tagnmhdr & ";int Item;" & $tagrect
  1725. Global Const $tagnmheader = $tagnmhdr & ";int Item;int Button;ptr pItem"
  1726. Global Const $taggetipaddress = "byte Field4;byte Field3;byte Field2;byte Field1"
  1727. Global Const $tagnmipaddress = $tagnmhdr & ";int Field;int Value"
  1728. Global Const $taglvfindinfo = "struct;uint Flags;ptr Text;lparam Param;" & $tagpoint & ";uint Direction;endstruct"
  1729. Global Const $taglvhittestinfo = $tagpoint & ";uint Flags;int Item;int SubItem;int iGroup"
  1730. 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"
  1731. Global Const $tagnmlistview = $tagnmhdr & ";int Item;int SubItem;uint NewState;uint OldState;uint Changed;" & "struct;long ActionX;long ActionY;endstruct;lparam Param"
  1732. 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"
  1733. Global Const $tagnmlvdispinfo = $tagnmhdr & ";" & $taglvitem
  1734. Global Const $tagnmlvfinditem = $tagnmhdr & ";int Start;" & $taglvfindinfo
  1735. Global Const $tagnmlvgetinfotip = $tagnmhdr & ";dword Flags;ptr Text;int TextMax;int Item;int SubItem;lparam lParam"
  1736. Global Const $tagnmitemactivate = $tagnmhdr & ";int Index;int SubItem;uint NewState;uint OldState;uint Changed;" & $tagpoint & ";lparam lParam;uint KeyFlags"
  1737. Global Const $tagnmlvkeydown = "align 1;" & $tagnmhdr & ";word VKey;uint Flags"
  1738. Global Const $tagnmlvscroll = $tagnmhdr & ";int DX;int DY"
  1739. Global Const $tagmchittestinfo = "uint Size;" & $tagpoint & ";uint Hit;" & $tagsystemtime & ";" & $tagrect & ";int iOffset;int iRow;int iCol"
  1740. 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"
  1741. 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"
  1742. 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"
  1743. Global Const $tagnmdaystate = $tagnmhdr & ";" & $tagsystemtime & ";int DayState;ptr pDayState"
  1744. 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"
  1745. Global Const $tagnmobjectnotify = $tagnmhdr & ";int Item;ptr piid;ptr pObject;long Result;dword dwFlags"
  1746. Global Const $tagnmtckeydown = "align 1;" & $tagnmhdr & ";word VKey;uint Flags"
  1747. 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"
  1748. Global Const $tagtvitemex = "struct;" & $tagtvitem & ";int Integral;uint uStateEx;hwnd hwnd;int iExpandedImage;int iReserved;endstruct"
  1749. 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"
  1750. Global Const $tagnmtvcustomdraw = "struct;" & $tagnmhdr & ";dword DrawStage;handle HDC;" & $tagrect & ";dword_ptr ItemSpec;uint ItemState;lparam ItemParam;endstruct" & ";dword ClrText;dword ClrTextBk;int Level"
  1751. Global Const $tagnmtvdispinfo = $tagnmhdr & ";" & $tagtvitem
  1752. Global Const $tagnmtvgetinfotip = $tagnmhdr & ";ptr Text;int TextMax;handle hItem;lparam lParam"
  1753. Global Const $tagnmtvitemchange = $tagnmhdr & ";uint Changed;handle hItem;uint StateNew;uint StateOld;lparam lParam;"
  1754. Global Const $tagtvhittestinfo = $tagpoint & ";uint Flags;handle Item"
  1755. Global Const $tagnmtvkeydown = "align 1;" & $tagnmhdr & ";word VKey;uint Flags"
  1756. Global Const $tagnmmouse = $tagnmhdr & ";dword_ptr ItemSpec;dword_ptr ItemData;" & $tagpoint & ";lparam HitInfo"
  1757. Global Const $tagtoken_privileges = "dword Count;align 4;int64 LUID;dword Attributes"
  1758. Global Const $tagimageinfo = "handle hBitmap;handle hMask;int Unused1;int Unused2;" & $tagrect
  1759. Global Const $tagmenuinfo = "dword Size;INT Mask;dword Style;uint YMax;handle hBack;dword ContextHelpID;ulong_ptr MenuData"
  1760. 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"
  1761. 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")
  1762. Global Const $tagnmrebarautobreak = $tagnmhdr & ";uint uBand;uint wID;lparam lParam;uint uMsg;uint fStyleCurrent;bool fAutoBreak"
  1763. 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"
  1764. Global Const $tagnmrebar = $tagnmhdr & ";dword dwMask;uint uBand;uint fStyle;uint wID;lparam lParam"
  1765. Global Const $tagnmrebarchevron = $tagnmhdr & ";uint uBand;uint wID;lparam lParam;" & $tagrect & ";lparam lParamNM"
  1766. 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"
  1767. Global Const $tagcolorscheme = "dword Size;dword BtnHighlight;dword BtnShadow"
  1768. 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
  1769. Global Const $tagnmtbhotitem = $tagnmhdr & ";int idOld;int idNew;dword dwFlags"
  1770. Global Const $tagtbbutton = "int Bitmap;int Command;byte State;byte Style;dword_ptr Param;int_ptr String"
  1771. Global Const $tagtbbuttoninfo = "uint Size;dword Mask;int Command;int Image;byte State;byte Style;word CX;dword_ptr Param;ptr Text;int TextMax"
  1772. Global Const $tagnetresource = "dword Scope;dword Type;dword DisplayType;dword Usage;ptr LocalName;ptr RemoteName;ptr Comment;ptr Provider"
  1773. Global Const $tagoverlapped = "ulong_ptr Internal;ulong_ptr InternalHigh;struct;dword Offset;dword OffsetHigh;endstruct;handle hEvent"
  1774. 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"
  1775. 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"
  1776. Global Const $tagbitmapinfo = $tagbitmapinfoheader & ";dword biRGBQuad[1]"
  1777. Global Const $tagblendfunction = "byte Op;byte Flags;byte Alpha;byte Format"
  1778. Global Const $tagguid = "struct;ulong Data1;ushort Data2;ushort Data3;byte Data4[8];endstruct"
  1779. Global Const $tagwindowplacement = "uint length;uint flags;uint showCmd;long ptMinPosition[2];long ptMaxPosition[2];long rcNormalPosition[4]"
  1780. Global Const $tagwindowpos = "hwnd hWnd;hwnd InsertAfter;int X;int Y;int CX;int CY;uint Flags"
  1781. Global Const $tagscrollinfo = "uint cbSize;uint fMask;int nMin;int nMax;uint nPage;int nPos;int nTrackPos"
  1782. Global Const $tagscrollbarinfo = "dword cbSize;" & $tagrect & ";int dxyLineButton;int xyThumbTop;" & "int xyThumbBottom;int reserved;dword rgstate[6]"
  1783. 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"
  1784. Global Const $tagkbdllhookstruct = "dword vkCode;dword scanCode;dword flags;dword time;ulong_ptr dwExtraInfo"
  1785. Global Const $tagprocess_information = "handle hProcess;handle hThread;dword ProcessID;dword ThreadID"
  1786. 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"
  1787. Global Const $tagsecurity_attributes = "dword Length;ptr Descriptor;bool InheritHandle"
  1788. 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]"
  1789. 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"
  1790. Global Const $hgdi_error = Ptr(-1)
  1791. Global Const $invalid_handle_value = Ptr(-1)
  1792. Global Const $clr_invalid = -1
  1793. Global Const $mb_precomposed = 1
  1794. Global Const $mb_composite = 2
  1795. Global Const $mb_useglyphchars = 4
  1796. Global Const $ulw_alpha = 2
  1797. Global Const $ulw_colorkey = 1
  1798. Global Const $ulw_opaque = 4
  1799. Global Const $ulw_ex_noresize = 8
  1800. Global Const $wh_callwndproc = 4
  1801. Global Const $wh_callwndprocret = 12
  1802. Global Const $wh_cbt = 5
  1803. Global Const $wh_debug = 9
  1804. Global Const $wh_foregroundidle = 11
  1805. Global Const $wh_getmessage = 3
  1806. Global Const $wh_journalplayback = 1
  1807. Global Const $wh_journalrecord = 0
  1808. Global Const $wh_keyboard = 2
  1809. Global Const $wh_keyboard_ll = 13
  1810. Global Const $wh_mouse = 7
  1811. Global Const $wh_mouse_ll = 14
  1812. Global Const $wh_msgfilter = -1
  1813. Global Const $wh_shell = 10
  1814. Global Const $wh_sysmsgfilter = 6
  1815. Global Const $wpf_asyncwindowplacement = 4
  1816. Global Const $wpf_restoretomaximized = 2
  1817. Global Const $wpf_setminposition = 1
  1818. Global Const $kf_extended = 256
  1819. Global Const $kf_altdown = 8192
  1820. Global Const $kf_up = 32768
  1821. Global Const $llkhf_extended = BitShift($kf_extended, 8)
  1822. Global Const $llkhf_injected = 16
  1823. Global Const $llkhf_altdown = BitShift($kf_altdown, 8)
  1824. Global Const $llkhf_up = BitShift($kf_up, 8)
  1825. Global Const $ofn_allowmultiselect = 512
  1826. Global Const $ofn_createprompt = 8192
  1827. Global Const $ofn_dontaddtorecent = 33554432
  1828. Global Const $ofn_enablehook = 32
  1829. Global Const $ofn_enableincludenotify = 4194304
  1830. Global Const $ofn_enablesizing = 8388608
  1831. Global Const $ofn_enabletemplate = 64
  1832. Global Const $ofn_enabletemplatehandle = 128
  1833. Global Const $ofn_explorer = 524288
  1834. Global Const $ofn_extensiondifferent = 1024
  1835. Global Const $ofn_filemustexist = 4096
  1836. Global Const $ofn_forceshowhidden = 268435456
  1837. Global Const $ofn_hidereadonly = 4
  1838. Global Const $ofn_longnames = 2097152
  1839. Global Const $ofn_nochangedir = 8
  1840. Global Const $ofn_nodereferencelinks = 1048576
  1841. Global Const $ofn_nolongnames = 262144
  1842. Global Const $ofn_nonetworkbutton = 131072
  1843. Global Const $ofn_noreadonlyreturn = 32768
  1844. Global Const $ofn_notestfilecreate = 65536
  1845. Global Const $ofn_novalidate = 256
  1846. Global Const $ofn_overwriteprompt = 2
  1847. Global Const $ofn_pathmustexist = 2048
  1848. Global Const $ofn_readonly = 1
  1849. Global Const $ofn_shareaware = 16384
  1850. Global Const $ofn_showhelp = 16
  1851. Global Const $ofn_ex_noplacesbar = 1
  1852. Global Const $std_cut = 0
  1853. Global Const $std_copy = 1
  1854. Global Const $std_paste = 2
  1855. Global Const $std_undo = 3
  1856. Global Const $std_redow = 4
  1857. Global Const $std_delete = 5
  1858. Global Const $std_filenew = 6
  1859. Global Const $std_fileopen = 7
  1860. Global Const $std_filesave = 8
  1861. Global Const $std_printpre = 9
  1862. Global Const $std_properties = 10
  1863. Global Const $std_help = 11
  1864. Global Const $std_find = 12
  1865. Global Const $std_replace = 13
  1866. Global Const $std_print = 14
  1867. Global Const $kb_sendspecial = 0
  1868. Global Const $kb_sendraw = 1
  1869. Global Const $kb_capsoff = 0
  1870. Global Const $kb_capson = 1
  1871. Global Const $s_ok = 0
  1872. Global Const $e_abort = -2147467260
  1873. Global Const $e_accessdenied = -2147024891
  1874. Global Const $e_fail = -2147467259
  1875. Global Const $e_handle = -2147024890
  1876. Global Const $e_invalidarg = -2147024809
  1877. Global Const $e_nointerface = -2147467262
  1878. Global Const $e_notimpl = -2147467263
  1879. Global Const $e_outofmemory = -2147024882
  1880. Global Const $e_pointer = -2147467261
  1881. Global Const $e_unexpected = -2147418113
  1882. #Region Global Variables and Constants
  1883.     Global $__g_venum, $__g_vext = 0
  1884.     Global $__g_irgbmode = 1
  1885.     Global Const $tagosversioninfo = "struct;dword OSVersionInfoSize;dword MajorVersion;dword MinorVersion;dword BuildNumber;dword PlatformId;wchar CSDVersion[128];endstruct"
  1886.     Global Const $image_bitmap = 0
  1887.     Global Const $image_icon = 1
  1888.     Global Const $image_cursor = 2
  1889.     Global Const $image_enhmetafile = 3
  1890.     Global Const $lr_defaultcolor = 0
  1891.     Global Const $lr_monochrome = 1
  1892.     Global Const $lr_color = 2
  1893.     Global Const $lr_copyreturnorg = 4
  1894.     Global Const $lr_copydeleteorg = 8
  1895.     Global Const $lr_loadfromfile = 16
  1896.     Global Const $lr_loadtransparent = 32
  1897.     Global Const $lr_defaultsize = 64
  1898.     Global Const $lr_vgacolor = 128
  1899.     Global Const $lr_loadmap3dcolors = 4096
  1900.     Global Const $lr_createdibsection = 8192
  1901.     Global Const $lr_copyfromresource = 16384
  1902.     Global Const $lr_shared = 32768
  1903.     Global Const $__tagcursorinfo = "dword Size;dword Flags;handle hCursor;" & "struct;long X;long Y;endstruct"
  1904.     Global Const $__winver = __winver()
  1905. #EndRegion Global Variables and Constants
  1906. #Region Functions list
  1907. #EndRegion Functions list
  1908. #Region Public Functions
  1909.  
  1910.     Func _winapi_createfile($sfilename, $icreation, $iaccess = 4, $ishare = 0, $iattributes = 0, $tsecurity = 0)
  1911.         Local $ida = 0, $ism = 0, $icd = 0, $ifa = 0
  1912.         If BitAND($iaccess, 1) <> 0 Then $ida = BitOR($ida, $generic_execute)
  1913.         If BitAND($iaccess, 2) <> 0 Then $ida = BitOR($ida, $generic_read)
  1914.         If BitAND($iaccess, 4) <> 0 Then $ida = BitOR($ida, $generic_write)
  1915.         If BitAND($ishare, 1) <> 0 Then $ism = BitOR($ism, $file_share_delete)
  1916.         If BitAND($ishare, 2) <> 0 Then $ism = BitOR($ism, $file_share_read)
  1917.         If BitAND($ishare, 4) <> 0 Then $ism = BitOR($ism, $file_share_write)
  1918.         Switch $icreation
  1919.             Case 0
  1920.                 $icd = $create_new
  1921.             Case 1
  1922.                 $icd = $create_always
  1923.             Case 2
  1924.                 $icd = $open_existing
  1925.             Case 3
  1926.                 $icd = $open_always
  1927.             Case 4
  1928.                 $icd = $truncate_existing
  1929.         EndSwitch
  1930.         If BitAND($iattributes, 1) <> 0 Then $ifa = BitOR($ifa, $file_attribute_archive)
  1931.         If BitAND($iattributes, 2) <> 0 Then $ifa = BitOR($ifa, $file_attribute_hidden)
  1932.         If BitAND($iattributes, 4) <> 0 Then $ifa = BitOR($ifa, $file_attribute_readonly)
  1933.         If BitAND($iattributes, 8) <> 0 Then $ifa = BitOR($ifa, $file_attribute_system)
  1934.         Local $aresult = DllCall("kernel32.dll", "handle", "CreateFileW", "wstr", $sfilename, "dword", $ida, "dword", $ism, "struct*", $tsecurity, "dword", $icd, "dword", $ifa, "ptr", 0)
  1935.         If @error OR ($aresult[0] = Ptr(-1)) Then Return SetError(@error, @extended, 0)
  1936.         Return $aresult[0]
  1937.     EndFunc
  1938.  
  1939.     Func _winapi_freelibrary($hmodule)
  1940.         Local $aresult = DllCall("kernel32.dll", "bool", "FreeLibrary", "handle", $hmodule)
  1941.         If @error Then Return SetError(@error, @extended, False)
  1942.         Return $aresult[0]
  1943.     EndFunc
  1944.  
  1945.     Func _winapi_getcursorinfo()
  1946.         Local $tcursor = DllStructCreate($__tagcursorinfo)
  1947.         Local $icursor = DllStructGetSize($tcursor)
  1948.         DllStructSetData($tcursor, "Size", $icursor)
  1949.         Local $aret = DllCall("user32.dll", "bool", "GetCursorInfo", "struct*", $tcursor)
  1950.         If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
  1951.         Local $acursor[5]
  1952.         $acursor[0] = True
  1953.         $acursor[1] = DllStructGetData($tcursor, "Flags") <> 0
  1954.         $acursor[2] = DllStructGetData($tcursor, "hCursor")
  1955.         $acursor[3] = DllStructGetData($tcursor, "X")
  1956.         $acursor[4] = DllStructGetData($tcursor, "Y")
  1957.         Return $acursor
  1958.     EndFunc
  1959.  
  1960.     Func _winapi_getdlgctrlid($hwnd)
  1961.         Local $aresult = DllCall("user32.dll", "int", "GetDlgCtrlID", "hwnd", $hwnd)
  1962.         If @error Then Return SetError(@error, @extended, 0)
  1963.         Return $aresult[0]
  1964.     EndFunc
  1965.  
  1966.     Func _winapi_getmodulehandle($smodulename)
  1967.         Local $smodulenametype = "wstr"
  1968.         If $smodulename = "" Then
  1969.             $smodulename = 0
  1970.             $smodulenametype = "ptr"
  1971.         EndIf
  1972.         Local $aresult = DllCall("kernel32.dll", "handle", "GetModuleHandleW", $smodulenametype, $smodulename)
  1973.         If @error Then Return SetError(@error, @extended, 0)
  1974.         Return $aresult[0]
  1975.     EndFunc
  1976.  
  1977.     Func _winapi_getstring($pstring, $bunicode = True)
  1978.         Local $ilength = _winapi_strlen($pstring, $bunicode)
  1979.         If @error OR NOT $ilength Then Return SetError(@error + 10, @extended, "")
  1980.         Local $tstring = DllStructCreate(($bunicode ? "wchar" : "char") & "[" & ($ilength + 1) & "]", $pstring)
  1981.         If @error Then Return SetError(@error, @extended, "")
  1982.         Return SetExtended($ilength, DllStructGetData($tstring, 1))
  1983.     EndFunc
  1984.  
  1985.     Func _winapi_iswow64process($ipid = 0)
  1986.         If NOT $ipid Then $ipid = @AutoItPID
  1987.         Local $hprocess = DllCall("kernel32.dll", "handle", "OpenProcess", "dword", ($__winver < 1536 ? 1024 : 4096), "bool", 0, "dword", $ipid)
  1988.         If @error OR NOT $hprocess[0] Then Return SetError(@error + 20, @extended, False)
  1989.         Local $aret = DllCall("kernel32.dll", "bool", "IsWow64Process", "handle", $hprocess[0], "bool*", 0)
  1990.         If __checkerrorclosehandle($aret, $hprocess[0]) Then Return SetError(@error, @extended, False)
  1991.         Return $aret[2]
  1992.     EndFunc
  1993.  
  1994.     Func _winapi_loadimage($hinstance, $simage, $itype, $ixdesired, $iydesired, $iload)
  1995.         Local $aresult, $simagetype = "int"
  1996.         If IsString($simage) Then $simagetype = "wstr"
  1997.         $aresult = DllCall("user32.dll", "handle", "LoadImageW", "handle", $hinstance, $simagetype, $simage, "uint", $itype, "int", $ixdesired, "int", $iydesired, "uint", $iload)
  1998.         If @error Then Return SetError(@error, @extended, 0)
  1999.         Return $aresult[0]
  2000.     EndFunc
  2001.  
  2002.     Func _winapi_loadlibrary($sfilename)
  2003.         Local $aresult = DllCall("kernel32.dll", "handle", "LoadLibraryW", "wstr", $sfilename)
  2004.         If @error Then Return SetError(@error, @extended, 0)
  2005.         Return $aresult[0]
  2006.     EndFunc
  2007.  
  2008.     Func _winapi_pathisdirectory($sfilepath)
  2009.         Local $aret = DllCall("shlwapi.dll", "bool", "PathIsDirectoryW", "wstr", $sfilepath)
  2010.         If @error Then Return SetError(@error, @extended, False)
  2011.         Return $aret[0]
  2012.     EndFunc
  2013.  
  2014.     Func _winapi_readfile($hfile, $pbuffer, $itoread, ByRef $iread, $toverlapped = 0)
  2015.         Local $aresult = DllCall("kernel32.dll", "bool", "ReadFile", "handle", $hfile, "struct*", $pbuffer, "dword", $itoread, "dword*", 0, "struct*", $toverlapped)
  2016.         If @error Then Return SetError(@error, @extended, False)
  2017.         $iread = $aresult[4]
  2018.         Return $aresult[0]
  2019.     EndFunc
  2020.  
  2021.     Func _winapi_strlen($pstring, $bunicode = True)
  2022.         Local $w = ""
  2023.         If $bunicode Then $w = "W"
  2024.         Local $aret = DllCall("kernel32.dll", "int", "lstrlen" & $w, "struct*", $pstring)
  2025.         If @error Then Return SetError(@error, @extended, 0)
  2026.         Return $aret[0]
  2027.     EndFunc
  2028.  
  2029.     Func _winapi_switchcolor($icolor)
  2030.         If $icolor = -1 Then Return $icolor
  2031.         Return BitOR(BitAND($icolor, 65280), BitShift(BitAND($icolor, 255), -16), BitShift(BitAND($icolor, 16711680), 16))
  2032.     EndFunc
  2033.  
  2034.     Func _winapi_writefile($hfile, $pbuffer, $itowrite, ByRef $iwritten, $toverlapped = 0)
  2035.         Local $aresult = DllCall("kernel32.dll", "bool", "WriteFile", "handle", $hfile, "struct*", $pbuffer, "dword", $itowrite, "dword*", 0, "struct*", $toverlapped)
  2036.         If @error Then Return SetError(@error, @extended, False)
  2037.         $iwritten = $aresult[4]
  2038.         Return $aresult[0]
  2039.     EndFunc
  2040.  
  2041. #EndRegion Public Functions
  2042. #Region Internal Functions
  2043.  
  2044.     Func __checkerrorarraybounds(Const ByRef $adata, ByRef $istart, ByRef $iend, $ndim = 1, $idim = $ubound_dimensions)
  2045.         If NOT IsArray($adata) Then Return SetError(1, 0, 1)
  2046.         If UBound($adata, $idim) <> $ndim Then Return SetError(2, 0, 1)
  2047.         If $istart < 0 Then $istart = 0
  2048.         Local $iubound = UBound($adata) - 1
  2049.         If $iend < 1 OR $iend > $iubound Then $iend = $iubound
  2050.         If $istart > $iend Then Return SetError(4, 0, 1)
  2051.         Return 0
  2052.     EndFunc
  2053.  
  2054.     Func __checkerrorclosehandle($aret, $hfile, $blasterror = False, $icurerr = @error, $icurext = @extended)
  2055.         If NOT $icurerr AND NOT $aret[0] Then $icurerr = 10
  2056.         Local $alasterror = DllCall("kernel32.dll", "dword", "GetLastError")
  2057.         DllCall("kernel32.dll", "bool", "CloseHandle", "handle", $hfile)
  2058.         If $icurerr Then DllCall("kernel32.dll", "none", "SetLastError", "dword", $alasterror[0])
  2059.         If $blasterror Then $icurext = $alasterror[0]
  2060.         Return SetError($icurerr, $icurext, $icurerr)
  2061.     EndFunc
  2062.  
  2063.     Func __dll($spath, $bpin = False)
  2064.         Local $aret = DllCall("kernel32.dll", "bool", "GetModuleHandleExW", "dword", ($bpin ? 1 : 2), "wstr", $spath, "ptr*", 0)
  2065.         If NOT $aret[3] Then
  2066.             Local $aresult = DllCall("kernel32.dll", "handle", "LoadLibraryW", "wstr", $spath)
  2067.             If NOT $aresult[0] Then Return 0
  2068.         EndIf
  2069.         Return 1
  2070.     EndFunc
  2071.  
  2072.     Func __enumwindowsproc($hwnd, $bvisible)
  2073.         Local $aresult
  2074.         If $bvisible Then
  2075.             $aresult = DllCall("user32.dll", "bool", "IsWindowVisible", "hwnd", $hwnd)
  2076.             If NOT $aresult[0] Then
  2077.                 Return 1
  2078.             EndIf
  2079.         EndIf
  2080.         __inc($__g_venum)
  2081.         $__g_venum[$__g_venum[0][0]][0] = $hwnd
  2082.         $aresult = DllCall("user32.dll", "int", "GetClassNameW", "hwnd", $hwnd, "wstr", "", "int", 4096)
  2083.         $__g_venum[$__g_venum[0][0]][1] = $aresult[2]
  2084.         Return 1
  2085.     EndFunc
  2086.  
  2087.     Func __fatalexit($icode, $stext = "")
  2088.         If $stext Then MsgBox($mb_systemmodal, "AutoIt", $stext)
  2089.         DllCall("kernel32.dll", "none", "FatalExit", "int", $icode)
  2090.     EndFunc
  2091.  
  2092.     Func __inc(ByRef $adata, $iincrement = 100)
  2093.         Select
  2094.             Case UBound($adata, $ubound_columns)
  2095.                 If $iincrement < 0 Then
  2096.                     ReDim $adata[$adata[0][0] + 1][UBound($adata, $ubound_columns)]
  2097.                 Else
  2098.                     $adata[0][0] += 1
  2099.                     If $adata[0][0] > UBound($adata) - 1 Then
  2100.                         ReDim $adata[$adata[0][0] + $iincrement][UBound($adata, $ubound_columns)]
  2101.                     EndIf
  2102.                 EndIf
  2103.             Case UBound($adata, $ubound_rows)
  2104.                 If $iincrement < 0 Then
  2105.                     ReDim $adata[$adata[0] + 1]
  2106.                 Else
  2107.                     $adata[0] += 1
  2108.                     If $adata[0] > UBound($adata) - 1 Then
  2109.                         ReDim $adata[$adata[0] + $iincrement]
  2110.                     EndIf
  2111.                 EndIf
  2112.             Case Else
  2113.                 Return 0
  2114.         EndSelect
  2115.         Return 1
  2116.     EndFunc
  2117.  
  2118.     Func __rgb($icolor)
  2119.         If $__g_irgbmode Then
  2120.             $icolor = _winapi_switchcolor($icolor)
  2121.         EndIf
  2122.         Return $icolor
  2123.     EndFunc
  2124.  
  2125.     Func __winver()
  2126.         Local $tosvi = DllStructCreate($tagosversioninfo)
  2127.         DllStructSetData($tosvi, 1, DllStructGetSize($tosvi))
  2128.         Local $aret = DllCall("kernel32.dll", "bool", "GetVersionExW", "struct*", $tosvi)
  2129.         If @error OR NOT $aret[0] Then Return SetError(@error, @extended, 0)
  2130.         Return BitOR(BitShift(DllStructGetData($tosvi, 2), -8), DllStructGetData($tosvi, 3))
  2131.     EndFunc
  2132.  
  2133. #EndRegion Internal Functions
  2134. #Region Global Variables and Constants
  2135. #EndRegion Global Variables and Constants
  2136. #Region Functions list
  2137. #EndRegion Functions list
  2138. #Region Public Functions
  2139.  
  2140.     Func _winapi_chartooem($sstr)
  2141.         Local $aret = DllCall("user32.dll", "bool", "CharToOemW", "wstr", $sstr, "wstr", "")
  2142.         If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, "")
  2143.         Return $aret[2]
  2144.     EndFunc
  2145.  
  2146.     Func _winapi_clienttoscreen($hwnd, ByRef $tpoint)
  2147.         Local $aret = DllCall("user32.dll", "bool", "ClientToScreen", "hwnd", $hwnd, "struct*", $tpoint)
  2148.         If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
  2149.         Return $tpoint
  2150.     EndFunc
  2151.  
  2152.     Func _winapi_dwordtofloat($ivalue)
  2153.         Local $tdword = DllStructCreate("dword")
  2154.         Local $tfloat = DllStructCreate("float", DllStructGetPtr($tdword))
  2155.         DllStructSetData($tdword, 1, $ivalue)
  2156.         Return DllStructGetData($tfloat, 1)
  2157.     EndFunc
  2158.  
  2159.     Func _winapi_dwordtoint($ivalue)
  2160.         Local $tdata = DllStructCreate("int")
  2161.         DllStructSetData($tdata, 1, $ivalue)
  2162.         Return DllStructGetData($tdata, 1)
  2163.     EndFunc
  2164.  
  2165.     Func _winapi_floattodword($ivalue)
  2166.         Local $tfloat = DllStructCreate("float")
  2167.         Local $tdword = DllStructCreate("dword", DllStructGetPtr($tfloat))
  2168.         DllStructSetData($tfloat, 1, $ivalue)
  2169.         Return DllStructGetData($tdword, 1)
  2170.     EndFunc
  2171.  
  2172.     Func _winapi_floattoint($nfloat)
  2173.         Local $tfloat = DllStructCreate("float")
  2174.         Local $tint = DllStructCreate("int", DllStructGetPtr($tfloat))
  2175.         DllStructSetData($tfloat, 1, $nfloat)
  2176.         Return DllStructGetData($tint, 1)
  2177.     EndFunc
  2178.  
  2179.     Func _winapi_getxyfrompoint(ByRef $tpoint, ByRef $ix, ByRef $iy)
  2180.         $ix = DllStructGetData($tpoint, "X")
  2181.         $iy = DllStructGetData($tpoint, "Y")
  2182.     EndFunc
  2183.  
  2184.     Func _winapi_guidfromstring($sguid)
  2185.         Local $tguid = DllStructCreate($tagguid)
  2186.         _winapi_guidfromstringex($sguid, $tguid)
  2187.         If @error Then Return SetError(@error + 10, @extended, 0)
  2188.         Return $tguid
  2189.     EndFunc
  2190.  
  2191.     Func _winapi_guidfromstringex($sguid, $tguid)
  2192.         Local $aresult = DllCall("ole32.dll", "long", "CLSIDFromString", "wstr", $sguid, "struct*", $tguid)
  2193.         If @error Then Return SetError(@error, @extended, False)
  2194.         Return $aresult[0]
  2195.     EndFunc
  2196.  
  2197.     Func _winapi_hashdata($pmemory, $isize, $ilength = 32)
  2198.         If ($ilength <= 0) OR ($ilength > 256) Then Return SetError(11, 0, 0)
  2199.         Local $tdata = DllStructCreate("byte[" & $ilength & "]")
  2200.         Local $aret = DllCall("shlwapi.dll", "uint", "HashData", "struct*", $pmemory, "dword", $isize, "struct*", $tdata, "dword", $ilength)
  2201.         If @error Then Return SetError(@error, @extended, 0)
  2202.         If $aret[0] Then Return SetError(10, $aret[0], 0)
  2203.         Return DllStructGetData($tdata, 1)
  2204.     EndFunc
  2205.  
  2206.     Func _winapi_hashstring($sstring, $bcasesensitive = True, $ilength = 32)
  2207.         Local $ilengths = StringLen($sstring)
  2208.         If NOT $ilengths OR ($ilength > 256) Then Return SetError(12, 0, 0)
  2209.         Local $tstring = DllStructCreate("wchar[" & ($ilengths + 1) & "]")
  2210.         If NOT $bcasesensitive Then
  2211.             $sstring = StringLower($sstring)
  2212.         EndIf
  2213.         DllStructSetData($tstring, 1, $sstring)
  2214.         Local $shash = _winapi_hashdata($tstring, 2 * $ilengths, $ilength)
  2215.         If @error Then Return SetError(@error, @extended, 0)
  2216.         Return $shash
  2217.     EndFunc
  2218.  
  2219.     Func _winapi_hibyte($ivalue)
  2220.         Return BitAND(BitShift($ivalue, 8), 255)
  2221.     EndFunc
  2222.  
  2223.     Func _winapi_hidword($ivalue)
  2224.         Local $tint64 = DllStructCreate("int64")
  2225.         Local $tqword = DllStructCreate("dword;dword", DllStructGetPtr($tint64))
  2226.         DllStructSetData($tint64, 1, $ivalue)
  2227.         Return DllStructGetData($tqword, 2)
  2228.     EndFunc
  2229.  
  2230.     Func _winapi_hiword($ilong)
  2231.         Return BitShift($ilong, 16)
  2232.     EndFunc
  2233.  
  2234.     Func _winapi_inttodword($ivalue)
  2235.         Local $tdata = DllStructCreate("dword")
  2236.         DllStructSetData($tdata, 1, $ivalue)
  2237.         Return DllStructGetData($tdata, 1)
  2238.     EndFunc
  2239.  
  2240.     Func _winapi_inttofloat($iint)
  2241.         Local $tint = DllStructCreate("int")
  2242.         Local $tfloat = DllStructCreate("float", DllStructGetPtr($tint))
  2243.         DllStructSetData($tint, 1, $iint)
  2244.         Return DllStructGetData($tfloat, 1)
  2245.     EndFunc
  2246.  
  2247.     Func _winapi_lobyte($ivalue)
  2248.         Return BitAND($ivalue, 255)
  2249.     EndFunc
  2250.  
  2251.     Func _winapi_lodword($ivalue)
  2252.         Local $tint64 = DllStructCreate("int64")
  2253.         Local $tqword = DllStructCreate("dword;dword", DllStructGetPtr($tint64))
  2254.         DllStructSetData($tint64, 1, $ivalue)
  2255.         Return DllStructGetData($tqword, 1)
  2256.     EndFunc
  2257.  
  2258.     Func _winapi_loword($ilong)
  2259.         Return BitAND($ilong, 65535)
  2260.     EndFunc
  2261.  
  2262.     Func _winapi_longmid($ivalue, $istart, $icount)
  2263.         Return BitAND(BitShift($ivalue, $istart), BitOR(BitShift(BitShift(2147483647, 32 - ($icount + 1)), 1), BitShift(1, -($icount - 1))))
  2264.     EndFunc
  2265.  
  2266.     Func _winapi_makelangid($ilngidprimary, $ilngidsub)
  2267.         Return BitOR(BitShift($ilngidsub, -10), $ilngidprimary)
  2268.     EndFunc
  2269.  
  2270.     Func _winapi_makelcid($ilngid, $isortid)
  2271.         Return BitOR(BitShift($isortid, -16), $ilngid)
  2272.     EndFunc
  2273.  
  2274.     Func _winapi_makelong($ilo, $ihi)
  2275.         Return BitOR(BitShift($ihi, -16), BitAND($ilo, 65535))
  2276.     EndFunc
  2277.  
  2278.     Func _winapi_makeqword($ilodword, $ihidword)
  2279.         Local $tint64 = DllStructCreate("uint64")
  2280.         Local $tdwords = DllStructCreate("dword;dword", DllStructGetPtr($tint64))
  2281.         DllStructSetData($tdwords, 1, $ilodword)
  2282.         DllStructSetData($tdwords, 2, $ihidword)
  2283.         Return DllStructGetData($tint64, 1)
  2284.     EndFunc
  2285.  
  2286.     Func _winapi_makeword($ilo, $ihi)
  2287.         Local $tword = DllStructCreate("ushort")
  2288.         Local $tbyte = DllStructCreate("byte;byte", DllStructGetPtr($tword))
  2289.         DllStructSetData($tbyte, 1, $ihi)
  2290.         DllStructSetData($tbyte, 2, $ilo)
  2291.         Return DllStructGetData($tword, 1)
  2292.     EndFunc
  2293.  
  2294.     Func _winapi_multibytetowidechar($vtext, $icodepage = 0, $iflags = 0, $bretstring = False)
  2295.         Local $stexttype = "str"
  2296.         If NOT IsString($vtext) Then $stexttype = "struct*"
  2297.         Local $aresult = DllCall("kernel32.dll", "int", "MultiByteToWideChar", "uint", $icodepage, "dword", $iflags, $stexttype, $vtext, "int", -1, "ptr", 0, "int", 0)
  2298.         If @error OR NOT $aresult[0] Then Return SetError(@error + 10, @extended, 0)
  2299.         Local $iout = $aresult[0]
  2300.         Local $tout = DllStructCreate("wchar[" & $iout & "]")
  2301.         $aresult = DllCall("kernel32.dll", "int", "MultiByteToWideChar", "uint", $icodepage, "dword", $iflags, $stexttype, $vtext, "int", -1, "struct*", $tout, "int", $iout)
  2302.         If @error OR NOT $aresult[0] Then Return SetError(@error + 20, @extended, 0)
  2303.         If $bretstring Then Return DllStructGetData($tout, 1)
  2304.         Return $tout
  2305.     EndFunc
  2306.  
  2307.     Func _winapi_multibytetowidecharex($stext, $ptext, $icodepage = 0, $iflags = 0)
  2308.         Local $aresult = DllCall("kernel32.dll", "int", "MultiByteToWideChar", "uint", $icodepage, "dword", $iflags, "STR", $stext, "int", -1, "struct*", $ptext, "int", (StringLen($stext) + 1) * 2)
  2309.         If @error Then Return SetError(@error, @extended, False)
  2310.         Return $aresult[0]
  2311.     EndFunc
  2312.  
  2313.     Func _winapi_oemtochar($sstr)
  2314.         Local $aret = DllCall("user32.dll", "bool", "OemToChar", "str", $sstr, "str", "")
  2315.         If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, "")
  2316.         Return $aret[2]
  2317.     EndFunc
  2318.  
  2319.     Func _winapi_pointfromrect(ByRef $trect, $bcenter = True)
  2320.         Local $ix1 = DllStructGetData($trect, "Left")
  2321.         Local $iy1 = DllStructGetData($trect, "Top")
  2322.         Local $ix2 = DllStructGetData($trect, "Right")
  2323.         Local $iy2 = DllStructGetData($trect, "Bottom")
  2324.         If $bcenter Then
  2325.             $ix1 = $ix1 + (($ix2 - $ix1) / 2)
  2326.             $iy1 = $iy1 + (($iy2 - $iy1) / 2)
  2327.         EndIf
  2328.         Local $tpoint = DllStructCreate($tagpoint)
  2329.         DllStructSetData($tpoint, "X", $ix1)
  2330.         DllStructSetData($tpoint, "Y", $iy1)
  2331.         Return $tpoint
  2332.     EndFunc
  2333.  
  2334.     Func _winapi_primarylangid($ilngid)
  2335.         Return BitAND($ilngid, 1023)
  2336.     EndFunc
  2337.  
  2338.     Func _winapi_screentoclient($hwnd, ByRef $tpoint)
  2339.         Local $aresult = DllCall("user32.dll", "bool", "ScreenToClient", "hwnd", $hwnd, "struct*", $tpoint)
  2340.         If @error Then Return SetError(@error, @extended, False)
  2341.         Return $aresult[0]
  2342.     EndFunc
  2343.  
  2344.     Func _winapi_shorttoword($ivalue)
  2345.         Return BitAND($ivalue, 65535)
  2346.     EndFunc
  2347.  
  2348.     Func _winapi_strformatbytesize($isize)
  2349.         Local $aret = DllCall("shlwapi.dll", "ptr", "StrFormatByteSizeW", "int64", $isize, "wstr", "", "uint", 1024)
  2350.         If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, "")
  2351.         Return $aret[2]
  2352.     EndFunc
  2353.  
  2354.     Func _winapi_strformatbytesizeex($isize)
  2355.         Local $asymbol = DllCall("kernel32.dll", "int", "GetLocaleInfoW", "dword", 1024, "dword", 15, "wstr", "", "int", 2048)
  2356.         If @error Then Return SetError(@error + 10, @extended, "")
  2357.         Local $ssize = _winapi_strformatbytesize(0)
  2358.         If @error Then Return SetError(@error, @extended, "")
  2359.         Return StringReplace($ssize, "0", StringRegExpReplace(Number($isize), "(?<=\d)(?=(\d{3})+\z)", $asymbol[3]))
  2360.     EndFunc
  2361.  
  2362.     Func _winapi_strformatkbsize($isize)
  2363.         Local $aret = DllCall("shlwapi.dll", "ptr", "StrFormatKBSizeW", "int64", $isize, "wstr", "", "uint", 1024)
  2364.         If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, "")
  2365.         Return $aret[2]
  2366.     EndFunc
  2367.  
  2368.     Func _winapi_strfromtimeinterval($itime, $idigits = 7)
  2369.         Local $aret = DllCall("shlwapi.dll", "int", "StrFromTimeIntervalW", "wstr", "", "uint", 1024, "dword", $itime, "int", $idigits)
  2370.         If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, "")
  2371.         Return StringStripWS($aret[1], $str_stripleading + $str_striptrailing)
  2372.     EndFunc
  2373.  
  2374.     Func _winapi_stringfromguid($tguid)
  2375.         Local $aresult = DllCall("ole32.dll", "int", "StringFromGUID2", "struct*", $tguid, "wstr", "", "int", 40)
  2376.         If @error OR NOT $aresult[0] Then Return SetError(@error, @extended, "")
  2377.         Return SetExtended($aresult[0], $aresult[2])
  2378.     EndFunc
  2379.  
  2380.     Func _winapi_sublangid($ilngid)
  2381.         Return BitShift($ilngid, 10)
  2382.     EndFunc
  2383.  
  2384.     Func _winapi_swapdword($ivalue)
  2385.         Local $tstruct1 = DllStructCreate("dword;dword")
  2386.         Local $tstruct2 = DllStructCreate("byte[4];byte[4]", DllStructGetPtr($tstruct1))
  2387.         DllStructSetData($tstruct1, 1, $ivalue)
  2388.         For $i = 1 To 4
  2389.             DllStructSetData($tstruct2, 2, DllStructGetData($tstruct2, 1, 5 - $i), $i)
  2390.         Next
  2391.         Return DllStructGetData($tstruct1, 2)
  2392.     EndFunc
  2393.  
  2394.     Func _winapi_swapqword($ivalue)
  2395.         Local $tstruct1 = DllStructCreate("int64;int64")
  2396.         Local $tstruct2 = DllStructCreate("byte[8];byte[8]", DllStructGetPtr($tstruct1))
  2397.         DllStructSetData($tstruct1, 1, $ivalue)
  2398.         For $i = 1 To 8
  2399.             DllStructSetData($tstruct2, 2, DllStructGetData($tstruct2, 1, 9 - $i), $i)
  2400.         Next
  2401.         Return DllStructGetData($tstruct1, 2)
  2402.     EndFunc
  2403.  
  2404.     Func _winapi_swapword($ivalue)
  2405.         Local $tstruct1 = DllStructCreate("word;word")
  2406.         Local $tstruct2 = DllStructCreate("byte[2];byte[2]", DllStructGetPtr($tstruct1))
  2407.         DllStructSetData($tstruct1, 1, $ivalue)
  2408.         For $i = 1 To 2
  2409.             DllStructSetData($tstruct2, 2, DllStructGetData($tstruct2, 1, 3 - $i), $i)
  2410.         Next
  2411.         Return DllStructGetData($tstruct1, 2)
  2412.     EndFunc
  2413.  
  2414.     Func _winapi_widechartomultibyte($vunicode, $icodepage = 0, $bretnostruct = True, $bretbinary = False)
  2415.         Local $sunicodetype = "wstr"
  2416.         If NOT IsString($vunicode) Then $sunicodetype = "struct*"
  2417.         Local $aresult = DllCall("kernel32.dll", "int", "WideCharToMultiByte", "uint", $icodepage, "dword", 0, $sunicodetype, $vunicode, "int", -1, "ptr", 0, "int", 0, "ptr", 0, "ptr", 0)
  2418.         If @error OR NOT $aresult[0] Then Return SetError(@error + 20, @extended, "")
  2419.         Local $tmultibyte = DllStructCreate((($bretbinary) ? ("byte") : ("char")) & "[" & $aresult[0] & "]")
  2420.         $aresult = DllCall("kernel32.dll", "int", "WideCharToMultiByte", "uint", $icodepage, "dword", 0, $sunicodetype, $vunicode, "int", -1, "struct*", $tmultibyte, "int", $aresult[0], "ptr", 0, "ptr", 0)
  2421.         If @error OR NOT $aresult[0] Then Return SetError(@error + 10, @extended, "")
  2422.         If $bretnostruct Then Return DllStructGetData($tmultibyte, 1)
  2423.         Return $tmultibyte
  2424.     EndFunc
  2425.  
  2426.     Func _winapi_wordtoshort($ivalue)
  2427.         If BitAND($ivalue, 32768) Then
  2428.             Return BitOR($ivalue, -32768)
  2429.         EndIf
  2430.         Return BitAND($ivalue, 32767)
  2431.     EndFunc
  2432.  
  2433. #EndRegion Public Functions
  2434. Global Const $__dlg_wm_user = 1024
  2435. Global Const $bif_browsefilejunctions = 65536
  2436. Global Const $bif_browseforcomputer = 4096
  2437. Global Const $bif_browseforprinter = 8192
  2438. Global Const $bif_browseincludefiles = 16384
  2439. Global Const $bif_browseincludeurls = 128
  2440. Global Const $bif_dontgobelowdomain = 2
  2441. Global Const $bif_editbox = 16
  2442. Global Const $bif_newdialogstyle = 64
  2443. Global Const $bif_nonewfolderbutton = 512
  2444. Global Const $bif_notranslatetargets = 1024
  2445. Global Const $bif_returnfsancestors = 8
  2446. Global Const $bif_returnonlyfsdirs = 1
  2447. Global Const $bif_shareable = 32768
  2448. Global Const $bif_statustext = 4
  2449. Global Const $bif_usenewui = BitOR($bif_editbox, $bif_newdialogstyle)
  2450. Global Const $bif_uahint = 256
  2451. Global Const $bif_validate = 32
  2452. Global Const $bffm_initialized = 1
  2453. Global Const $bffm_iunknown = 5
  2454. Global Const $bffm_selchanged = 2
  2455. Global Const $bffm_validatefailed = 4
  2456. Global Const $bffm_setstatustexta = $__dlg_wm_user + 100
  2457. Global Const $bffm_enableok = $__dlg_wm_user + 101
  2458. Global Const $bffm_setselectiona = $__dlg_wm_user + 102
  2459. Global Const $bffm_setselectionw = $__dlg_wm_user + 103
  2460. Global Const $bffm_setstatustextw = $__dlg_wm_user + 104
  2461. Global Const $bffm_setoktext = $__dlg_wm_user + 105
  2462. Global Const $bffm_setexpanded = $__dlg_wm_user + 106
  2463. Global Const $cderr_dialogfailure = 65535
  2464. Global Const $cderr_findresfailure = 6
  2465. Global Const $cderr_initialization = 2
  2466. Global Const $cderr_loadresfailure = 7
  2467. Global Const $cderr_loadstrfailure = 5
  2468. Global Const $cderr_lockresfailure = 8
  2469. Global Const $cderr_memallocfailure = 9
  2470. Global Const $cderr_memlockfailure = 10
  2471. Global Const $cderr_nohinstance = 4
  2472. Global Const $cderr_nohook = 11
  2473. Global Const $cderr_notemplate = 3
  2474. Global Const $cderr_registermsgfail = 12
  2475. Global Const $cderr_structsize = 1
  2476. Global Const $pderr_createicfailure = 4106
  2477. Global Const $pderr_defaultdifferent = 4108
  2478. Global Const $pderr_dndmmismatch = 4105
  2479. Global Const $pderr_getdevmodefail = 4101
  2480. Global Const $pderr_initfailure = 4102
  2481. Global Const $pderr_loaddrvfailure = 4100
  2482. Global Const $pderr_nodefaultprn = 4104
  2483. Global Const $pderr_nodevices = 4103
  2484. Global Const $pderr_parsefailure = 4098
  2485. Global Const $pderr_printernotfound = 4107
  2486. Global Const $pderr_retdeffailure = 4099
  2487. Global Const $pderr_setupfailure = 4097
  2488. Global Const $cferr_maxlessthanmin = 8194
  2489. Global Const $cferr_nofonts = 8193
  2490. Global Const $fnerr_buffertoosmall = 12291
  2491. Global Const $fnerr_invalidfilename = 12290
  2492. Global Const $fnerr_subclassfailure = 12289
  2493. Global Const $frerr_bufferlengthzero = 16385
  2494. Global Const $fr_dialogterm = 64
  2495. Global Const $fr_down = 1
  2496. Global Const $fr_enablehook = 256
  2497. Global Const $fr_enabletemplate = 512
  2498. Global Const $fr_enabletemplatehandle = 8192
  2499. Global Const $fr_findnext = 8
  2500. Global Const $fr_hideupdown = 16384
  2501. Global Const $fr_hidematchcase = 32768
  2502. Global Const $fr_hidewholeword = 65536
  2503. Global Const $fr_matchcase = 4
  2504. Global Const $fr_nomatchcase = 2048
  2505. Global Const $fr_noupdown = 1024
  2506. Global Const $fr_nowholeword = 4096
  2507. Global Const $fr_replace = 16
  2508. Global Const $fr_replaceall = 32
  2509. Global Const $fr_showhelp = 128
  2510. Global Const $fr_wholeword = 2
  2511. Global Const $shfmt_id_default = 65535
  2512. Global Const $shfmt_opt_full = 0
  2513. Global Const $shfmt_opt_quickformat = 1
  2514. Global Const $shfmt_opt_sysonly = 2
  2515. Global Const $shfmt_error = -1
  2516. Global Const $shfmt_cancel = -2
  2517. Global Const $shfmt_noformat = -3
  2518. Global Const $cdm_first = $__dlg_wm_user + 100
  2519. Global Const $cdm_getspec = $cdm_first
  2520. Global Const $cdm_getfilepath = $cdm_first + 1
  2521. Global Const $cdm_getfolderpath = $cdm_first + 2
  2522. Global Const $cdm_getfolderidlist = $cdm_first + 3
  2523. Global Const $cdm_setcontroltext = $cdm_first + 4
  2524. Global Const $cdm_hidecontrol = $cdm_first + 5
  2525. Global Const $cdm_setdefext = $cdm_first + 6
  2526. Global Const $cdm_last = $__dlg_wm_user + 200
  2527. Global Const $cdn_first = -601
  2528. Global Const $cdn_initdone = $cdn_first
  2529. Global Const $cdn_selchange = $cdn_first - 1
  2530. Global Const $cdn_folderchange = $cdn_first - 2
  2531. Global Const $cdn_shareviolation = $cdn_first - 3
  2532. Global Const $cdn_help = $cdn_first - 4
  2533. Global Const $cdn_fileok = $cdn_first - 5
  2534. Global Const $cdn_typechange = $cdn_first - 6
  2535. Global Const $cdn_includeitem = $cdn_first - 7
  2536. Global Const $cdn_last = -699
  2537. Global Const $psd_defaultminmargins = 0
  2538. Global Const $psd_disablemargins = 16
  2539. Global Const $psd_disableorientation = 256
  2540. Global Const $psd_disablepagepainting = 524288
  2541. Global Const $psd_disablepaper = 512
  2542. Global Const $psd_disableprinter = 32
  2543. Global Const $psd_enablepagepainthook = 262144
  2544. Global Const $psd_enablepagesetuphook = 8192
  2545. Global Const $psd_enablepagesetuptemplate = 32768
  2546. Global Const $psd_enablepagesetuptemplatehandle = 131072
  2547. Global Const $psd_inhundredthsofmillimeters = 8
  2548. Global Const $psd_inthousandthsofinches = 4
  2549. Global Const $psd_margins = 2
  2550. Global Const $psd_minmargins = 1
  2551. Global Const $psd_nonetworkbutton = 2097152
  2552. Global Const $psd_nowarning = 128
  2553. Global Const $psd_returndefault = 1024
  2554. Global Const $psd_showhelp = 2048
  2555. Global Const $wm_psd_pagesetupdlg = $__dlg_wm_user
  2556. Global Const $wm_psd_fullpagerect = $__dlg_wm_user + 1
  2557. Global Const $wm_psd_minmarginrect = $__dlg_wm_user + 2
  2558. Global Const $wm_psd_marginrect = $__dlg_wm_user + 3
  2559. Global Const $wm_psd_greektextrect = $__dlg_wm_user + 4
  2560. Global Const $wm_psd_envstamprect = $__dlg_wm_user + 5
  2561. Global Const $wm_psd_yafullpagerect = $__dlg_wm_user + 6
  2562. Global Const $pd_allpages = 0
  2563. Global Const $pd_collate = 16
  2564. Global Const $pd_currentpage = 4194304
  2565. Global Const $pd_disableprinttofile = 524288
  2566. Global Const $pd_enableprinthook = 4096
  2567. Global Const $pd_enableprinttemplate = 16384
  2568. Global Const $pd_enableprinttemplatehandle = 65536
  2569. Global Const $pd_enablesetuphook = 8192
  2570. Global Const $pd_enablesetuptemplate = 32768
  2571. Global Const $pd_enablesetuptemplatehandle = 131072
  2572. Global Const $pd_exclusionflags = 16777216
  2573. Global Const $pd_hideprinttofile = 1048576
  2574. Global Const $pd_nocurrentpage = 8388608
  2575. Global Const $pd_nonetworkbutton = 2097152
  2576. Global Const $pd_nopagenums = 8
  2577. Global Const $pd_noselection = 4
  2578. Global Const $pd_nowarning = 128
  2579. Global Const $pd_pagenums = 2
  2580. Global Const $pd_printsetup = 64
  2581. Global Const $pd_printtofile = 32
  2582. Global Const $pd_returndc = 256
  2583. Global Const $pd_returndefault = 1024
  2584. Global Const $pd_returnic = 512
  2585. Global Const $pd_selection = 1
  2586. Global Const $pd_showhelp = 2048
  2587. Global Const $pd_usedevmodecopies = 262144
  2588. Global Const $pd_usedevmodecopiesandcollate = $pd_usedevmodecopies
  2589. Global Const $pd_uselargetemplate = 268435456
  2590. Global Const $pd_result_apply = 2
  2591. Global Const $pd_result_cancel = 0
  2592. Global Const $pd_result_print = 1
  2593. Global Const $ewx_logoff = 0
  2594. Global Const $ewx_poweroff = 8
  2595. Global Const $ewx_reboot = 2
  2596. Global Const $ewx_shutdown = 1
  2597. Global Const $ewx_force = 4
  2598. Global Const $ewx_forceifhung = 16
  2599. Global Const $oaif_allow_registration = 1
  2600. Global Const $oaif_register_ext = 2
  2601. Global Const $oaif_exec = 4
  2602. Global Const $oaif_force_registration = 8
  2603. Global Const $oaif_hide_registration = 32
  2604. Global Const $oaif_url_protocol = 64
  2605. Global Const $credui_flags_always_show_ui = 128
  2606. Global Const $credui_flags_complete_username = 2048
  2607. Global Const $credui_flags_do_not_persist = 2
  2608. Global Const $credui_flags_exclude_certificates = 8
  2609. Global Const $credui_flags_expect_confirmation = 131072
  2610. Global Const $credui_flags_generic_credentials = 262144
  2611. Global Const $credui_flags_incorrect_password = 1
  2612. Global Const $credui_flags_keep_username = 1048576
  2613. Global Const $credui_flags_password_only_ok = 512
  2614. Global Const $credui_flags_persist = 4096
  2615. Global Const $credui_flags_request_administrator = 4
  2616. Global Const $credui_flags_require_certificate = 16
  2617. Global Const $credui_flags_require_smartcard = 256
  2618. Global Const $credui_flags_server_credential = 16384
  2619. Global Const $credui_flags_show_save_check_box = 64
  2620. Global Const $credui_flags_username_target_credentials = 524288
  2621. Global Const $credui_flags_validate_username = 1024
  2622. Global Const $creduiwin_authpackage_only = 16
  2623. Global Const $creduiwin_checkbox = 2
  2624. Global Const $creduiwin_enumerate_admins = 256
  2625. Global Const $creduiwin_enumerate_current_user = 512
  2626. Global Const $creduiwin_generic = 1
  2627. Global Const $creduiwin_in_cred_only = 32
  2628. Global Const $creduiwin_secure_prompt = 4096
  2629. Global Const $creduiwin_pack_32_wow = 268435456
  2630. Global Const $creduiwin_preprompting = 8192
  2631. Global Const $coinit_apartmentthreaded = 2
  2632. Global Const $coinit_disable_ole1dde = 4
  2633. Global Const $coinit_multithreaded = 0
  2634. Global Const $coinit_speed_over_memory = 8
  2635. #Region Global Variables and Constants
  2636.     Global Const $__tagwinapicom_guid = "struct;ulong Data1;ushort Data2;ushort Data3;byte Data4[8];endstruct"
  2637. #EndRegion Global Variables and Constants
  2638. #Region Functions list
  2639. #EndRegion Functions list
  2640. #Region Public Functions
  2641.  
  2642.     Func _winapi_clsidfromprogid($sprogid)
  2643.         Local $tguid = DllStructCreate($__tagwinapicom_guid)
  2644.         Local $areturn = DllCall("ole32.dll", "long", "CLSIDFromProgID", "wstr", $sprogid, "struct*", $tguid)
  2645.         If @error Then Return SetError(@error, @extended, "")
  2646.         If $areturn[0] Then Return SetError(10, $areturn[0], "")
  2647.         $areturn = DllCall("ole32.dll", "int", "StringFromGUID2", "struct*", $tguid, "wstr", "", "int", 39)
  2648.         If @error OR NOT $areturn[0] Then Return SetError(@error + 20, @extended, "")
  2649.         Return $areturn[2]
  2650.     EndFunc
  2651.  
  2652.     Func _winapi_coinitialize($iflags = 0)
  2653.         Local $areturn = DllCall("ole32.dll", "long", "CoInitializeEx", "ptr", 0, "dword", $iflags)
  2654.         If @error Then Return SetError(@error, @extended, 0)
  2655.         If $areturn[0] Then Return SetError(10, $areturn[0], 0)
  2656.         Return 1
  2657.     EndFunc
  2658.  
  2659.     Func _winapi_cotaskmemalloc($isize)
  2660.         Local $areturn = DllCall("ole32.dll", "ptr", "CoTaskMemAlloc", "uint_ptr", $isize)
  2661.         If @error Then Return SetError(@error, @extended, 0)
  2662.         Return $areturn[0]
  2663.     EndFunc
  2664.  
  2665.     Func _winapi_cotaskmemfree($pmemory)
  2666.         DllCall("ole32.dll", "none", "CoTaskMemFree", "ptr", $pmemory)
  2667.         If @error Then Return SetError(@error, @extended, 0)
  2668.         Return 1
  2669.     EndFunc
  2670.  
  2671.     Func _winapi_cotaskmemrealloc($pmemory, $isize)
  2672.         Local $areturn = DllCall("ole32.dll", "ptr", "CoTaskMemRealloc", "ptr", $pmemory, "ulong_ptr", $isize)
  2673.         If @error Then Return SetError(@error, @extended, 0)
  2674.         Return $areturn[0]
  2675.     EndFunc
  2676.  
  2677.     Func _winapi_couninitialize()
  2678.         DllCall("ole32.dll", "none", "CoUninitialize")
  2679.         If @error Then Return SetError(@error, @extended, 0)
  2680.         Return 1
  2681.     EndFunc
  2682.  
  2683.     Func _winapi_createguid()
  2684.         Local $tguid = DllStructCreate($__tagwinapicom_guid)
  2685.         Local $areturn = DllCall("ole32.dll", "long", "CoCreateGuid", "struct*", $tguid)
  2686.         If @error Then Return SetError(@error, @extended, "")
  2687.         If $areturn[0] Then Return SetError(10, $areturn[0], "")
  2688.         $areturn = DllCall("ole32.dll", "int", "StringFromGUID2", "struct*", $tguid, "wstr", "", "int", 65536)
  2689.         If @error OR NOT $areturn[0] Then Return SetError(@error + 20, @extended, "")
  2690.         Return $areturn[2]
  2691.     EndFunc
  2692.  
  2693.     Func _winapi_createstreamonhglobal($hglobal = 0, $bdeleteonrelease = True)
  2694.         Local $areturn = DllCall("ole32.dll", "long", "CreateStreamOnHGlobal", "handle", $hglobal, "bool", $bdeleteonrelease, "ptr*", 0)
  2695.         If @error Then Return SetError(@error, @extended, 0)
  2696.         If $areturn[0] Then Return SetError(10, $areturn[0], 0)
  2697.         Return $areturn[3]
  2698.     EndFunc
  2699.  
  2700.     Func _winapi_gethglobalfromstream($pstream)
  2701.         Local $areturn = DllCall("ole32.dll", "uint", "GetHGlobalFromStream", "ptr", $pstream, "ptr*", 0)
  2702.         If @error Then Return SetError(@error, @extended, 0)
  2703.         If $areturn[0] Then Return SetError(10, $areturn[0], 0)
  2704.         Return $areturn[2]
  2705.     EndFunc
  2706.  
  2707.     Func _winapi_progidfromclsid($sclsid)
  2708.         Local $tguid = DllStructCreate($__tagwinapicom_guid)
  2709.         Local $areturn = DllCall("ole32.dll", "uint", "CLSIDFromString", "wstr", $sclsid, "struct*", $tguid)
  2710.         If @error OR $areturn[0] Then Return SetError(@error + 20, @extended, "")
  2711.         $areturn = DllCall("ole32.dll", "uint", "ProgIDFromCLSID", "struct*", $tguid, "ptr*", 0)
  2712.         If @error Then Return SetError(@error, @extended, "")
  2713.         If $areturn[0] Then Return SetError(10, $areturn[0], "")
  2714.         Local $sid = _winapi_getstring($areturn[2])
  2715.         _winapi_cotaskmemfree($areturn[2])
  2716.         Return $sid
  2717.     EndFunc
  2718.  
  2719.     Func _winapi_releasestream($pstream)
  2720.         Local $areturn = DllCall("oleaut32.dll", "long", "DispCallFunc", "ptr", $pstream, "ulong_ptr", 8 * (1 + @AutoItX64), "uint", 4, "ushort", 23, "uint", 0, "ptr", 0, "ptr", 0, "str", "")
  2721.         If @error Then Return SetError(@error, @extended, 0)
  2722.         If $areturn[0] Then Return SetError(10, $areturn[0], 0)
  2723.         Return 1
  2724.     EndFunc
  2725.  
  2726. #EndRegion Public Functions
  2727. #Region Global Variables and Constants
  2728.     Global $__g_hheap = 0
  2729. #EndRegion Global Variables and Constants
  2730. #Region Functions list
  2731. #EndRegion Functions list
  2732. #Region Public Functions
  2733.  
  2734.     Func _winapi_createbuffer($ilength, $pbuffer = 0, $babort = True)
  2735.         $pbuffer = __heaprealloc($pbuffer, $ilength, 0, $babort)
  2736.         If @error Then Return SetError(@error, @extended, 0)
  2737.         Return $pbuffer
  2738.     EndFunc
  2739.  
  2740.     Func _winapi_createbufferfromstruct($tstruct, $pbuffer = 0, $babort = True)
  2741.         If NOT IsDllStruct($tstruct) Then Return SetError(1, 0, 0)
  2742.         $pbuffer = __heaprealloc($pbuffer, DllStructGetSize($tstruct), 0, $babort)
  2743.         If @error Then Return SetError(@error + 100, @extended, 0)
  2744.         _winapi_movememory($pbuffer, $tstruct, DllStructGetSize($tstruct))
  2745.         Return $pbuffer
  2746.     EndFunc
  2747.  
  2748.     Func _winapi_createstring($sstring, $pstring = 0, $ilength = -1, $bunicode = True, $babort = True)
  2749.         $ilength = Number($ilength)
  2750.         If $ilength >= 0 Then
  2751.             $sstring = StringLeft($sstring, $ilength)
  2752.         Else
  2753.             $ilength = StringLen($sstring)
  2754.         EndIf
  2755.         Local $isize = $ilength + 1
  2756.         If $bunicode Then
  2757.             $isize *= 2
  2758.         EndIf
  2759.         $pstring = __heaprealloc($pstring, $isize, 0, $babort)
  2760.         If @error Then Return SetError(@error, @extended, 0)
  2761.         DllStructSetData(DllStructCreate(($bunicode ? "wchar" : "char") & "[" & ($ilength + 1) & "]", $pstring), 1, $sstring)
  2762.         Return SetExtended($ilength, $pstring)
  2763.     EndFunc
  2764.  
  2765.     Func _winapi_equalmemory($psource1, $psource2, $ilength)
  2766.         If _winapi_isbadreadptr($psource1, $ilength) Then Return SetError(11, @extended, 0)
  2767.         If _winapi_isbadreadptr($psource2, $ilength) Then Return SetError(12, @extended, 0)
  2768.         Local $aret = DllCall("ntdll.dll", "ulong_ptr", "RtlCompareMemory", "struct*", $psource1, "struct*", $psource2, "ulong_ptr", $ilength)
  2769.         If @error Then Return SetError(@error, @extended, 0)
  2770.         Return Number($aret[0] = $ilength)
  2771.     EndFunc
  2772.  
  2773.     Func _winapi_fillmemory($pmemory, $ilength, $ivalue = 0)
  2774.         If _winapi_isbadwriteptr($pmemory, $ilength) Then Return SetError(11, @extended, 0)
  2775.         DllCall("ntdll.dll", "none", "RtlFillMemory", "struct*", $pmemory, "ulong_ptr", $ilength, "byte", $ivalue)
  2776.         If @error Then Return SetError(@error, @extended, 0)
  2777.         Return 1
  2778.     EndFunc
  2779.  
  2780.     Func _winapi_freememory($pmemory)
  2781.         If NOT __heapfree($pmemory, 1) Then Return SetError(@error, @extended, 0)
  2782.         Return 1
  2783.     EndFunc
  2784.  
  2785.     Func _winapi_getmemorysize($pmemory)
  2786.         Local $iresult = __heapsize($pmemory, 1)
  2787.         If @error Then Return SetError(@error, @extended, 0)
  2788.         Return $iresult
  2789.     EndFunc
  2790.  
  2791.     Func _winapi_globalmemorystatus()
  2792.         Local Const $tagmemorystatusex = "dword Length;dword MemoryLoad;" & "uint64 TotalPhys;uint64 AvailPhys;uint64 TotalPageFile;uint64 AvailPageFile;" & "uint64 TotalVirtual;uint64 AvailVirtual;uint64 AvailExtendedVirtual"
  2793.         Local $tmem = DllStructCreate($tagmemorystatusex)
  2794.         DllStructSetData($tmem, 1, DllStructGetSize($tmem))
  2795.         Local $aret = DllCall("kernel32.dll", "bool", "GlobalMemoryStatusEx", "struct*", $tmem)
  2796.         If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
  2797.         Local $amem[7]
  2798.         $amem[0] = DllStructGetData($tmem, 2)
  2799.         $amem[1] = DllStructGetData($tmem, 3)
  2800.         $amem[2] = DllStructGetData($tmem, 4)
  2801.         $amem[3] = DllStructGetData($tmem, 5)
  2802.         $amem[4] = DllStructGetData($tmem, 6)
  2803.         $amem[5] = DllStructGetData($tmem, 7)
  2804.         $amem[6] = DllStructGetData($tmem, 8)
  2805.         Return $amem
  2806.     EndFunc
  2807.  
  2808.     Func _winapi_isbadcodeptr($paddress)
  2809.         Local $aret = DllCall("kernel32.dll", "bool", "IsBadCodePtr", "struct*", $paddress)
  2810.         If @error Then Return SetError(@error, @extended, False)
  2811.         Return $aret[0]
  2812.     EndFunc
  2813.  
  2814.     Func _winapi_isbadreadptr($paddress, $ilength)
  2815.         Local $aret = DllCall("kernel32.dll", "bool", "IsBadReadPtr", "struct*", $paddress, "uint_ptr", $ilength)
  2816.         If @error Then Return SetError(@error, @extended, False)
  2817.         Return $aret[0]
  2818.     EndFunc
  2819.  
  2820.     Func _winapi_isbadstringptr($paddress, $ilength)
  2821.         Local $aret = DllCall("kernel32.dll", "bool", "IsBadStringPtr", "struct*", $paddress, "uint_ptr", $ilength)
  2822.         If @error Then Return SetError(@error, @extended, False)
  2823.         Return $aret[0]
  2824.     EndFunc
  2825.  
  2826.     Func _winapi_isbadwriteptr($paddress, $ilength)
  2827.         Local $aret = DllCall("kernel32.dll", "bool", "IsBadWritePtr", "struct*", $paddress, "uint_ptr", $ilength)
  2828.         If @error Then Return SetError(@error, @extended, False)
  2829.         Return $aret[0]
  2830.     EndFunc
  2831.  
  2832.     Func _winapi_ismemory($pmemory)
  2833.         Local $bresult = __heapvalidate($pmemory)
  2834.         Return SetError(@error, @extended, $bresult)
  2835.     EndFunc
  2836.  
  2837.     Func _winapi_localfree($hmemory)
  2838.         Local $aresult = DllCall("kernel32.dll", "handle", "LocalFree", "handle", $hmemory)
  2839.         If @error Then Return SetError(@error, @extended, False)
  2840.         Return $aresult[0]
  2841.     EndFunc
  2842.  
  2843.     Func _winapi_movememory($pdestination, $psource, $ilength)
  2844.         If _winapi_isbadreadptr($psource, $ilength) Then Return SetError(10, @extended, 0)
  2845.         If _winapi_isbadwriteptr($pdestination, $ilength) Then Return SetError(11, @extended, 0)
  2846.         DllCall("ntdll.dll", "none", "RtlMoveMemory", "struct*", $pdestination, "struct*", $psource, "ulong_ptr", $ilength)
  2847.         If @error Then Return SetError(@error, @extended, 0)
  2848.         Return 1
  2849.     EndFunc
  2850.  
  2851.     Func _winapi_readprocessmemory($hprocess, $pbaseaddress, $pbuffer, $isize, ByRef $iread)
  2852.         Local $aresult = DllCall("kernel32.dll", "bool", "ReadProcessMemory", "handle", $hprocess, "ptr", $pbaseaddress, "struct*", $pbuffer, "ulong_ptr", $isize, "ulong_ptr*", 0)
  2853.         If @error Then Return SetError(@error, @extended, False)
  2854.         $iread = $aresult[5]
  2855.         Return $aresult[0]
  2856.     EndFunc
  2857.  
  2858.     Func _winapi_writeprocessmemory($hprocess, $pbaseaddress, $pbuffer, $isize, ByRef $iwritten, $sbuffer = "ptr")
  2859.         Local $aresult = DllCall("kernel32.dll", "bool", "WriteProcessMemory", "handle", $hprocess, "ptr", $pbaseaddress, $sbuffer, $pbuffer, "ulong_ptr", $isize, "ulong_ptr*", 0)
  2860.         If @error Then Return SetError(@error, @extended, False)
  2861.         $iwritten = $aresult[5]
  2862.         Return $aresult[0]
  2863.     EndFunc
  2864.  
  2865.     Func _winapi_zeromemory($pmemory, $ilength)
  2866.         If _winapi_isbadwriteptr($pmemory, $ilength) Then Return SetError(11, @extended, 0)
  2867.         DllCall("ntdll.dll", "none", "RtlZeroMemory", "struct*", $pmemory, "ulong_ptr", $ilength)
  2868.         If @error Then Return SetError(@error, @extended, 0)
  2869.         Return 1
  2870.     EndFunc
  2871.  
  2872. #EndRegion Public Functions
  2873. #Region Internal Functions
  2874.  
  2875.     Func __heapalloc($isize, $babort = False)
  2876.         Local $aret
  2877.         If NOT $__g_hheap Then
  2878.             $aret = DllCall("kernel32.dll", "handle", "HeapCreate", "dword", 0, "ulong_ptr", 0, "ulong_ptr", 0)
  2879.             If @error OR NOT $aret[0] Then __fatalexit(1, "Error allocating memory.")
  2880.             $__g_hheap = $aret[0]
  2881.         EndIf
  2882.         $aret = DllCall("kernel32.dll", "ptr", "HeapAlloc", "handle", $__g_hheap, "dword", 8, "ulong_ptr", $isize)
  2883.         If @error OR NOT $aret[0] Then
  2884.             If $babort Then __fatalexit(1, "Error allocating memory.")
  2885.             Return SetError(@error + 30, @extended, 0)
  2886.         EndIf
  2887.         Return $aret[0]
  2888.     EndFunc
  2889.  
  2890.     Func __heapfree(ByRef $pmemory, $bcheck = False, $icurerr = @error, $icurext = @extended)
  2891.         If $bcheck AND (NOT __heapvalidate($pmemory)) Then Return SetError(@error, @extended, 0)
  2892.         Local $aret = DllCall("kernel32.dll", "int", "HeapFree", "handle", $__g_hheap, "dword", 0, "ptr", $pmemory)
  2893.         If @error OR NOT $aret[0] Then Return SetError(@error + 40, @extended, 0)
  2894.         $pmemory = 0
  2895.         Return SetError($icurerr, $icurext, 1)
  2896.     EndFunc
  2897.  
  2898.     Func __heaprealloc($pmemory, $isize, $bamount = False, $babort = False)
  2899.         Local $aret, $pret
  2900.         If __heapvalidate($pmemory) Then
  2901.             If $bamount AND (__heapsize($pmemory) >= $isize) Then Return SetExtended(1, Ptr($pmemory))
  2902.             $aret = DllCall("kernel32.dll", "ptr", "HeapReAlloc", "handle", $__g_hheap, "dword", 8, "ptr", $pmemory, "ulong_ptr", $isize)
  2903.             If @error OR NOT $aret[0] Then
  2904.                 If $babort Then __fatalexit(1, "Error allocating memory.")
  2905.                 Return SetError(@error + 20, @extended, Ptr($pmemory))
  2906.             EndIf
  2907.             $pret = $aret[0]
  2908.         Else
  2909.             $pret = __heapalloc($isize, $babort)
  2910.             If @error Then Return SetError(@error, @extended, 0)
  2911.         EndIf
  2912.         Return $pret
  2913.     EndFunc
  2914.  
  2915.     Func __heapsize($pmemory, $bcheck = False)
  2916.         If $bcheck AND (NOT __heapvalidate($pmemory)) Then Return SetError(@error, @extended, 0)
  2917.         Local $aret = DllCall("kernel32.dll", "ulong_ptr", "HeapSize", "handle", $__g_hheap, "dword", 0, "ptr", $pmemory)
  2918.         If @error OR ($aret[0] = Ptr(-1)) Then Return SetError(@error + 50, @extended, 0)
  2919.         Return $aret[0]
  2920.     EndFunc
  2921.  
  2922.     Func __heapvalidate($pmemory)
  2923.         If (NOT $__g_hheap) OR (NOT Ptr($pmemory)) Then Return SetError(9, 0, False)
  2924.         Local $aret = DllCall("kernel32.dll", "int", "HeapValidate", "handle", $__g_hheap, "dword", 0, "ptr", $pmemory)
  2925.         If @error Then Return SetError(@error, @extended, False)
  2926.         Return $aret[0]
  2927.     EndFunc
  2928.  
  2929. #EndRegion Internal Functions
  2930. Global Const $snd_application = 128
  2931. Global Const $snd_alias = 65536
  2932. Global Const $snd_alias_id = 1114112
  2933. Global Const $snd_async = 1
  2934. Global Const $snd_filename = 131072
  2935. Global Const $snd_loop = 8
  2936. Global Const $snd_memory = 4
  2937. Global Const $snd_nodefault = 2
  2938. Global Const $snd_nostop = 16
  2939. Global Const $snd_nowait = 8192
  2940. Global Const $snd_purge = 64
  2941. Global Const $snd_resource = 262148
  2942. Global Const $snd_sentry = 524288
  2943. Global Const $snd_sync = 0
  2944. Global Const $snd_system = 2097152
  2945. Global Const $snd_system_nostop = 2097168
  2946. Global Const $snd_alias_systemasterisk = "SystemAsterisk"
  2947. Global Const $snd_alias_systemdefault = "SystemDefault"
  2948. Global Const $snd_alias_systemexclamation = "SystemExclamation"
  2949. Global Const $snd_alias_systemexit = "SystemExit"
  2950. Global Const $snd_alias_systemhand = "SystemHand"
  2951. Global Const $snd_alias_systemquestion = "SystemQuestion"
  2952. Global Const $snd_alias_systemstart = "SystemStart"
  2953. Global Const $snd_alias_systemwelcome = "SystemWelcome"
  2954. #Region Global Variables and Constants
  2955. #EndRegion Global Variables and Constants
  2956. #Region Functions list
  2957. #EndRegion Functions list
  2958. #Region Public Functions
  2959.  
  2960.     Func _winapi_arraytostruct(Const ByRef $adata, $istart = 0, $iend = -1)
  2961.         If __checkerrorarraybounds($adata, $istart, $iend) Then Return SetError(@error + 10, @extended, 0)
  2962.         Local $tagstruct = ""
  2963.         For $i = $istart To $iend
  2964.             $tagstruct &= "wchar[" & (StringLen($adata[$i]) + 1) & "];"
  2965.         Next
  2966.         Local $tdata = DllStructCreate($tagstruct & "wchar[1]")
  2967.         Local $icount = 1
  2968.         For $i = $istart To $iend
  2969.             DllStructSetData($tdata, $icount, $adata[$i])
  2970.             $icount += 1
  2971.         Next
  2972.         DllStructSetData($tdata, $icount, ChrW(0))
  2973.         Return $tdata
  2974.     EndFunc
  2975.  
  2976.     Func _winapi_createmargins($ileftwidth, $irightwidth, $itopheight, $ibottomheight)
  2977.         Local $tmargins = DllStructCreate($tagmargins)
  2978.         DllStructSetData($tmargins, 1, $ileftwidth)
  2979.         DllStructSetData($tmargins, 2, $irightwidth)
  2980.         DllStructSetData($tmargins, 3, $itopheight)
  2981.         DllStructSetData($tmargins, 4, $ibottomheight)
  2982.         Return $tmargins
  2983.     EndFunc
  2984.  
  2985.     Func _winapi_createpoint($ix, $iy)
  2986.         Local $tpoint = DllStructCreate($tagpoint)
  2987.         DllStructSetData($tpoint, 1, $ix)
  2988.         DllStructSetData($tpoint, 2, $iy)
  2989.         Return $tpoint
  2990.     EndFunc
  2991.  
  2992.     Func _winapi_createrect($ileft, $itop, $iright, $ibottom)
  2993.         Local $trect = DllStructCreate($tagrect)
  2994.         DllStructSetData($trect, 1, $ileft)
  2995.         DllStructSetData($trect, 2, $itop)
  2996.         DllStructSetData($trect, 3, $iright)
  2997.         DllStructSetData($trect, 4, $ibottom)
  2998.         Return $trect
  2999.     EndFunc
  3000.  
  3001.     Func _winapi_createrectex($ix, $iy, $iwidth, $iheight)
  3002.         Local $trect = DllStructCreate($tagrect)
  3003.         DllStructSetData($trect, 1, $ix)
  3004.         DllStructSetData($trect, 2, $iy)
  3005.         DllStructSetData($trect, 3, $ix + $iwidth)
  3006.         DllStructSetData($trect, 4, $iy + $iheight)
  3007.         Return $trect
  3008.     EndFunc
  3009.  
  3010.     Func _winapi_createsize($iwidth, $iheight)
  3011.         Local $tsize = DllStructCreate($tagsize)
  3012.         DllStructSetData($tsize, 1, $iwidth)
  3013.         DllStructSetData($tsize, 2, $iheight)
  3014.         Return $tsize
  3015.     EndFunc
  3016.  
  3017.     Func _winapi_copystruct($tstruct, $sstruct = "")
  3018.         Local $isize = DllStructGetSize($tstruct)
  3019.         If NOT $isize Then Return SetError(1, 0, 0)
  3020.         Local $tresult
  3021.         If NOT StringStripWS($sstruct, $str_stripleading + $str_striptrailing + $str_stripspaces) Then
  3022.             $tresult = DllStructCreate("byte[" & $isize & "]")
  3023.         Else
  3024.             $tresult = DllStructCreate($sstruct)
  3025.         EndIf
  3026.         If DllStructGetSize($tresult) < $isize Then Return SetError(2, 0, 0)
  3027.         _winapi_movememory($tresult, $tstruct, $isize)
  3028.         Return $tresult
  3029.     EndFunc
  3030.  
  3031.     Func _winapi_getextended()
  3032.         Return $__g_vext
  3033.     EndFunc
  3034.  
  3035.     Func _winapi_getmousepos($btoclient = False, $hwnd = 0)
  3036.         Local $imode = Opt("MouseCoordMode", 1)
  3037.         Local $apos = MouseGetPos()
  3038.         Opt("MouseCoordMode", $imode)
  3039.         Local $tpoint = DllStructCreate($tagpoint)
  3040.         DllStructSetData($tpoint, "X", $apos[0])
  3041.         DllStructSetData($tpoint, "Y", $apos[1])
  3042.         If $btoclient AND NOT _winapi_screentoclient($hwnd, $tpoint) Then Return SetError(@error + 20, @extended, 0)
  3043.         Return $tpoint
  3044.     EndFunc
  3045.  
  3046.     Func _winapi_getmouseposx($btoclient = False, $hwnd = 0)
  3047.         Local $tpoint = _winapi_getmousepos($btoclient, $hwnd)
  3048.         If @error Then Return SetError(@error, @extended, 0)
  3049.         Return DllStructGetData($tpoint, "X")
  3050.     EndFunc
  3051.  
  3052.     Func _winapi_getmouseposy($btoclient = False, $hwnd = 0)
  3053.         Local $tpoint = _winapi_getmousepos($btoclient, $hwnd)
  3054.         If @error Then Return SetError(@error, @extended, 0)
  3055.         Return DllStructGetData($tpoint, "Y")
  3056.     EndFunc
  3057.  
  3058.     Func _winapi_muldiv($inumber, $inumerator, $idenominator)
  3059.         Local $aresult = DllCall("kernel32.dll", "int", "MulDiv", "int", $inumber, "int", $inumerator, "int", $idenominator)
  3060.         If @error Then Return SetError(@error, @extended, -1)
  3061.         Return $aresult[0]
  3062.     EndFunc
  3063.  
  3064.     Func _winapi_playsound($ssound, $iflags = $snd_system_nostop, $hinstance = 0)
  3065.         Local $stypeofsound = "ptr"
  3066.         If $ssound Then
  3067.             If IsString($ssound) Then
  3068.                 $stypeofsound = "wstr"
  3069.             EndIf
  3070.         Else
  3071.             $ssound = 0
  3072.             $iflags = 0
  3073.         EndIf
  3074.         Local $aret = DllCall("winmm.dll", "bool", "PlaySoundW", $stypeofsound, $ssound, "handle", $hinstance, "dword", $iflags)
  3075.         If @error Then Return SetError(@error, @extended, False)
  3076.         Return $aret[0]
  3077.     EndFunc
  3078.  
  3079.     Func _winapi_stringlena(Const ByRef $tstring)
  3080.         Local $aresult = DllCall("kernel32.dll", "int", "lstrlenA", "struct*", $tstring)
  3081.         If @error Then Return SetError(@error, @extended, 0)
  3082.         Return $aresult[0]
  3083.     EndFunc
  3084.  
  3085.     Func _winapi_stringlenw(Const ByRef $tstring)
  3086.         Local $aresult = DllCall("kernel32.dll", "int", "lstrlenW", "struct*", $tstring)
  3087.         If @error Then Return SetError(@error, @extended, 0)
  3088.         Return $aresult[0]
  3089.     EndFunc
  3090.  
  3091.     Func _winapi_structtoarray(ByRef $tstruct, $iitems = 0)
  3092.         Local $isize = 2 * Floor(DllStructGetSize($tstruct) / 2)
  3093.         Local $pstruct = DllStructGetPtr($tstruct)
  3094.         If NOT $isize OR NOT $pstruct Then Return SetError(1, 0, 0)
  3095.         Local $tdata, $ilength, $ioffset = 0
  3096.         Local $aresult[101] = [0]
  3097.         While 1
  3098.             $ilength = _winapi_strlen($pstruct + $ioffset)
  3099.             If NOT $ilength Then
  3100.                 ExitLoop
  3101.             EndIf
  3102.             If 2 * (1 + $ilength) + $ioffset > $isize Then Return SetError(3, 0, 0)
  3103.             $tdata = DllStructCreate("wchar[" & (1 + $ilength) & "]", $pstruct + $ioffset)
  3104.             If @error Then Return SetError(@error + 10, 0, 0)
  3105.             __inc($aresult)
  3106.             $aresult[$aresult[0]] = DllStructGetData($tdata, 1)
  3107.             If $aresult[0] = $iitems Then
  3108.                 ExitLoop
  3109.             EndIf
  3110.             $ioffset += 2 * (1 + $ilength)
  3111.             If $ioffset >= $isize Then Return SetError(3, 0, 0)
  3112.         WEnd
  3113.         If NOT $aresult[0] Then Return SetError(2, 0, 0)
  3114.         __inc($aresult, -1)
  3115.         Return $aresult
  3116.     EndFunc
  3117.  
  3118.     Func _winapi_unionstruct($tstruct1, $tstruct2, $sstruct = "")
  3119.         Local $asize[2] = [DllStructGetSize($tstruct1), DllStructGetSize($tstruct2)]
  3120.         If NOT $asize[0] OR NOT $asize[1] Then Return SetError(1, 0, 0)
  3121.         Local $tresult
  3122.         If NOT StringStripWS($sstruct, $str_stripleading + $str_striptrailing + $str_stripspaces) Then
  3123.             $tresult = DllStructCreate("byte[" & ($asize[0] + $asize[1]) & "]")
  3124.         Else
  3125.             $tresult = DllStructCreate($sstruct)
  3126.         EndIf
  3127.         If DllStructGetSize($tresult) < ($asize[0] + $asize[1]) Then Return SetError(2, 0, 0)
  3128.         _winapi_movememory($tresult, $tstruct1, $asize[0])
  3129.         _winapi_movememory(DllStructGetPtr($tresult) + $asize[0], $tstruct2, $asize[1])
  3130.         Return $tresult
  3131.     EndFunc
  3132.  
  3133. #EndRegion Public Functions
  3134. Global Const $dllver_platform_windows = 1
  3135. Global Const $dllver_platform_nt = 2
  3136. Global Const $shcne_allevents = 2147483647
  3137. Global Const $shcne_assocchanged = 134217728
  3138. Global Const $shcne_attributes = 2048
  3139. Global Const $shcne_create = 2
  3140. Global Const $shcne_delete = 4
  3141. Global Const $shcne_driveadd = 256
  3142. Global Const $shcne_driveaddgui = 65536
  3143. Global Const $shcne_driveremoved = 128
  3144. Global Const $shcne_extended_event = 67108864
  3145. Global Const $shcne_freespace = 262144
  3146. Global Const $shcne_mediainserted = 32
  3147. Global Const $shcne_mediaremoved = 64
  3148. Global Const $shcne_mkdir = 8
  3149. Global Const $shcne_netshare = 512
  3150. Global Const $shcne_netunshare = 1024
  3151. Global Const $shcne_renamefolder = 131072
  3152. Global Const $shcne_renameitem = 1
  3153. Global Const $shcne_rmdir = 16
  3154. Global Const $shcne_serverdisconnect = 16384
  3155. Global Const $shcne_updatedir = 4096
  3156. Global Const $shcne_updateimage = 32768
  3157. Global Const $shcne_updateitem = 8192
  3158. Global Const $shcne_diskevents = 145439
  3159. Global Const $shcne_globalevents = 201687520
  3160. Global Const $shcne_interrupt = -2147483648
  3161. Global Const $shcnf_dword = 3
  3162. Global Const $shcnf_idlist = 0
  3163. Global Const $shcnf_path = 1
  3164. Global Const $shcnf_printer = 2
  3165. Global Const $shcnf_flush = 4096
  3166. Global Const $shcnf_flushnowait = 8192
  3167. Global Const $shcnf_notifyrecursive = 65536
  3168. Global Const $shcnrf_interruptlevel = 1
  3169. Global Const $shcnrf_shelllevel = 2
  3170. Global Const $shcnrf_recursiveinterrupt = 4096
  3171. Global Const $shcnrf_newdelivery = 32768
  3172. Global Const $sherb_noconfirmation = 1
  3173. Global Const $sherb_noprogressui = 2
  3174. Global Const $sherb_nosound = 4
  3175. Global Const $sherb_no_ui = BitOR($sherb_noconfirmation, $sherb_noprogressui, $sherb_nosound)
  3176. Global Const $see_mask_default = 0
  3177. Global Const $see_mask_classname = 1
  3178. Global Const $see_mask_classkey = 3
  3179. Global Const $see_mask_idlist = 4
  3180. Global Const $see_mask_invokeidlist = 12
  3181. Global Const $see_mask_icon = 16
  3182. Global Const $see_mask_hotkey = 32
  3183. Global Const $see_mask_nocloseprocess = 64
  3184. Global Const $see_mask_connectnetdrv = 128
  3185. Global Const $see_mask_noasync = 256
  3186. Global Const $see_mask_flag_ddewait = $see_mask_noasync
  3187. Global Const $see_mask_doenvsubst = 512
  3188. Global Const $see_mask_flag_no_ui = 1024
  3189. Global Const $see_mask_unicode = 16384
  3190. Global Const $see_mask_no_console = 32768
  3191. Global Const $see_mask_asyncok = 1048576
  3192. Global Const $see_mask_noqueryclassstore = 16777216
  3193. Global Const $see_mask_hmonitor = 2097152
  3194. Global Const $see_mask_nozonechecks = 8388608
  3195. Global Const $see_mask_waitforinputidle = 33554432
  3196. Global Const $see_mask_flag_log_usage = 67108864
  3197. Global Const $se_err_accessdenied = 5
  3198. Global Const $se_err_associncomplete = 27
  3199. Global Const $se_err_ddebusy = 30
  3200. Global Const $se_err_ddefail = 29
  3201. Global Const $se_err_ddetimeout = 28
  3202. Global Const $se_err_dllnotfound = 32
  3203. Global Const $se_err_fnf = 2
  3204. Global Const $se_err_noassoc = 31
  3205. Global Const $se_err_oom = 8
  3206. Global Const $se_err_pnf = 3
  3207. Global Const $se_err_share = 26
  3208. Global Const $fo_copy = 2
  3209. Global Const $fo_delete = 3
  3210. Global Const $fo_move = 1
  3211. Global Const $fo_rename = 4
  3212. Global Const $fof_allowundo = 64
  3213. Global Const $fof_confirmmouse = 2
  3214. Global Const $fof_filesonly = 128
  3215. Global Const $fof_multidestfiles = 1
  3216. Global Const $fof_noconfirmation = 16
  3217. Global Const $fof_noconfirmmkdir = 512
  3218. Global Const $fof_no_connected_elements = 8192
  3219. Global Const $fof_nocopysecurityattribs = 2048
  3220. Global Const $fof_noerrorui = 1024
  3221. Global Const $fof_norecursereparse = 32768
  3222. Global Const $fof_norecursion = 4096
  3223. Global Const $fof_renameoncollision = 8
  3224. Global Const $fof_silent = 4
  3225. Global Const $fof_simpleprogress = 256
  3226. Global Const $fof_wantmappinghandle = 32
  3227. Global Const $fof_wantnukewarning = 16384
  3228. Global Const $fof_no_ui = BitOR($fof_noconfirmation, $fof_noconfirmmkdir, $fof_noerrorui, $fof_silent)
  3229. Global Const $shgfi_addoverlays = 32
  3230. Global Const $shgfi_attr_specified = 131072
  3231. Global Const $shgfi_attributes = 2048
  3232. Global Const $shgfi_displayname = 512
  3233. Global Const $shgfi_exetype = 8192
  3234. Global Const $shgfi_icon = 256
  3235. Global Const $shgfi_iconlocation = 4096
  3236. Global Const $shgfi_largeicon = 0
  3237. Global Const $shgfi_linkoverlay = 32768
  3238. Global Const $shgfi_openicon = 2
  3239. Global Const $shgfi_overlayindex = 64
  3240. Global Const $shgfi_pidl = 8
  3241. Global Const $shgfi_selected = 65536
  3242. Global Const $shgfi_shelliconsize = 4
  3243. Global Const $shgfi_smallicon = 1
  3244. Global Const $shgfi_sysiconindex = 16384
  3245. Global Const $shgfi_typename = 1024
  3246. Global Const $shgfi_usefileattributes = 16
  3247. Global Const $sfgao_cancopy = 1
  3248. Global Const $sfgao_canmove = 2
  3249. Global Const $sfgao_canlink = 4
  3250. Global Const $sfgao_storage = 8
  3251. Global Const $sfgao_canrename = 16
  3252. Global Const $sfgao_candelete = 32
  3253. Global Const $sfgao_haspropsheet = 64
  3254. Global Const $sfgao_droptarget = 256
  3255. Global Const $sfgao_capabilitymask = BitOR($sfgao_cancopy, $sfgao_canmove, $sfgao_canlink, $sfgao_canrename, $sfgao_candelete, $sfgao_haspropsheet, $sfgao_droptarget)
  3256. Global Const $sfgao_system = 4096
  3257. Global Const $sfgao_encrypted = 8192
  3258. Global Const $sfgao_isslow = 16384
  3259. Global Const $sfgao_ghosted = 32768
  3260. Global Const $sfgao_link = 65536
  3261. Global Const $sfgao_share = 131072
  3262. Global Const $sfgao_readonly = 262144
  3263. Global Const $sfgao_hidden = 524288
  3264. Global Const $sfgao_displayattrmask = BitOR($sfgao_isslow, $sfgao_ghosted, $sfgao_link, $sfgao_share, $sfgao_readonly, $sfgao_hidden)
  3265. Global Const $sfgao_nonenumerated = 1048576
  3266. Global Const $sfgao_newcontent = 2097152
  3267. Global Const $sfgao_stream = 4194304
  3268. Global Const $sfgao_storageancestor = 8388608
  3269. Global Const $sfgao_validate = 16777216
  3270. Global Const $sfgao_removable = 33554432
  3271. Global Const $sfgao_compressed = 67108864
  3272. Global Const $sfgao_browsable = 134217728
  3273. Global Const $sfgao_filesysancestor = 268435456
  3274. Global Const $sfgao_folder = 536870912
  3275. Global Const $sfgao_filesystem = 1073741824
  3276. Global Const $sfgao_storagecapmask = BitOR($sfgao_storage, $sfgao_link, $sfgao_readonly, $sfgao_stream, $sfgao_storageancestor, $sfgao_filesysancestor, $sfgao_folder, $sfgao_filesystem)
  3277. Global Const $sfgao_hassubfolder = -2147483648
  3278. Global Const $sfgao_contentsmask = $sfgao_hassubfolder
  3279. Global Const $sfgao_pkeysfgaomask = BitOR($sfgao_isslow, $sfgao_readonly, $sfgao_hassubfolder, $sfgao_validate)
  3280. Global Const $ido_shgioi_default = 268435452
  3281. Global Const $ido_shgioi_link = 268435454
  3282. Global Const $ido_shgioi_share = 268435455
  3283. Global Const $ido_shgioi_slowfile = 268435453
  3284. Global Const $fcsm_viewid = 1
  3285. Global Const $fcsm_webviewtemplate = 2
  3286. Global Const $fcsm_infotip = 4
  3287. Global Const $fcsm_clsid = 8
  3288. Global Const $fcsm_iconfile = 16
  3289. Global Const $fcsm_logo = 32
  3290. Global Const $fcsm_flags = 64
  3291. Global Const $fcs_read = 1
  3292. Global Const $fcs_forcewrite = 2
  3293. Global Const $fcs_write = BitOR($fcs_read, $fcs_forcewrite)
  3294. Global Const $ssf_autocheckselect = 8388608
  3295. Global Const $ssf_desktophtml = 512
  3296. Global Const $ssf_dontprettypath = 2048
  3297. Global Const $ssf_doubleclickinwebview = 128
  3298. Global Const $ssf_hideicons = 16384
  3299. Global Const $ssf_iconsonly = 16777216
  3300. Global Const $ssf_mapnetdrvbutton = 4096
  3301. Global Const $ssf_noconfirmrecycle = 32768
  3302. Global Const $ssf_nonetcrawling = 1048576
  3303. Global Const $ssf_sepprocess = 524288
  3304. Global Const $ssf_showallobjects = 1
  3305. Global Const $ssf_showcompcolor = 8
  3306. Global Const $ssf_showextensions = 2
  3307. Global Const $ssf_showinfotip = 8192
  3308. Global Const $ssf_showsuperhidden = 262144
  3309. Global Const $ssf_showsysfiles = 32
  3310. Global Const $ssf_showtypeoverlay = 33554432
  3311. Global Const $ssf_startpanelon = 2097152
  3312. Global Const $ssf_win95classic = 1024
  3313. Global Const $ssf_webview = 131072
  3314. Global Const $csidl_admintools = 48
  3315. Global Const $csidl_altstartup = 29
  3316. Global Const $csidl_appdata = 26
  3317. Global Const $csidl_bitbucket = 10
  3318. Global Const $csidl_cdburn_area = 59
  3319. Global Const $csidl_common_admintools = 47
  3320. Global Const $csidl_common_altstartup = 30
  3321. Global Const $csidl_common_appdata = 35
  3322. Global Const $csidl_common_desktopdirectory = 25
  3323. Global Const $csidl_common_documents = 46
  3324. Global Const $csidl_common_favorites = 31
  3325. Global Const $csidl_common_music = 53
  3326. Global Const $csidl_common_pictures = 54
  3327. Global Const $csidl_common_programs = 23
  3328. Global Const $csidl_common_startmenu = 22
  3329. Global Const $csidl_common_startup = 24
  3330. Global Const $csidl_common_templates = 45
  3331. Global Const $csidl_common_video = 55
  3332. Global Const $csidl_computersnearme = 61
  3333. Global Const $csidl_connections = 49
  3334. Global Const $csidl_controls = 3
  3335. Global Const $csidl_cookies = 33
  3336. Global Const $csidl_desktop = 0
  3337. Global Const $csidl_desktopdirectory = 16
  3338. Global Const $csidl_drives = 17
  3339. Global Const $csidl_favorites = 6
  3340. Global Const $csidl_fonts = 20
  3341. Global Const $csidl_internet_cache = 32
  3342. Global Const $csidl_history = 34
  3343. Global Const $csidl_local_appdata = 28
  3344. Global Const $csidl_mymusic = 13
  3345. Global Const $csidl_mypictures = 39
  3346. Global Const $csidl_myvideo = 14
  3347. Global Const $csidl_nethood = 19
  3348. Global Const $csidl_personal = 5
  3349. Global Const $csidl_printers = 4
  3350. Global Const $csidl_printhood = 27
  3351. Global Const $csidl_profile = 40
  3352. Global Const $csidl_program_files = 38
  3353. Global Const $csidl_program_files_common = 43
  3354. Global Const $csidl_program_files_commonx86 = 44
  3355. Global Const $csidl_program_filesx86 = 42
  3356. Global Const $csidl_programs = 2
  3357. Global Const $csidl_recent = 8
  3358. Global Const $csidl_sendto = 9
  3359. Global Const $csidl_startmenu = 11
  3360. Global Const $csidl_startup = 7
  3361. Global Const $csidl_system = 37
  3362. Global Const $csidl_systemx86 = 41
  3363. Global Const $csidl_templates = 21
  3364. Global Const $csidl_windows = 36
  3365. Global Const $siid_docnoassoc = 0
  3366. Global Const $siid_docassoc = 1
  3367. Global Const $siid_application = 2
  3368. Global Const $siid_folder = 3
  3369. Global Const $siid_folderopen = 4
  3370. Global Const $siid_drive525 = 5
  3371. Global Const $siid_drive35 = 6
  3372. Global Const $siid_driveremove = 7
  3373. Global Const $siid_drivefixed = 8
  3374. Global Const $siid_drivenet = 9
  3375. Global Const $siid_drivenetdisabled = 10
  3376. Global Const $siid_drivecd = 11
  3377. Global Const $siid_driveram = 12
  3378. Global Const $siid_world = 13
  3379. Global Const $siid_server = 15
  3380. Global Const $siid_printer = 16
  3381. Global Const $siid_mynetwork = 17
  3382. Global Const $siid_find = 22
  3383. Global Const $siid_help = 23
  3384. Global Const $siid_share = 28
  3385. Global Const $siid_link = 29
  3386. Global Const $siid_slowfile = 30
  3387. Global Const $siid_recycler = 31
  3388. Global Const $siid_recyclerfull = 32
  3389. Global Const $siid_mediacdaudio = 40
  3390. Global Const $siid_lock = 47
  3391. Global Const $siid_autolist = 49
  3392. Global Const $siid_printernet = 50
  3393. Global Const $siid_servershare = 51
  3394. Global Const $siid_printerfax = 52
  3395. Global Const $siid_printerfaxnet = 53
  3396. Global Const $siid_printerfile = 54
  3397. Global Const $siid_stack = 55
  3398. Global Const $siid_mediasvcd = 56
  3399. Global Const $siid_stuffedfolder = 57
  3400. Global Const $siid_driveunknown = 58
  3401. Global Const $siid_drivedvd = 59
  3402. Global Const $siid_mediadvd = 60
  3403. Global Const $siid_mediadvdram = 61
  3404. Global Const $siid_mediadvdrw = 62
  3405. Global Const $siid_mediadvdr = 63
  3406. Global Const $siid_mediadvdrom = 64
  3407. Global Const $siid_mediacdaudioplus = 65
  3408. Global Const $siid_mediacdrw = 66
  3409. Global Const $siid_mediacdr = 67
  3410. Global Const $siid_mediacdburn = 68
  3411. Global Const $siid_mediablankcd = 69
  3412. Global Const $siid_mediacdrom = 70
  3413. Global Const $siid_audiofiles = 71
  3414. Global Const $siid_imagefiles = 72
  3415. Global Const $siid_videofiles = 73
  3416. Global Const $siid_mixedfiles = 74
  3417. Global Const $siid_folderback = 75
  3418. Global Const $siid_folderfront = 76
  3419. Global Const $siid_shield = 77
  3420. Global Const $siid_warning = 78
  3421. Global Const $siid_info = 79
  3422. Global Const $siid_error = 80
  3423. Global Const $siid_key = 81
  3424. Global Const $siid_software = 82
  3425. Global Const $siid_rename = 83
  3426. Global Const $siid_delete = 84
  3427. Global Const $siid_mediaaudiodvd = 85
  3428. Global Const $siid_mediamoviedvd = 86
  3429. Global Const $siid_mediaenhancedcd = 87
  3430. Global Const $siid_mediaenhanceddvd = 88
  3431. Global Const $siid_mediahddvd = 89
  3432. Global Const $siid_mediabluray = 90
  3433. Global Const $siid_mediavcd = 91
  3434. Global Const $siid_mediadvdplusr = 92
  3435. Global Const $siid_mediadvdplusrw = 93
  3436. Global Const $siid_desktoppc = 94
  3437. Global Const $siid_mobilepc = 95
  3438. Global Const $siid_users = 96
  3439. Global Const $siid_mediasmartmedia = 97
  3440. Global Const $siid_mediacompactflash = 98
  3441. Global Const $siid_devicecellphone = 99
  3442. Global Const $siid_devicecamera = 100
  3443. Global Const $siid_devicevideocamera = 101
  3444. Global Const $siid_deviceaudioplayer = 102
  3445. Global Const $siid_networkconnect = 103
  3446. Global Const $siid_internet = 104
  3447. Global Const $siid_zipfile = 105
  3448. Global Const $siid_settings = 106
  3449. Global Const $siid_drivehddvd = 132
  3450. Global Const $siid_drivebd = 133
  3451. Global Const $siid_mediahddvdrom = 134
  3452. Global Const $siid_mediahddvdr = 135
  3453. Global Const $siid_mediahddvdram = 136
  3454. Global Const $siid_mediabdrom = 137
  3455. Global Const $siid_mediabdr = 138
  3456. Global Const $siid_mediabdre = 139
  3457. Global Const $siid_clustereddrive = 140
  3458. Global Const $siid_max_icons = 174
  3459. Global Const $shgsi_iconlocation = 0
  3460. Global Const $shgsi_icon = $shgfi_icon
  3461. Global Const $shgsi_sysiconindex = $shgfi_sysiconindex
  3462. Global Const $shgsi_linkoverlay = $shgfi_linkoverlay
  3463. Global Const $shgsi_selected = $shgfi_selected
  3464. Global Const $shgsi_largeicon = $shgfi_largeicon
  3465. Global Const $shgsi_smallicon = $shgfi_smallicon
  3466. Global Const $shgsi_shelliconsize = $shgfi_shelliconsize
  3467. Global Const $nim_add = 0
  3468. Global Const $nim_modify = 1
  3469. Global Const $nim_delete = 2
  3470. Global Const $nim_setfocus = 3
  3471. Global Const $nim_setversion = 4
  3472. Global Const $nif_message = 1
  3473. Global Const $nif_icon = 2
  3474. Global Const $nif_tip = 4
  3475. Global Const $nif_state = 8
  3476. Global Const $nif_info = 16
  3477. Global Const $nif_guid = 32
  3478. Global Const $nif_realtime = 64
  3479. Global Const $nif_showtip = 128
  3480. Global Const $nis_hidden = 1
  3481. Global Const $nis_sharedicon = 2
  3482. Global Const $niif_none = 0
  3483. Global Const $niif_info = 1
  3484. Global Const $niif_warning = 2
  3485. Global Const $niif_error = 3
  3486. Global Const $niif_user = 4
  3487. Global Const $niif_nosound = 16
  3488. Global Const $niif_large_icon = 16
  3489. Global Const $niif_respect_quiet_time = 128
  3490. Global Const $niif_icon_mask = 15
  3491. Global Const $shop_printername = 1
  3492. Global Const $shop_filepath = 2
  3493. Global Const $shop_volumeguid = 4
  3494. Global Const $ofasi_edit = 1
  3495. Global Const $ofasi_opendesktop = 2
  3496. Global Const $quns_not_present = 1
  3497. Global Const $quns_busy = 2
  3498. Global Const $quns_running_d3d_full_screen = 3
  3499. Global Const $quns_presentation_mode = 4
  3500. Global Const $quns_accepts_notifications = 5
  3501. Global Const $quns_quiet_time = 6
  3502. Global Const $rest_norun = 1
  3503. Global Const $rest_noclose = 2
  3504. Global Const $rest_nosaveset = 3
  3505. Global Const $rest_nofilemenu = 4
  3506. Global Const $rest_nosetfolders = 5
  3507. Global Const $rest_nosettaskbar = 6
  3508. Global Const $rest_nodesktop = 7
  3509. Global Const $rest_nofind = 8
  3510. Global Const $rest_nodrives = 9
  3511. Global Const $rest_nodriveautorun = 10
  3512. Global Const $rest_nodrivetypeautorun = 11
  3513. Global Const $rest_nonethood = 12
  3514. Global Const $rest_startbanner = 13
  3515. Global Const $rest_restrictrun = 14
  3516. Global Const $rest_noprintertabs = 15
  3517. Global Const $rest_noprinterdelete = 16
  3518. Global Const $rest_noprinteradd = 17
  3519. Global Const $rest_nostartmenusubfolders = 18
  3520. Global Const $rest_mydocsonnet = 19
  3521. Global Const $rest_noexittodos = 20
  3522. Global Const $rest_enforceshellextsecurity = 21
  3523. Global Const $rest_linkresolveignorelinkinfo = 22
  3524. Global Const $rest_nocommongroups = 23
  3525. Global Const $rest_separatedesktopprocess = 24
  3526. Global Const $rest_noweb = 25
  3527. Global Const $rest_notraycontextmenu = 26
  3528. Global Const $rest_noviewcontextmenu = 27
  3529. Global Const $rest_nonetconnectdisconnect = 28
  3530. Global Const $rest_startmenulogoff = 29
  3531. Global Const $rest_nosettingsassist = 30
  3532. Global Const $rest_nointerneticon = 31
  3533. Global Const $rest_norecentdocshistory = 32
  3534. Global Const $rest_norecentdocsmenu = 33
  3535. Global Const $rest_noactivedesktop = 34
  3536. Global Const $rest_noactivedesktopchanges = 35
  3537. Global Const $rest_nofavoritesmenu = 36
  3538. Global Const $rest_clearrecentdocsonexit = 37
  3539. Global Const $rest_classicshell = 38
  3540. Global Const $rest_nocustomizewebview = 39
  3541. Global Const $rest_nohtmlwallpaper = 40
  3542. Global Const $rest_nochangingwallpaper = 41
  3543. Global Const $rest_nodeskcomp = 42
  3544. Global Const $rest_noadddeskcomp = 43
  3545. Global Const $rest_nodeldeskcomp = 44
  3546. Global Const $rest_noclosedeskcomp = 45
  3547. Global Const $rest_noclose_dragdropband = 46
  3548. Global Const $rest_nomovingband = 47
  3549. Global Const $rest_noeditdeskcomp = 48
  3550. Global Const $rest_noresolvesearch = 49
  3551. Global Const $rest_noresolvetrack = 50
  3552. Global Const $rest_forcecopyaclwithfile = 51
  3553. Global Const $rest_nologo3channelnotify = 52
  3554. Global Const $rest_noforgetsoftwareupdate = 53
  3555. Global Const $rest_nosetactivedesktop = 54
  3556. Global Const $rest_noupdatewindows = 55
  3557. Global Const $rest_nochangestarmenu = 56
  3558. Global Const $rest_nofolderoptions = 57
  3559. Global Const $rest_hasfindcomputers = 58
  3560. Global Const $rest_intellimenus = 59
  3561. Global Const $rest_rundlgmemcheckbox = 60
  3562. Global Const $rest_arp_showpostsetup = 61
  3563. Global Const $rest_nocsc = 62
  3564. Global Const $rest_nocontrolpanel = 63
  3565. Global Const $rest_enumworkgroup = 64
  3566. Global Const $rest_arp_noarp = 65
  3567. Global Const $rest_arp_noremovepage = 66
  3568. Global Const $rest_arp_noaddpage = 67
  3569. Global Const $rest_arp_nowinsetuppage = 68
  3570. Global Const $rest_greymsiads = 69
  3571. Global Const $rest_nochangemappeddrivelabel = 70
  3572. Global Const $rest_nochangemappeddrivecomment = 71
  3573. Global Const $rest_maxrecentdocs = 72
  3574. Global Const $rest_nonetworkconnections = 73
  3575. Global Const $rest_forcestartmenulogoff = 74
  3576. Global Const $rest_nowebview = 75
  3577. Global Const $rest_nocustomizethisfolder = 76
  3578. Global Const $rest_noencryption = 77
  3579. Global Const $rest_dontshowsuperhidden = 78
  3580. Global Const $rest_noshellsearchbutton = 79
  3581. Global Const $rest_nohardwaretab = 80
  3582. Global Const $rest_norunasinstallprompt = 81
  3583. Global Const $rest_promptrunasinstallnetpath = 82
  3584. Global Const $rest_nomanagemycomputerverb = 83
  3585. Global Const $rest_norecentdocsnethood = 84
  3586. Global Const $rest_disallowrun = 85
  3587. Global Const $rest_nowelcomescreen = 86
  3588. Global Const $rest_restrictcpl = 87
  3589. Global Const $rest_disallowcpl = 88
  3590. Global Const $rest_nosmballoontip = 89
  3591. Global Const $rest_nosmhelp = 90
  3592. Global Const $rest_nowinkeys = 91
  3593. Global Const $rest_noencryptonmove = 92
  3594. Global Const $rest_nolocalmachinerun = 93
  3595. Global Const $rest_nocurrentuserrun = 94
  3596. Global Const $rest_nolocalmachinerunonce = 95
  3597. Global Const $rest_nocurrentuserrunonce = 96
  3598. Global Const $rest_forceactivedesktopon = 97
  3599. Global Const $rest_nocomputersnearme = 98
  3600. Global Const $rest_noviewondrive = 99
  3601. Global Const $rest_nonetcrawl = 100
  3602. Global Const $rest_noshareddocuments = 101
  3603. Global Const $rest_nosmmydocs = 102
  3604. Global Const $rest_nosmmypics = 103
  3605. Global Const $rest_allowbitbuckdrives = 104
  3606. Global Const $rest_nonlegacyshellmode = 105
  3607. Global Const $rest_nocontrolpanelbarricade = 106
  3608. Global Const $rest_nostartpage = 107
  3609. Global Const $rest_noautotraynotify = 108
  3610. Global Const $rest_notaskgrouping = 109
  3611. Global Const $rest_nocdburning = 110
  3612. Global Const $rest_mycompnoprop = 111
  3613. Global Const $rest_mydocsnoprop = 112
  3614. Global Const $rest_nostartpanel = 113
  3615. Global Const $rest_nodisplayappearancepage = 114
  3616. Global Const $rest_nothemestab = 115
  3617. Global Const $rest_novisualstylechoice = 116
  3618. Global Const $rest_nosizechoice = 117
  3619. Global Const $rest_nocolorchoice = 118
  3620. Global Const $rest_setvisualstyle = 119
  3621. Global Const $rest_startrunnohomepath = 120
  3622. Global Const $rest_nousernameinstartpanel = 121
  3623. Global Const $rest_nomycomputericon = 122
  3624. Global Const $rest_nosmnetworkplaces = 123
  3625. Global Const $rest_nosmpinnedlist = 124
  3626. Global Const $rest_nosmmymusic = 125
  3627. Global Const $rest_nosmejectpc = 126
  3628. Global Const $rest_nosmmoreprograms = 127
  3629. Global Const $rest_nosmmfuprograms = 128
  3630. Global Const $rest_notrayitemsdisplay = 129
  3631. Global Const $rest_notoolbarsontaskbar = 130
  3632. Global Const $rest_nosmconfigureprograms = 131
  3633. Global Const $rest_hideclock = 132
  3634. Global Const $rest_nolowdiskspacechecks = 133
  3635. Global Const $rest_noentirenetwork = 134
  3636. Global Const $rest_nodesktopcleanup = 135
  3637. Global Const $rest_bitbucknukeondelete = 136
  3638. Global Const $rest_bitbuckconfirmdelete = 137
  3639. Global Const $rest_bitbucknoprop = 138
  3640. Global Const $rest_nodispbackground = 139
  3641. Global Const $rest_nodispscreensavepg = 140
  3642. Global Const $rest_nodispsettingspg = 141
  3643. Global Const $rest_nodispscreensavepreview = 142
  3644. Global Const $rest_nodisplaycpl = 143
  3645. Global Const $rest_hiderunasverb = 144
  3646. Global Const $rest_nothumbnailcache = 145
  3647. Global Const $rest_nostrcmplogical = 146
  3648. Global Const $rest_nopublishwizard = 147
  3649. Global Const $rest_noonlineprintswizard = 148
  3650. Global Const $rest_nowebservices = 149
  3651. Global Const $rest_allowunhashedwebview = 150
  3652. Global Const $rest_allowlegacywebview = 151
  3653. Global Const $rest_revertwebviewsecurity = 152
  3654. Global Const $rest_inheritconsolehandles = 153
  3655. Global Const $rest_sortmaxitemcount = 154
  3656. Global Const $rest_noremoterecursiveevents = 155
  3657. Global Const $rest_noremotechangenotify = 156
  3658. Global Const $rest_nosimplenetidlist = 157
  3659. Global Const $rest_noenumentirenetwork = 158
  3660. Global Const $rest_nodetailsthumbnailonnetwork = 159
  3661. Global Const $rest_nointernetopenwith = 160
  3662. Global Const $rest_allowlegacylmzbehavior = 161
  3663. Global Const $rest_dontretrybadnetname = 162
  3664. Global Const $rest_allowfileclsidjunctions = 163
  3665. Global Const $rest_noupnpinstall = 164
  3666. Global Const $rest_arp_dontgrouppatches = 165
  3667. Global Const $rest_arp_nochooseprogramspage = 166
  3668. Global Const $rest_nodisconnect = 167
  3669. Global Const $rest_nosecurity = 168
  3670. Global Const $rest_nofileassociate = 169
  3671. Global Const $rest_allowcommenttoggle = 170
  3672. Global Const $rest_usedesktopinicache = 171
  3673. Global Const $gil_dontcache = 16
  3674. Global Const $gil_notfilename = 8
  3675. Global Const $gil_perclass = 4
  3676. Global Const $gil_perinstance = 2
  3677. Global Const $gil_simulatedoc = 1
  3678. Global Const $gil_shield = 512
  3679. Global Const $gil_forcenoshield = 1024
  3680. Global Const $folderid_addnewprograms = "{DE61D971-5EBC-4F02-A3A9-6C82895E5C04}"
  3681. Global Const $folderid_admintools = "{724EF170-A42D-4FEF-9F26-B60E846FBA4F}"
  3682. Global Const $folderid_appupdates = "{A305CE99-F527-492B-8B1A-7E76FA98D6E4}"
  3683. Global Const $folderid_cdburning = "{9E52AB10-F80D-49DF-ACB8-4330F5687855}"
  3684. Global Const $folderid_changeremoveprograms = "{DF7266AC-9274-4867-8D55-3BD661DE872D}"
  3685. Global Const $folderid_commonadmintools = "{D0384E7D-BAC3-4797-8F14-CBA229B392B5}"
  3686. Global Const $folderid_commonoemlinks = "{C1BAE2D0-10DF-4334-BEDD-7AA20B227A9D}"
  3687. Global Const $folderid_commonprograms = "{0139D44E-6AFE-49F2-8690-3DAFCAE6FFB8}"
  3688. Global Const $folderid_commonstartmenu = "{A4115719-D62E-491D-AA7C-E74B8BE3B067}"
  3689. Global Const $folderid_commonstartup = "{82A5EA35-D9CD-47C5-9629-E15D2F714E6E}"
  3690. Global Const $folderid_commontemplates = "{B94237E7-57AC-4347-9151-B08C6C32D1F7}"
  3691. Global Const $folderid_computerfolder = "{0AC0837C-BBF8-452A-850D-79D08E667CA7}"
  3692. Global Const $folderid_conflictfolder = "{4BFEFB45-347D-4006-A5BE-AC0CB0567192}"
  3693. Global Const $folderid_connectionsfolder = "{6F0CD92B-2E97-45D1-88FF-B0D186B8DEDD}"
  3694. Global Const $folderid_contacts = "{56784854-C6CB-462B-8169-88E350ACB882}"
  3695. Global Const $folderid_controlpanelfolder = "{82A74AEB-AEB4-465C-A014-D097EE346D63}"
  3696. Global Const $folderid_cookies = "{2B0F765D-C0E9-4171-908E-08A611B84FF6}"
  3697. Global Const $folderid_desktop = "{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}"
  3698. Global Const $folderid_devicemetadatastore = "{5CE4A5E9-E4EB-479D-B89F-130C02886155}"
  3699. Global Const $folderid_documentslibrary = "{7B0DB17D-9CD2-4A93-9733-46CC89022E7C}"
  3700. Global Const $folderid_downloads = "{374DE290-123F-4565-9164-39C4925E467B}"
  3701. Global Const $folderid_favorites = "{1777F761-68AD-4D8A-87BD-30B759FA33DD}"
  3702. Global Const $folderid_fonts = "{FD228CB7-AE11-4AE3-864C-16F3910AB8FE}"
  3703. Global Const $folderid_games = "{CAC52C1A-B53D-4EDC-92D7-6B2E8AC19434}"
  3704. Global Const $folderid_gametasks = "{054FAE61-4DD8-4787-80B6-090220C4B700}"
  3705. Global Const $folderid_history = "{D9DC8A3B-B784-432E-A781-5A1130A75963}"
  3706. Global Const $folderid_homegroup = "{52528A6B-B9E3-4ADD-B60D-588C2DBA842D}"
  3707. Global Const $folderid_implicitappshortcuts = "{BCB5256F-79F6-4CEE-B725-DC34E402FD46}"
  3708. Global Const $folderid_internetcache = "{352481E8-33BE-4251-BA85-6007CAEDCF9D}"
  3709. Global Const $folderid_internetfolder = "{4D9F7874-4E0C-4904-967B-40B0D20C3E4B}"
  3710. Global Const $folderid_libraries = "{1B3EA5DC-B587-4786-B4EF-BD1DC332AEAE}"
  3711. Global Const $folderid_links = "{BFB9D5E0-C6A9-404C-B2B2-AE6DB6AF4968}"
  3712. Global Const $folderid_localappdata = "{F1B32785-6FBA-4FCF-9D55-7B8E7F157091}"
  3713. Global Const $folderid_localappdatalow = "{A520A1A4-1780-4FF6-BD18-167343C5AF16}"
  3714. Global Const $folderid_localizedresourcesdir = "{2A00375E-224C-49DE-B8D1-440DF7EF3DDC}"
  3715. Global Const $folderid_music = "{4BD8D571-6D19-48D3-BE97-422220080E43}"
  3716. Global Const $folderid_musiclibrary = "{2112AB0A-C86A-4FFE-A368-0DE96E47012E}"
  3717. Global Const $folderid_nethood = "{C5ABBF53-E17F-4121-8900-86626FC2C973}"
  3718. Global Const $folderid_networkfolder = "{D20BEEC4-5CA8-4905-AE3B-BF251EA09B53}"
  3719. Global Const $folderid_originalimages = "{2C36C0AA-5812-4B87-BFD0-4CD0DFB19B39}"
  3720. Global Const $folderid_photoalbums = "{69D2CF90-FC33-4FB7-9A0C-EBB0F0FCB43C}"
  3721. Global Const $folderid_pictureslibrary = "{A990AE9F-A03B-4E80-94BC-9912D7504104}"
  3722. Global Const $folderid_pictures = "{33E28130-4E1E-4676-835A-98395C3BC3BB}"
  3723. Global Const $folderid_playlists = "{DE92C1C7-837F-4F69-A3BB-86E631204A23}"
  3724. Global Const $folderid_printersfolder = "{76FC4E2D-D6AD-4519-A663-37BD56068185}"
  3725. Global Const $folderid_printhood = "{9274BD8D-CFD1-41C3-B35E-B13F55A758F4}"
  3726. Global Const $folderid_profile = "{5E6C858F-0E22-4760-9AFE-EA3317B67173}"
  3727. Global Const $folderid_programdata = "{62AB5D82-FDC1-4DC3-A9DD-070D1D495D97}"
  3728. Global Const $folderid_programfiles = "{905E63B6-C1BF-494E-B29C-65B732D3D21A}"
  3729. Global Const $folderid_programfilesx64 = "{6D809377-6AF0-444B-8957-A3773F02200E}"
  3730. Global Const $folderid_programfilesx86 = "{7C5A40EF-A0FB-4BFC-874A-C0F2E0B9FA8E}"
  3731. Global Const $folderid_programfilescommon = "{F7F1ED05-9F6D-47A2-AAAE-29D317C6F066}"
  3732. Global Const $folderid_programfilescommonx64 = "{6365D5A7-0F0D-45E5-87F6-0DA56B6A4F7D}"
  3733. Global Const $folderid_programfilescommonx86 = "{DE974D24-D9C6-4D3E-BF91-F4455120B917}"
  3734. Global Const $folderid_programs = "{A77F5D77-2E2B-44C3-A6A2-ABA601054A51}"
  3735. Global Const $folderid_public = "{DFDF76A2-C82A-4D63-906A-5644AC457385}"
  3736. Global Const $folderid_publicdesktop = "{C4AA340D-F20F-4863-AFEF-F87EF2E6BA25}"
  3737. Global Const $folderid_publicdocuments = "{ED4824AF-DCE4-45A8-81E2-FC7965083634}"
  3738. Global Const $folderid_publicdownloads = "{3D644C9B-1FB8-4F30-9B45-F670235F79C0}"
  3739. Global Const $folderid_publicgametasks = "{DEBF2536-E1A8-4C59-B6A2-414586476AEA}"
  3740. Global Const $folderid_publiclibraries = "{48DAF80B-E6CF-4F4E-B800-0E69D84EE384}"
  3741. Global Const $folderid_publicmusic = "{3214FAB5-9757-4298-BB61-92A9DEAA44FF}"
  3742. Global Const $folderid_publicpictures = "{B6EBFB86-6907-413C-9AF7-4FC2ABF07CC5}"
  3743. Global Const $folderid_publicringtones = "{E555AB60-153B-4D17-9F04-A5FE99FC15EC}"
  3744. Global Const $folderid_publicvideos = "{2400183A-6185-49FB-A2D8-4A392A602BA3}"
  3745. Global Const $folderid_quicklaunch = "{52A4F021-7B75-48A9-9F6B-4B87A210BC8F}"
  3746. Global Const $folderid_recent = "{AE50C081-EBD2-438A-8655-8A092E34987A}"
  3747. Global Const $folderid_recordedtvlibrary = "{1A6FDBA2-F42D-4358-A798-B74D745926C5}"
  3748. Global Const $folderid_recyclebinfolder = "{B7534046-3ECB-4C18-BE4E-64CD4CB7D6AC}"
  3749. Global Const $folderid_resourcedir = "{8AD10C31-2ADB-4296-A8F7-E4701232C972}"
  3750. Global Const $folderid_ringtones = "{C870044B-F49E-4126-A9C3-B52A1FF411E8}"
  3751. Global Const $folderid_roamingappdata = "{3EB685DB-65F9-4CF6-A03A-E3EF65729F3D}"
  3752. Global Const $folderid_samplemusic = "{B250C668-F57D-4EE1-A63C-290EE7D1AA1F}"
  3753. Global Const $folderid_samplepictures = "{C4900540-2379-4C75-844B-64E6FAF8716B}"
  3754. Global Const $folderid_sampleplaylists = "{15CA69B3-30EE-49C1-ACE1-6B5EC372AFB5}"
  3755. Global Const $folderid_samplevideos = "{859EAD94-2E85-48AD-A71A-0969CB56A6CD}"
  3756. Global Const $folderid_savedgames = "{4C5C32FF-BB9D-43B0-B5B4-2D72E54EAAA4}"
  3757. Global Const $folderid_savedsearches = "{7D1D3A04-DEBB-4115-95CF-2F29DA2920DA}"
  3758. Global Const $folderid_search_csc = "{EE32E446-31CA-4ABA-814F-A5EBD2FD6D5E}"
  3759. Global Const $folderid_search_mapi = "{98EC0E18-2098-4D44-8644-66979315A281}"
  3760. Global Const $folderid_searchhome = "{190337D1-B8CA-4121-A639-6D472D16972A}"
  3761. Global Const $folderid_sendto = "{8983036C-27C0-404B-8F08-102D10DCFD74}"
  3762. Global Const $folderid_sidebardefaultparts = "{7B396E54-9EC5-4300-BE0A-2482EBAE1A26}"
  3763. Global Const $folderid_sidebarparts = "{A75D362E-50FC-4FB7-AC2C-A8BEAA314493}"
  3764. Global Const $folderid_startmenu = "{625B53C3-AB48-4EC1-BA1F-A1EF4146FC19}"
  3765. Global Const $folderid_startup = "{B97D20BB-F46A-4C97-BA10-5E3608430854}"
  3766. Global Const $folderid_syncmanagerfolder = "{43668BF8-C14E-49B2-97C9-747784D784B7}"
  3767. Global Const $folderid_syncresultsfolder = "{289A9A43-BE44-4057-A41B-587A76D7E7F9}"
  3768. Global Const $folderid_syncsetupfolder = "{0F214138-B1D3-4A90-BBA9-27CBC0C5389A}"
  3769. Global Const $folderid_system = "{1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}"
  3770. Global Const $folderid_systemx86 = "{D65231B0-B2F1-4857-A4CE-A8E7C6EA7D27}"
  3771. Global Const $folderid_templates = "{A63293E8-664E-48DB-A079-DF759E0509F7}"
  3772. Global Const $folderid_userpinned = "{9E3995AB-1F9C-4F13-B827-48B24B6C7174}"
  3773. Global Const $folderid_userprofiles = "{0762D272-C50A-4BB0-A382-697DCD729B80}"
  3774. Global Const $folderid_userprogramfiles = "{5CD7AEE2-2219-4A67-B85D-6C9CE15660CB}"
  3775. Global Const $folderid_userprogramfilescommon = "{BCBD3057-CA5C-4622-B42D-BC56DB0AE516}"
  3776. Global Const $folderid_usersfiles = "{F3CE0F7C-4901-4ACC-8648-D5D44B04EF8F}"
  3777. Global Const $folderid_userslibraries = "{A302545D-DEFF-464B-ABE8-61C8648D939B}"
  3778. Global Const $folderid_videos = "{18989B1D-99B5-455B-841C-AB7C74E4DDFC}"
  3779. Global Const $folderid_videoslibrary = "{491E922F-5643-4AF4-A7EB-4E7A138D8174}"
  3780. Global Const $folderid_windows = "{F38BF404-1D43-42F2-9305-67DE0B28FC23}"
  3781. Global Const $kf_flag_alias_only = -2147483648
  3782. Global Const $kf_flag_create = 32768
  3783. Global Const $kf_flag_dont_verify = 16384
  3784. Global Const $kf_flag_dont_unexpand = 8192
  3785. Global Const $kf_flag_no_alias = 4096
  3786. Global Const $kf_flag_init = 2048
  3787. Global Const $kf_flag_default_path = 1024
  3788. Global Const $kf_flag_no_appcontainer_redirection = 65536
  3789. Global Const $kf_flag_not_parent_relative = 512
  3790. Global Const $kf_flag_simple_idlist = 256
  3791. Global Const $url_scheme_invalid = -1
  3792. Global Const $url_scheme_unknown = 0
  3793. Global Const $url_scheme_ftp = 1
  3794. Global Const $url_scheme_http = 2
  3795. Global Const $url_scheme_gopher = 3
  3796. Global Const $url_scheme_mailto = 4
  3797. Global Const $url_scheme_news = 5
  3798. Global Const $url_scheme_nntp = 6
  3799. Global Const $url_scheme_telnet = 7
  3800. Global Const $url_scheme_wais = 8
  3801. Global Const $url_scheme_file = 9
  3802. Global Const $url_scheme_mk = 10
  3803. Global Const $url_scheme_https = 11
  3804. Global Const $url_scheme_shell = 12
  3805. Global Const $url_scheme_snews = 13
  3806. Global Const $url_scheme_local = 14
  3807. Global Const $url_scheme_javascript = 15
  3808. Global Const $url_scheme_vbscript = 16
  3809. Global Const $url_scheme_about = 17
  3810. Global Const $url_scheme_res = 18
  3811. Global Const $url_scheme_msshellrooted = 19
  3812. Global Const $url_scheme_msshellidlist = 20
  3813. Global Const $url_scheme_mshelp = 21
  3814. Global Const $url_scheme_msshelldevice = 22
  3815. Global Const $url_scheme_wildcard = 23
  3816. Global Const $url_scheme_search_ms = 24
  3817. Global Const $url_scheme_search = 25
  3818. Global Const $url_scheme_knownfolder = 26
  3819. Global Const $gct_invalid = 0
  3820. Global Const $gct_lfnchar = 1
  3821. Global Const $gct_separator = 8
  3822. Global Const $gct_shortchar = 2
  3823. Global Const $gct_wild = 4
  3824. Global Const $url_apply_default = 1
  3825. Global Const $url_apply_guessscheme = 2
  3826. Global Const $url_apply_guessfile = 4
  3827. Global Const $url_apply_forceapply = 8
  3828. Global Const $url_dont_simplify = 134217728
  3829. Global Const $url_escape_as_utf8 = 262144
  3830. Global Const $url_escape_percent = 4096
  3831. Global Const $url_escape_spaces_only = 67108864
  3832. Global Const $url_escape_unsafe = 536870912
  3833. Global Const $url_no_meta = 134217728
  3834. Global Const $url_pluggable_protocol = 1073741824
  3835. Global Const $url_unescape = 268435456
  3836. Global Const $url_part_hostname = 2
  3837. Global Const $url_part_password = 4
  3838. Global Const $url_part_port = 5
  3839. Global Const $url_part_query = 6
  3840. Global Const $url_part_scheme = 1
  3841. Global Const $url_part_username = 3
  3842. Global Const $urlis_appliable = 4
  3843. Global Const $urlis_directory = 5
  3844. Global Const $urlis_fileurl = 3
  3845. Global Const $urlis_hasquery = 6
  3846. Global Const $urlis_nohistory = 2
  3847. Global Const $urlis_opaque = 1
  3848. Global Const $urlis_url = 0
  3849. #Region Functions list
  3850. #EndRegion Functions list
  3851. #Region Public Functions
  3852.  
  3853.     Func _winapi_commandlinetoargv($scmd)
  3854.         Local $aresult[1] = [0]
  3855.         $scmd = StringStripWS($scmd, $str_stripleading + $str_striptrailing)
  3856.         If NOT $scmd Then
  3857.             Return $aresult
  3858.         EndIf
  3859.         Local $aret = DllCall("shell32.dll", "ptr", "CommandLineToArgvW", "wstr", $scmd, "int*", 0)
  3860.         If @error OR NOT $aret[0] OR (NOT $aret[2]) Then Return SetError(@error + 10, @extended, 0)
  3861.         Local $tptr = DllStructCreate("ptr[" & $aret[2] & "]", $aret[0])
  3862.         Dim $aresult[$aret[2] + 1] = [$aret[2]]
  3863.         For $i = 1 To $aret[2]
  3864.             $aresult[$i] = _winapi_getstring(DllStructGetData($tptr, 1, $i))
  3865.         Next
  3866.         DllCall("kernel32.dll", "handle", "LocalFree", "handle", $aret[0])
  3867.         Return $aresult
  3868.     EndFunc
  3869.  
  3870.     Func _winapi_isnameinexpression($sstring, $spattern, $bcasesensitive = False)
  3871.         If NOT $bcasesensitive Then $spattern = StringUpper($spattern)
  3872.         Local $tus1 = __us($spattern)
  3873.         Local $tus2 = __us($sstring)
  3874.         Local $aret = DllCall("ntdll.dll", "boolean", "RtlIsNameInExpression", "struct*", $tus1, "struct*", $tus2, "boolean", NOT $bcasesensitive, "ptr", 0)
  3875.         If @error Then Return SetError(@error, @extended, False)
  3876.         Return $aret[0]
  3877.     EndFunc
  3878.  
  3879.     Func _winapi_parseurl($surl)
  3880.         Local $tagparsedurl = "dword Size;ptr Protocol;uint cchProtocol;ptr Suffix;uint cchSuffix;uint Scheme"
  3881.         Local $tpurl = DllStructCreate($tagparsedurl)
  3882.         DllStructSetData($tpurl, 1, DllStructGetSize($tpurl))
  3883.         Local $turl = DllStructCreate("wchar[4096]")
  3884.         DllStructSetData($turl, 1, $surl)
  3885.         Local $aret = DllCall("shlwapi.dll", "long", "ParseURLW", "struct*", $turl, "struct*", $tpurl)
  3886.         If @error Then Return SetError(@error, @extended, "")
  3887.         If $aret[0] Then Return SetError(10, $aret[0], "")
  3888.         Local $aresult[3]
  3889.         $aresult[0] = DllStructGetData(DllStructCreate("wchar[" & DllStructGetData($tpurl, 3) & "]", DllStructGetData($tpurl, 2)), 1)
  3890.         $aresult[1] = DllStructGetData(DllStructCreate("wchar[" & DllStructGetData($tpurl, 5) & "]", DllStructGetData($tpurl, 4)), 1)
  3891.         $aresult[2] = DllStructGetData($tpurl, 6)
  3892.         Return $aresult
  3893.     EndFunc
  3894.  
  3895.     Func _winapi_parseusername($suser)
  3896.         If NOT __dll("credui.dll") Then Return SetError(103, 0, 0)
  3897.         Local $aret = DllCall("credui.dll", "dword", "CredUIParseUserNameW", "wstr", $suser, "wstr", "", "ulong", 4096, "wstr", "", "ulong", 4096)
  3898.         If @error Then Return SetError(@error, @extended, 0)
  3899.         Switch $aret[0]
  3900.             Case 0
  3901.             Case 1315
  3902.                 If StringStripWS($suser, $str_stripleading + $str_striptrailing) Then
  3903.                     $aret[2] = $suser
  3904.                     $aret[4] = ""
  3905.                 Else
  3906.                     ContinueCase
  3907.                 EndIf
  3908.             Case Else
  3909.                 Return SetError(10, $aret[0], 0)
  3910.         EndSwitch
  3911.         Local $aresult[2]
  3912.         $aresult[0] = $aret[4]
  3913.         $aresult[1] = $aret[2]
  3914.         Return $aresult
  3915.     EndFunc
  3916.  
  3917.     Func _winapi_pathaddbackslash($sfilepath)
  3918.         Local $tpath = DllStructCreate("wchar[260]")
  3919.         DllStructSetData($tpath, 1, $sfilepath)
  3920.         Local $aret = DllCall("shlwapi.dll", "ptr", "PathAddBackslashW", "struct*", $tpath)
  3921.         If @error OR NOT $aret[0] Then Return SetError(@error, @extended, "")
  3922.         Return DllStructGetData($tpath, 1)
  3923.     EndFunc
  3924.  
  3925.     Func _winapi_pathaddextension($sfilepath, $sext = "")
  3926.         Local $tpath = DllStructCreate("wchar[260]")
  3927.         DllStructSetData($tpath, 1, $sfilepath)
  3928.         Local $stypeofext = "wstr"
  3929.         If NOT StringStripWS($sext, $str_stripleading + $str_striptrailing) Then
  3930.             $stypeofext = "ptr"
  3931.             $sext = 0
  3932.         EndIf
  3933.         Local $aret = DllCall("shlwapi.dll", "bool", "PathAddExtensionW", "struct*", $tpath, $stypeofext, $sext)
  3934.         If @error Then Return SetError(@error, @extended, "")
  3935.         Return SetExtended($aret[0], DllStructGetData($tpath, 1))
  3936.     EndFunc
  3937.  
  3938.     Func _winapi_pathappend($sfilepath, $smore)
  3939.         Local $tpath = DllStructCreate("wchar[260]")
  3940.         DllStructSetData($tpath, 1, $sfilepath)
  3941.         Local $aret = DllCall("shlwapi.dll", "bool", "PathAppendW", "struct*", $tpath, "wstr", $smore)
  3942.         If @error OR NOT $aret[0] Then Return SetError(@error, @extended, "")
  3943.         Return DllStructGetData($tpath, 1)
  3944.     EndFunc
  3945.  
  3946.     Func _winapi_pathbuildroot($idrive)
  3947.         Local $aret = DllCall("shlwapi.dll", "ptr", "PathBuildRootW", "wstr", "", "int", $idrive)
  3948.         If @error Then Return SetError(@error, @extended, "")
  3949.         Return $aret[1]
  3950.     EndFunc
  3951.  
  3952.     Func _winapi_pathcanonicalize($sfilepath)
  3953.         Local $aret = DllCall("shlwapi.dll", "bool", "PathCanonicalizeW", "wstr", "", "wstr", $sfilepath)
  3954.         If @error OR NOT $aret[0] Then Return SetError(@error, @extended, $sfilepath)
  3955.         Return $aret[1]
  3956.     EndFunc
  3957.  
  3958.     Func _winapi_pathcommonprefix($spath1, $spath2)
  3959.         Local $aret = DllCall("shlwapi.dll", "int", "PathCommonPrefixW", "wstr", $spath1, "wstr", $spath2, "wstr", "")
  3960.         If @error Then Return SetError(@error, @extended, "")
  3961.         Return SetExtended($aret[0], $aret[3])
  3962.     EndFunc
  3963.  
  3964.     Func _winapi_pathcompactpath($hwnd, $sfilepath, $iwidth = 0)
  3965.         If $iwidth < 1 Then
  3966.             Local $trect = DllStructCreate($tagrect)
  3967.             DllCall("user32.dll", "bool", "GetClientRect", "hwnd", $hwnd, "struct*", $trect)
  3968.             $iwidth += DllStructGetData($trect, "Right") - DllStructGetData($trect, "Left")
  3969.         EndIf
  3970.         Local $aret = DllCall("user32.dll", "handle", "GetDC", "hwnd", $hwnd)
  3971.         If @error OR NOT $aret[0] Then Return SetError(@error + 20, @extended, $sfilepath)
  3972.         Local $hdc = $aret[0]
  3973.         Local Const $wm_getfont = 49
  3974.         $aret = DllCall("user32.dll", "ptr", "SendMessage", "hwnd", $hwnd, "uint", $wm_getfont, "wparam", 0, "lparam", 0)
  3975.         Local $hback = DllCall("gdi32.dll", "handle", "SelectObject", "handle", $hdc, "handle", $aret[0])
  3976.         Local $ierror = 0
  3977.         $aret = DllCall("shlwapi.dll", "bool", "PathCompactPathW", "handle", $hdc, "wstr", $sfilepath, "int", $iwidth)
  3978.         If @error OR NOT $aret[0] Then $ierror = @error + 10
  3979.         DllCall("gdi32.dll", "handle", "SelectObject", "handle", $hdc, "handle", $hback[0])
  3980.         DllCall("user32.dll", "int", "ReleaseDC", "hwnd", $hwnd, "handle", $hdc)
  3981.         If $ierror Then Return SetError($ierror, 0, $sfilepath)
  3982.         Return $aret[2]
  3983.     EndFunc
  3984.  
  3985.     Func _winapi_pathcompactpathex($sfilepath, $imax)
  3986.         Local $aret = DllCall("shlwapi.dll", "bool", "PathCompactPathExW", "wstr", "", "wstr", $sfilepath, "uint", $imax + 1, "dword", 0)
  3987.         If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, $sfilepath)
  3988.         Return $aret[1]
  3989.     EndFunc
  3990.  
  3991.     Func _winapi_pathcreatefromurl($surl)
  3992.         Local $aret = DllCall("shlwapi.dll", "long", "PathCreateFromUrlW", "wstr", $surl, "wstr", "", "dword*", 4096, "dword", 0)
  3993.         If @error Then Return SetError(@error, @extended, "")
  3994.         If $aret[0] Then Return SetError(10, $aret[0], "")
  3995.         Return $aret[2]
  3996.     EndFunc
  3997.  
  3998.     Func _winapi_pathfindextension($sfilepath)
  3999.         Local $aret = DllCall("shlwapi.dll", "wstr", "PathFindExtensionW", "wstr", $sfilepath)
  4000.         If @error Then Return SetError(@error, @extended, "")
  4001.         Return $aret[0]
  4002.     EndFunc
  4003.  
  4004.     Func _winapi_pathfindfilename($sfilepath)
  4005.         Local $aret = DllCall("shlwapi.dll", "wstr", "PathFindFileNameW", "wstr", $sfilepath)
  4006.         If @error Then Return SetError(@error, @extended, $sfilepath)
  4007.         Return $aret[0]
  4008.     EndFunc
  4009.  
  4010.     Func _winapi_pathfindnextcomponent($sfilepath)
  4011.         Local $tpath = DllStructCreate("wchar[" & (StringLen($sfilepath) + 1) & "]")
  4012.         DllStructSetData($tpath, 1, $sfilepath)
  4013.         Local $aret = DllCall("shlwapi.dll", "ptr", "PathFindNextComponentW", "struct*", $tpath)
  4014.         If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, "")
  4015.         Return _winapi_getstring($aret[0])
  4016.     EndFunc
  4017.  
  4018.     Func _winapi_pathfindonpath(Const $sfilepath, $aextrapaths = "", Const $spathdelimiter = @LF)
  4019.         Local $iextracount = 0
  4020.         If IsString($aextrapaths) Then
  4021.             If StringLen($aextrapaths) Then
  4022.                 $aextrapaths = StringSplit($aextrapaths, $spathdelimiter, $str_entiresplit + $str_nocount)
  4023.                 $iextracount = UBound($aextrapaths, $ubound_rows)
  4024.             EndIf
  4025.         ElseIf IsArray($aextrapaths) Then
  4026.             $iextracount = UBound($aextrapaths)
  4027.         EndIf
  4028.         Local $tpaths, $tpathptrs
  4029.         If $iextracount Then
  4030.             Local $tagstruct = ""
  4031.             For $path In $aextrapaths
  4032.                 $tagstruct &= "wchar[" & StringLen($path) + 1 & "];"
  4033.             Next
  4034.             $tpaths = DllStructCreate($tagstruct)
  4035.             $tpathptrs = DllStructCreate("ptr[" & $iextracount + 1 & "]")
  4036.             For $i = 1 To $iextracount
  4037.                 DllStructSetData($tpaths, $i, $aextrapaths[$i - 1])
  4038.                 DllStructSetData($tpathptrs, 1, DllStructGetPtr($tpaths, $i), $i)
  4039.             Next
  4040.             DllStructSetData($tpathptrs, 1, Ptr(0), $iextracount + 1)
  4041.         EndIf
  4042.         Local $aresult = DllCall("shlwapi.dll", "bool", "PathFindOnPathW", "wstr", $sfilepath, "struct*", $tpathptrs)
  4043.         If @error OR NOT $aresult[0] Then Return SetError(@error + 10, @extended, $sfilepath)
  4044.         Return $aresult[1]
  4045.     EndFunc
  4046.  
  4047.     Func _winapi_pathgetargs($sfilepath)
  4048.         Local $tpath = DllStructCreate("wchar[" & (StringLen($sfilepath) + 1) & "]")
  4049.         DllStructSetData($tpath, 1, $sfilepath)
  4050.         Local $aret = DllCall("shlwapi.dll", "ptr", "PathGetArgsW", "struct*", $tpath)
  4051.         If @error OR NOT $aret[0] Then Return SetError(@error, @extended, "")
  4052.         Return _winapi_getstring($aret[0])
  4053.     EndFunc
  4054.  
  4055.     Func _winapi_pathgetchartype($schar)
  4056.         Local $aret = DllCall("shlwapi.dll", "uint", "PathGetCharTypeW", "word", AscW($schar))
  4057.         If @error Then Return SetError(@error, @extended, -1)
  4058.         Return $aret[0]
  4059.     EndFunc
  4060.  
  4061.     Func _winapi_pathgetdrivenumber($sfilepath)
  4062.         Local $aret = DllCall("shlwapi.dll", "int", "PathGetDriveNumberW", "wstr", $sfilepath)
  4063.         If @error OR ($aret[0] = -1) Then Return SetError(@error, @extended, "")
  4064.         Return Chr($aret[0] + 65) & ":"
  4065.     EndFunc
  4066.  
  4067.     Func _winapi_pathiscontenttype($sfilepath, $stype)
  4068.         Local $aret = DllCall("shlwapi.dll", "bool", "PathIsContentTypeW", "wstr", $sfilepath, "wstr", $stype)
  4069.         If @error Then Return SetError(@error, @extended, False)
  4070.         Return $aret[0]
  4071.     EndFunc
  4072.  
  4073.     Func _winapi_pathisexe($sfilepath)
  4074.         Local $aret = DllCall("shell32.dll", "bool", "PathIsExe", "wstr", $sfilepath)
  4075.         If @error Then Return SetError(@error, @extended, False)
  4076.         Return $aret[0]
  4077.     EndFunc
  4078.  
  4079.     Func _winapi_pathisfilespec($sfilepath)
  4080.         Local $aret = DllCall("shlwapi.dll", "bool", "PathIsFileSpecW", "wstr", $sfilepath)
  4081.         If @error Then Return SetError(@error, @extended, False)
  4082.         Return $aret[0]
  4083.     EndFunc
  4084.  
  4085.     Func _winapi_pathislfnfilespec($sfilepath)
  4086.         Local $aret = DllCall("shlwapi.dll", "bool", "PathIsLFNFileSpecW", "wstr", $sfilepath)
  4087.         If @error Then Return SetError(@error, @extended, False)
  4088.         Return $aret[0]
  4089.     EndFunc
  4090.  
  4091.     Func _winapi_pathisrelative($sfilepath)
  4092.         Local $aret = DllCall("shlwapi.dll", "bool", "PathIsRelativeW", "wstr", $sfilepath)
  4093.         If @error Then Return SetError(@error, @extended, False)
  4094.         Return $aret[0]
  4095.     EndFunc
  4096.  
  4097.     Func _winapi_pathisroot($sfilepath)
  4098.         Local $aret = DllCall("shlwapi.dll", "bool", "PathIsRootW", "wstr", $sfilepath)
  4099.         If @error Then Return SetError(@error, @extended, False)
  4100.         Return $aret[0]
  4101.     EndFunc
  4102.  
  4103.     Func _winapi_pathissameroot($spath1, $spath2)
  4104.         Local $aret = DllCall("shlwapi.dll", "bool", "PathIsSameRootW", "wstr", $spath1, "wstr", $spath2)
  4105.         If @error Then Return SetError(@error, @extended, False)
  4106.         Return $aret[0]
  4107.     EndFunc
  4108.  
  4109.     Func _winapi_pathissystemfolder($sfilepath)
  4110.         Local $aret = DllCall("shlwapi.dll", "bool", "PathIsSystemFolderW", "wstr", $sfilepath, "dword", 0)
  4111.         If @error Then Return SetError(@error, @extended, False)
  4112.         Return $aret[0]
  4113.     EndFunc
  4114.  
  4115.     Func _winapi_pathisunc($sfilepath)
  4116.         Local $aret = DllCall("shlwapi.dll", "bool", "PathIsUNCW", "wstr", $sfilepath)
  4117.         If @error Then Return SetError(@error, @extended, False)
  4118.         Return $aret[0]
  4119.     EndFunc
  4120.  
  4121.     Func _winapi_pathisuncserver($sfilepath)
  4122.         Local $aret = DllCall("shlwapi.dll", "bool", "PathIsUNCServerW", "wstr", $sfilepath)
  4123.         If @error Then Return SetError(@error, @extended, False)
  4124.         Return $aret[0]
  4125.     EndFunc
  4126.  
  4127.     Func _winapi_pathisuncservershare($sfilepath)
  4128.         Local $aret = DllCall("shlwapi.dll", "bool", "PathIsUNCServerShareW", "wstr", $sfilepath)
  4129.         If @error Then Return SetError(@error, @extended, False)
  4130.         Return $aret[0]
  4131.     EndFunc
  4132.  
  4133.     Func _winapi_pathmakesystemfolder($sfilepath)
  4134.         Local $aret = DllCall("shlwapi.dll", "bool", "PathMakeSystemFolderW", "wstr", $sfilepath)
  4135.         If @error Then Return SetError(@error, @extended, False)
  4136.         Return $aret[0]
  4137.     EndFunc
  4138.  
  4139.     Func _winapi_pathmatchspec($sfilepath, $sspec)
  4140.         Local $aret = DllCall("shlwapi.dll", "bool", "PathMatchSpecW", "wstr", $sfilepath, "wstr", $sspec)
  4141.         If @error Then Return SetError(@error, @extended, False)
  4142.         Return $aret[0]
  4143.     EndFunc
  4144.  
  4145.     Func _winapi_pathparseiconlocation($sfilepath)
  4146.         Local $aret = DllCall("shlwapi.dll", "int", "PathParseIconLocationW", "wstr", $sfilepath)
  4147.         If @error Then Return SetError(@error, @extended, 0)
  4148.         Local $aresult[2]
  4149.         $aresult[0] = $aret[1]
  4150.         $aresult[1] = $aret[0]
  4151.         Return $aresult
  4152.     EndFunc
  4153.  
  4154.     Func _winapi_pathrelativepathto($spathfrom, $bdirfrom, $spathto, $bdirto)
  4155.         If $bdirfrom Then
  4156.             $bdirfrom = 16
  4157.         EndIf
  4158.         If $bdirto Then
  4159.             $bdirto = 16
  4160.         EndIf
  4161.         Local $aret = DllCall("shlwapi.dll", "bool", "PathRelativePathToW", "wstr", "", "wstr", $spathfrom, "dword", $bdirfrom, "wstr", $spathto, "dword", $bdirto)
  4162.         If @error OR NOT $aret[0] Then Return SetError(@error, @extended, "")
  4163.         Return $aret[1]
  4164.     EndFunc
  4165.  
  4166.     Func _winapi_pathremoveargs($sfilepath)
  4167.         Local $aret = DllCall("shlwapi.dll", "none", "PathRemoveArgsW", "wstr", $sfilepath)
  4168.         If @error Then Return SetError(@error, @extended, "")
  4169.         Return $aret[1]
  4170.     EndFunc
  4171.  
  4172.     Func _winapi_pathremovebackslash($sfilepath)
  4173.         Local $aret = DllCall("shlwapi.dll", "ptr", "PathRemoveBackslashW", "wstr", $sfilepath)
  4174.         If @error Then Return SetError(@error, @extended, "")
  4175.         Return $aret[1]
  4176.     EndFunc
  4177.  
  4178.     Func _winapi_pathremoveextension($sfilepath)
  4179.         Local $aret = DllCall("shlwapi.dll", "none", "PathRemoveExtensionW", "wstr", $sfilepath)
  4180.         If @error Then Return SetError(@error, @extended, "")
  4181.         Return $aret[1]
  4182.     EndFunc
  4183.  
  4184.     Func _winapi_pathremovefilespec($sfilepath)
  4185.         Local $aret = DllCall("shlwapi.dll", "bool", "PathRemoveFileSpecW", "wstr", $sfilepath)
  4186.         If @error Then Return SetError(@error, @extended, "")
  4187.         Return SetExtended($aret[0], $aret[1])
  4188.     EndFunc
  4189.  
  4190.     Func _winapi_pathrenameextension($sfilepath, $sext)
  4191.         Local $tpath = DllStructCreate("wchar[260]")
  4192.         DllStructSetData($tpath, 1, $sfilepath)
  4193.         Local $aret = DllCall("shlwapi.dll", "bool", "PathRenameExtensionW", "struct*", $tpath, "wstr", $sext)
  4194.         If @error OR NOT $aret[0] Then Return SetError(@error, @extended, "")
  4195.         Return DllStructGetData($tpath, 1)
  4196.     EndFunc
  4197.  
  4198.     Func _winapi_pathsearchandqualify($sfilepath, $bexists = False)
  4199.         Local $aret = DllCall("shlwapi.dll", "bool", "PathSearchAndQualifyW", "wstr", $sfilepath, "wstr", "", "int", 4096)
  4200.         If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, "")
  4201.         If $bexists AND NOT FileExists($aret[2]) Then Return SetError(20, 0, "")
  4202.         Return $aret[2]
  4203.     EndFunc
  4204.  
  4205.     Func _winapi_pathskiproot($sfilepath)
  4206.         Local $tpath = DllStructCreate("wchar[" & (StringLen($sfilepath) + 1) & "]")
  4207.         DllStructSetData($tpath, 1, $sfilepath)
  4208.         Local $aret = DllCall("shlwapi.dll", "ptr", "PathSkipRootW", "struct*", $tpath)
  4209.         If @error Then Return SetError(@error, @extended, "")
  4210.         If NOT $aret[0] Then Return $sfilepath
  4211.         Return _winapi_getstring($aret[0])
  4212.     EndFunc
  4213.  
  4214.     Func _winapi_pathstrippath($sfilepath)
  4215.         Local $aret = DllCall("shlwapi.dll", "none", "PathStripPathW", "wstr", $sfilepath)
  4216.         If @error Then Return SetError(@error, @extended, "")
  4217.         Return $aret[1]
  4218.     EndFunc
  4219.  
  4220.     Func _winapi_pathstriptoroot($sfilepath)
  4221.         Local $aret = DllCall("shlwapi.dll", "bool", "PathStripToRootW", "wstr", $sfilepath)
  4222.         If @error OR NOT $aret[0] Then Return SetError(@error, @extended, "")
  4223.         Return $aret[1]
  4224.     EndFunc
  4225.  
  4226.     Func _winapi_pathundecorate($sfilepath)
  4227.         Local $aret = DllCall("shlwapi.dll", "none", "PathUndecorateW", "wstr", $sfilepath)
  4228.         If @error Then Return SetError(@error, @extended, "")
  4229.         Return $aret[1]
  4230.     EndFunc
  4231.  
  4232.     Func _winapi_pathunexpandenvstrings($sfilepath)
  4233.         Local $aret = DllCall("shlwapi.dll", "bool", "PathUnExpandEnvStringsW", "wstr", $sfilepath, "wstr", "", "uint", 4096)
  4234.         If @error OR NOT $aret[0] Then Return SetError(@error, @extended, "")
  4235.         Return $aret[2]
  4236.     EndFunc
  4237.  
  4238.     Func _winapi_pathunmakesystemfolder($sfilepath)
  4239.         Local $aret = DllCall("shlwapi.dll", "bool", "PathUnmakeSystemFolderW", "wstr", $sfilepath)
  4240.         If @error Then Return SetError(@error, @extended, False)
  4241.         Return $aret[0]
  4242.     EndFunc
  4243.  
  4244.     Func _winapi_pathunquotespaces($sfilepath)
  4245.         Local $aret = DllCall("shlwapi.dll", "none", "PathUnquoteSpacesW", "wstr", $sfilepath)
  4246.         If @error Then Return SetError(@error, @extended, "")
  4247.         Return $aret[1]
  4248.     EndFunc
  4249.  
  4250.     Func _winapi_pathyetanothermakeuniquename($sfilepath)
  4251.         Local $aret = DllCall("shell32.dll", "int", "PathYetAnotherMakeUniqueName", "wstr", "", "wstr", $sfilepath, "ptr", 0, "ptr", 0)
  4252.         If @error OR NOT $aret[0] Then Return SetError(@error, @extended, "")
  4253.         Return $aret[1]
  4254.     EndFunc
  4255.  
  4256.     Func _winapi_shellgetimagelist($bsmall = False)
  4257.         Local $plarge, $psmall, $tptr = DllStructCreate("ptr")
  4258.         If $bsmall Then
  4259.             $plarge = 0
  4260.             $psmall = DllStructGetPtr($tptr)
  4261.         Else
  4262.             $plarge = DllStructGetPtr($tptr)
  4263.             $psmall = 0
  4264.         EndIf
  4265.         Local $aret = DllCall("shell32.dll", "int", "Shell_GetImageLists", "ptr", $plarge, "ptr", $psmall)
  4266.         If @error OR NOT $aret[0] Then Return SetError(@error, @extended, 0)
  4267.         Return DllStructGetData($tptr, 1)
  4268.     EndFunc
  4269.  
  4270.     Func _winapi_urlapplyscheme($surl, $iflags = 1)
  4271.         Local $aret = DllCall("shlwapi.dll", "long", "UrlApplySchemeW", "wstr", $surl, "wstr", "", "dword*", 4096, "dword", $iflags)
  4272.         If @error Then Return SetError(@error, @extended, "")
  4273.         If $aret[0] Then Return SetError(10, $aret[0], "")
  4274.         Return $aret[2]
  4275.     EndFunc
  4276.  
  4277.     Func _winapi_urlcanonicalize($surl, $iflags)
  4278.         Local $aret = DllCall("shlwapi.dll", "long", "UrlCanonicalizeW", "wstr", $surl, "wstr", "", "dword*", 4096, "dword", $iflags)
  4279.         If @error Then Return SetError(@error, @extended, "")
  4280.         If $aret[0] Then Return SetError(10, $aret[0], "")
  4281.         Return $aret[2]
  4282.     EndFunc
  4283.  
  4284.     Func _winapi_urlcombine($surl, $spart, $iflags = 0)
  4285.         Local $aret = DllCall("shlwapi.dll", "long", "UrlCombineW", "wstr", $surl, "wstr", $spart, "wstr", "", "dword*", 4096, "dword", $iflags)
  4286.         If @error Then Return SetError(@error, @extended, "")
  4287.         If $aret[0] Then Return SetError(10, $aret[0], "")
  4288.         Return $aret[3]
  4289.     EndFunc
  4290.  
  4291.     Func _winapi_urlcompare($surl1, $surl2, $bignoreslash = False)
  4292.         Local $aret = DllCall("shlwapi.dll", "int", "UrlCompareW", "wstr", $surl1, "wstr", $surl2, "bool", $bignoreslash)
  4293.         If @error Then Return SetError(@error, @extended, 0)
  4294.         Return $aret[0]
  4295.     EndFunc
  4296.  
  4297.     Func _winapi_urlcreatefrompath($sfilepath)
  4298.         Local $aret = DllCall("shlwapi.dll", "long", "UrlCreateFromPathW", "wstr", $sfilepath, "wstr", "", "dword*", 4096, "dword", 0)
  4299.         If @error Then Return SetError(@error, @extended, "")
  4300.         If $aret[0] < 0 OR $aret[0] > 1 Then
  4301.             Return SetError(10, $aret[0], "")
  4302.         EndIf
  4303.         Return $aret[2]
  4304.     EndFunc
  4305.  
  4306.     Func _winapi_urlfixup($surl)
  4307.         Local $aret = DllCall("shlwapi.dll", "long", "UrlFixupW", "wstr", $surl, "wstr", "", "dword", 4096)
  4308.         If @error Then Return SetError(@error, @extended, "")
  4309.         If $aret[0] Then Return SetError(10, $aret[0], "")
  4310.         Return $aret[2]
  4311.     EndFunc
  4312.  
  4313.     Func _winapi_urlgetpart($surl, $ipart)
  4314.         Local $aret = DllCall("shlwapi.dll", "long", "UrlGetPartW", "wstr", $surl, "wstr", "", "dword*", 4096, "dword", $ipart, "dword", 0)
  4315.         If @error Then Return SetError(@error, @extended, "")
  4316.         If $aret[0] Then Return SetError(10, $aret[0], "")
  4317.         Return $aret[2]
  4318.     EndFunc
  4319.  
  4320.     Func _winapi_urlhash($surl, $ilength = 32)
  4321.         If $ilength <= 0 OR $ilength > 256 Then Return SetError(256, 0, 0)
  4322.         Local $tdata = DllStructCreate("byte[" & $ilength & "]")
  4323.         Local $aret = DllCall("shlwapi.dll", "long", "UrlHashW", "wstr", $surl, "struct*", $tdata, "dword", $ilength)
  4324.         If @error Then Return SetError(@error + 10, @extended, 0)
  4325.         If $aret[0] Then Return SetError(10, $aret[0], 0)
  4326.         Return DllStructGetData($tdata, 1)
  4327.     EndFunc
  4328.  
  4329.     Func _winapi_urlis($surl, $itype = 0)
  4330.         Local $aret = DllCall("shlwapi.dll", "bool", "UrlIsW", "wstr", $surl, "uint", $itype)
  4331.         If @error Then Return SetError(@error, @extended, False)
  4332.         Return $aret[0]
  4333.     EndFunc
  4334.  
  4335. #EndRegion Public Functions
  4336. #Region Internal Functions
  4337.  
  4338.     Func __us($sstring, $ilength = 0)
  4339.         If $ilength Then
  4340.             $sstring = StringLeft($sstring, $ilength)
  4341.         Else
  4342.             $ilength = StringLen($sstring)
  4343.         EndIf
  4344.         Local $tus = DllStructCreate("ushort;ushort;ptr;wchar[" & ($ilength + 1) & "]")
  4345.         DllStructSetData($tus, 1, 2 * StringLen($sstring))
  4346.         DllStructSetData($tus, 2, 2 * $ilength)
  4347.         DllStructSetData($tus, 3, DllStructGetPtr($tus, 4))
  4348.         DllStructSetData($tus, 4, $sstring)
  4349.         Return $tus
  4350.     EndFunc
  4351.  
  4352. #EndRegion Internal Functions
  4353. Global Const $klf_activate = 1
  4354. Global Const $klf_notellshell = 128
  4355. Global Const $klf_reorder = 8
  4356. Global Const $klf_replacelang = 16
  4357. Global Const $klf_reset = 1073741824
  4358. Global Const $klf_setforprocess = 256
  4359. Global Const $klf_shiftlock = 65536
  4360. Global Const $klf_substitute_ok = 2
  4361. Global Const $hkl_next = 1
  4362. Global Const $hkl_prev = 0
  4363. Global Const $aw_activate = 131072
  4364. Global Const $aw_blend = 524288
  4365. Global Const $aw_center = 16
  4366. Global Const $aw_hide = 65536
  4367. Global Const $aw_hor_negative = 2
  4368. Global Const $aw_hor_positive = 1
  4369. Global Const $aw_slide = 262144
  4370. Global Const $aw_ver_negative = 8
  4371. Global Const $aw_ver_positive = 4
  4372. Global Const $bsf_allowsfw = 128
  4373. Global Const $bsf_flushdisk = 4
  4374. Global Const $bsf_forceifhung = 32
  4375. Global Const $bsf_ignorecurrenttask = 2
  4376. Global Const $bsf_nohang = 8
  4377. Global Const $bsf_notimeoutifnothung = 64
  4378. Global Const $bsf_postmessage = 16
  4379. Global Const $bsf_query = 1
  4380. Global Const $bsf_sendnotifymessage = 256
  4381. Global Const $bsm_allcomponents = 0
  4382. Global Const $bsm_alldesktops = 8
  4383. Global Const $bsm_applications = 16
  4384. Global Const $bsm_installabledrivers = 4
  4385. Global Const $bsm_netdriver = 2
  4386. Global Const $bsm_vxds = 1
  4387. Global Const $mditile_horizontal = 1
  4388. Global Const $mditile_skipdisabled = 2
  4389. Global Const $mditile_vertical = 0
  4390. Global Const $mditile_zorder = 4
  4391. Global Const $msgflt_allow = 1
  4392. Global Const $msgflt_disallow = 2
  4393. Global Const $msgflt_reset = 0
  4394. Global Const $msgfltinfo_allowed_higher = 3
  4395. Global Const $msgfltinfo_alreadyallowed_forwnd = 1
  4396. Global Const $msgfltinfo_alreadydisallowed_forwnd = 2
  4397. Global Const $msgfltinfo_none = 0
  4398. Global Const $cwp_all = 0
  4399. Global Const $cwp_skipinvisible = 1
  4400. Global Const $cwp_skipdisabled = 2
  4401. Global Const $cwp_skiptransparent = 4
  4402. Global Const $compression_format_none = 0
  4403. Global Const $compression_format_default = 1
  4404. Global Const $compression_format_lznt1 = 2
  4405. Global Const $compression_format_xpress = 3
  4406. Global Const $compression_format_xpress_huff = 4
  4407. Global Const $compression_engine_standard = 0
  4408. Global Const $compression_engine_maximum = 256
  4409. Global Const $compression_engine_hiber = 512
  4410. Global Const $winsta_accessclipboard = 4
  4411. Global Const $winsta_accessglobalatoms = 32
  4412. Global Const $winsta_createdesktop = 8
  4413. Global Const $winsta_enumdesktops = 1
  4414. Global Const $winsta_enumerate = 256
  4415. Global Const $winsta_exitwindows = 64
  4416. Global Const $winsta_readattributes = 2
  4417. Global Const $winsta_readscreen = 512
  4418. Global Const $winsta_writeattributes = 16
  4419. Global Const $winsta_all_access = BitOR($winsta_accessclipboard, $winsta_accessglobalatoms, $winsta_createdesktop, $winsta_enumdesktops, $winsta_enumerate, $winsta_exitwindows, $winsta_readattributes, $winsta_readscreen, $winsta_writeattributes)
  4420. Global Const $cwf_create_only = 1
  4421. Global Const $gcl_cbclsextra = -20
  4422. Global Const $gcl_cbwndextra = -18
  4423. Global Const $gcl_hbrbackground = -10
  4424. Global Const $gcl_hcursor = -12
  4425. Global Const $gcl_hicon = -14
  4426. Global Const $gcl_hiconsm = -34
  4427. Global Const $gcl_hmodule = -16
  4428. Global Const $gcl_menuname = -8
  4429. Global Const $gcl_style = -26
  4430. Global Const $gcl_wndproc = -24
  4431. Global Const $dockinfo_docked = 2
  4432. Global Const $dockinfo_undocked = 1
  4433. Global Const $dockinfo_user_supplied = 4
  4434. Global Const $dockinfo_user_docked = 5
  4435. Global Const $dockinfo_user_undocked = 6
  4436. Global Const $gui_caretblinking = 1
  4437. Global Const $gui_inmenumode = 4
  4438. Global Const $gui_inmovesize = 2
  4439. Global Const $gui_popupmenumode = 16
  4440. Global Const $gui_systemmenumode = 8
  4441. Global Const $handle_flag_inherit = 1
  4442. Global Const $handle_flag_protect_from_close = 2
  4443. Global Const $get_module_handle_ex_flag_from_address = 4
  4444. Global Const $get_module_handle_ex_flag_pin = 1
  4445. Global Const $get_module_handle_ex_flag_unchanged_refcount = 2
  4446. Global Const $get_module_handle_ex_flag_default = 0
  4447. Global Const $processor_architecture_amd64 = 9
  4448. Global Const $processor_architecture_ia64 = 6
  4449. Global Const $processor_architecture_intel = 0
  4450. Global Const $processor_architecture_unknown = 65535
  4451. Global Const $processor_intel_386 = 386
  4452. Global Const $processor_intel_486 = 486
  4453. Global Const $processor_intel_pentium = 586
  4454. Global Const $processor_intel_ia64 = 2200
  4455. Global Const $processor_amd_x8664 = 8664
  4456. Global Const $uoi_flags = 1
  4457. Global Const $uoi_heapsize = 5
  4458. Global Const $uoi_io = 6
  4459. Global Const $uoi_name = 2
  4460. Global Const $uoi_type = 3
  4461. Global Const $uoi_user_sid = 4
  4462. Global Const $df_allowotheraccounthook = 1
  4463. Global Const $wsf_visible = 1
  4464. Global Const $ver_suite_backoffice = 4
  4465. Global Const $ver_suite_blade = 1024
  4466. Global Const $ver_suite_compute_server = 16384
  4467. Global Const $ver_suite_datacenter = 128
  4468. Global Const $ver_suite_enterprise = 2
  4469. Global Const $ver_suite_embeddednt = 64
  4470. Global Const $ver_suite_personal = 512
  4471. Global Const $ver_suite_singleuserts = 256
  4472. Global Const $ver_suite_smallbusiness = 1
  4473. Global Const $ver_suite_smallbusiness_restricted = 32
  4474. Global Const $ver_suite_storage_server = 8192
  4475. Global Const $ver_suite_terminal = 16
  4476. Global Const $ver_suite_wh_server = 32768
  4477. Global Const $ver_nt_domain_controller = 2
  4478. Global Const $ver_nt_server = 3
  4479. Global Const $ver_nt_workstation = 1
  4480. Global Const $wda_monitor = 1
  4481. Global Const $wda_none = 0
  4482. Global Const $pf_3dnow_instructions_available = 7
  4483. Global Const $pf_channels_enabled = 16
  4484. Global Const $pf_compare_exchange_double = 2
  4485. Global Const $pf_compare_exchange128 = 14
  4486. Global Const $pf_compare64_exchange128 = 15
  4487. Global Const $pf_floating_point_emulated = 1
  4488. Global Const $pf_floating_point_precision_errata = 0
  4489. Global Const $pf_mmx_instructions_available = 3
  4490. Global Const $pf_nx_enabled = 12
  4491. Global Const $pf_pae_enabled = 9
  4492. Global Const $pf_rdtsc_instruction_available = 8
  4493. Global Const $pf_sse3_instructions_available = 13
  4494. Global Const $pf_xmmi_instructions_available = 6
  4495. Global Const $pf_xmmi64_instructions_available = 10
  4496. Global Const $pf_xsave_enabled = 17
  4497. Global Const $keyeventf_extendedkey = 1
  4498. Global Const $keyeventf_keyup = 2
  4499. Global Const $lim_small = 0
  4500. Global Const $lim_large = 1
  4501. Global Const $mapvk_vk_to_char = 2
  4502. Global Const $mapvk_vk_to_vsc = 0
  4503. Global Const $mapvk_vk_to_vsc_ex = 4
  4504. Global Const $mapvk_vsc_to_vk = 1
  4505. Global Const $mapvk_vsc_to_vk_ex = 3
  4506. Global Const $mod_alt = 1
  4507. Global Const $mod_control = 2
  4508. Global Const $mod_norepeat = 16384
  4509. Global Const $mod_shift = 4
  4510. Global Const $mod_win = 8
  4511. Global Const $guid_acdc_power_source = "{5D3E9A59-E9D5-4B00-A6BD-FF34FF516548}"
  4512. Global Const $guid_battery_percentage_remaining = "{A7AD8041-B45A-4CAE-87A3-EECBB468A9E1}"
  4513. Global Const $guid_idle_background_task = "{515C31D8-F734-163D-A0FD-11A08C91E8F1}"
  4514. Global Const $guid_monitor_power_on = "{02731015-4510-4526-99E6-E5A17EBD1AEA}"
  4515. Global Const $guid_powerscheme_personality = "{245D8541-3943-4422-B025-13A784F679B7}"
  4516. Global Const $guid_system_awaymode = "{98A7F580-01F7-48AA-9C0F-44352C29E5C0}"
  4517. Global Const $guid_min_power_savings = "{8C5E7FDA-E8BF-4A96-9A85-A6E23A8C635C}"
  4518. Global Const $guid_max_power_savings = "{A1841308-3541-4FAB-BC81-F71556F20B4A}"
  4519. Global Const $guid_typical_power_savings = "{381B4222-F694-41F0-9685-FF5BB260DF2E}"
  4520. Global Const $hshell_windowcreated = 1
  4521. Global Const $hshell_windowdestroyed = 2
  4522. Global Const $hshell_activateshellwindow = 3
  4523. Global Const $hshell_windowactivated = 4
  4524. Global Const $hshell_getminrect = 5
  4525. Global Const $hshell_redraw = 6
  4526. Global Const $hshell_taskman = 7
  4527. Global Const $hshell_language = 8
  4528. Global Const $hshell_sysmenu = 9
  4529. Global Const $hshell_endtask = 10
  4530. Global Const $hshell_accessibilitystate = 11
  4531. Global Const $hshell_appcommand = 12
  4532. Global Const $hshell_windowreplaced = 13
  4533. Global Const $hshell_windowreplacing = 14
  4534. Global Const $hshell_rudeappactivated = 32772
  4535. Global Const $hshell_flash = 32774
  4536. Global Const $hwnd_broadcast = 65535
  4537. Global Const $smto_block = 1
  4538. Global Const $smto_normal = 0
  4539. Global Const $smto_abortifhung = 2
  4540. Global Const $smto_notimeoutifnothung = 8
  4541. Global Const $smto_erroronexit = 32
  4542. Global Const $inputlangchange_backward = 4
  4543. Global Const $inputlangchange_forward = 2
  4544. Global Const $inputlangchange_syscharset = 1
  4545. Global Const $event_min = 1
  4546. Global Const $event_system_sound = 1
  4547. Global Const $event_system_alert = 2
  4548. Global Const $event_system_foreground = 3
  4549. Global Const $event_system_menustart = 4
  4550. Global Const $event_system_menuend = 5
  4551. Global Const $event_system_menupopupstart = 6
  4552. Global Const $event_system_menupopupend = 7
  4553. Global Const $event_system_capturestart = 8
  4554. Global Const $event_system_captureend = 9
  4555. Global Const $event_system_movesizestart = 10
  4556. Global Const $event_system_movesizeend = 11
  4557. Global Const $event_system_contexthelpstart = 12
  4558. Global Const $event_system_contexthelpend = 13
  4559. Global Const $event_system_dragdropstart = 14
  4560. Global Const $event_system_dragdropend = 15
  4561. Global Const $event_system_dialogstart = 16
  4562. Global Const $event_system_dialogend = 17
  4563. Global Const $event_system_scrollingstart = 18
  4564. Global Const $event_system_scrollingend = 19
  4565. Global Const $event_system_switchstart = 20
  4566. Global Const $event_system_switchend = 21
  4567. Global Const $event_system_minimizestart = 22
  4568. Global Const $event_system_minimizeend = 23
  4569. Global Const $event_system_desktopswitch = 32
  4570. Global Const $event_object_create = 32768
  4571. Global Const $event_object_destroy = 32769
  4572. Global Const $event_object_show = 32770
  4573. Global Const $event_object_hide = 32771
  4574. Global Const $event_object_reorder = 32772
  4575. Global Const $event_object_focus = 32773
  4576. Global Const $event_object_selection = 32774
  4577. Global Const $event_object_selectionadd = 32775
  4578. Global Const $event_object_selectionremove = 32776
  4579. Global Const $event_object_selectionwithin = 32777
  4580. Global Const $event_object_statechange = 32778
  4581. Global Const $event_object_locationchange = 32779
  4582. Global Const $event_object_namechange = 32780
  4583. Global Const $event_object_descriptionchange = 32781
  4584. Global Const $event_object_valuechange = 32782
  4585. Global Const $event_object_parentchange = 32783
  4586. Global Const $event_object_helpchange = 32784
  4587. Global Const $event_object_defactionchange = 32785
  4588. Global Const $event_object_acceleratorchange = 32786
  4589. Global Const $event_object_invoked = 32787
  4590. Global Const $event_object_textselectionchanged = 32788
  4591. Global Const $event_object_contentscrolled = 32789
  4592. Global Const $event_max = 2147483647
  4593. Global Const $winevent_incontext = 4
  4594. Global Const $winevent_outofcontext = 0
  4595. Global Const $winevent_skipownprocess = 2
  4596. Global Const $winevent_skipownthread = 1
  4597. Global Const $tme_cancel = -2147483648
  4598. Global Const $tme_hover = 1
  4599. Global Const $tme_leave = 2
  4600. Global Const $tme_nonclient = 16
  4601. Global Const $tme_query = 1073741824
  4602. Global Const $desktop_createmenu = 4
  4603. Global Const $desktop_createwindow = 2
  4604. Global Const $desktop_enumerate = 64
  4605. Global Const $desktop_hookcontrol = 8
  4606. Global Const $desktop_journalplayback = 32
  4607. Global Const $desktop_journalrecord = 16
  4608. Global Const $desktop_readobjects = 1
  4609. Global Const $desktop_switchdesktop = 256
  4610. Global Const $desktop_writeobjects = 128
  4611. Global Const $desktop_all_access = BitOR($desktop_createmenu, $desktop_createwindow, $desktop_enumerate, $desktop_hookcontrol, $desktop_journalplayback, $desktop_journalrecord, $desktop_readobjects, $desktop_switchdesktop, $desktop_writeobjects)
  4612. Global Const $ridev_appkeys = 1024
  4613. Global Const $ridev_capturemouse = 512
  4614. Global Const $ridev_devnotify = 8192
  4615. Global Const $ridev_exclude = 16
  4616. Global Const $ridev_exinputsink = 4096
  4617. Global Const $ridev_inputsink = 256
  4618. Global Const $ridev_nohotkeys = 512
  4619. Global Const $ridev_nolegacy = 48
  4620. Global Const $ridev_pageonly = 32
  4621. Global Const $ridev_remove = 1
  4622. Global Const $rid_header = 268435461
  4623. Global Const $rid_input = 268435459
  4624. Global Const $rim_typehid = 2
  4625. Global Const $rim_typekeyboard = 1
  4626. Global Const $rim_typemouse = 0
  4627. Global Const $ridi_devicename = 536870919
  4628. Global Const $ridi_deviceinfo = 536870923
  4629. Global Const $ridi_preparseddata = 536870917
  4630. Global Const $mouse_attributes_changed = 4
  4631. Global Const $mouse_move_absolute = 1
  4632. Global Const $mouse_move_relative = 0
  4633. Global Const $mouse_virtual_desktop = 2
  4634. Global Const $ri_mouse_left_button_down = 1
  4635. Global Const $ri_mouse_left_button_up = 2
  4636. Global Const $ri_mouse_middle_button_down = 16
  4637. Global Const $ri_mouse_middle_button_up = 32
  4638. Global Const $ri_mouse_right_button_down = 4
  4639. Global Const $ri_mouse_right_button_up = 8
  4640. Global Const $ri_mouse_button_1_down = $ri_mouse_left_button_down
  4641. Global Const $ri_mouse_button_1_up = $ri_mouse_left_button_up
  4642. Global Const $ri_mouse_button_2_down = $ri_mouse_right_button_down
  4643. Global Const $ri_mouse_button_2_up = $ri_mouse_right_button_up
  4644. Global Const $ri_mouse_button_3_down = $ri_mouse_middle_button_down
  4645. Global Const $ri_mouse_button_3_up = $ri_mouse_middle_button_up
  4646. Global Const $ri_mouse_button_4_down = 64
  4647. Global Const $ri_mouse_button_4_up = 128
  4648. Global Const $ri_mouse_button_5_down = 256
  4649. Global Const $ri_mouse_button_5_up = 512
  4650. Global Const $ri_mouse_wheel = 1024
  4651. Global Const $ri_key_break = 1
  4652. Global Const $ri_key_e0 = 2
  4653. Global Const $ri_key_e1 = 4
  4654. Global Const $ri_key_make = 0
  4655. #Region Global Variables and Constants
  4656.     Global Const $duplicate_close_source = 1
  4657.     Global Const $duplicate_same_access = 2
  4658.     Global Const $obj_bitmap = 7
  4659.     Global Const $obj_brush = 2
  4660.     Global Const $obj_colorspace = 14
  4661.     Global Const $obj_dc = 3
  4662.     Global Const $obj_enhmetadc = 12
  4663.     Global Const $obj_enhmetafile = 13
  4664.     Global Const $obj_extpen = 11
  4665.     Global Const $obj_font = 6
  4666.     Global Const $obj_memdc = 10
  4667.     Global Const $obj_metadc = 4
  4668.     Global Const $obj_metafile = 9
  4669.     Global Const $obj_pal = 5
  4670.     Global Const $obj_pen = 1
  4671.     Global Const $obj_region = 8
  4672.     Global Const $null_brush = 5
  4673.     Global Const $null_pen = 8
  4674.     Global Const $black_brush = 4
  4675.     Global Const $dkgray_brush = 3
  4676.     Global Const $dc_brush = 18
  4677.     Global Const $gray_brush = 2
  4678.     Global Const $hollow_brush = $null_brush
  4679.     Global Const $ltgray_brush = 1
  4680.     Global Const $white_brush = 0
  4681.     Global Const $black_pen = 7
  4682.     Global Const $dc_pen = 19
  4683.     Global Const $white_pen = 6
  4684.     Global Const $ansi_fixed_font = 11
  4685.     Global Const $ansi_var_font = 12
  4686.     Global Const $device_default_font = 14
  4687.     Global Const $default_gui_font = 17
  4688.     Global Const $oem_fixed_font = 10
  4689.     Global Const $system_font = 13
  4690.     Global Const $system_fixed_font = 16
  4691.     Global Const $default_palette = 15
  4692. #EndRegion Global Variables and Constants
  4693. #Region Functions list
  4694. #EndRegion Functions list
  4695. #Region Public Functions
  4696.  
  4697.     Func _winapi_closehandle($hobject)
  4698.         Local $aresult = DllCall("kernel32.dll", "bool", "CloseHandle", "handle", $hobject)
  4699.         If @error Then Return SetError(@error, @extended, False)
  4700.         Return $aresult[0]
  4701.     EndFunc
  4702.  
  4703.     Func _winapi_deleteobject($hobject)
  4704.         Local $aresult = DllCall("gdi32.dll", "bool", "DeleteObject", "handle", $hobject)
  4705.         If @error Then Return SetError(@error, @extended, False)
  4706.         Return $aresult[0]
  4707.     EndFunc
  4708.  
  4709.     Func _winapi_duplicatehandle($hsourceprocesshandle, $hsourcehandle, $htargetprocesshandle, $idesiredaccess, $iinherithandle, $ioptions)
  4710.         Local $aresult = DllCall("kernel32.dll", "bool", "DuplicateHandle", "handle", $hsourceprocesshandle, "handle", $hsourcehandle, "handle", $htargetprocesshandle, "handle*", 0, "dword", $idesiredaccess, "bool", $iinherithandle, "dword", $ioptions)
  4711.         If @error OR NOT $aresult[0] Then Return SetError(@error, @extended, 0)
  4712.         Return $aresult[4]
  4713.     EndFunc
  4714.  
  4715.     Func _winapi_getcurrentobject($hdc, $itype)
  4716.         Local $aret = DllCall("gdi32.dll", "handle", "GetCurrentObject", "handle", $hdc, "uint", $itype)
  4717.         If @error OR NOT $aret[0] Then Return SetError(@error, @extended, 0)
  4718.         Return $aret[0]
  4719.     EndFunc
  4720.  
  4721.     Func _winapi_getcurrentprocess()
  4722.         Local $aresult = DllCall("kernel32.dll", "handle", "GetCurrentProcess")
  4723.         If @error Then Return SetError(@error, @extended, 0)
  4724.         Return $aresult[0]
  4725.     EndFunc
  4726.  
  4727.     Func _winapi_getobject($hobject, $isize, $pobject)
  4728.         Local $aresult = DllCall("gdi32.dll", "int", "GetObjectW", "handle", $hobject, "int", $isize, "struct*", $pobject)
  4729.         If @error Then Return SetError(@error, @extended, 0)
  4730.         Return $aresult[0]
  4731.     EndFunc
  4732.  
  4733.     Func _winapi_getobjectinfobyhandle($hobject)
  4734.         Local $tagpublic_object_basic_information = "ulong Attributes;ulong GrantedAcess;ulong HandleCount;ulong PointerCount;ulong Reserved[10]"
  4735.         Local $tpobi = DllStructCreate($tagpublic_object_basic_information)
  4736.         Local $aret = DllCall("ntdll.dll", "long", "ZwQueryObject", "handle", $hobject, "uint", 0, "struct*", $tpobi, "ulong", DllStructGetSize($tpobi), "ptr", 0)
  4737.         If @error Then Return SetError(@error, @extended, 0)
  4738.         If $aret[0] Then Return SetError(10, $aret[0], 0)
  4739.         Local $aresult[4]
  4740.         For $i = 0 To 3
  4741.             $aresult[$i] = DllStructGetData($tpobi, $i + 1)
  4742.         Next
  4743.         Return $aresult
  4744.     EndFunc
  4745.  
  4746.     Func _winapi_getobjectnamebyhandle($hobject)
  4747.         Local $tagunicode_string = "struct;ushort Length;ushort MaximumLength;ptr Buffer;endstruct"
  4748.         Local $tagpublic_object_type_information = "struct;" & $tagunicode_string & ";ulong Reserved[22];endstruct"
  4749.         Local $tpoti = DllStructCreate($tagpublic_object_type_information & ";byte[32]")
  4750.         Local $aret = DllCall("ntdll.dll", "long", "ZwQueryObject", "handle", $hobject, "uint", 2, "struct*", $tpoti, "ulong", DllStructGetSize($tpoti), "ulong*", 0)
  4751.         If @error Then Return SetError(@error, @extended, "")
  4752.         If $aret[0] Then Return SetError(10, $aret[0], "")
  4753.         Local $pdata = DllStructGetData($tpoti, 3)
  4754.         If NOT $pdata Then Return SetError(11, 0, "")
  4755.         Return _winapi_getstring($pdata)
  4756.     EndFunc
  4757.  
  4758.     Func _winapi_getobjecttype($hobject)
  4759.         Local $aret = DllCall("gdi32.dll", "dword", "GetObjectType", "handle", $hobject)
  4760.         If @error Then Return SetError(@error, @extended, 0)
  4761.         Return $aret[0]
  4762.     EndFunc
  4763.  
  4764.     Func _winapi_getstdhandle($istdhandle)
  4765.         If $istdhandle < 0 OR $istdhandle > 2 Then Return SetError(2, 0, -1)
  4766.         Local Const $ahandle[3] = [-10, -11, -12]
  4767.         Local $aresult = DllCall("kernel32.dll", "handle", "GetStdHandle", "dword", $ahandle[$istdhandle])
  4768.         If @error Then Return SetError(@error, @extended, -1)
  4769.         Return $aresult[0]
  4770.     EndFunc
  4771.  
  4772.     Func _winapi_getstockobject($iobject)
  4773.         Local $aresult = DllCall("gdi32.dll", "handle", "GetStockObject", "int", $iobject)
  4774.         If @error Then Return SetError(@error, @extended, 0)
  4775.         Return $aresult[0]
  4776.     EndFunc
  4777.  
  4778.     Func _winapi_selectobject($hdc, $hgdiobj)
  4779.         Local $aresult = DllCall("gdi32.dll", "handle", "SelectObject", "handle", $hdc, "handle", $hgdiobj)
  4780.         If @error Then Return SetError(@error, @extended, False)
  4781.         Return $aresult[0]
  4782.     EndFunc
  4783.  
  4784.     Func _winapi_sethandleinformation($hobject, $imask, $iflags)
  4785.         Local $aresult = DllCall("kernel32.dll", "bool", "SetHandleInformation", "handle", $hobject, "dword", $imask, "dword", $iflags)
  4786.         If @error Then Return SetError(@error, @extended, False)
  4787.         Return $aresult[0]
  4788.     EndFunc
  4789.  
  4790. #EndRegion Public Functions
  4791. #Region Global Variables and Constants
  4792.     Global Const $tagbitmap = "struct;long bmType;long bmWidth;long bmHeight;long bmWidthBytes;ushort bmPlanes;ushort bmBitsPixel;ptr bmBits;endstruct"
  4793.     Global Const $tagbitmapv5header = "struct;dword bV5Size;long bV5Width;long bV5Height;ushort bV5Planes;ushort bV5BitCount;dword bV5Compression;dword bV5SizeImage;long bV5XPelsPerMeter;long bV5YPelsPerMeter;dword bV5ClrUsed;dword bV5ClrImportant;dword bV5RedMask;dword bV5GreenMask;dword bV5BlueMask;dword bV5AlphaMask;dword bV5CSType;int bV5Endpoints[9];dword bV5GammaRed;dword bV5GammaGreen;dword bV5GammaBlue;dword bV5Intent;dword bV5ProfileData;dword bV5ProfileSize;dword bV5Reserved;endstruct"
  4794.     Global Const $tagdibsection = $tagbitmap & ";" & $tagbitmapinfoheader & ";dword dsBitfields[3];ptr dshSection;dword dsOffset"
  4795.     Global Const $tmpf_fixed_pitch = 1
  4796.     Global Const $tmpf_vector = 2
  4797.     Global Const $tmpf_truetype = 4
  4798.     Global Const $tmpf_device = 8
  4799.     Global Const $__winapiconstant_fw_normal = 400
  4800.     Global Const $__winapiconstant_default_charset = 1
  4801.     Global Const $__winapiconstant_out_default_precis = 0
  4802.     Global Const $__winapiconstant_clip_default_precis = 0
  4803.     Global Const $__winapiconstant_default_quality = 0
  4804. #EndRegion Global Variables and Constants
  4805. #Region Functions list
  4806. #EndRegion Functions list
  4807. #Region Public Functions
  4808.  
  4809.     Func _winapi_bitblt($hdestdc, $ixdest, $iydest, $iwidth, $iheight, $hsrcdc, $ixsrc, $iysrc, $irop)
  4810.         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)
  4811.         If @error Then Return SetError(@error, @extended, False)
  4812.         Return $aresult[0]
  4813.     EndFunc
  4814.  
  4815.     Func _winapi_combinergn($hrgndest, $hrgnsrc1, $hrgnsrc2, $icombinemode)
  4816.         Local $aresult = DllCall("gdi32.dll", "int", "CombineRgn", "handle", $hrgndest, "handle", $hrgnsrc1, "handle", $hrgnsrc2, "int", $icombinemode)
  4817.         If @error Then Return SetError(@error, @extended, 0)
  4818.         Return $aresult[0]
  4819.     EndFunc
  4820.  
  4821.     Func _winapi_copybitmap($hbitmap)
  4822.         $hbitmap = _winapi_copyimage($hbitmap, 0, 0, 0, 8192)
  4823.         Return SetError(@error, @extended, $hbitmap)
  4824.     EndFunc
  4825.  
  4826.     Func _winapi_copyimage($himage, $itype = 0, $ixdesiredpixels = 0, $iydesiredpixels = 0, $iflags = 0)
  4827.         Local $aret = DllCall("user32.dll", "handle", "CopyImage", "handle", $himage, "uint", $itype, "int", $ixdesiredpixels, "int", $iydesiredpixels, "uint", $iflags)
  4828.         If @error Then Return SetError(@error, @extended, 0)
  4829.         Return $aret[0]
  4830.     EndFunc
  4831.  
  4832.     Func _winapi_createandbitmap($hbitmap)
  4833.         Local $ierror = 0, $hdib = 0
  4834.         $hbitmap = _winapi_copybitmap($hbitmap)
  4835.         If NOT $hbitmap Then Return SetError(@error + 20, @extended, 0)
  4836.         Do
  4837.             Local $atdib[2]
  4838.             $atdib[0] = DllStructCreate($tagdibsection)
  4839.             If (NOT _winapi_getobject($hbitmap, DllStructGetSize($atdib[0]), $atdib[0])) OR (DllStructGetData($atdib[0], "bmBitsPixel") <> 32) OR (DllStructGetData($atdib[0], "biCompression")) Then
  4840.                 $ierror = 10
  4841.                 ExitLoop
  4842.             EndIf
  4843.             $atdib[1] = DllStructCreate($tagbitmap)
  4844.             $hdib = _winapi_createdib(DllStructGetData($atdib[0], "bmWidth"), DllStructGetData($atdib[0], "bmHeight"), 1)
  4845.             If NOT _winapi_getobject($hdib, DllStructGetSize($atdib[1]), $atdib[1]) Then
  4846.                 $ierror = 11
  4847.                 ExitLoop
  4848.             EndIf
  4849.             Local $aret = DllCall("user32.dll", "lresult", "CallWindowProc", "ptr", __andproc(), "ptr", 0, "uint", 0, "wparam", DllStructGetPtr($atdib[0]), "lparam", DllStructGetPtr($atdib[1]))
  4850.             If @error Then
  4851.                 $ierror = @error
  4852.                 ExitLoop
  4853.             EndIf
  4854.             If NOT $aret[0] Then
  4855.                 $ierror = 12
  4856.                 ExitLoop
  4857.             EndIf
  4858.             $ierror = 0
  4859.         Until 1
  4860.         _winapi_deleteobject($hbitmap)
  4861.         If $ierror Then
  4862.             If $hdib Then
  4863.                 _winapi_deleteobject($hdib)
  4864.             EndIf
  4865.             $hdib = 0
  4866.         EndIf
  4867.         Return SetError($ierror, 0, $hdib)
  4868.     EndFunc
  4869.  
  4870.     Func _winapi_createbitmap($iwidth, $iheight, $iplanes = 1, $ibitsperpel = 1, $pbits = 0)
  4871.         Local $aresult = DllCall("gdi32.dll", "handle", "CreateBitmap", "int", $iwidth, "int", $iheight, "uint", $iplanes, "uint", $ibitsperpel, "struct*", $pbits)
  4872.         If @error Then Return SetError(@error, @extended, 0)
  4873.         Return $aresult[0]
  4874.     EndFunc
  4875.  
  4876.     Func _winapi_createcompatiblebitmap($hdc, $iwidth, $iheight)
  4877.         Local $aresult = DllCall("gdi32.dll", "handle", "CreateCompatibleBitmap", "handle", $hdc, "int", $iwidth, "int", $iheight)
  4878.         If @error Then Return SetError(@error, @extended, 0)
  4879.         Return $aresult[0]
  4880.     EndFunc
  4881.  
  4882.     Func _winapi_createdib($iwidth, $iheight, $ibitsperpel = 32, $tcolortable = 0, $icolorcount = 0)
  4883.         Local $argbq[2], $icolors, $tagrgbq
  4884.         Switch $ibitsperpel
  4885.             Case 1
  4886.                 $icolors = 2
  4887.             Case 4
  4888.                 $icolors = 16
  4889.             Case 8
  4890.                 $icolors = 256
  4891.             Case Else
  4892.                 $icolors = 0
  4893.         EndSwitch
  4894.         If $icolors Then
  4895.             If NOT IsDllStruct($tcolortable) Then
  4896.                 Switch $ibitsperpel
  4897.                     Case 1
  4898.                         $argbq[0] = 0
  4899.                         $argbq[1] = 16777215
  4900.                         $tcolortable = _winapi_createdibcolortable($argbq)
  4901.                     Case Else
  4902.                 EndSwitch
  4903.             Else
  4904.                 If $icolors > $icolorcount Then
  4905.                     $icolors = $icolorcount
  4906.                 EndIf
  4907.                 If (NOT $icolors) OR ((4 * $icolors) > DllStructGetSize($tcolortable)) Then
  4908.                     Return SetError(20, 0, 0)
  4909.                 EndIf
  4910.             EndIf
  4911.             $tagrgbq = ";dword aRGBQuad[" & $icolors & "]"
  4912.         Else
  4913.             $tagrgbq = ""
  4914.         EndIf
  4915.         Local $tbitmapinfo = DllStructCreate($tagbitmapinfoheader & $tagrgbq)
  4916.         DllStructSetData($tbitmapinfo, "biSize", 40)
  4917.         DllStructSetData($tbitmapinfo, "biWidth", $iwidth)
  4918.         DllStructSetData($tbitmapinfo, "biHeight", $iheight)
  4919.         DllStructSetData($tbitmapinfo, "biPlanes", 1)
  4920.         DllStructSetData($tbitmapinfo, "biBitCount", $ibitsperpel)
  4921.         DllStructSetData($tbitmapinfo, "biCompression", 0)
  4922.         DllStructSetData($tbitmapinfo, "biSizeImage", 0)
  4923.         DllStructSetData($tbitmapinfo, "biXPelsPerMeter", 0)
  4924.         DllStructSetData($tbitmapinfo, "biYPelsPerMeter", 0)
  4925.         DllStructSetData($tbitmapinfo, "biClrUsed", $icolors)
  4926.         DllStructSetData($tbitmapinfo, "biClrImportant", 0)
  4927.         If $icolors Then
  4928.             If IsDllStruct($tcolortable) Then
  4929.                 _winapi_movememory(DllStructGetPtr($tbitmapinfo, "aRGBQuad"), $tcolortable, 4 * $icolors)
  4930.             Else
  4931.                 _winapi_zeromemory(DllStructGetPtr($tbitmapinfo, "aRGBQuad"), 4 * $icolors)
  4932.             EndIf
  4933.         EndIf
  4934.         Local $hbitmap = _winapi_createdibsection(0, $tbitmapinfo, 0, $__g_vext)
  4935.         If NOT $hbitmap Then Return SetError(@error, @extended, 0)
  4936.         Return $hbitmap
  4937.     EndFunc
  4938.  
  4939.     Func _winapi_createdibsection($hdc, $tbitmapinfo, $iusage, ByRef $pbits, $hsection = 0, $ioffset = 0)
  4940.         $pbits = 0
  4941.         Local $aret = DllCall("gdi32.dll", "handle", "CreateDIBSection", "handle", $hdc, "struct*", $tbitmapinfo, "uint", $iusage, "ptr*", 0, "handle", $hsection, "dword", $ioffset)
  4942.         If @error OR NOT $aret[0] Then Return SetError(@error, @extended, 0)
  4943.         $pbits = $aret[4]
  4944.         Return $aret[0]
  4945.     EndFunc
  4946.  
  4947.     Func _winapi_createdibcolortable(Const ByRef $acolortable, $istart = 0, $iend = -1)
  4948.         If __checkerrorarraybounds($acolortable, $istart, $iend) Then Return SetError(@error + 10, @extended, 0)
  4949.         Local $tcolortable = DllStructCreate("dword[" & ($iend - $istart + 1) & "]")
  4950.         Local $icount = 1
  4951.         For $i = $istart To $iend
  4952.             DllStructSetData($tcolortable, 1, _winapi_switchcolor(__rgb($acolortable[$i])), $icount)
  4953.             $icount += 1
  4954.         Next
  4955.         Return $tcolortable
  4956.     EndFunc
  4957.  
  4958.     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")
  4959.         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)
  4960.         If @error Then Return SetError(@error, @extended, 0)
  4961.         Return $aresult[0]
  4962.     EndFunc
  4963.  
  4964.     Func _winapi_createfontindirect($tlogfont)
  4965.         Local $aresult = DllCall("gdi32.dll", "handle", "CreateFontIndirectW", "struct*", $tlogfont)
  4966.         If @error Then Return SetError(@error, @extended, 0)
  4967.         Return $aresult[0]
  4968.     EndFunc
  4969.  
  4970.     Func _winapi_createrectrgn($ileftrect, $itoprect, $irightrect, $ibottomrect)
  4971.         Local $aresult = DllCall("gdi32.dll", "handle", "CreateRectRgn", "int", $ileftrect, "int", $itoprect, "int", $irightrect, "int", $ibottomrect)
  4972.         If @error Then Return SetError(@error, @extended, 0)
  4973.         Return $aresult[0]
  4974.     EndFunc
  4975.  
  4976.     Func _winapi_createroundrectrgn($ileftrect, $itoprect, $irightrect, $ibottomrect, $iwidthellipse, $iheightellipse)
  4977.         Local $aresult = DllCall("gdi32.dll", "handle", "CreateRoundRectRgn", "int", $ileftrect, "int", $itoprect, "int", $irightrect, "int", $ibottomrect, "int", $iwidthellipse, "int", $iheightellipse)
  4978.         If @error Then Return SetError(@error, @extended, 0)
  4979.         Return $aresult[0]
  4980.     EndFunc
  4981.  
  4982.     Func _winapi_createsolidbrush($icolor)
  4983.         Local $aresult = DllCall("gdi32.dll", "handle", "CreateSolidBrush", "INT", $icolor)
  4984.         If @error Then Return SetError(@error, @extended, 0)
  4985.         Return $aresult[0]
  4986.     EndFunc
  4987.  
  4988.     Func _winapi_getbitmapdimension($hbitmap)
  4989.         Local $tobj = DllStructCreate($tagbitmap)
  4990.         Local $aret = DllCall("gdi32.dll", "int", "GetObject", "handle", $hbitmap, "int", DllStructGetSize($tobj), "struct*", $tobj)
  4991.         If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
  4992.         Return _winapi_createsize(DllStructGetData($tobj, "bmWidth"), DllStructGetData($tobj, "bmHeight"))
  4993.     EndFunc
  4994.  
  4995.     Func _winapi_getsyscolorbrush($iindex)
  4996.         Local $aresult = DllCall("user32.dll", "handle", "GetSysColorBrush", "int", $iindex)
  4997.         If @error Then Return SetError(@error, @extended, 0)
  4998.         Return $aresult[0]
  4999.     EndFunc
  5000.  
  5001.     Func _winapi_gettextextentpoint32($hdc, $stext)
  5002.         Local $tsize = DllStructCreate($tagsize)
  5003.         Local $isize = StringLen($stext)
  5004.         Local $aret = DllCall("gdi32.dll", "bool", "GetTextExtentPoint32W", "handle", $hdc, "wstr", $stext, "int", $isize, "struct*", $tsize)
  5005.         If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
  5006.         Return $tsize
  5007.     EndFunc
  5008.  
  5009.     Func _winapi_gettextmetrics($hdc)
  5010.         Local $ttextmetric = DllStructCreate($tagtextmetric)
  5011.         Local $aret = DllCall("gdi32.dll", "bool", "GetTextMetricsW", "handle", $hdc, "struct*", $ttextmetric)
  5012.         If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
  5013.         Return $ttextmetric
  5014.     EndFunc
  5015.  
  5016.     Func _winapi_getwindowrgn($hwnd, $hrgn)
  5017.         Local $aresult = DllCall("user32.dll", "int", "GetWindowRgn", "hwnd", $hwnd, "handle", $hrgn)
  5018.         If @error Then Return SetError(@error, @extended, 0)
  5019.         Return $aresult[0]
  5020.     EndFunc
  5021.  
  5022.     Func _winapi_isalphabitmap($hbitmap)
  5023.         $hbitmap = _winapi_copybitmap($hbitmap)
  5024.         If NOT $hbitmap Then Return SetError(@error + 20, @extended, 0)
  5025.         Local $aret, $ierror = 0
  5026.         Do
  5027.             Local $tdib = DllStructCreate($tagdibsection)
  5028.             If (NOT _winapi_getobject($hbitmap, DllStructGetSize($tdib), $tdib)) OR (DllStructGetData($tdib, "bmBitsPixel") <> 32) OR (DllStructGetData($tdib, "biCompression")) Then
  5029.                 $ierror = 1
  5030.                 ExitLoop
  5031.             EndIf
  5032.             $aret = DllCall("user32.dll", "int", "CallWindowProc", "ptr", __alphaproc(), "ptr", 0, "uint", 0, "struct*", $tdib, "ptr", 0)
  5033.             If @error OR ($aret[0] = -1) Then
  5034.                 $ierror = @error + 10
  5035.                 ExitLoop
  5036.             EndIf
  5037.         Until 1
  5038.         _winapi_deleteobject($hbitmap)
  5039.         If $ierror Then Return SetError($ierror, 0, 0)
  5040.         Return $aret[0]
  5041.     EndFunc
  5042.  
  5043.     Func _winapi_ptinrect(ByRef $trect, ByRef $tpoint)
  5044.         Local $aresult = DllCall("user32.dll", "bool", "PtInRect", "struct*", $trect, "struct", $tpoint)
  5045.         If @error Then Return SetError(@error, @extended, False)
  5046.         Return $aresult[0]
  5047.     EndFunc
  5048.  
  5049.     Func _winapi_redrawwindow($hwnd, $trect = 0, $hregion = 0, $iflags = 5)
  5050.         Local $aresult = DllCall("user32.dll", "bool", "RedrawWindow", "hwnd", $hwnd, "struct*", $trect, "handle", $hregion, "uint", $iflags)
  5051.         If @error Then Return SetError(@error, @extended, False)
  5052.         Return $aresult[0]
  5053.     EndFunc
  5054.  
  5055.     Func _winapi_setwindowrgn($hwnd, $hrgn, $bredraw = True)
  5056.         Local $aresult = DllCall("user32.dll", "int", "SetWindowRgn", "hwnd", $hwnd, "handle", $hrgn, "bool", $bredraw)
  5057.         If @error Then Return SetError(@error, @extended, False)
  5058.         Return $aresult[0]
  5059.     EndFunc
  5060.  
  5061. #EndRegion Public Functions
  5062. #Region Embedded DLL Functions
  5063.  
  5064.     Func __alphaproc()
  5065.         Static $pproc = 0
  5066.         If NOT $pproc Then
  5067.             If @AutoItX64 Then
  5068.                 $pproc = __init(Binary("0x48894C240848895424104C894424184C894C24205541574831C050504883EC28" & "48837C24600074054831C0EB0748C7C0010000004821C0751F488B6C24604883" & "7D180074054831C0EB0748C7C0010000004821C07502EB0948C7C001000000EB" & "034831C04821C0740C48C7C0FFFFFFFF4863C0EB6F48C744242800000000488B" & "6C24604C637D04488B6C2460486345084C0FAFF849C1E7024983C7FC4C3B7C24" & "287C36488B6C24604C8B7D184C037C24284983C7034C897C2430488B6C243080" & "7D0000740C48C7C0010000004863C0EB1348834424280471A54831C04863C0EB" & "034831C04883C438415F5DC3"))
  5069.             Else
  5070.                 $pproc = __init(Binary("0x555331C05050837C241C00740431C0EB05B80100000021C075198B6C241C837D" & "1400740431C0EB05B80100000021C07502EB07B801000000EB0231C021C07407" & "B8FFFFFFFFEB4FC70424000000008B6C241C8B5D048B6C241C0FAF5D08C1E302" & "83C3FC3B1C247C288B6C241C8B5D14031C2483C303895C24048B6C2404807D00" & "007407B801000000EB0C8304240471BE31C0EB0231C083C4085B5DC21000"))
  5071.             EndIf
  5072.         EndIf
  5073.         Return $pproc
  5074.     EndFunc
  5075.  
  5076.     Func __andproc()
  5077.         Static $pproc = 0
  5078.         If NOT $pproc Then
  5079.             If @AutoItX64 Then
  5080.                 $pproc = __init(Binary("0x48894C240848895424104C894424184C894C2420554157415648C7C009000000" & "4883EC0848C704240000000048FFC875EF4883EC284883BC24A0000000007405" & "4831C0EB0748C7C0010000004821C00F85840000004883BC24A8000000007405" & "4831C0EB0748C7C0010000004821C07555488BAC24A000000048837D18007405" & "4831C0EB0748C7C0010000004821C07522488BAC24A800000048837D18007405" & "4831C0EB0748C7C0010000004821C07502EB0948C7C001000000EB034831C048" & "21C07502EB0948C7C001000000EB034831C04821C07502EB0948C7C001000000" & "EB034831C04821C0740B4831C04863C0E9D701000048C74424280000000048C7" & "44243000000000488BAC24A00000004C637D0849FFCF4C3B7C24300F8C9C0100" & "0048C74424380000000048C74424400000000048C744244800000000488BAC24" & "A00000004C637D0449FFCF4C3B7C24480F8CDB000000488BAC24A00000004C8B" & "7D184C037C24284983C7034C897C2450488B6C2450807D000074264C8B7C2440" & "4C8B74243849F7DE4983C61F4C89F148C7C00100000048D3E04909C74C897C24" & "4048FF4424384C8B7C24384983FF1F7E6F4C8B7C244049F7D74C897C244048C7" & "442458180000004831C0483B4424587F3D488BAC24A80000004C8B7D184C037C" & "24604C897C24504C8B7C2440488B4C245849D3FF4C89F850488B6C2458588845" & "0048FF4424604883442458F871B948C74424380000000048C744244000000000" & "48834424280448FF4424480F810BFFFFFF48837C24380074794C8B7C244049F7" & "D74C8B74243849F7DE4983C6204C89F148C7C0FFFFFFFF48D3E04921C74C897C" & "244048C7442458180000004831C0483B4424587F3D488BAC24A80000004C8B7D" & "184C037C24604C897C24504C8B7C2440488B4C245849D3FF4C89F850488B6C24" & "585888450048FF4424604883442458F871B948FF4424300F814AFEFFFF48C7C0" & "010000004863C0EB034831C04883C470415E415F5DC3"))
  5081.             Else
  5082.                 $pproc = __init(Binary("0x555357BA0800000083EC04C70424000000004A75F3837C243800740431C0EB05" & "B80100000021C07562837C243C00740431C0EB05B80100000021C0753F8B6C24" & "38837D1400740431C0EB05B80100000021C075198B6C243C837D1400740431C0" & "EB05B80100000021C07502EB07B801000000EB0231C021C07502EB07B8010000" & "00EB0231C021C07502EB07B801000000EB0231C021C0740731C0E969010000C7" & "042400000000C7442404000000008B6C24388B5D084B3B5C24040F8C3F010000" & "C744240800000000C744240C00000000C7442410000000008B6C24388B5D044B" & "3B5C24100F8CA90000008B6C24388B5D14031C2483C303895C24148B6C241480" & "7D0000741C8B5C240C8B7C2408F7DF83C71F89F9B801000000D3E009C3895C24" & "0CFF4424088B5C240883FB1F7E578B5C240CF7D3895C240CC744241818000000" & "31C03B4424187F2D8B6C243C8B5D14035C241C895C24148B5C240C8B4C2418D3" & "FB538B6C241858884500FF44241C83442418F871CBC744240800000000C74424" & "0C0000000083042404FF4424100F8145FFFFFF837C240800745B8B5C240CF7D3" & "8B7C2408F7DF83C72089F9B8FFFFFFFFD3E021C3895C240CC744241818000000" & "31C03B4424187F2D8B6C243C8B5D14035C241C895C24148B5C240C8B4C2418D3" & "FB538B6C241858884500FF44241C83442418F871CBFF4424040F81AFFEFFFFB8" & "01000000EB0231C083C4205F5B5DC21000"))
  5083.             EndIf
  5084.         EndIf
  5085.         Return $pproc
  5086.     EndFunc
  5087.  
  5088.     Func __xorproc()
  5089.         Static $pproc = 0
  5090.         If NOT $pproc Then
  5091.             If @AutoItX64 Then
  5092.                 $pproc = __init(Binary("0x48894C240848895424104C894424184C894C24205541574831C050504883EC28" & "48837C24600074054831C0EB0748C7C0010000004821C0751B48837C24680074" & "054831C0EB0748C7C0010000004821C07502EB0948C7C001000000EB034831C0" & "4821C074084831C04863C0EB7748C7442428000000004C637C24584983C7FC4C" & "3B7C24287C4F4C8B7C24604C037C24284C897C2430488B6C2430807D00007405" & "4831C0EB0748C7C0010000004821C0741C4C8B7C24684C037C24284983C7034C" & "897C2430488B6C2430C64500FF48834424280471A148C7C0010000004863C0EB" & "034831C04883C438415F5DC3"))
  5093.             Else
  5094.                 $pproc = __init(Binary("0x555331C05050837C241C00740431C0EB05B80100000021C07516837C24200074" & "0431C0EB05B80100000021C07502EB07B801000000EB0231C021C0740431C0EB" & "5AC70424000000008B5C241883C3FC3B1C247C3E8B5C241C031C24895C24048B" & "6C2404807D0000740431C0EB05B80100000021C074168B5C2420031C2483C303" & "895C24048B6C2404C64500FF8304240471B6B801000000EB0231C083C4085B5D" & "C21000"))
  5095.             EndIf
  5096.         EndIf
  5097.         Return $pproc
  5098.     EndFunc
  5099.  
  5100. #EndRegion Embedded DLL Functions
  5101. #Region Internal Functions
  5102.  
  5103.     Func __init($ddata)
  5104.         Local $ilength = BinaryLen($ddata)
  5105.         Local $aret = DllCall("kernel32.dll", "ptr", "VirtualAlloc", "ptr", 0, "ulong_ptr", $ilength, "dword", 4096, "dword", 64)
  5106.         If @error OR NOT $aret[0] Then __fatalexit(1, "Error allocating memory.")
  5107.         Local $tdata = DllStructCreate("byte[" & $ilength & "]", $aret[0])
  5108.         DllStructSetData($tdata, 1, $ddata)
  5109.         Return $aret[0]
  5110.     EndFunc
  5111.  
  5112. #EndRegion Internal Functions
  5113. #Region Global Variables and Constants
  5114.     Global Const $di_mask = 1
  5115.     Global Const $di_image = 2
  5116.     Global Const $di_normal = 3
  5117.     Global Const $di_compat = 4
  5118.     Global Const $di_defaultsize = 8
  5119.     Global Const $di_nomirror = 16
  5120.     Global Const $display_device_attached_to_desktop = 1
  5121.     Global Const $display_device_multi_driver = 2
  5122.     Global Const $display_device_primary_device = 4
  5123.     Global Const $display_device_mirroring_driver = 8
  5124.     Global Const $display_device_vga_compatible = 16
  5125.     Global Const $display_device_removable = 32
  5126.     Global Const $display_device_disconnect = 33554432
  5127.     Global Const $display_device_remote = 67108864
  5128.     Global Const $display_device_modespruned = 134217728
  5129. #EndRegion Global Variables and Constants
  5130. #Region Functions list
  5131. #EndRegion Functions list
  5132. #Region Public Functions
  5133.  
  5134.     Func _winapi_createcompatibledc($hdc)
  5135.         Local $aresult = DllCall("gdi32.dll", "handle", "CreateCompatibleDC", "handle", $hdc)
  5136.         If @error Then Return SetError(@error, @extended, 0)
  5137.         Return $aresult[0]
  5138.     EndFunc
  5139.  
  5140.     Func _winapi_deletedc($hdc)
  5141.         Local $aresult = DllCall("gdi32.dll", "bool", "DeleteDC", "handle", $hdc)
  5142.         If @error Then Return SetError(@error, @extended, False)
  5143.         Return $aresult[0]
  5144.     EndFunc
  5145.  
  5146.     Func _winapi_drawedge($hdc, $trect, $iedgetype, $iflags)
  5147.         Local $aresult = DllCall("user32.dll", "bool", "DrawEdge", "handle", $hdc, "struct*", $trect, "uint", $iedgetype, "uint", $iflags)
  5148.         If @error Then Return SetError(@error, @extended, False)
  5149.         Return $aresult[0]
  5150.     EndFunc
  5151.  
  5152.     Func _winapi_drawframecontrol($hdc, $trect, $itype, $istate)
  5153.         Local $aresult = DllCall("user32.dll", "bool", "DrawFrameControl", "handle", $hdc, "struct*", $trect, "uint", $itype, "uint", $istate)
  5154.         If @error Then Return SetError(@error, @extended, False)
  5155.         Return $aresult[0]
  5156.     EndFunc
  5157.  
  5158.     Func _winapi_drawicon($hdc, $ix, $iy, $hicon)
  5159.         Local $aresult = DllCall("user32.dll", "bool", "DrawIcon", "handle", $hdc, "int", $ix, "int", $iy, "handle", $hicon)
  5160.         If @error Then Return SetError(@error, @extended, False)
  5161.         Return $aresult[0]
  5162.     EndFunc
  5163.  
  5164.     Func _winapi_drawiconex($hdc, $ix, $iy, $hicon, $iwidth = 0, $iheight = 0, $istep = 0, $hbrush = 0, $iflags = 3)
  5165.         Local $ioptions
  5166.         Switch $iflags
  5167.             Case 1
  5168.                 $ioptions = $di_mask
  5169.             Case 2
  5170.                 $ioptions = $di_image
  5171.             Case 3
  5172.                 $ioptions = $di_normal
  5173.             Case 4
  5174.                 $ioptions = $di_compat
  5175.             Case 5
  5176.                 $ioptions = $di_defaultsize
  5177.             Case Else
  5178.                 $ioptions = $di_nomirror
  5179.         EndSwitch
  5180.         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)
  5181.         If @error Then Return SetError(@error, @extended, False)
  5182.         Return $aresult[0]
  5183.     EndFunc
  5184.  
  5185.     Func _winapi_drawtext($hdc, $stext, ByRef $trect, $iflags)
  5186.         Local $aresult = DllCall("user32.dll", "int", "DrawTextW", "handle", $hdc, "wstr", $stext, "int", -1, "struct*", $trect, "uint", $iflags)
  5187.         If @error Then Return SetError(@error, @extended, 0)
  5188.         Return $aresult[0]
  5189.     EndFunc
  5190.  
  5191.     Func _winapi_enumdisplaydevices($sdevice, $idevnum)
  5192.         Local $tname = 0, $iflags = 0, $adevice[5]
  5193.         If $sdevice <> "" Then
  5194.             $tname = DllStructCreate("wchar Text[" & StringLen($sdevice) + 1 & "]")
  5195.             DllStructSetData($tname, "Text", $sdevice)
  5196.         EndIf
  5197.         Local Const $tagdisplay_device = "dword Size;wchar Name[32];wchar String[128];dword Flags;wchar ID[128];wchar Key[128]"
  5198.         Local $tdevice = DllStructCreate($tagdisplay_device)
  5199.         Local $idevice = DllStructGetSize($tdevice)
  5200.         DllStructSetData($tdevice, "Size", $idevice)
  5201.         Local $aret = DllCall("user32.dll", "bool", "EnumDisplayDevicesW", "struct*", $tname, "dword", $idevnum, "struct*", $tdevice, "dword", 1)
  5202.         If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
  5203.         Local $in = DllStructGetData($tdevice, "Flags")
  5204.         If BitAND($in, $display_device_attached_to_desktop) <> 0 Then $iflags = BitOR($iflags, 1)
  5205.         If BitAND($in, $display_device_primary_device) <> 0 Then $iflags = BitOR($iflags, 2)
  5206.         If BitAND($in, $display_device_mirroring_driver) <> 0 Then $iflags = BitOR($iflags, 4)
  5207.         If BitAND($in, $display_device_vga_compatible) <> 0 Then $iflags = BitOR($iflags, 8)
  5208.         If BitAND($in, $display_device_removable) <> 0 Then $iflags = BitOR($iflags, 16)
  5209.         If BitAND($in, $display_device_modespruned) <> 0 Then $iflags = BitOR($iflags, 32)
  5210.         $adevice[0] = True
  5211.         $adevice[1] = DllStructGetData($tdevice, "Name")
  5212.         $adevice[2] = DllStructGetData($tdevice, "String")
  5213.         $adevice[3] = $iflags
  5214.         $adevice[4] = DllStructGetData($tdevice, "ID")
  5215.         Return $adevice
  5216.     EndFunc
  5217.  
  5218.     Func _winapi_fillrect($hdc, $trect, $hbrush)
  5219.         Local $aresult
  5220.         If IsPtr($hbrush) Then
  5221.             $aresult = DllCall("user32.dll", "int", "FillRect", "handle", $hdc, "struct*", $trect, "handle", $hbrush)
  5222.         Else
  5223.             $aresult = DllCall("user32.dll", "int", "FillRect", "handle", $hdc, "struct*", $trect, "dword_ptr", $hbrush)
  5224.         EndIf
  5225.         If @error Then Return SetError(@error, @extended, False)
  5226.         Return $aresult[0]
  5227.     EndFunc
  5228.  
  5229.     Func _winapi_framerect($hdc, $trect, $hbrush)
  5230.         Local $aresult = DllCall("user32.dll", "int", "FrameRect", "handle", $hdc, "struct*", $trect, "handle", $hbrush)
  5231.         If @error Then Return SetError(@error, @extended, False)
  5232.         Return $aresult[0]
  5233.     EndFunc
  5234.  
  5235.     Func _winapi_getbkmode($hdc)
  5236.         Local $aresult = DllCall("gdi32.dll", "int", "GetBkMode", "handle", $hdc)
  5237.         If @error Then Return SetError(@error, @extended, 0)
  5238.         Return $aresult[0]
  5239.     EndFunc
  5240.  
  5241.     Func _winapi_getdc($hwnd)
  5242.         Local $aresult = DllCall("user32.dll", "handle", "GetDC", "hwnd", $hwnd)
  5243.         If @error Then Return SetError(@error, @extended, 0)
  5244.         Return $aresult[0]
  5245.     EndFunc
  5246.  
  5247.     Func _winapi_getdcex($hwnd, $hrgn, $iflags)
  5248.         Local $aret = DllCall("user32.dll", "handle", "GetDCEx", "hwnd", $hwnd, "handle", $hrgn, "dword", $iflags)
  5249.         If @error Then Return SetError(@error, @extended, 0)
  5250.         Return $aret[0]
  5251.     EndFunc
  5252.  
  5253.     Func _winapi_getdevicecaps($hdc, $iindex)
  5254.         Local $aresult = DllCall("gdi32.dll", "int", "GetDeviceCaps", "handle", $hdc, "int", $iindex)
  5255.         If @error Then Return SetError(@error, @extended, 0)
  5256.         Return $aresult[0]
  5257.     EndFunc
  5258.  
  5259.     Func _winapi_gettextcolor($hdc)
  5260.         Local $aret = DllCall("gdi32.dll", "dword", "GetTextColor", "handle", $hdc)
  5261.         If @error OR ($aret[0] = 4294967295) Then Return SetError(@error, @extended, -1)
  5262.         Return __rgb($aret[0])
  5263.     EndFunc
  5264.  
  5265.     Func _winapi_getwindowdc($hwnd)
  5266.         Local $aresult = DllCall("user32.dll", "handle", "GetWindowDC", "hwnd", $hwnd)
  5267.         If @error Then Return SetError(@error, @extended, 0)
  5268.         Return $aresult[0]
  5269.     EndFunc
  5270.  
  5271.     Func _winapi_printwindow($hwnd, $hdc, $bclient = False)
  5272.         Local $aret = DllCall("user32.dll", "bool", "PrintWindow", "hwnd", $hwnd, "handle", $hdc, "uint", $bclient)
  5273.         If @error Then Return SetError(@error, @extended, False)
  5274.         Return $aret[0]
  5275.     EndFunc
  5276.  
  5277.     Func _winapi_releasedc($hwnd, $hdc)
  5278.         Local $aresult = DllCall("user32.dll", "int", "ReleaseDC", "hwnd", $hwnd, "handle", $hdc)
  5279.         If @error Then Return SetError(@error, @extended, False)
  5280.         Return $aresult[0]
  5281.     EndFunc
  5282.  
  5283.     Func _winapi_restoredc($hdc, $iid)
  5284.         Local $aret = DllCall("gdi32.dll", "bool", "RestoreDC", "handle", $hdc, "int", $iid)
  5285.         If @error Then Return SetError(@error, @extended, False)
  5286.         Return $aret[0]
  5287.     EndFunc
  5288.  
  5289.     Func _winapi_savedc($hdc)
  5290.         Local $aret = DllCall("gdi32.dll", "int", "SaveDC", "handle", $hdc)
  5291.         If @error Then Return SetError(@error, @extended, 0)
  5292.         Return $aret[0]
  5293.     EndFunc
  5294.  
  5295.     Func _winapi_setbkcolor($hdc, $icolor)
  5296.         Local $aresult = DllCall("gdi32.dll", "INT", "SetBkColor", "handle", $hdc, "INT", $icolor)
  5297.         If @error Then Return SetError(@error, @extended, -1)
  5298.         Return $aresult[0]
  5299.     EndFunc
  5300.  
  5301.     Func _winapi_setbkmode($hdc, $ibkmode)
  5302.         Local $aresult = DllCall("gdi32.dll", "int", "SetBkMode", "handle", $hdc, "int", $ibkmode)
  5303.         If @error Then Return SetError(@error, @extended, 0)
  5304.         Return $aresult[0]
  5305.     EndFunc
  5306.  
  5307.     Func _winapi_settextcolor($hdc, $icolor)
  5308.         Local $aresult = DllCall("gdi32.dll", "INT", "SetTextColor", "handle", $hdc, "INT", $icolor)
  5309.         If @error Then Return SetError(@error, @extended, -1)
  5310.         Return $aresult[0]
  5311.     EndFunc
  5312.  
  5313.     Func _winapi_twipsperpixelx()
  5314.         Local $hdc, $itwipsperpixelx
  5315.         $hdc = _winapi_getdc(0)
  5316.         Local Const $__winapiconstant_logpixelsx = 88
  5317.         $itwipsperpixelx = 1440 / _winapi_getdevicecaps($hdc, $__winapiconstant_logpixelsx)
  5318.         _winapi_releasedc(0, $hdc)
  5319.         Return $itwipsperpixelx
  5320.     EndFunc
  5321.  
  5322.     Func _winapi_twipsperpixely()
  5323.         Local $hdc, $itwipsperpixely
  5324.         $hdc = _winapi_getdc(0)
  5325.         Local Const $__winapiconstant_logpixelsy = 90
  5326.         $itwipsperpixely = 1440 / _winapi_getdevicecaps($hdc, $__winapiconstant_logpixelsy)
  5327.         _winapi_releasedc(0, $hdc)
  5328.         Return $itwipsperpixely
  5329.     EndFunc
  5330.  
  5331. #EndRegion Public Functions
  5332. #Region Internal Functions
  5333. #EndRegion Internal Functions
  5334. #Region Global Variables and Constants
  5335. #EndRegion Global Variables and Constants
  5336. #Region Functions list
  5337. #EndRegion Functions list
  5338. #Region Public Functions
  5339.     Global Const $tagiconinfo = "bool Icon;dword XHotSpot;dword YHotSpot;handle hMask;handle hColor"
  5340.  
  5341.     Func _winapi_addicontransparency($hicon, $ipercent = 50, $bdelete = False)
  5342.         Local $tbitmap, $hdib = 0, $hresult = 0
  5343.         Local $ahbitmap[2]
  5344.         Local $ticoninfo = DllStructCreate($tagiconinfo)
  5345.         Local $aret = DllCall("user32.dll", "bool", "GetIconInfo", "handle", $hicon, "struct*", $ticoninfo)
  5346.         If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
  5347.         For $i = 0 To 1
  5348.             $ahbitmap[$i] = DllStructGetData($ticoninfo, $i + 4)
  5349.         Next
  5350.         Local $ierror = 0
  5351.         Do
  5352.             $hdib = _winapi_copybitmap($ahbitmap[1])
  5353.             If NOT $hdib Then
  5354.                 $ierror = 20
  5355.                 ExitLoop
  5356.             EndIf
  5357.             $tbitmap = DllStructCreate($tagbitmap)
  5358.             If (NOT _winapi_getobject($hdib, DllStructGetSize($tbitmap), $tbitmap)) OR (DllStructGetData($tbitmap, "bmBitsPixel") <> 32) Then
  5359.                 $ierror = 21
  5360.                 ExitLoop
  5361.             EndIf
  5362.             $aret = DllCall("user32.dll", "lresult", "CallWindowProc", "PTR", __transparencyproc(), "hwnd", 0, "uint", $ipercent, "wparam", DllStructGetPtr($tbitmap), "lparam", 0)
  5363.             If @error OR NOT $aret[0] Then
  5364.                 $ierror = @error + 30
  5365.                 ExitLoop
  5366.             EndIf
  5367.             If $aret[0] = -1 Then
  5368.                 $hresult = _winapi_createemptyicon(DllStructGetData($tbitmap, "bmWidth"), DllStructGetData($tbitmap, "bmHeight"))
  5369.             Else
  5370.                 $hresult = _winapi_createiconindirect($hdib, $ahbitmap[0])
  5371.             EndIf
  5372.             If NOT $hresult Then $ierror = 22
  5373.         Until 1
  5374.         If $hdib Then
  5375.             _winapi_deleteobject($hdib)
  5376.         EndIf
  5377.         For $i = 0 To 1
  5378.             If $ahbitmap[$i] Then
  5379.                 _winapi_deleteobject($ahbitmap[$i])
  5380.             EndIf
  5381.         Next
  5382.         If $ierror Then Return SetError($ierror, 0, 0)
  5383.         If $bdelete Then
  5384.             _winapi_destroyicon($hicon)
  5385.         EndIf
  5386.         Return $hresult
  5387.     EndFunc
  5388.  
  5389.     Func _winapi_copyicon($hicon)
  5390.         Local $aresult = DllCall("user32.dll", "handle", "CopyIcon", "handle", $hicon)
  5391.         If @error Then Return SetError(@error, @extended, 0)
  5392.         Return $aresult[0]
  5393.     EndFunc
  5394.  
  5395.     Func _winapi_create32bithicon($hicon, $bdelete = False)
  5396.         Local $ahbitmap[2], $hresult = 0
  5397.         Local $adib[2][2] = [[0, 0], [0, 0]]
  5398.         Local $ticoninfo = DllStructCreate($tagiconinfo)
  5399.         Local $aret = DllCall("user32.dll", "bool", "GetIconInfo", "handle", $hicon, "struct*", $ticoninfo)
  5400.         If @error Then Return SetError(@error, @extended, 0)
  5401.         If NOT $aret[0] Then Return SetError(10, 0, 0)
  5402.         For $i = 0 To 1
  5403.             $ahbitmap[$i] = DllStructGetData($ticoninfo, $i + 4)
  5404.         Next
  5405.         If _winapi_isalphabitmap($ahbitmap[1]) Then
  5406.             $adib[0][0] = _winapi_createandbitmap($ahbitmap[1])
  5407.             If NOT @error Then
  5408.                 $hresult = _winapi_createiconindirect($ahbitmap[1], $adib[0][0])
  5409.             EndIf
  5410.         Else
  5411.             Local $tsize = _winapi_getbitmapdimension($ahbitmap[1])
  5412.             Local $asize[2]
  5413.             For $i = 0 To 1
  5414.                 $asize[$i] = DllStructGetData($tsize, $i + 1)
  5415.             Next
  5416.             Local $hsrcdc = _winapi_createcompatibledc(0)
  5417.             Local $hdstdc = _winapi_createcompatibledc(0)
  5418.             Local $hsrcsv, $hdstsv
  5419.             For $i = 0 To 1
  5420.                 $adib[$i][0] = _winapi_createdib($asize[0], $asize[1])
  5421.                 $adib[$i][1] = $__g_vext
  5422.                 $hsrcsv = _winapi_selectobject($hsrcdc, $ahbitmap[$i])
  5423.                 $hdstsv = _winapi_selectobject($hdstdc, $adib[$i][0])
  5424.                 _winapi_bitblt($hdstdc, 0, 0, $asize[0], $asize[1], $hsrcdc, 0, 0, 12583114)
  5425.                 _winapi_selectobject($hsrcdc, $hsrcsv)
  5426.                 _winapi_selectobject($hdstdc, $hdstsv)
  5427.             Next
  5428.             _winapi_deletedc($hsrcdc)
  5429.             _winapi_deletedc($hdstdc)
  5430.             $aret = DllCall("user32.dll", "lresult", "CallWindowProc", "ptr", __xorproc(), "ptr", 0, "uint", $asize[0] * $asize[1] * 4, "wparam", $adib[0][1], "lparam", $adib[1][1])
  5431.             If NOT @error AND $aret[0] Then
  5432.                 $hresult = _winapi_createiconindirect($adib[1][0], $ahbitmap[0])
  5433.             EndIf
  5434.         EndIf
  5435.         For $i = 0 To 1
  5436.             _winapi_deleteobject($ahbitmap[$i])
  5437.             If $adib[$i][0] Then
  5438.                 _winapi_deleteobject($adib[$i][0])
  5439.             EndIf
  5440.         Next
  5441.         If NOT $hresult Then Return SetError(11, 0, 0)
  5442.         If $bdelete Then
  5443.             _winapi_destroyicon($hicon)
  5444.         EndIf
  5445.         Return $hresult
  5446.     EndFunc
  5447.  
  5448.     Func _winapi_createemptyicon($iwidth, $iheight, $ibitsperpel = 32)
  5449.         Local $hxor = _winapi_createdib($iwidth, $iheight, $ibitsperpel)
  5450.         Local $hand = _winapi_createdib($iwidth, $iheight, 1)
  5451.         Local $hdc = _winapi_createcompatibledc(0)
  5452.         Local $hsv = _winapi_selectobject($hdc, $hand)
  5453.         Local $hbrush = _winapi_createsolidbrush(16777215)
  5454.         Local $trect = _winapi_createrect(0, 0, $iwidth, $iheight)
  5455.         _winapi_fillrect($hdc, $trect, $hbrush)
  5456.         _winapi_deleteobject($hbrush)
  5457.         _winapi_selectobject($hdc, $hsv)
  5458.         _winapi_deletedc($hdc)
  5459.         Local $hicon = _winapi_createiconindirect($hxor, $hand)
  5460.         Local $ierror = @error
  5461.         If $hxor Then
  5462.             _winapi_deleteobject($hxor)
  5463.         EndIf
  5464.         If $hand Then
  5465.             _winapi_deleteobject($hand)
  5466.         EndIf
  5467.         If NOT $hicon Then Return SetError($ierror + 10, 0, 0)
  5468.         Return $hicon
  5469.     EndFunc
  5470.  
  5471.     Func _winapi_createicon($hinstance, $iwidth, $iheight, $iplanes, $ibitspixel, $pandbits, $pxorbits)
  5472.         Local $aret = DllCall("user32.dll", "handle", "CreateIcon", "handle", $hinstance, "int", $iwidth, "int", $iheight, "byte", $iplanes, "byte", $ibitspixel, "struct*", $pandbits, "struct*", $pxorbits)
  5473.         If @error Then Return SetError(@error, @extended, 0)
  5474.         Return $aret[0]
  5475.     EndFunc
  5476.  
  5477.     Func _winapi_createiconfromresourceex($pdata, $isize, $bicon = True, $ixdesiredpixels = 0, $iydesiredpixels = 0, $iflags = 0)
  5478.         Local $aret = DllCall("user32.dll", "handle", "CreateIconFromResourceEx", "ptr", $pdata, "dword", $isize, "bool", $bicon, "dword", 196608, "int", $ixdesiredpixels, "int", $iydesiredpixels, "uint", $iflags)
  5479.         If @error Then Return SetError(@error, @extended, 0)
  5480.         Return $aret[0]
  5481.     EndFunc
  5482.  
  5483.     Func _winapi_createiconindirect($hbitmap, $hmask, $ixhotspot = 0, $iyhotspot = 0, $bicon = True)
  5484.         Local $ticoninfo = DllStructCreate($tagiconinfo)
  5485.         DllStructSetData($ticoninfo, 1, $bicon)
  5486.         DllStructSetData($ticoninfo, 2, $ixhotspot)
  5487.         DllStructSetData($ticoninfo, 3, $iyhotspot)
  5488.         DllStructSetData($ticoninfo, 4, $hmask)
  5489.         DllStructSetData($ticoninfo, 5, $hbitmap)
  5490.         Local $aret = DllCall("user32.dll", "handle", "CreateIconIndirect", "struct*", $ticoninfo)
  5491.         If @error Then Return SetError(@error, @extended, 0)
  5492.         Return $aret[0]
  5493.     EndFunc
  5494.  
  5495.     Func _winapi_destroyicon($hicon)
  5496.         Local $aresult = DllCall("user32.dll", "bool", "DestroyIcon", "handle", $hicon)
  5497.         If @error Then Return SetError(@error, @extended, False)
  5498.         Return $aresult[0]
  5499.     EndFunc
  5500.  
  5501.     Func _winapi_extracticon($sicon, $iindex, $bsmall = False)
  5502.         Local $plarge, $psmall, $tptr = DllStructCreate("ptr")
  5503.         If $bsmall Then
  5504.             $plarge = 0
  5505.             $psmall = DllStructGetPtr($tptr)
  5506.         Else
  5507.             $plarge = DllStructGetPtr($tptr)
  5508.             $psmall = 0
  5509.         EndIf
  5510.         DllCall("shell32.dll", "uint", "ExtractIconExW", "wstr", $sicon, "int", $iindex, "ptr", $plarge, "ptr", $psmall, "uint", 1)
  5511.         If @error Then Return SetError(@error, @extended, 0)
  5512.         Return DllStructGetData($tptr, 1)
  5513.     EndFunc
  5514.  
  5515.     Func _winapi_extracticonex($sfilepath, $iindex, $palarge, $pasmall, $iicons)
  5516.         Local $aresult = DllCall("shell32.dll", "uint", "ExtractIconExW", "wstr", $sfilepath, "int", $iindex, "struct*", $palarge, "struct*", $pasmall, "uint", $iicons)
  5517.         If @error Then Return SetError(@error, @extended, 0)
  5518.         Return $aresult[0]
  5519.     EndFunc
  5520.  
  5521.     Func _winapi_fileiconinit($brestore = True)
  5522.         Local $aret = DllCall("shell32.dll", "int", 660, "int", $brestore)
  5523.         If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
  5524.         Return 1
  5525.     EndFunc
  5526.  
  5527.     Func _winapi_geticondimension($hicon)
  5528.         Local $ticoninfo = DllStructCreate($tagiconinfo)
  5529.         Local $aret = DllCall("user32.dll", "bool", "GetIconInfo", "handle", $hicon, "struct*", $ticoninfo)
  5530.         If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
  5531.         Local $tsize = _winapi_getbitmapdimension(DllStructGetData($ticoninfo, 5))
  5532.         For $i = 4 To 5
  5533.             _winapi_deleteobject(DllStructGetData($ticoninfo, $i))
  5534.         Next
  5535.         If NOT IsDllStruct($tsize) Then Return SetError(20, 0, 0)
  5536.         Return $tsize
  5537.     EndFunc
  5538.  
  5539.     Func _winapi_geticoninfo($hicon)
  5540.         Local $tinfo = DllStructCreate($tagiconinfo)
  5541.         Local $aret = DllCall("user32.dll", "bool", "GetIconInfo", "handle", $hicon, "struct*", $tinfo)
  5542.         If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
  5543.         Local $aicon[6]
  5544.         $aicon[0] = True
  5545.         $aicon[1] = DllStructGetData($tinfo, "Icon") <> 0
  5546.         $aicon[2] = DllStructGetData($tinfo, "XHotSpot")
  5547.         $aicon[3] = DllStructGetData($tinfo, "YHotSpot")
  5548.         $aicon[4] = DllStructGetData($tinfo, "hMask")
  5549.         $aicon[5] = DllStructGetData($tinfo, "hColor")
  5550.         Return $aicon
  5551.     EndFunc
  5552.  
  5553.     Func _winapi_geticoninfoex($hicon)
  5554.         Local $tiiex = DllStructCreate("dword;int;dword;dword;ptr;ptr;ushort;wchar[260];wchar[260]")
  5555.         DllStructSetData($tiiex, 1, DllStructGetSize($tiiex))
  5556.         Local $aret = DllCall("user32.dll", "bool", "GetIconInfoExW", "handle", $hicon, "struct*", $tiiex)
  5557.         If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
  5558.         Local $aresult[8]
  5559.         For $i = 0 To 7
  5560.             $aresult[$i] = DllStructGetData($tiiex, $i + 2)
  5561.         Next
  5562.         Return $aresult
  5563.     EndFunc
  5564.  
  5565.     Func _winapi_loadicon($hinstance, $sname)
  5566.         Local $stypeofname = "int"
  5567.         If IsString($sname) Then
  5568.             $stypeofname = "wstr"
  5569.         EndIf
  5570.         Local $aret = DllCall("user32.dll", "handle", "LoadIconW", "handle", $hinstance, $stypeofname, $sname)
  5571.         If @error Then Return SetError(@error, @extended, 0)
  5572.         Return $aret[0]
  5573.     EndFunc
  5574.  
  5575.     Func _winapi_loadiconmetric($hinstance, $sname, $imetric)
  5576.         Local $stypeofname = "int"
  5577.         If IsString($sname) Then
  5578.             $stypeofname = "wstr"
  5579.         EndIf
  5580.         Local $aret = DllCall("comctl32.dll", "long", "LoadIconMetric", "handle", $hinstance, $stypeofname, $sname, "int", $imetric, "handle*", 0)
  5581.         If @error Then Return SetError(@error, @extended, 0)
  5582.         If $aret[0] Then Return SetError(10, $aret[0], 0)
  5583.         Return $aret[4]
  5584.     EndFunc
  5585.  
  5586.     Func _winapi_loadiconwithscaledown($hinstance, $sname, $iwidth, $iheight)
  5587.         Local $stypeofname = "int"
  5588.         If IsString($sname) Then
  5589.             $stypeofname = "wstr"
  5590.         EndIf
  5591.         Local $aret = DllCall("comctl32.dll", "long", "LoadIconWithScaleDown", "handle", $hinstance, $stypeofname, $sname, "int", $iwidth, "int", $iheight, "handle*", 0)
  5592.         If @error Then Return SetError(@error, @extended, 0)
  5593.         If $aret[0] Then Return SetError(10, $aret[0], 0)
  5594.         Return $aret[5]
  5595.     EndFunc
  5596.  
  5597.     Func _winapi_loadshell32icon($iiconid)
  5598.         Local $ticons = DllStructCreate("ptr Data")
  5599.         Local $iicons = _winapi_extracticonex("shell32.dll", $iiconid, 0, $ticons, 1)
  5600.         If @error Then Return SetError(@error, @extended, 0)
  5601.         If $iicons <= 0 Then Return SetError(10, 0, 0)
  5602.         Return DllStructGetData($ticons, "Data")
  5603.     EndFunc
  5604.  
  5605.     Func _winapi_lookupiconidfromdirectoryex($pdata, $bicon = True, $ixdesiredpixels = 0, $iydesiredpixels = 0, $iflags = 0)
  5606.         Local $aret = DllCall("user32.dll", "int", "LookupIconIdFromDirectoryEx", "ptr", $pdata, "bool", $bicon, "int", $ixdesiredpixels, "int", $iydesiredpixels, "uint", $iflags)
  5607.         If @error Then Return SetError(@error, @extended, 0)
  5608.         Return $aret[0]
  5609.     EndFunc
  5610.  
  5611.     Func _winapi_mirroricon($hicon, $bdelete = False)
  5612.         If NOT $bdelete Then
  5613.             $hicon = _winapi_copyicon($hicon)
  5614.         EndIf
  5615.         Local $aret = DllCall("comctl32.dll", "int", 414, "ptr", 0, "ptr*", $hicon)
  5616.         If @error OR NOT $aret[0] Then
  5617.             Local $ierror = @error + 10
  5618.             If $hicon AND NOT $bdelete Then
  5619.                 _winapi_destroyicon($hicon)
  5620.             EndIf
  5621.             Return SetError($ierror, 0, 0)
  5622.         EndIf
  5623.         Return $aret[2]
  5624.     EndFunc
  5625.  
  5626. #EndRegion Public Functions
  5627. #Region Embedded DLL Functions
  5628.  
  5629.     Func __transparencyproc()
  5630.         Static $pproc = 0
  5631.         If NOT $pproc Then
  5632.             If @AutoItX64 Then
  5633.                 $pproc = __init(Binary("0x48894C240848895424104C894424184C894C24205541574831C0505050505050" & "4883EC284883BC24800000000074054831C0EB0748C7C0010000004821C07522" & "488BAC248000000048837D180074054831C0EB0748C7C0010000004821C07502" & "EB0948C7C001000000EB034831C04821C0740B4831C04863C0E93C0100004C63" & "7C24784983FF647E0F48C7C0010000004863C0E9220100004C637C24784D21FF" & "7D08C74424780000000048C74424280100000048C74424300000000048C74424" & "3800000000488BAC24800000004C637D04488BAC2480000000486345084C0FAF" & "F849C1E7024983C7FC4C3B7C24380F8C88000000488BAC24800000004C8B7D18" & "4C037C24384983C7034C897C2440488B6C2440480FB64500505888442448807C" & "244800744B4C0FB67C244848634424784C0FAFF84C89F848C7C1640000004899" & "48F7F94989C74C89F850488B6C244858884500488B6C2440807D0000740948C7" & "4424280000000048C7442430010000004883442438040F8149FFFFFF48837C24" & "3000741148837C242800740948C7C001000000EB034831C04821C0740E48C7C0" & "FFFFFFFF4863C0EB11EB0C48C7C0010000004863C0EB034831C04883C458415F" & "5DC3"))
  5634.             Else
  5635.                 $pproc = __init(Binary("0x555331C05050505050837C242800740431C0EB05B80100000021C075198B6C24" & "28837D1400740431C0EB05B80100000021C07502EB07B801000000EB0231C021" & "C0740731C0E9E50000008B5C242483FB647E0AB801000000E9D20000008B5C24" & "2421DB7D08C744242400000000C7042401000000C744240400000000C7442408" & "000000008B6C24288B5D048B6C24280FAF5D08C1E30283C3FC3B5C24087C648B" & "6C24288B5D14035C240883C303895C240C8B6C240C0FB6450088442410807C24" & "100074380FB65C24100FAF5C242489D8B96400000099F7F989C3538B6C241058" & "8845008B6C240C807D00007407C7042400000000C74424040100000083442408" & "047181837C240400740D833C24007407B801000000EB0231C021C07409B8FFFF" & "FFFFEB0BEB07B801000000EB0231C083C4145B5DC21000"))
  5636.             EndIf
  5637.         EndIf
  5638.         Return $pproc
  5639.     EndFunc
  5640.  
  5641. #EndRegion Embedded DLL Functions
  5642. #Region Global Variables and Constants
  5643.     Global $__g_ainprocess_winapi[64][2] = [[0, 0]]
  5644.     Global $__g_awinlist_winapi[64][2] = [[0, 0]]
  5645.     Global Const $gw_hwndfirst = 0
  5646.     Global Const $gw_hwndlast = 1
  5647.     Global Const $gw_hwndnext = 2
  5648.     Global Const $gw_hwndprev = 3
  5649.     Global Const $gw_owner = 4
  5650.     Global Const $gw_child = 5
  5651.     Global Const $gw_enabledpopup = 6
  5652.     Global Const $gwl_wndproc = -4
  5653.     Global Const $gwl_hinstance = -6
  5654.     Global Const $gwl_hwndparent = -8
  5655.     Global Const $gwl_id = -12
  5656.     Global Const $gwl_style = -16
  5657.     Global Const $gwl_exstyle = -20
  5658.     Global Const $gwl_userdata = -21
  5659.     Global Const $__winapiconstant_wm_setfont = 48
  5660. #EndRegion Global Variables and Constants
  5661. #Region Functions list
  5662. #EndRegion Functions list
  5663. #Region Public Functions
  5664.  
  5665.     Func _winapi_createwindowex($iexstyle, $sclass, $sname, $istyle, $ix, $iy, $iwidth, $iheight, $hparent, $hmenu = 0, $hinstance = 0, $pparam = 0)
  5666.         If $hinstance = 0 Then $hinstance = _winapi_getmodulehandle("")
  5667.         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)
  5668.         If @error Then Return SetError(@error, @extended, 0)
  5669.         Return $aresult[0]
  5670.     EndFunc
  5671.  
  5672.     Func _winapi_getclientrect($hwnd)
  5673.         Local $trect = DllStructCreate($tagrect)
  5674.         Local $aret = DllCall("user32.dll", "bool", "GetClientRect", "hwnd", $hwnd, "struct*", $trect)
  5675.         If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
  5676.         Return $trect
  5677.     EndFunc
  5678.  
  5679.     Func _winapi_getdesktopwindow()
  5680.         Local $aresult = DllCall("user32.dll", "hwnd", "GetDesktopWindow")
  5681.         If @error Then Return SetError(@error, @extended, 0)
  5682.         Return $aresult[0]
  5683.     EndFunc
  5684.  
  5685.     Func _winapi_destroywindow($hwnd)
  5686.         Local $aresult = DllCall("user32.dll", "bool", "DestroyWindow", "hwnd", $hwnd)
  5687.         If @error Then Return SetError(@error, @extended, False)
  5688.         Return $aresult[0]
  5689.     EndFunc
  5690.  
  5691.     Func _winapi_enablewindow($hwnd, $benable = True)
  5692.         Local $aresult = DllCall("user32.dll", "bool", "EnableWindow", "hwnd", $hwnd, "bool", $benable)
  5693.         If @error Then Return SetError(@error, @extended, False)
  5694.         Return $aresult[0]
  5695.     EndFunc
  5696.  
  5697.     Func _winapi_enumwindows($bvisible = True, $hwnd = Default)
  5698.         __winapi_enumwindowsinit()
  5699.         If $hwnd = Default Then $hwnd = _winapi_getdesktopwindow()
  5700.         __winapi_enumwindowschild($hwnd, $bvisible)
  5701.         Return $__g_awinlist_winapi
  5702.     EndFunc
  5703.  
  5704.     Func _winapi_enumwindowspopup()
  5705.         __winapi_enumwindowsinit()
  5706.         Local $hwnd = _winapi_getwindow(_winapi_getdesktopwindow(), $gw_child)
  5707.         Local $sclass
  5708.         While $hwnd <> 0
  5709.             If _winapi_iswindowvisible($hwnd) Then
  5710.                 $sclass = _winapi_getclassname($hwnd)
  5711.                 If $sclass = "#32768" Then
  5712.                     __winapi_enumwindowsadd($hwnd)
  5713.                 ElseIf $sclass = "ToolbarWindow32" Then
  5714.                     __winapi_enumwindowsadd($hwnd)
  5715.                 ElseIf $sclass = "ToolTips_Class32" Then
  5716.                     __winapi_enumwindowsadd($hwnd)
  5717.                 ElseIf $sclass = "BaseBar" Then
  5718.                     __winapi_enumwindowschild($hwnd)
  5719.                 EndIf
  5720.             EndIf
  5721.             $hwnd = _winapi_getwindow($hwnd, $gw_hwndnext)
  5722.         WEnd
  5723.         Return $__g_awinlist_winapi
  5724.     EndFunc
  5725.  
  5726.     Func _winapi_enumwindowstop()
  5727.         __winapi_enumwindowsinit()
  5728.         Local $hwnd = _winapi_getwindow(_winapi_getdesktopwindow(), $gw_child)
  5729.         While $hwnd <> 0
  5730.             If _winapi_iswindowvisible($hwnd) Then __winapi_enumwindowsadd($hwnd)
  5731.             $hwnd = _winapi_getwindow($hwnd, $gw_hwndnext)
  5732.         WEnd
  5733.         Return $__g_awinlist_winapi
  5734.     EndFunc
  5735.  
  5736.     Func _winapi_getclassname($hwnd)
  5737.         If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
  5738.         Local $aresult = DllCall("user32.dll", "int", "GetClassNameW", "hwnd", $hwnd, "wstr", "", "int", 4096)
  5739.         If @error OR NOT $aresult[0] Then Return SetError(@error, @extended, "")
  5740.         Return SetExtended($aresult[0], $aresult[2])
  5741.     EndFunc
  5742.  
  5743.     Func _winapi_getfocus()
  5744.         Local $aresult = DllCall("user32.dll", "hwnd", "GetFocus")
  5745.         If @error Then Return SetError(@error, @extended, 0)
  5746.         Return $aresult[0]
  5747.     EndFunc
  5748.  
  5749.     Func _winapi_getparent($hwnd)
  5750.         Local $aresult = DllCall("user32.dll", "hwnd", "GetParent", "hwnd", $hwnd)
  5751.         If @error Then Return SetError(@error, @extended, 0)
  5752.         Return $aresult[0]
  5753.     EndFunc
  5754.  
  5755.     Func _winapi_getsyscolor($iindex)
  5756.         Local $aresult = DllCall("user32.dll", "INT", "GetSysColor", "int", $iindex)
  5757.         If @error Then Return SetError(@error, @extended, 0)
  5758.         Return $aresult[0]
  5759.     EndFunc
  5760.  
  5761.     Func _winapi_getsystemmetrics($iindex)
  5762.         Local $aresult = DllCall("user32.dll", "int", "GetSystemMetrics", "int", $iindex)
  5763.         If @error Then Return SetError(@error, @extended, 0)
  5764.         Return $aresult[0]
  5765.     EndFunc
  5766.  
  5767.     Func _winapi_getwindow($hwnd, $icmd)
  5768.         Local $aresult = DllCall("user32.dll", "hwnd", "GetWindow", "hwnd", $hwnd, "uint", $icmd)
  5769.         If @error Then Return SetError(@error, @extended, 0)
  5770.         Return $aresult[0]
  5771.     EndFunc
  5772.  
  5773.     Func _winapi_getwindowheight($hwnd)
  5774.         Local $trect = _winapi_getwindowrect($hwnd)
  5775.         If @error Then Return SetError(@error, @extended, 0)
  5776.         Return DllStructGetData($trect, "Bottom") - DllStructGetData($trect, "Top")
  5777.     EndFunc
  5778.  
  5779.     Func _winapi_getwindowlong($hwnd, $iindex)
  5780.         Local $sfuncname = "GetWindowLongW"
  5781.         If @AutoItX64 Then $sfuncname = "GetWindowLongPtrW"
  5782.         Local $aresult = DllCall("user32.dll", "long_ptr", $sfuncname, "hwnd", $hwnd, "int", $iindex)
  5783.         If @error OR NOT $aresult[0] Then Return SetError(@error + 10, @extended, 0)
  5784.         Return $aresult[0]
  5785.     EndFunc
  5786.  
  5787.     Func _winapi_getwindowrect($hwnd)
  5788.         Local $trect = DllStructCreate($tagrect)
  5789.         Local $aret = DllCall("user32.dll", "bool", "GetWindowRect", "hwnd", $hwnd, "struct*", $trect)
  5790.         If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
  5791.         Return $trect
  5792.     EndFunc
  5793.  
  5794.     Func _winapi_getwindowtext($hwnd)
  5795.         Local $aresult = DllCall("user32.dll", "int", "GetWindowTextW", "hwnd", $hwnd, "wstr", "", "int", 4096)
  5796.         If @error OR NOT $aresult[0] Then Return SetError(@error + 10, @extended, "")
  5797.         Return SetExtended($aresult[0], $aresult[2])
  5798.     EndFunc
  5799.  
  5800.     Func _winapi_getwindowthreadprocessid($hwnd, ByRef $ipid)
  5801.         Local $aresult = DllCall("user32.dll", "dword", "GetWindowThreadProcessId", "hwnd", $hwnd, "dword*", 0)
  5802.         If @error Then Return SetError(@error, @extended, 0)
  5803.         $ipid = $aresult[2]
  5804.         Return $aresult[0]
  5805.     EndFunc
  5806.  
  5807.     Func _winapi_getwindowwidth($hwnd)
  5808.         Local $trect = _winapi_getwindowrect($hwnd)
  5809.         If @error Then Return SetError(@error, @extended, 0)
  5810.         Return DllStructGetData($trect, "Right") - DllStructGetData($trect, "Left")
  5811.     EndFunc
  5812.  
  5813.     Func _winapi_inprocess($hwnd, ByRef $hlastwnd)
  5814.         If $hwnd = $hlastwnd Then Return True
  5815.         For $ii = $__g_ainprocess_winapi[0][0] To 1 Step -1
  5816.             If $hwnd = $__g_ainprocess_winapi[$ii][0] Then
  5817.                 If $__g_ainprocess_winapi[$ii][1] Then
  5818.                     $hlastwnd = $hwnd
  5819.                     Return True
  5820.                 Else
  5821.                     Return False
  5822.                 EndIf
  5823.             EndIf
  5824.         Next
  5825.         Local $ipid
  5826.         _winapi_getwindowthreadprocessid($hwnd, $ipid)
  5827.         Local $icount = $__g_ainprocess_winapi[0][0] + 1
  5828.         If $icount >= 64 Then $icount = 1
  5829.         $__g_ainprocess_winapi[0][0] = $icount
  5830.         $__g_ainprocess_winapi[$icount][0] = $hwnd
  5831.         $__g_ainprocess_winapi[$icount][1] = ($ipid = @AutoItPID)
  5832.         Return $__g_ainprocess_winapi[$icount][1]
  5833.     EndFunc
  5834.  
  5835.     Func _winapi_invalidaterect($hwnd, $trect = 0, $berase = True)
  5836.         Local $aresult = DllCall("user32.dll", "bool", "InvalidateRect", "hwnd", $hwnd, "struct*", $trect, "bool", $berase)
  5837.         If @error Then Return SetError(@error, @extended, False)
  5838.         Return $aresult[0]
  5839.     EndFunc
  5840.  
  5841.     Func _winapi_isclassname($hwnd, $sclassname)
  5842.         Local $sseparator = Opt("GUIDataSeparatorChar")
  5843.         Local $aclassname = StringSplit($sclassname, $sseparator)
  5844.         If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
  5845.         Local $sclasscheck = _winapi_getclassname($hwnd)
  5846.         For $x = 1 To UBound($aclassname) - 1
  5847.             If StringUpper(StringMid($sclasscheck, 1, StringLen($aclassname[$x]))) = StringUpper($aclassname[$x]) Then Return True
  5848.         Next
  5849.         Return False
  5850.     EndFunc
  5851.  
  5852.     Func _winapi_iswindow($hwnd)
  5853.         Local $aresult = DllCall("user32.dll", "bool", "IsWindow", "hwnd", $hwnd)
  5854.         If @error Then Return SetError(@error, @extended, 0)
  5855.         Return $aresult[0]
  5856.     EndFunc
  5857.  
  5858.     Func _winapi_iswindowvisible($hwnd)
  5859.         Local $aresult = DllCall("user32.dll", "bool", "IsWindowVisible", "hwnd", $hwnd)
  5860.         If @error Then Return SetError(@error, @extended, 0)
  5861.         Return $aresult[0]
  5862.     EndFunc
  5863.  
  5864.     Func _winapi_movewindow($hwnd, $ix, $iy, $iwidth, $iheight, $brepaint = True)
  5865.         Local $aresult = DllCall("user32.dll", "bool", "MoveWindow", "hwnd", $hwnd, "int", $ix, "int", $iy, "int", $iwidth, "int", $iheight, "bool", $brepaint)
  5866.         If @error Then Return SetError(@error, @extended, False)
  5867.         Return $aresult[0]
  5868.     EndFunc
  5869.  
  5870.     Func _winapi_setfocus($hwnd)
  5871.         Local $aresult = DllCall("user32.dll", "hwnd", "SetFocus", "hwnd", $hwnd)
  5872.         If @error Then Return SetError(@error, @extended, 0)
  5873.         Return $aresult[0]
  5874.     EndFunc
  5875.  
  5876.     Func _winapi_setfont($hwnd, $hfont, $bredraw = True)
  5877.         _sendmessage($hwnd, $__winapiconstant_wm_setfont, $hfont, $bredraw, 0, "hwnd")
  5878.     EndFunc
  5879.  
  5880.     Func _winapi_setparent($hwndchild, $hwndparent)
  5881.         Local $aresult = DllCall("user32.dll", "hwnd", "SetParent", "hwnd", $hwndchild, "hwnd", $hwndparent)
  5882.         If @error Then Return SetError(@error, @extended, 0)
  5883.         Return $aresult[0]
  5884.     EndFunc
  5885.  
  5886.     Func _winapi_setwindowpos($hwnd, $hafter, $ix, $iy, $icx, $icy, $iflags)
  5887.         Local $aresult = DllCall("user32.dll", "bool", "SetWindowPos", "hwnd", $hwnd, "hwnd", $hafter, "int", $ix, "int", $iy, "int", $icx, "int", $icy, "uint", $iflags)
  5888.         If @error Then Return SetError(@error, @extended, False)
  5889.         Return $aresult[0]
  5890.     EndFunc
  5891.  
  5892.     Func _winapi_setwindowtext($hwnd, $stext)
  5893.         Local $aresult = DllCall("user32.dll", "bool", "SetWindowTextW", "hwnd", $hwnd, "wstr", $stext)
  5894.         If @error Then Return SetError(@error, @extended, False)
  5895.         Return $aresult[0]
  5896.     EndFunc
  5897.  
  5898.     Func _winapi_showwindow($hwnd, $icmdshow = 5)
  5899.         Local $aresult = DllCall("user32.dll", "bool", "ShowWindow", "hwnd", $hwnd, "int", $icmdshow)
  5900.         If @error Then Return SetError(@error, @extended, False)
  5901.         Return $aresult[0]
  5902.     EndFunc
  5903.  
  5904.     Func _winapi_updatewindow($hwnd)
  5905.         Local $aresult = DllCall("user32.dll", "bool", "UpdateWindow", "hwnd", $hwnd)
  5906.         If @error Then Return SetError(@error, @extended, False)
  5907.         Return $aresult[0]
  5908.     EndFunc
  5909.  
  5910. #EndRegion Public Functions
  5911. #Region Internal Functions
  5912.  
  5913.     Func __winapi_enumwindowsadd($hwnd, $sclass = "")
  5914.         If $sclass = "" Then $sclass = _winapi_getclassname($hwnd)
  5915.         $__g_awinlist_winapi[0][0] += 1
  5916.         Local $icount = $__g_awinlist_winapi[0][0]
  5917.         If $icount >= $__g_awinlist_winapi[0][1] Then
  5918.             ReDim $__g_awinlist_winapi[$icount + 64][2]
  5919.             $__g_awinlist_winapi[0][1] += 64
  5920.         EndIf
  5921.         $__g_awinlist_winapi[$icount][0] = $hwnd
  5922.         $__g_awinlist_winapi[$icount][1] = $sclass
  5923.     EndFunc
  5924.  
  5925.     Func __winapi_enumwindowschild($hwnd, $bvisible = True)
  5926.         $hwnd = _winapi_getwindow($hwnd, $gw_child)
  5927.         While $hwnd <> 0
  5928.             If (NOT $bvisible) OR _winapi_iswindowvisible($hwnd) Then
  5929.                 __winapi_enumwindowsadd($hwnd)
  5930.                 __winapi_enumwindowschild($hwnd, $bvisible)
  5931.             EndIf
  5932.             $hwnd = _winapi_getwindow($hwnd, $gw_hwndnext)
  5933.         WEnd
  5934.     EndFunc
  5935.  
  5936.     Func __winapi_enumwindowsinit()
  5937.         ReDim $__g_awinlist_winapi[64][2]
  5938.         $__g_awinlist_winapi[0][0] = 0
  5939.         $__g_awinlist_winapi[0][1] = 64
  5940.     EndFunc
  5941.  
  5942. #EndRegion Internal Functions
  5943. Global Const $flashw_caption = 1
  5944. Global Const $flashw_tray = 2
  5945. Global Const $flashw_timer = 4
  5946. Global Const $flashw_timernofg = 12
  5947. Global Const $tagupdatelayeredwindowinfo = "dword Size;hwnd hDstDC;long DstX;long DstY;long cX;long cY;hwnd hSrcDC;long SrcX;long SrcY;dword crKey;byte BlendOp;byte BlendFlags;byte Alpha;byte AlphaFormat;dword Flags;long DirtyLeft;long DirtyTop;long DirtyRight;long DirtyBottom"
  5948. Global Const $tagwindowinfo = "dword Size;struct;long rWindow[4];endstruct;struct;long rClient[4];endstruct;dword Style;dword ExStyle;dword WindowStatus;uint cxWindowBorders;uint cyWindowBorders;word atomWindowType;word CreatorVersion"
  5949. Global Const $tagwndclass = "uint Style;ptr hWndProc;int ClsExtra;int WndExtra;ptr hInstance;ptr hIcon;ptr hCursor;ptr hBackground;ptr MenuName;ptr ClassName"
  5950. Global Const $tagwndclassex = "uint Size;uint Style;ptr hWndProc;int ClsExtra;int WndExtra;ptr hInstance;ptr hIcon;ptr hCursor;ptr hBackground;ptr MenuName;ptr ClassName;ptr hIconSm"
  5951. Global Const $tagflashwinfo = "uint Size;hwnd hWnd;dword Flags;uint Count;dword TimeOut"
  5952.  
  5953. Func _winapi_adjustwindowrectex(ByRef $trect, $istyle, $iexstyle = 0, $bmenu = False)
  5954.     Local $aret = DllCall("user32.dll", "bool", "AdjustWindowRectEx", "struct*", $trect, "dword", $istyle, "bool", $bmenu, "dword", $iexstyle)
  5955.     If @error Then Return SetError(@error, @extended, False)
  5956.     Return $aret[0]
  5957. EndFunc
  5958.  
  5959. Func _winapi_animatewindow($hwnd, $iflags, $iduration = 1000)
  5960.     Local $aret = DllCall("user32.dll", "bool", "AnimateWindow", "hwnd", $hwnd, "dword", $iduration, "dword", $iflags)
  5961.     If @error Then Return SetError(@error, @extended, False)
  5962.     Return $aret[0]
  5963. EndFunc
  5964.  
  5965. Func _winapi_begindeferwindowpos($iamount = 1)
  5966.     Local $aret = DllCall("user32.dll", "handle", "BeginDeferWindowPos", "int", $iamount)
  5967.     If @error Then Return SetError(@error, @extended, 0)
  5968.     Return $aret[0]
  5969. EndFunc
  5970.  
  5971. Func _winapi_bringwindowtotop($hwnd)
  5972.     Local $aret = DllCall("user32.dll", "bool", "BringWindowToTop", "hwnd", $hwnd)
  5973.     If @error Then Return SetError(@error, @extended, False)
  5974.     Return $aret[0]
  5975. EndFunc
  5976.  
  5977. Func _winapi_broadcastsystemmessage($imsg, $wparam = 0, $lparam = 0, $iflags = 0, $irecipients = 0)
  5978.     Local $aret = DllCall("user32.dll", "long", "BroadcastSystemMessageW", "dword", $iflags, "dword*", $irecipients, "uint", $imsg, "wparam", $wparam, "lparam", $lparam)
  5979.     If @error OR ($aret[0] = -1) Then Return SetError(@error, @extended, -1)
  5980.     Return SetExtended($aret[2], $aret[0])
  5981. EndFunc
  5982.  
  5983. Func _winapi_callwindowproc($pprevwndfunc, $hwnd, $imsg, $wparam, $lparam)
  5984.     Local $aresult = DllCall("user32.dll", "lresult", "CallWindowProc", "ptr", $pprevwndfunc, "hwnd", $hwnd, "uint", $imsg, "wparam", $wparam, "lparam", $lparam)
  5985.     If @error Then Return SetError(@error, @extended, -1)
  5986.     Return $aresult[0]
  5987. EndFunc
  5988.  
  5989. Func _winapi_callwindowprocw($pprevwndproc, $hwnd, $imsg, $wparam, $lparam)
  5990.     Local $aret = DllCall("user32.dll", "lresult", "CallWindowProcW", "ptr", $pprevwndproc, "hwnd", $hwnd, "uint", $imsg, "wparam", $wparam, "lparam", $lparam)
  5991.     If @error Then Return SetError(@error, @extended, 0)
  5992.     Return $aret[0]
  5993. EndFunc
  5994.  
  5995. Func _winapi_cascadewindows($awnds, $trect = 0, $hparent = 0, $iflags = 0, $istart = 0, $iend = -1)
  5996.     If __checkerrorarraybounds($awnds, $istart, $iend) Then Return SetError(@error + 10, @extended, 0)
  5997.     Local $icount = $iend - $istart + 1
  5998.     Local $twnds = DllStructCreate("hwnd[" & $icount & "]")
  5999.     $icount = 1
  6000.     For $i = $istart To $iend
  6001.         DllStructSetData($twnds, 1, $awnds[$i], $icount)
  6002.         $icount += 1
  6003.     Next
  6004.     Local $aret = DllCall("user32.dll", "word", "CascadeWindows", "hwnd", $hparent, "uint", $iflags, "struct*", $trect, "uint", $icount - 1, "struct*", $twnds)
  6005.     If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
  6006.     Return $aret[0]
  6007. EndFunc
  6008.  
  6009. Func _winapi_changewindowmessagefilterex($hwnd, $imsg, $iaction)
  6010.     Local $tcfs, $aret
  6011.     If $hwnd AND ($__winver > 1536) Then
  6012.         Local Const $tagchangefilterstruct = "dword cbSize; dword ExtStatus"
  6013.         $tcfs = DllStructCreate($tagchangefilterstruct)
  6014.         DllStructSetData($tcfs, 1, DllStructGetSize($tcfs))
  6015.         $aret = DllCall("user32.dll", "bool", "ChangeWindowMessageFilterEx", "hwnd", $hwnd, "uint", $imsg, "dword", $iaction, "struct*", $tcfs)
  6016.     Else
  6017.         $tcfs = 0
  6018.         $aret = DllCall("user32.dll", "bool", "ChangeWindowMessageFilter", "uint", $imsg, "dword", $iaction)
  6019.     EndIf
  6020.     If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
  6021.     Return SetExtended(DllStructGetData($tcfs, 2), 1)
  6022. EndFunc
  6023.  
  6024. Func _winapi_childwindowfrompointex($hwnd, $tpoint, $iflags = 0)
  6025.     Local $aret = DllCall("user32.dll", "hwnd", "ChildWindowFromPointEx", "hwnd", $hwnd, "struct", $tpoint, "uint", $iflags)
  6026.     If @error Then Return SetError(@error, @extended, 0)
  6027.     Return $aret[0]
  6028. EndFunc
  6029.  
  6030. Func _winapi_closewindow($hwnd)
  6031.     Local $aret = DllCall("user32.dll", "bool", "CloseWindow", "hwnd", $hwnd)
  6032.     If @error Then Return SetError(@error, @extended, False)
  6033.     Return $aret[0]
  6034. EndFunc
  6035.  
  6036. Func _winapi_deferwindowpos($hinfo, $hwnd, $hafter, $ix, $iy, $iwidth, $iheight, $iflags)
  6037.     Local $aret = DllCall("user32.dll", "handle", "DeferWindowPos", "handle", $hinfo, "hwnd", $hwnd, "hwnd", $hafter, "int", $ix, "int", $iy, "int", $iwidth, "int", $iheight, "uint", $iflags)
  6038.     If @error Then Return SetError(@error, @extended, 0)
  6039.     Return $aret[0]
  6040. EndFunc
  6041.  
  6042. Func _winapi_defwindowproc($hwnd, $imsg, $wparam, $lparam)
  6043.     Local $aresult = DllCall("user32.dll", "lresult", "DefWindowProc", "hwnd", $hwnd, "uint", $imsg, "wparam", $wparam, "lparam", $lparam)
  6044.     If @error Then Return SetError(@error, @extended, 0)
  6045.     Return $aresult[0]
  6046. EndFunc
  6047.  
  6048. Func _winapi_defwindowprocw($hwnd, $imsg, $wparam, $lparam)
  6049.     Local $aret = DllCall("user32.dll", "lresult", "DefWindowProcW", "hwnd", $hwnd, "uint", $imsg, "wparam", $wparam, "lparam", $lparam)
  6050.     If @error Then Return SetError(@error, @extended, 0)
  6051.     Return $aret[0]
  6052. EndFunc
  6053.  
  6054. Func _winapi_deregistershellhookwindow($hwnd)
  6055.     Local $aret = DllCall("user32.dll", "bool", "DeregisterShellHookWindow", "hwnd", $hwnd)
  6056.     If @error Then Return SetError(@error, @extended, False)
  6057.     Return $aret[0]
  6058. EndFunc
  6059.  
  6060. Func _winapi_dragacceptfiles($hwnd, $baccept = True)
  6061.     DllCall("shell32.dll", "none", "DragAcceptFiles", "hwnd", $hwnd, "bool", $baccept)
  6062.     If @error Then Return SetError(@error, @extended, 0)
  6063.     Return 1
  6064. EndFunc
  6065.  
  6066. Func _winapi_dragfinish($hdrop)
  6067.     DllCall("shell32.dll", "none", "DragFinish", "handle", $hdrop)
  6068.     If @error Then Return SetError(@error, @extended, 0)
  6069.     Return 1
  6070. EndFunc
  6071.  
  6072. Func _winapi_dragqueryfileex($hdrop, $iflag = 0)
  6073.     Local $aret = DllCall("shell32.dll", "uint", "DragQueryFileW", "handle", $hdrop, "uint", -1, "ptr", 0, "uint", 0)
  6074.     If @error Then Return SetError(@error, @extended, 0)
  6075.     If NOT $aret[0] Then Return SetError(10, 0, 0)
  6076.     Local $icount = $aret[0]
  6077.     Local $aresult[$icount + 1]
  6078.     For $i = 0 To $icount - 1
  6079.         $aret = DllCall("shell32.dll", "uint", "DragQueryFileW", "handle", $hdrop, "uint", $i, "wstr", "", "uint", 4096)
  6080.         If NOT $aret[0] Then Return SetError(11, 0, 0)
  6081.         If $iflag Then
  6082.             Local $bdir = _winapi_pathisdirectory($aret[3])
  6083.             If (($iflag = 1) AND $bdir) OR (($iflag = 2) AND NOT $bdir) Then
  6084.                 ContinueLoop
  6085.             EndIf
  6086.         EndIf
  6087.         $aresult[$i + 1] = $aret[3]
  6088.         $aresult[0] += 1
  6089.     Next
  6090.     If NOT $aresult[0] Then Return SetError(12, 0, 0)
  6091.     __inc($aresult, -1)
  6092.     Return $aresult
  6093. EndFunc
  6094.  
  6095. Func _winapi_dragquerypoint($hdrop)
  6096.     Local $tpoint = DllStructCreate($tagpoint)
  6097.     Local $aret = DllCall("shell32.dll", "bool", "DragQueryPoint", "handle", $hdrop, "struct*", $tpoint)
  6098.     If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
  6099.     Return $tpoint
  6100. EndFunc
  6101.  
  6102. Func _winapi_enddeferwindowpos($hinfo)
  6103.     Local $aret = DllCall("user32.dll", "bool", "EndDeferWindowPos", "handle", $hinfo)
  6104.     If @error Then Return SetError(@error, @extended, False)
  6105.     Return $aret[0]
  6106. EndFunc
  6107.  
  6108. Func _winapi_enumchildwindows($hwnd, $bvisible = True)
  6109.     If NOT _winapi_getwindow($hwnd, 5) Then Return SetError(2, 0, 0)
  6110.     Local $henumproc = DllCallbackRegister("__EnumWindowsProc", "bool", "hwnd;lparam")
  6111.     Dim $__g_venum[101][2] = [[0]]
  6112.     DllCall("user32.dll", "bool", "EnumChildWindows", "hwnd", $hwnd, "ptr", DllCallbackGetPtr($henumproc), "lparam", $bvisible)
  6113.     If @error OR NOT $__g_venum[0][0] Then
  6114.         $__g_venum = @error + 10
  6115.     EndIf
  6116.     DllCallbackFree($henumproc)
  6117.     If $__g_venum Then Return SetError($__g_venum, 0, 0)
  6118.     __inc($__g_venum, -1)
  6119.     Return $__g_venum
  6120. EndFunc
  6121.  
  6122. Func _winapi_findwindow($sclassname, $swindowname)
  6123.     Local $aresult = DllCall("user32.dll", "hwnd", "FindWindowW", "wstr", $sclassname, "wstr", $swindowname)
  6124.     If @error Then Return SetError(@error, @extended, 0)
  6125.     Return $aresult[0]
  6126. EndFunc
  6127.  
  6128. Func _winapi_flashwindow($hwnd, $binvert = True)
  6129.     Local $aresult = DllCall("user32.dll", "bool", "FlashWindow", "hwnd", $hwnd, "bool", $binvert)
  6130.     If @error Then Return SetError(@error, @extended, False)
  6131.     Return $aresult[0]
  6132. EndFunc
  6133.  
  6134. Func _winapi_flashwindowex($hwnd, $iflags = 3, $icount = 3, $itimeout = 0)
  6135.     Local $tflash = DllStructCreate($tagflashwinfo)
  6136.     Local $iflash = DllStructGetSize($tflash)
  6137.     Local $imode = 0
  6138.     If BitAND($iflags, 1) <> 0 Then $imode = BitOR($imode, $flashw_caption)
  6139.     If BitAND($iflags, 2) <> 0 Then $imode = BitOR($imode, $flashw_tray)
  6140.     If BitAND($iflags, 4) <> 0 Then $imode = BitOR($imode, $flashw_timer)
  6141.     If BitAND($iflags, 8) <> 0 Then $imode = BitOR($imode, $flashw_timernofg)
  6142.     DllStructSetData($tflash, "Size", $iflash)
  6143.     DllStructSetData($tflash, "hWnd", $hwnd)
  6144.     DllStructSetData($tflash, "Flags", $imode)
  6145.     DllStructSetData($tflash, "Count", $icount)
  6146.     DllStructSetData($tflash, "Timeout", $itimeout)
  6147.     Local $aresult = DllCall("user32.dll", "bool", "FlashWindowEx", "struct*", $tflash)
  6148.     If @error Then Return SetError(@error, @extended, False)
  6149.     Return $aresult[0]
  6150. EndFunc
  6151.  
  6152. Func _winapi_getancestor($hwnd, $iflags = 1)
  6153.     Local $aresult = DllCall("user32.dll", "hwnd", "GetAncestor", "hwnd", $hwnd, "uint", $iflags)
  6154.     If @error Then Return SetError(@error, @extended, 0)
  6155.     Return $aresult[0]
  6156. EndFunc
  6157.  
  6158. Func _winapi_getclassinfoex($sclass, $hinstance = 0)
  6159.     Local $stypeofclass = "ptr"
  6160.     If IsString($sclass) Then
  6161.         $stypeofclass = "wstr"
  6162.     EndIf
  6163.     Local $twndclassex = DllStructCreate($tagwndclassex)
  6164.     Local $aret = DllCall("user32.dll", "bool", "GetClassInfoExW", "handle", $hinstance, $stypeofclass, $sclass, "struct*", $twndclassex)
  6165.     If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
  6166.     Return $twndclassex
  6167. EndFunc
  6168.  
  6169. Func _winapi_getclasslongex($hwnd, $iindex)
  6170.     Local $aret
  6171.     If @AutoItX64 Then
  6172.         $aret = DllCall("user32.dll", "ulong_ptr", "GetClassLongPtrW", "hwnd", $hwnd, "int", $iindex)
  6173.     Else
  6174.         $aret = DllCall("user32.dll", "dword", "GetClassLongW", "hwnd", $hwnd, "int", $iindex)
  6175.     EndIf
  6176.     If @error OR NOT $aret[0] Then Return SetError(@error, @extended, 0)
  6177.     Return $aret[0]
  6178. EndFunc
  6179.  
  6180. Func _winapi_getclientheight($hwnd)
  6181.     Local $trect = _winapi_getclientrect($hwnd)
  6182.     If @error Then Return SetError(@error, @extended, 0)
  6183.     Return DllStructGetData($trect, "Bottom") - DllStructGetData($trect, "Top")
  6184. EndFunc
  6185.  
  6186. Func _winapi_getclientwidth($hwnd)
  6187.     Local $trect = _winapi_getclientrect($hwnd)
  6188.     If @error Then Return SetError(@error, @extended, 0)
  6189.     Return DllStructGetData($trect, "Right") - DllStructGetData($trect, "Left")
  6190. EndFunc
  6191.  
  6192. Func _winapi_getdlgitem($hwnd, $iitemid)
  6193.     Local $aresult = DllCall("user32.dll", "hwnd", "GetDlgItem", "hwnd", $hwnd, "int", $iitemid)
  6194.     If @error Then Return SetError(@error, @extended, 0)
  6195.     Return $aresult[0]
  6196. EndFunc
  6197.  
  6198. Func _winapi_getforegroundwindow()
  6199.     Local $aresult = DllCall("user32.dll", "hwnd", "GetForegroundWindow")
  6200.     If @error Then Return SetError(@error, @extended, 0)
  6201.     Return $aresult[0]
  6202. EndFunc
  6203.  
  6204. Func _winapi_getguithreadinfo($ithreadid)
  6205.     Local Const $tagguithreadinfo = "dword Size;dword Flags;hwnd hWndActive;hwnd hWndFocus;hwnd hWndCapture;hwnd hWndMenuOwner;hwnd hWndMoveSize;hwnd hWndCaret;struct rcCaret;long left;long top;long right;long bottom;endstruct"
  6206.     Local $tgti = DllStructCreate($tagguithreadinfo)
  6207.     DllStructSetData($tgti, 1, DllStructGetSize($tgti))
  6208.     Local $aret = DllCall("user32.dll", "bool", "GetGUIThreadInfo", "dword", $ithreadid, "struct*", $tgti)
  6209.     If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
  6210.     Local $aresult[11]
  6211.     For $i = 0 To 10
  6212.         $aresult[$i] = DllStructGetData($tgti, $i + 2)
  6213.     Next
  6214.     For $i = 9 To 10
  6215.         $aresult[$i] -= $aresult[$i - 2]
  6216.     Next
  6217.     Return $aresult
  6218. EndFunc
  6219.  
  6220. Func _winapi_getlastactivepopup($hwnd)
  6221.     Local $aret = DllCall("user32.dll", "hwnd", "GetLastActivePopup", "hwnd", $hwnd)
  6222.     If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
  6223.     If $aret[0] = $hwnd Then Return SetError(1, 0, 0)
  6224.     Return $aret[0]
  6225. EndFunc
  6226.  
  6227. Func _winapi_getlayeredwindowattributes($hwnd, ByRef $itranscolor, ByRef $itransgui, $bcolorref = False)
  6228.     $itranscolor = -1
  6229.     $itransgui = -1
  6230.     Local $aresult = DllCall("user32.dll", "bool", "GetLayeredWindowAttributes", "hwnd", $hwnd, "INT*", $itranscolor, "byte*", $itransgui, "dword*", 0)
  6231.     If @error OR NOT $aresult[0] Then Return SetError(@error, @extended, 0)
  6232.     If NOT $bcolorref Then
  6233.         $aresult[2] = Int(BinaryMid($aresult[2], 3, 1) & BinaryMid($aresult[2], 2, 1) & BinaryMid($aresult[2], 1, 1))
  6234.     EndIf
  6235.     $itranscolor = $aresult[2]
  6236.     $itransgui = $aresult[3]
  6237.     Return $aresult[4]
  6238. EndFunc
  6239.  
  6240. Func _winapi_getmessageextrainfo()
  6241.     Local $aret = DllCall("user32.dll", "lparam", "GetMessageExtraInfo")
  6242.     If @error Then Return SetError(@error, @extended, 0)
  6243.     Return $aret[0]
  6244. EndFunc
  6245.  
  6246. Func _winapi_getshellwindow()
  6247.     Local $aret = DllCall("user32.dll", "hwnd", "GetShellWindow")
  6248.     If @error Then Return SetError(@error, @extended, 0)
  6249.     Return $aret[0]
  6250. EndFunc
  6251.  
  6252. Func _winapi_gettopwindow($hwnd)
  6253.     Local $aret = DllCall("user32.dll", "hwnd", "GetTopWindow", "hwnd", $hwnd)
  6254.     If @error Then Return SetError(@error, @extended, 0)
  6255.     Return $aret[0]
  6256. EndFunc
  6257.  
  6258. Func _winapi_getwindowdisplayaffinity($hwnd)
  6259.     Local $aret = DllCall("user32.dll", "bool", "GetWindowDisplayAffinity", "hwnd", $hwnd, "dword*", 0)
  6260.     If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
  6261.     Return $aret[2]
  6262. EndFunc
  6263.  
  6264. Func _winapi_getwindowinfo($hwnd)
  6265.     Local $twindowinfo = DllStructCreate($tagwindowinfo)
  6266.     DllStructSetData($twindowinfo, "Size", DllStructGetSize($twindowinfo))
  6267.     Local $aret = DllCall("user32.dll", "bool", "GetWindowInfo", "hwnd", $hwnd, "struct*", $twindowinfo)
  6268.     If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
  6269.     Return $twindowinfo
  6270. EndFunc
  6271.  
  6272. Func _winapi_getwindowplacement($hwnd)
  6273.     Local $twindowplacement = DllStructCreate($tagwindowplacement)
  6274.     DllStructSetData($twindowplacement, "length", DllStructGetSize($twindowplacement))
  6275.     Local $aret = DllCall("user32.dll", "bool", "GetWindowPlacement", "hwnd", $hwnd, "struct*", $twindowplacement)
  6276.     If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
  6277.     Return $twindowplacement
  6278. EndFunc
  6279.  
  6280. Func _winapi_ischild($hwnd, $hwndparent)
  6281.     Local $aret = DllCall("user32.dll", "bool", "IsChild", "hwnd", $hwndparent, "hwnd", $hwnd)
  6282.     If @error Then Return SetError(@error, @extended, False)
  6283.     Return $aret[0]
  6284. EndFunc
  6285.  
  6286. Func _winapi_ishungappwindow($hwnd)
  6287.     Local $aret = DllCall("user32.dll", "bool", "IsHungAppWindow", "hwnd", $hwnd)
  6288.     If @error Then Return SetError(@error, @extended, False)
  6289.     Return $aret[0]
  6290. EndFunc
  6291.  
  6292. Func _winapi_isiconic($hwnd)
  6293.     Local $aret = DllCall("user32.dll", "bool", "IsIconic", "hwnd", $hwnd)
  6294.     If @error Then Return SetError(@error, @extended, False)
  6295.     Return $aret[0]
  6296. EndFunc
  6297.  
  6298. Func _winapi_iswindowunicode($hwnd)
  6299.     Local $aret = DllCall("user32.dll", "bool", "IsWindowUnicode", "hwnd", $hwnd)
  6300.     If @error Then Return SetError(@error, @extended, False)
  6301.     Return $aret[0]
  6302. EndFunc
  6303.  
  6304. Func _winapi_iszoomed($hwnd)
  6305.     Local $aret = DllCall("user32.dll", "bool", "IsZoomed", "hwnd", $hwnd)
  6306.     If @error Then Return SetError(@error, @extended, False)
  6307.     Return $aret[0]
  6308. EndFunc
  6309.  
  6310. Func _winapi_killtimer($hwnd, $itimerid)
  6311.     Local $aret = DllCall("user32.dll", "bool", "KillTimer", "hwnd", $hwnd, "uint_ptr", $itimerid)
  6312.     If @error Then Return SetError(@error, @extended, 0)
  6313.     Return $aret[0]
  6314. EndFunc
  6315.  
  6316. Func _winapi_openicon($hwnd)
  6317.     Local $aret = DllCall("user32.dll", "bool", "OpenIcon", "hwnd", $hwnd)
  6318.     If @error Then Return SetError(@error, @extended, 0)
  6319.     Return $aret[0]
  6320. EndFunc
  6321.  
  6322. Func _winapi_postmessage($hwnd, $imsg, $wparam, $lparam)
  6323.     Local $aresult = DllCall("user32.dll", "bool", "PostMessage", "hwnd", $hwnd, "uint", $imsg, "wparam", $wparam, "lparam", $lparam)
  6324.     If @error Then Return SetError(@error, @extended, False)
  6325.     Return $aresult[0]
  6326. EndFunc
  6327.  
  6328. Func _winapi_registerclass($twndclass)
  6329.     Local $aret = DllCall("user32.dll", "word", "RegisterClassW", "struct*", $twndclass)
  6330.     If @error Then Return SetError(@error, @extended, 0)
  6331.     Return $aret[0]
  6332. EndFunc
  6333.  
  6334. Func _winapi_registerclassex($twndclassex)
  6335.     Local $aret = DllCall("user32.dll", "word", "RegisterClassExW", "struct*", $twndclassex)
  6336.     If @error Then Return SetError(@error, @extended, 0)
  6337.     Return $aret[0]
  6338. EndFunc
  6339.  
  6340. Func _winapi_registershellhookwindow($hwnd)
  6341.     Local $aret = DllCall("user32.dll", "bool", "RegisterShellHookWindow", "hwnd", $hwnd)
  6342.     If @error Then Return SetError(@error, @extended, False)
  6343.     Return $aret[0]
  6344. EndFunc
  6345.  
  6346. Func _winapi_registerwindowmessage($smessage)
  6347.     Local $aresult = DllCall("user32.dll", "uint", "RegisterWindowMessageW", "wstr", $smessage)
  6348.     If @error Then Return SetError(@error, @extended, 0)
  6349.     Return $aresult[0]
  6350. EndFunc
  6351.  
  6352. Func _winapi_sendmessagetimeout($hwnd, $imsg, $wparam = 0, $lparam = 0, $itimeout = 1000, $iflags = 0)
  6353.     Local $aret = DllCall("user32.dll", "lresult", "SendMessageTimeoutW", "hwnd", $hwnd, "uint", $imsg, "wparam", $wparam, "lparam", $lparam, "uint", $iflags, "uint", $itimeout, "dword_ptr*", 0)
  6354.     If @error Then Return SetError(@error, @extended, -1)
  6355.     If NOT $aret[0] Then Return SetError(10, _winapi_getlasterror(), -1)
  6356.     Return $aret[7]
  6357. EndFunc
  6358.  
  6359. Func _winapi_setclasslongex($hwnd, $iindex, $inewlong)
  6360.     Local $aret
  6361.     If @AutoItX64 Then
  6362.         $aret = DllCall("user32.dll", "ulong_ptr", "SetClassLongPtrW", "hwnd", $hwnd, "int", $iindex, "long_ptr", $inewlong)
  6363.     Else
  6364.         $aret = DllCall("user32.dll", "dword", "SetClassLongW", "hwnd", $hwnd, "int", $iindex, "long", $inewlong)
  6365.     EndIf
  6366.     If @error Then Return SetError(@error, @extended, 0)
  6367.     Return $aret[0]
  6368. EndFunc
  6369.  
  6370. Func _winapi_setforegroundwindow($hwnd)
  6371.     Local $aret = DllCall("user32.dll", "bool", "SetForegroundWindow", "hwnd", $hwnd)
  6372.     If @error Then Return SetError(@error, @extended, False)
  6373.     Return $aret[0]
  6374. EndFunc
  6375.  
  6376. Func _winapi_setlayeredwindowattributes($hwnd, $itranscolor, $itransgui = 255, $iflags = 3, $bcolorref = False)
  6377.     If $iflags = Default OR $iflags = "" OR $iflags < 0 Then $iflags = 3
  6378.     If NOT $bcolorref Then
  6379.         $itranscolor = Int(BinaryMid($itranscolor, 3, 1) & BinaryMid($itranscolor, 2, 1) & BinaryMid($itranscolor, 1, 1))
  6380.     EndIf
  6381.     Local $aresult = DllCall("user32.dll", "bool", "SetLayeredWindowAttributes", "hwnd", $hwnd, "INT", $itranscolor, "byte", $itransgui, "dword", $iflags)
  6382.     If @error Then Return SetError(@error, @extended, False)
  6383.     Return $aresult[0]
  6384. EndFunc
  6385.  
  6386. Func _winapi_setmessageextrainfo($lparam)
  6387.     Local $aret = DllCall("user32.dll", "lparam", "SetMessageExtraInfo", "lparam", $lparam)
  6388.     If @error Then Return SetError(@error, @extended, 0)
  6389.     Return $aret[0]
  6390. EndFunc
  6391.  
  6392. Func _winapi_setsyscolors($velements, $vcolors)
  6393.     Local $bisearray = IsArray($velements), $biscarray = IsArray($vcolors)
  6394.     Local $ielementnum
  6395.     If NOT $biscarray AND NOT $bisearray Then
  6396.         $ielementnum = 1
  6397.     ElseIf $biscarray OR $bisearray Then
  6398.         If NOT $biscarray OR NOT $bisearray Then Return SetError(-1, -1, False)
  6399.         If UBound($velements) <> UBound($vcolors) Then Return SetError(-1, -1, False)
  6400.         $ielementnum = UBound($velements)
  6401.     EndIf
  6402.     Local $telements = DllStructCreate("int Element[" & $ielementnum & "]")
  6403.     Local $tcolors = DllStructCreate("INT NewColor[" & $ielementnum & "]")
  6404.     If NOT $bisearray Then
  6405.         DllStructSetData($telements, "Element", $velements, 1)
  6406.     Else
  6407.         For $x = 0 To $ielementnum - 1
  6408.             DllStructSetData($telements, "Element", $velements[$x], $x + 1)
  6409.         Next
  6410.     EndIf
  6411.     If NOT $biscarray Then
  6412.         DllStructSetData($tcolors, "NewColor", $vcolors, 1)
  6413.     Else
  6414.         For $x = 0 To $ielementnum - 1
  6415.             DllStructSetData($tcolors, "NewColor", $vcolors[$x], $x + 1)
  6416.         Next
  6417.     EndIf
  6418.     Local $aresult = DllCall("user32.dll", "bool", "SetSysColors", "int", $ielementnum, "struct*", $telements, "struct*", $tcolors)
  6419.     If @error Then Return SetError(@error, @extended, False)
  6420.     Return $aresult[0]
  6421. EndFunc
  6422.  
  6423. Func _winapi_settimer($hwnd, $itimerid, $ielapse, $ptimerfunc)
  6424.     Local $aret = DllCall("user32.dll", "uint_ptr", "SetTimer", "hwnd", $hwnd, "uint_ptr", $itimerid, "uint", $ielapse, "ptr", $ptimerfunc)
  6425.     If @error Then Return SetError(@error, @extended, 0)
  6426.     Return $aret[0]
  6427. EndFunc
  6428.  
  6429. Func _winapi_setwindowdisplayaffinity($hwnd, $iaffinity)
  6430.     Local $aret = DllCall("user32.dll", "bool", "SetWindowDisplayAffinity", "hwnd", $hwnd, "dword", $iaffinity)
  6431.     If @error Then Return SetError(@error, @extended, False)
  6432.     Return $aret[0]
  6433. EndFunc
  6434.  
  6435. Func _winapi_setwindowlong($hwnd, $iindex, $ivalue)
  6436.     _winapi_setlasterror(0)
  6437.     Local $sfuncname = "SetWindowLongW"
  6438.     If @AutoItX64 Then $sfuncname = "SetWindowLongPtrW"
  6439.     Local $aresult = DllCall("user32.dll", "long_ptr", $sfuncname, "hwnd", $hwnd, "int", $iindex, "long_ptr", $ivalue)
  6440.     If @error Then Return SetError(@error, @extended, 0)
  6441.     Return $aresult[0]
  6442. EndFunc
  6443.  
  6444. Func _winapi_setwindowplacement($hwnd, $twindowplacement)
  6445.     Local $aresult = DllCall("user32.dll", "bool", "SetWindowPlacement", "hwnd", $hwnd, "struct*", $twindowplacement)
  6446.     If @error Then Return SetError(@error, @extended, False)
  6447.     Return $aresult[0]
  6448. EndFunc
  6449.  
  6450. Func _winapi_showownedpopups($hwnd, $bshow)
  6451.     Local $aret = DllCall("user32.dll", "bool", "ShowOwnedPopups", "hwnd", $hwnd, "bool", $bshow)
  6452.     If @error Then Return SetError(@error, @extended, False)
  6453.     Return $aret[0]
  6454. EndFunc
  6455.  
  6456. Func _winapi_switchtothiswindow($hwnd, $balttab = False)
  6457.     DllCall("user32.dll", "none", "SwitchToThisWindow", "hwnd", $hwnd, "bool", $balttab)
  6458.     If @error Then Return SetError(@error, @extended, 0)
  6459.     Return 1
  6460. EndFunc
  6461.  
  6462. Func _winapi_tilewindows($awnds, $trect = 0, $hparent = 0, $iflags = 0, $istart = 0, $iend = -1)
  6463.     If __checkerrorarraybounds($awnds, $istart, $iend) Then Return SetError(@error + 10, @extended, 0)
  6464.     Local $icount = $iend - $istart + 1
  6465.     Local $twnds = DllStructCreate("hwnd[" & $icount & "]")
  6466.     $icount = 1
  6467.     For $i = $istart To $iend
  6468.         DllStructSetData($twnds, 1, $awnds[$i], $icount)
  6469.         $icount += 1
  6470.     Next
  6471.     Local $aret = DllCall("user32.dll", "word", "TileWindows", "hwnd", $hparent, "uint", $iflags, "struct*", $trect, "uint", $icount - 1, "struct*", $twnds)
  6472.     If @error Then Return SetError(@error, @extended, 0)
  6473.     Return $aret[0]
  6474. EndFunc
  6475.  
  6476. Func _winapi_unregisterclass($sclass, $hinstance = 0)
  6477.     Local $stypeofclass = "ptr"
  6478.     If IsString($sclass) Then
  6479.         $stypeofclass = "wstr"
  6480.     EndIf
  6481.     Local $aret = DllCall("user32.dll", "bool", "UnregisterClassW", $stypeofclass, $sclass, "handle", $hinstance)
  6482.     If @error Then Return SetError(@error, @extended, False)
  6483.     Return $aret[0]
  6484. EndFunc
  6485.  
  6486. Func _winapi_updatelayeredwindow($hwnd, $hdestdc, $tptdest, $tsize, $hsrcdc, $tptsrce, $irgb, $tblend, $iflags)
  6487.     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)
  6488.     If @error Then Return SetError(@error, @extended, False)
  6489.     Return $aresult[0]
  6490. EndFunc
  6491.  
  6492. Func _winapi_updatelayeredwindowex($hwnd, $ix, $iy, $hbitmap, $iopacity = 255, $bdelete = False)
  6493.     Local $aret = DllCall("user32.dll", "handle", "GetDC", "hwnd", $hwnd)
  6494.     Local $hdc = $aret[0]
  6495.     $aret = DllCall("gdi32.dll", "handle", "CreateCompatibleDC", "handle", $hdc)
  6496.     Local $hdestdc = $aret[0]
  6497.     $aret = DllCall("gdi32.dll", "handle", "SelectObject", "handle", $hdestdc, "handle", $hbitmap)
  6498.     Local $hdestsv = $aret[0]
  6499.     Local $tpoint
  6500.     If ($ix = -1) AND ($iy = -1) Then
  6501.         $tpoint = DllStructCreate("int;int")
  6502.     Else
  6503.         $tpoint = DllStructCreate("int;int;int;int")
  6504.         DllStructSetData($tpoint, 3, $ix)
  6505.         DllStructSetData($tpoint, 4, $iy)
  6506.     EndIf
  6507.     DllStructSetData($tpoint, 1, 0)
  6508.     DllStructSetData($tpoint, 2, 0)
  6509.     Local $tblendfunction = DllStructCreate($tagblendfunction)
  6510.     DllStructSetData($tblendfunction, 1, 0)
  6511.     DllStructSetData($tblendfunction, 2, 0)
  6512.     DllStructSetData($tblendfunction, 3, $iopacity)
  6513.     DllStructSetData($tblendfunction, 4, 1)
  6514.     Local Const $tagbitmap = "struct;long bmType;long bmWidth;long bmHeight;long bmWidthBytes;ushort bmPlanes;ushort bmBitsPixel;ptr bmBits;endstruct"
  6515.     Local $tobj = DllStructCreate($tagbitmap)
  6516.     DllCall("gdi32.dll", "int", "GetObject", "handle", $hbitmap, "int", DllStructGetSize($tobj), "struct*", $tobj)
  6517.     Local $tsize = DllStructCreate($tagsize, DllStructGetPtr($tobj, "bmWidth"))
  6518.     $aret = DllCall("user32.dll", "bool", "UpdateLayeredWindow", "hwnd", $hwnd, "handle", $hdc, "ptr", DllStructGetPtr($tpoint, 3), "struct*", $tsize, "handle", $hdestdc, "struct*", $tpoint, "dword", 0, "struct*", $tblendfunction, "dword", 2)
  6519.     Local $ierror = @error
  6520.     DllCall("user32.dll", "bool", "ReleaseDC", "hwnd", $hwnd, "handle", $hdc)
  6521.     DllCall("gdi32.dll", "handle", "SelectObject", "handle", $hdestdc, "handle", $hdestsv)
  6522.     DllCall("gdi32.dll", "bool", "DeleteDC", "handle", $hdestdc)
  6523.     If $ierror Then Return SetError($ierror, 0, False)
  6524.     If $bdelete Then
  6525.         DllCall("gdi32.dll", "bool", "DeleteObject", "handle", $hbitmap)
  6526.     EndIf
  6527.     Return $aret[0]
  6528. EndFunc
  6529.  
  6530. Func _winapi_updatelayeredwindowindirect($hwnd, $tulwinfo)
  6531.     Local $aret = DllCall("user32.dll", "bool", "UpdateLayeredWindowIndirect", "hwnd", $hwnd, "struct*", $tulwinfo)
  6532.     If @error Then Return SetError(@error, @extended, False)
  6533.     Return $aret[0]
  6534. EndFunc
  6535.  
  6536. Func _winapi_windowfrompoint(ByRef $tpoint)
  6537.     Local $aresult = DllCall("user32.dll", "hwnd", "WindowFromPoint", "struct", $tpoint)
  6538.     If @error Then Return SetError(@error, @extended, 0)
  6539.     Return $aresult[0]
  6540. EndFunc
  6541.  
  6542. #EndRegion Public Functions
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top