Advertisement
Guest User

Untitled

a guest
Mar 3rd, 2017
481
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 264.57 KB | None | 0 0
  1. #RequireAdmin
  2. #Region
  3. #AutoIt3Wrapper_Icon=WTP\finaltest\redicon.ico
  4. #AutoIt3Wrapper_OutFile=FINALTESTv2.exe
  5. #EndRegion
  6. Global Const $bs_groupbox = 7
  7. Global Const $bs_bottom = 2048
  8. Global Const $bs_center = 768
  9. Global Const $bs_defpushbutton = 1
  10. Global Const $bs_left = 256
  11. Global Const $bs_multiline = 8192
  12. Global Const $bs_pushbox = 10
  13. Global Const $bs_pushlike = 4096
  14. Global Const $bs_right = 512
  15. Global Const $bs_rightbutton = 32
  16. Global Const $bs_top = 1024
  17. Global Const $bs_vcenter = 3072
  18. Global Const $bs_flat = 32768
  19. Global Const $bs_icon = 64
  20. Global Const $bs_bitmap = 128
  21. Global Const $bs_notify = 16384
  22. Global Const $bs_splitbutton = 12
  23. Global Const $bs_defsplitbutton = 13
  24. Global Const $bs_commandlink = 14
  25. Global Const $bs_defcommandlink = 15
  26. Global Const $bcsif_glyph = 1
  27. Global Const $bcsif_image = 2
  28. Global Const $bcsif_style = 4
  29. Global Const $bcsif_size = 8
  30. Global Const $bcss_nosplit = 1
  31. Global Const $bcss_stretch = 2
  32. Global Const $bcss_alignleft = 4
  33. Global Const $bcss_image = 8
  34. Global Const $button_imagelist_align_left = 0
  35. Global Const $button_imagelist_align_right = 1
  36. Global Const $button_imagelist_align_top = 2
  37. Global Const $button_imagelist_align_bottom = 3
  38. Global Const $button_imagelist_align_center = 4
  39. Global Const $bs_3state = 5
  40. Global Const $bs_auto3state = 6
  41. Global Const $bs_autocheckbox = 3
  42. Global Const $bs_checkbox = 2
  43. Global Const $bs_radiobutton = 4
  44. Global Const $bs_autoradiobutton = 9
  45. Global Const $bs_ownerdraw = 11
  46. Global Const $gui_ss_default_button = 0
  47. Global Const $gui_ss_default_checkbox = 0
  48. Global Const $gui_ss_default_group = 0
  49. Global Const $gui_ss_default_radio = 0
  50. Global Const $bcm_first = 5632
  51. Global Const $bcm_getidealsize = ($bcm_first + 1)
  52. Global Const $bcm_getimagelist = ($bcm_first + 3)
  53. Global Const $bcm_getnote = ($bcm_first + 10)
  54. Global Const $bcm_getnotelength = ($bcm_first + 11)
  55. Global Const $bcm_getsplitinfo = ($bcm_first + 8)
  56. Global Const $bcm_gettextmargin = ($bcm_first + 5)
  57. Global Const $bcm_setdropdownstate = ($bcm_first + 6)
  58. Global Const $bcm_setimagelist = ($bcm_first + 2)
  59. Global Const $bcm_setnote = ($bcm_first + 9)
  60. Global Const $bcm_setshield = ($bcm_first + 12)
  61. Global Const $bcm_setsplitinfo = ($bcm_first + 7)
  62. Global Const $bcm_settextmargin = ($bcm_first + 4)
  63. Global Const $bm_click = 245
  64. Global Const $bm_getcheck = 240
  65. Global Const $bm_getimage = 246
  66. Global Const $bm_getstate = 242
  67. Global Const $bm_setcheck = 241
  68. Global Const $bm_setdontclick = 248
  69. Global Const $bm_setimage = 247
  70. Global Const $bm_setstate = 243
  71. Global Const $bm_setstyle = 244
  72. Global Const $bcn_first = -1250
  73. Global Const $bcn_dropdown = ($bcn_first + 2)
  74. Global Const $bcn_hotitemchange = ($bcn_first + 1)
  75. Global Const $bn_clicked = 0
  76. Global Const $bn_paint = 1
  77. Global Const $bn_hilite = 2
  78. Global Const $bn_unhilite = 3
  79. Global Const $bn_disable = 4
  80. Global Const $bn_doubleclicked = 5
  81. Global Const $bn_setfocus = 6
  82. Global Const $bn_killfocus = 7
  83. Global Const $bn_pushed = $bn_hilite
  84. Global Const $bn_unpushed = $bn_unhilite
  85. Global Const $bn_dblclk = $bn_doubleclicked
  86. Global Const $bst_checked = 1
  87. Global Const $bst_indeterminate = 2
  88. Global Const $bst_unchecked = 0
  89. Global Const $bst_focus = 8
  90. Global Const $bst_pushed = 4
  91. Global Const $bst_dontclick = 128
  92. Global Const $gui_event_single = 0
  93. Global Const $gui_event_array = 1
  94. Global Const $gui_event_none = 0
  95. Global Const $gui_event_close = -3
  96. Global Const $gui_event_minimize = -4
  97. Global Const $gui_event_restore = -5
  98. Global Const $gui_event_maximize = -6
  99. Global Const $gui_event_primarydown = -7
  100. Global Const $gui_event_primaryup = -8
  101. Global Const $gui_event_secondarydown = -9
  102. Global Const $gui_event_secondaryup = -10
  103. Global Const $gui_event_mousemove = -11
  104. Global Const $gui_event_resized = -12
  105. Global Const $gui_event_dropped = -13
  106. Global Const $gui_rundefmsg = "GUI_RUNDEFMSG"
  107. Global Const $gui_avistop = 0
  108. Global Const $gui_avistart = 1
  109. Global Const $gui_aviclose = 2
  110. Global Const $gui_checked = 1
  111. Global Const $gui_indeterminate = 2
  112. Global Const $gui_unchecked = 4
  113. Global Const $gui_dropaccepted = 8
  114. Global Const $gui_nodropaccepted = 4096
  115. Global Const $gui_acceptfiles = $gui_dropaccepted
  116. Global Const $gui_show = 16
  117. Global Const $gui_hide = 32
  118. Global Const $gui_enable = 64
  119. Global Const $gui_disable = 128
  120. Global Const $gui_focus = 256
  121. Global Const $gui_nofocus = 8192
  122. Global Const $gui_defbutton = 512
  123. Global Const $gui_expand = 1024
  124. Global Const $gui_ontop = 2048
  125. Global Const $gui_fontnormal = 0
  126. Global Const $gui_fontitalic = 2
  127. Global Const $gui_fontunder = 4
  128. Global Const $gui_fontstrike = 8
  129. Global Const $gui_dockauto = 1
  130. Global Const $gui_dockleft = 2
  131. Global Const $gui_dockright = 4
  132. Global Const $gui_dockhcenter = 8
  133. Global Const $gui_docktop = 32
  134. Global Const $gui_dockbottom = 64
  135. Global Const $gui_dockvcenter = 128
  136. Global Const $gui_dockwidth = 256
  137. Global Const $gui_dockheight = 512
  138. Global Const $gui_docksize = 768
  139. Global Const $gui_dockmenubar = 544
  140. Global Const $gui_dockstatebar = 576
  141. Global Const $gui_dockall = 802
  142. Global Const $gui_dockborders = 102
  143. Global Const $gui_gr_close = 1
  144. Global Const $gui_gr_line = 2
  145. Global Const $gui_gr_bezier = 4
  146. Global Const $gui_gr_move = 6
  147. Global Const $gui_gr_color = 8
  148. Global Const $gui_gr_rect = 10
  149. Global Const $gui_gr_ellipse = 12
  150. Global Const $gui_gr_pie = 14
  151. Global Const $gui_gr_dot = 16
  152. Global Const $gui_gr_pixel = 18
  153. Global Const $gui_gr_hint = 20
  154. Global Const $gui_gr_refresh = 22
  155. Global Const $gui_gr_pensize = 24
  156. Global Const $gui_gr_nobkcolor = -2
  157. Global Const $gui_bkcolor_default = -1
  158. Global Const $gui_bkcolor_transparent = -2
  159. Global Const $gui_bkcolor_lv_alternate = -33554432
  160. Global Const $gui_read_default = 0
  161. Global Const $gui_read_extended = 1
  162. Global Const $gui_cursor_nooverride = 0
  163. Global Const $gui_cursor_override = 1
  164. Global Const $gui_ws_ex_parentdrag = 1048576
  165. Global Const $color_aqua = 65535
  166. Global Const $color_black = 0
  167. Global Const $color_blue = 255
  168. Global Const $color_cream = 16776176
  169. Global Const $color_fuchsia = 16711935
  170. Global Const $color_gray = 8421504
  171. Global Const $color_green = 32768
  172. Global Const $color_lime = 65280
  173. Global Const $color_maroon = 9116770
  174. Global Const $color_medblue = 708
  175. Global Const $color_medgray = 10526884
  176. Global Const $color_moneygreen = 12639424
  177. Global Const $color_navy = 128
  178. Global Const $color_olive = 8421376
  179. Global Const $color_purple = 8388736
  180. Global Const $color_red = 16711680
  181. Global Const $color_silver = 12632256
  182. Global Const $color_skyblue = 10930928
  183. Global Const $color_teal = 32896
  184. Global Const $color_white = 16777215
  185. Global Const $color_yellow = 16776960
  186. Global Const $clr_none = -1
  187. Global Const $clr_default = -16777216
  188. Global Const $clr_aqua = 16776960
  189. Global Const $clr_black = 0
  190. Global Const $clr_blue = 16711680
  191. Global Const $clr_cream = 15793151
  192. Global Const $clr_fuchsia = 16711935
  193. Global Const $clr_gray = 8421504
  194. Global Const $clr_green = 32768
  195. Global Const $clr_lime = 65280
  196. Global Const $clr_maroon = 6429835
  197. Global Const $clr_medblue = 12845568
  198. Global Const $clr_medgray = 10789024
  199. Global Const $clr_moneygreen = 12639424
  200. Global Const $clr_navy = 8388608
  201. Global Const $clr_olive = 32896
  202. Global Const $clr_purple = 8388736
  203. Global Const $clr_red = 255
  204. Global Const $clr_silver = 12632256
  205. Global Const $clr_skyblue = 15780518
  206. Global Const $clr_teal = 8421376
  207. Global Const $clr_white = 16777215
  208. Global Const $clr_yellow = 65535
  209. Global Const $cc_anycolor = 256
  210. Global Const $cc_fullopen = 2
  211. Global Const $cc_rgbinit = 1
  212. Global Const $tcs_ex_flatseparators = 1
  213. Global Const $tcs_ex_registerdrop = 2
  214. Global Const $tcht_nowhere = 1
  215. Global Const $tcht_onitemicon = 2
  216. Global Const $tcht_onitemlabel = 4
  217. Global Const $tcht_onitem = 6
  218. Global Const $tcif_text = 1
  219. Global Const $tcif_image = 2
  220. Global Const $tcif_rtlreading = 4
  221. Global Const $tcif_param = 8
  222. Global Const $tcif_state = 16
  223. Global Const $tcif_alldata = 27
  224. Global Const $tcis_buttonpressed = 1
  225. Global Const $tcis_highlighted = 2
  226. Global Const $tc_err = -1
  227. Global Const $tcs_bottom = 2
  228. Global Const $tcs_buttons = 256
  229. Global Const $tcs_fixedwidth = 1024
  230. Global Const $tcs_flatbuttons = 8
  231. Global Const $tcs_focusnever = 32768
  232. Global Const $tcs_focusonbuttondown = 4096
  233. Global Const $tcs_forceiconleft = 16
  234. Global Const $tcs_forcelabelleft = 32
  235. Global Const $tcs_hottrack = 64
  236. Global Const $tcs_multiline = 512
  237. Global Const $tcs_multiselect = 4
  238. Global Const $tcs_ownerdrawfixed = 8192
  239. Global Const $tcs_raggedright = 2048
  240. Global Const $tcs_right = 2
  241. Global Const $tcs_rightjustify = 0
  242. Global Const $tcs_scrollopposite = 1
  243. Global Const $tcs_singleline = 0
  244. Global Const $tcs_tabs = 0
  245. Global Const $tcs_tooltips = 16384
  246. Global Const $tcs_vertical = 128
  247. Global Const $gui_ss_default_tab = 0
  248. Global Const $tcm_first = 4864
  249. Global Const $tccm_first = 8192
  250. Global Const $tcm_adjustrect = ($tcm_first + 40)
  251. Global Const $tcm_deleteallitems = ($tcm_first + 9)
  252. Global Const $tcm_deleteitem = ($tcm_first + 8)
  253. Global Const $tcm_deselectall = ($tcm_first + 50)
  254. Global Const $tcm_getcurfocus = ($tcm_first + 47)
  255. Global Const $tcm_getcursel = ($tcm_first + 11)
  256. Global Const $tcm_getextendedstyle = ($tcm_first + 53)
  257. Global Const $tcm_getimagelist = ($tcm_first + 2)
  258. Global Const $tcm_getitema = ($tcm_first + 5)
  259. Global Const $tcm_getitemw = ($tcm_first + 60)
  260. Global Const $tcm_getitemcount = ($tcm_first + 4)
  261. Global Const $tcm_getitemrect = ($tcm_first + 10)
  262. Global Const $tcm_getrowcount = ($tcm_first + 44)
  263. Global Const $tcm_gettooltips = ($tcm_first + 45)
  264. Global Const $tccm_getunicodeformat = ($tccm_first + 6)
  265. Global Const $tcm_getunicodeformat = $tccm_getunicodeformat
  266. Global Const $tcm_highlightitem = ($tcm_first + 51)
  267. Global Const $tcm_hittest = ($tcm_first + 13)
  268. Global Const $tcm_insertitema = ($tcm_first + 7)
  269. Global Const $tcm_insertitemw = ($tcm_first + 62)
  270. Global Const $tcm_removeimage = ($tcm_first + 42)
  271. Global Const $tcm_setitema = ($tcm_first + 6)
  272. Global Const $tcm_setitemw = ($tcm_first + 61)
  273. Global Const $tcm_setitemextra = ($tcm_first + 14)
  274. Global Const $tcm_setitemsize = $tcm_first + 41
  275. Global Const $tcm_setcurfocus = ($tcm_first + 48)
  276. Global Const $tcm_setcursel = ($tcm_first + 12)
  277. Global Const $tcm_setextendedstyle = ($tcm_first + 52)
  278. Global Const $tcm_setimagelist = $tcm_first + 3
  279. Global Const $tcm_setmintabwidth = ($tcm_first + 49)
  280. Global Const $tcm_setpadding = ($tcm_first + 43)
  281. Global Const $tcm_settooltips = ($tcm_first + 46)
  282. Global Const $tccm_setunicodeformat = ($tccm_first + 5)
  283. Global Const $tcm_setunicodeformat = $tccm_setunicodeformat
  284. Global Const $tcn_first = -550
  285. Global Const $tcn_focuschange = ($tcn_first - 4)
  286. Global Const $tcn_getobject = ($tcn_first - 3)
  287. Global Const $tcn_keydown = ($tcn_first + 0)
  288. Global Const $tcn_selchange = ($tcn_first - 1)
  289. Global Const $tcn_selchanging = ($tcn_first - 2)
  290. Global Const $wc_animate = "SysAnimate32"
  291. Global Const $wc_button = "Button"
  292. Global Const $wc_combobox = "ComboBox"
  293. Global Const $wc_comboboxex = "ComboBoxEx32"
  294. Global Const $wc_datetimepick = "SysDateTimePick32"
  295. Global Const $wc_edit = "Edit"
  296. Global Const $wc_header = "SysHeader32"
  297. Global Const $wc_hotkey = "msctls_hotkey32"
  298. Global Const $wc_ipaddress = "SysIPAddress32"
  299. Global Const $wc_link = "SysLink"
  300. Global Const $wc_listbox = "ListBox"
  301. Global Const $wc_listview = "SysListView32"
  302. Global Const $wc_monthcal = "SysMonthCal32"
  303. Global Const $wc_nativefontctl = "NativeFontCtl"
  304. Global Const $wc_pagescroller = "SysPager"
  305. Global Const $wc_progress = "msctls_progress32"
  306. Global Const $wc_rebar = "ReBarWindow32"
  307. Global Const $wc_scrollbar = "ScrollBar"
  308. Global Const $wc_static = "Static"
  309. Global Const $wc_statusbar = "msctls_statusbar32"
  310. Global Const $wc_tabcontrol = "SysTabControl32"
  311. Global Const $wc_toolbar = "ToolbarWindow32"
  312. Global Const $wc_tooltips = "tooltips_class32"
  313. Global Const $wc_trackbar = "msctls_trackbar32"
  314. Global Const $wc_treeview = "SysTreeView32"
  315. Global Const $wc_updown = "msctls_updown32"
  316. Global Const $ws_overlapped = 0
  317. Global Const $ws_tiled = $ws_overlapped
  318. Global Const $ws_maximizebox = 65536
  319. Global Const $ws_minimizebox = 131072
  320. Global Const $ws_tabstop = 65536
  321. Global Const $ws_group = 131072
  322. Global Const $ws_sizebox = 262144
  323. Global Const $ws_thickframe = $ws_sizebox
  324. Global Const $ws_sysmenu = 524288
  325. Global Const $ws_hscroll = 1048576
  326. Global Const $ws_vscroll = 2097152
  327. Global Const $ws_dlgframe = 4194304
  328. Global Const $ws_border = 8388608
  329. Global Const $ws_caption = 12582912
  330. Global Const $ws_overlappedwindow = BitOR($ws_caption, $ws_maximizebox, $ws_minimizebox, $ws_overlapped, $ws_sysmenu, $ws_thickframe)
  331. Global Const $ws_tiledwindow = $ws_overlappedwindow
  332. Global Const $ws_maximize = 16777216
  333. Global Const $ws_clipchildren = 33554432
  334. Global Const $ws_clipsiblings = 67108864
  335. Global Const $ws_disabled = 134217728
  336. Global Const $ws_visible = 268435456
  337. Global Const $ws_minimize = 536870912
  338. Global Const $ws_iconic = $ws_minimize
  339. Global Const $ws_child = 1073741824
  340. Global Const $ws_childwindow = $ws_child
  341. Global Const $ws_popup = -2147483648
  342. Global Const $ws_popupwindow = -2138570752
  343. Global Const $ds_3dlook = 4
  344. Global Const $ds_absalign = 1
  345. Global Const $ds_center = 2048
  346. Global Const $ds_centermouse = 4096
  347. Global Const $ds_contexthelp = 8192
  348. Global Const $ds_control = 1024
  349. Global Const $ds_fixedsys = 8
  350. Global Const $ds_localedit = 32
  351. Global Const $ds_modalframe = 128
  352. Global Const $ds_nofailcreate = 16
  353. Global Const $ds_noidlemsg = 256
  354. Global Const $ds_setfont = 64
  355. Global Const $ds_setforeground = 512
  356. Global Const $ds_shellfont = BitOR($ds_fixedsys, $ds_setfont)
  357. Global Const $ds_sysmodal = 2
  358. Global Const $ws_ex_acceptfiles = 16
  359. Global Const $ws_ex_appwindow = 262144
  360. Global Const $ws_ex_composited = 33554432
  361. Global Const $ws_ex_controlparent = 65536
  362. Global Const $ws_ex_clientedge = 512
  363. Global Const $ws_ex_contexthelp = 1024
  364. Global Const $ws_ex_dlgmodalframe = 1
  365. Global Const $ws_ex_layered = 524288
  366. Global Const $ws_ex_layoutrtl = 4194304
  367. Global Const $ws_ex_left = 0
  368. Global Const $ws_ex_leftscrollbar = 16384
  369. Global Const $ws_ex_ltrreading = 0
  370. Global Const $ws_ex_mdichild = 64
  371. Global Const $ws_ex_noactivate = 134217728
  372. Global Const $ws_ex_noinheritlayout = 1048576
  373. Global Const $ws_ex_noparentnotify = 4
  374. Global Const $ws_ex_right = 4096
  375. Global Const $ws_ex_rightscrollbar = 0
  376. Global Const $ws_ex_rtlreading = 8192
  377. Global Const $ws_ex_staticedge = 131072
  378. Global Const $ws_ex_toolwindow = 128
  379. Global Const $ws_ex_topmost = 8
  380. Global Const $ws_ex_transparent = 32
  381. Global Const $ws_ex_windowedge = 256
  382. Global Const $ws_ex_overlappedwindow = BitOR($ws_ex_clientedge, $ws_ex_windowedge)
  383. Global Const $ws_ex_palettewindow = BitOR($ws_ex_toolwindow, $ws_ex_topmost, $ws_ex_windowedge)
  384. Global Const $wm_null = 0
  385. Global Const $wm_create = 1
  386. Global Const $wm_destroy = 2
  387. Global Const $wm_move = 3
  388. Global Const $wm_sizewait = 4
  389. Global Const $wm_size = 5
  390. Global Const $wm_activate = 6
  391. Global Const $wm_setfocus = 7
  392. Global Const $wm_killfocus = 8
  393. Global Const $wm_setvisible = 9
  394. Global Const $wm_enable = 10
  395. Global Const $wm_setredraw = 11
  396. Global Const $wm_settext = 12
  397. Global Const $wm_gettext = 13
  398. Global Const $wm_gettextlength = 14
  399. Global Const $wm_paint = 15
  400. Global Const $wm_close = 16
  401. Global Const $wm_queryendsession = 17
  402. Global Const $wm_quit = 18
  403. Global Const $wm_erasebkgnd = 20
  404. Global Const $wm_queryopen = 19
  405. Global Const $wm_syscolorchange = 21
  406. Global Const $wm_endsession = 22
  407. Global Const $wm_systemerror = 23
  408. Global Const $wm_showwindow = 24
  409. Global Const $wm_ctlcolor = 25
  410. Global Const $wm_settingchange = 26
  411. Global Const $wm_wininichange = 26
  412. Global Const $wm_devmodechange = 27
  413. Global Const $wm_activateapp = 28
  414. Global Const $wm_fontchange = 29
  415. Global Const $wm_timechange = 30
  416. Global Const $wm_cancelmode = 31
  417. Global Const $wm_setcursor = 32
  418. Global Const $wm_mouseactivate = 33
  419. Global Const $wm_childactivate = 34
  420. Global Const $wm_queuesync = 35
  421. Global Const $wm_getminmaxinfo = 36
  422. Global Const $wm_logoff = 37
  423. Global Const $wm_painticon = 38
  424. Global Const $wm_iconerasebkgnd = 39
  425. Global Const $wm_nextdlgctl = 40
  426. Global Const $wm_alttabactive = 41
  427. Global Const $wm_spoolerstatus = 42
  428. Global Const $wm_drawitem = 43
  429. Global Const $wm_measureitem = 44
  430. Global Const $wm_deleteitem = 45
  431. Global Const $wm_vkeytoitem = 46
  432. Global Const $wm_chartoitem = 47
  433. Global Const $wm_setfont = 48
  434. Global Const $wm_getfont = 49
  435. Global Const $wm_sethotkey = 50
  436. Global Const $wm_gethotkey = 51
  437. Global Const $wm_filesyschange = 52
  438. Global Const $wm_isactiveicon = 53
  439. Global Const $wm_queryparkicon = 54
  440. Global Const $wm_querydragicon = 55
  441. Global Const $wm_winhelp = 56
  442. Global Const $wm_compareitem = 57
  443. Global Const $wm_fullscreen = 58
  444. Global Const $wm_clientshutdown = 59
  445. Global Const $wm_ddemlevent = 60
  446. Global Const $wm_getobject = 61
  447. Global Const $wm_calcscroll = 63
  448. Global Const $wm_testing = 64
  449. Global Const $wm_compacting = 65
  450. Global Const $wm_otherwindowcreated = 66
  451. Global Const $wm_otherwindowdestroyed = 67
  452. Global Const $wm_commnotify = 68
  453. Global Const $wm_mediastatuschange = 69
  454. Global Const $wm_windowposchanging = 70
  455. Global Const $wm_windowposchanged = 71
  456. Global Const $wm_power = 72
  457. Global Const $wm_copyglobaldata = 73
  458. Global Const $wm_copydata = 74
  459. Global Const $wm_canceljournal = 75
  460. Global Const $wm_logonnotify = 76
  461. Global Const $wm_keyf1 = 77
  462. Global Const $wm_notify = 78
  463. Global Const $wm_access_window = 79
  464. Global Const $wm_inputlangchangerequest = 80
  465. Global Const $wm_inputlangchange = 81
  466. Global Const $wm_tcard = 82
  467. Global Const $wm_help = 83
  468. Global Const $wm_userchanged = 84
  469. Global Const $wm_notifyformat = 85
  470. Global Const $wm_qm_activate = 96
  471. Global Const $wm_hook_do_callback = 97
  472. Global Const $wm_syscopydata = 98
  473. Global Const $wm_finaldestroy = 112
  474. Global Const $wm_measureitem_clientdata = 113
  475. Global Const $wm_contextmenu = 123
  476. Global Const $wm_stylechanging = 124
  477. Global Const $wm_stylechanged = 125
  478. Global Const $wm_displaychange = 126
  479. Global Const $wm_geticon = 127
  480. Global Const $wm_seticon = 128
  481. Global Const $wm_nccreate = 129
  482. Global Const $wm_ncdestroy = 130
  483. Global Const $wm_nccalcsize = 131
  484. Global Const $wm_nchittest = 132
  485. Global Const $wm_ncpaint = 133
  486. Global Const $wm_ncactivate = 134
  487. Global Const $wm_getdlgcode = 135
  488. Global Const $wm_syncpaint = 136
  489. Global Const $wm_synctask = 137
  490. Global Const $wm_kludgeminrect = 139
  491. Global Const $wm_lpkdrawswitchwnd = 140
  492. Global Const $wm_uahdestroywindow = 144
  493. Global Const $wm_uahdrawmenu = 145
  494. Global Const $wm_uahdrawmenuitem = 146
  495. Global Const $wm_uahinitmenu = 147
  496. Global Const $wm_uahmeasuremenuitem = 148
  497. Global Const $wm_uahncpaintmenupopup = 149
  498. Global Const $wm_ncmousemove = 160
  499. Global Const $wm_nclbuttondown = 161
  500. Global Const $wm_nclbuttonup = 162
  501. Global Const $wm_nclbuttondblclk = 163
  502. Global Const $wm_ncrbuttondown = 164
  503. Global Const $wm_ncrbuttonup = 165
  504. Global Const $wm_ncrbuttondblclk = 166
  505. Global Const $wm_ncmbuttondown = 167
  506. Global Const $wm_ncmbuttonup = 168
  507. Global Const $wm_ncmbuttondblclk = 169
  508. Global Const $wm_ncxbuttondown = 171
  509. Global Const $wm_ncxbuttonup = 172
  510. Global Const $wm_ncxbuttondblclk = 173
  511. Global Const $wm_ncuahdrawcaption = 174
  512. Global Const $wm_ncuahdrawframe = 175
  513. Global Const $wm_input_device_change = 254
  514. Global Const $wm_input = 255
  515. Global Const $wm_keydown = 256
  516. Global Const $wm_keyfirst = 256
  517. Global Const $wm_keyup = 257
  518. Global Const $wm_char = 258
  519. Global Const $wm_deadchar = 259
  520. Global Const $wm_syskeydown = 260
  521. Global Const $wm_syskeyup = 261
  522. Global Const $wm_syschar = 262
  523. Global Const $wm_sysdeadchar = 263
  524. Global Const $wm_yomichar = 264
  525. Global Const $wm_keylast = 265
  526. Global Const $wm_unichar = 265
  527. Global Const $wm_convertrequest = 266
  528. Global Const $wm_convertresult = 267
  529. Global Const $wm_im_info = 268
  530. Global Const $wm_ime_startcomposition = 269
  531. Global Const $wm_ime_endcomposition = 270
  532. Global Const $wm_ime_composition = 271
  533. Global Const $wm_ime_keylast = 271
  534. Global Const $wm_initdialog = 272
  535. Global Const $wm_command = 273
  536. Global Const $wm_syscommand = 274
  537. Global Const $wm_timer = 275
  538. Global Const $wm_hscroll = 276
  539. Global Const $wm_vscroll = 277
  540. Global Const $wm_initmenu = 278
  541. Global Const $wm_initmenupopup = 279
  542. Global Const $wm_systimer = 280
  543. Global Const $wm_gesture = 281
  544. Global Const $wm_gesturenotify = 282
  545. Global Const $wm_gestureinput = 283
  546. Global Const $wm_gesturenotified = 284
  547. Global Const $wm_menuselect = 287
  548. Global Const $wm_menuchar = 288
  549. Global Const $wm_enteridle = 289
  550. Global Const $wm_menurbuttonup = 290
  551. Global Const $wm_menudrag = 291
  552. Global Const $wm_menugetobject = 292
  553. Global Const $wm_uninitmenupopup = 293
  554. Global Const $wm_menucommand = 294
  555. Global Const $wm_changeuistate = 295
  556. Global Const $wm_updateuistate = 296
  557. Global Const $wm_queryuistate = 297
  558. Global Const $wm_lbtrackpoint = 305
  559. Global Const $wm_ctlcolormsgbox = 306
  560. Global Const $wm_ctlcoloredit = 307
  561. Global Const $wm_ctlcolorlistbox = 308
  562. Global Const $wm_ctlcolorbtn = 309
  563. Global Const $wm_ctlcolordlg = 310
  564. Global Const $wm_ctlcolorscrollbar = 311
  565. Global Const $wm_ctlcolorstatic = 312
  566. Global Const $mn_gethmenu = 481
  567. Global Const $wm_parentnotify = 528
  568. Global Const $wm_entermenuloop = 529
  569. Global Const $wm_exitmenuloop = 530
  570. Global Const $wm_nextmenu = 531
  571. Global Const $wm_sizing = 532
  572. Global Const $wm_capturechanged = 533
  573. Global Const $wm_moving = 534
  574. Global Const $wm_powerbroadcast = 536
  575. Global Const $wm_devicechange = 537
  576. Global Const $wm_mdicreate = 544
  577. Global Const $wm_mdidestroy = 545
  578. Global Const $wm_mdiactivate = 546
  579. Global Const $wm_mdirestore = 547
  580. Global Const $wm_mdinext = 548
  581. Global Const $wm_mdimaximize = 549
  582. Global Const $wm_mditile = 550
  583. Global Const $wm_mdicascade = 551
  584. Global Const $wm_mdiiconarrange = 552
  585. Global Const $wm_mdigetactive = 553
  586. Global Const $wm_dropobject = 554
  587. Global Const $wm_querydropobject = 555
  588. Global Const $wm_begindrag = 556
  589. Global Const $wm_dragloop = 557
  590. Global Const $wm_dragselect = 558
  591. Global Const $wm_dragmove = 559
  592. Global Const $wm_mdisetmenu = 560
  593. Global Const $wm_entersizemove = 561
  594. Global Const $wm_exitsizemove = 562
  595. Global Const $wm_dropfiles = 563
  596. Global Const $wm_mdirefreshmenu = 564
  597. Global Const $wm_touch = 576
  598. Global Const $wm_ime_setcontext = 641
  599. Global Const $wm_ime_notify = 642
  600. Global Const $wm_ime_control = 643
  601. Global Const $wm_ime_compositionfull = 644
  602. Global Const $wm_ime_select = 645
  603. Global Const $wm_ime_char = 646
  604. Global Const $wm_ime_system = 647
  605. Global Const $wm_ime_request = 648
  606. Global Const $wm_ime_keydown = 656
  607. Global Const $wm_ime_keyup = 657
  608. Global Const $wm_ncmousehover = 672
  609. Global Const $wm_mousehover = 673
  610. Global Const $wm_ncmouseleave = 674
  611. Global Const $wm_mouseleave = 675
  612. Global Const $wm_wtssession_change = 689
  613. Global Const $wm_tablet_first = 704
  614. Global Const $wm_tablet_last = 735
  615. Global Const $wm_cut = 768
  616. Global Const $wm_copy = 769
  617. Global Const $wm_paste = 770
  618. Global Const $wm_clear = 771
  619. Global Const $wm_undo = 772
  620. Global Const $wm_paletteischanging = 784
  621. Global Const $wm_hotkey = 786
  622. Global Const $wm_palettechanged = 785
  623. Global Const $wm_sysmenu = 787
  624. Global Const $wm_hookmsg = 788
  625. Global Const $wm_exitprocess = 789
  626. Global Const $wm_wakethread = 790
  627. Global Const $wm_print = 791
  628. Global Const $wm_printclient = 792
  629. Global Const $wm_appcommand = 793
  630. Global Const $wm_querynewpalette = 783
  631. Global Const $wm_themechanged = 794
  632. Global Const $wm_uahinit = 795
  633. Global Const $wm_desktopnotify = 796
  634. Global Const $wm_clipboardupdate = 797
  635. Global Const $wm_dwmcompositionchanged = 798
  636. Global Const $wm_dwmncrenderingchanged = 799
  637. Global Const $wm_dwmcolorizationcolorchanged = 800
  638. Global Const $wm_dwmwindowmaximizedchange = 801
  639. Global Const $wm_dwmexileframe = 802
  640. Global Const $wm_dwmsendiconicthumbnail = 803
  641. Global Const $wm_magnification_started = 804
  642. Global Const $wm_magnification_ended = 805
  643. Global Const $wm_dwmsendiconiclivepreviewbitmap = 806
  644. Global Const $wm_dwmthumbnailsizechanged = 807
  645. Global Const $wm_magnification_output = 808
  646. Global Const $wm_measurecontrol = 816
  647. Global Const $wm_getactiontext = 817
  648. Global Const $wm_forwardkeydown = 819
  649. Global Const $wm_forwardkeyup = 820
  650. Global Const $wm_gettitlebarinfoex = 831
  651. Global Const $wm_notifywow = 832
  652. Global Const $wm_handheldfirst = 856
  653. Global Const $wm_handheldlast = 863
  654. Global Const $wm_afxfirst = 864
  655. Global Const $wm_afxlast = 895
  656. Global Const $wm_penwinfirst = 896
  657. Global Const $wm_penwinlast = 911
  658. Global Const $wm_dde_initiate = 992
  659. Global Const $wm_dde_terminate = 993
  660. Global Const $wm_dde_advise = 994
  661. Global Const $wm_dde_unadvise = 995
  662. Global Const $wm_dde_ack = 996
  663. Global Const $wm_dde_data = 997
  664. Global Const $wm_dde_request = 998
  665. Global Const $wm_dde_poke = 999
  666. Global Const $wm_dde_execute = 1000
  667. Global Const $wm_dbnotification = 1021
  668. Global Const $wm_netconnect = 1022
  669. Global Const $wm_hibernate = 1023
  670. Global Const $wm_user = 1024
  671. Global Const $wm_app = 32768
  672. Global Const $nm_first = 0
  673. Global Const $nm_outofmemory = $nm_first - 1
  674. Global Const $nm_click = $nm_first - 2
  675. Global Const $nm_dblclk = $nm_first - 3
  676. Global Const $nm_return = $nm_first - 4
  677. Global Const $nm_rclick = $nm_first - 5
  678. Global Const $nm_rdblclk = $nm_first - 6
  679. Global Const $nm_setfocus = $nm_first - 7
  680. Global Const $nm_killfocus = $nm_first - 8
  681. Global Const $nm_customdraw = $nm_first - 12
  682. Global Const $nm_hover = $nm_first - 13
  683. Global Const $nm_nchittest = $nm_first - 14
  684. Global Const $nm_keydown = $nm_first - 15
  685. Global Const $nm_releasedcapture = $nm_first - 16
  686. Global Const $nm_setcursor = $nm_first - 17
  687. Global Const $nm_char = $nm_first - 18
  688. Global Const $nm_tooltipscreated = $nm_first - 19
  689. Global Const $nm_ldown = $nm_first - 20
  690. Global Const $nm_rdown = $nm_first - 21
  691. Global Const $nm_themechanged = $nm_first - 22
  692. Global Const $wm_mousefirst = 512
  693. Global Const $wm_mousemove = 512
  694. Global Const $wm_lbuttondown = 513
  695. Global Const $wm_lbuttonup = 514
  696. Global Const $wm_lbuttondblclk = 515
  697. Global Const $wm_rbuttondown = 516
  698. Global Const $wm_rbuttonup = 517
  699. Global Const $wm_rbuttondblclk = 518
  700. Global Const $wm_mbuttondown = 519
  701. Global Const $wm_mbuttonup = 520
  702. Global Const $wm_mbuttondblclk = 521
  703. Global Const $wm_mousewheel = 522
  704. Global Const $wm_xbuttondown = 523
  705. Global Const $wm_xbuttonup = 524
  706. Global Const $wm_xbuttondblclk = 525
  707. Global Const $wm_mousehwheel = 526
  708. Global Const $ps_solid = 0
  709. Global Const $ps_dash = 1
  710. Global Const $ps_dot = 2
  711. Global Const $ps_dashdot = 3
  712. Global Const $ps_dashdotdot = 4
  713. Global Const $ps_null = 5
  714. Global Const $ps_insideframe = 6
  715. Global Const $ps_userstyle = 7
  716. Global Const $ps_alternate = 8
  717. Global Const $ps_endcap_round = 0
  718. Global Const $ps_endcap_square = 256
  719. Global Const $ps_endcap_flat = 512
  720. Global Const $ps_join_bevel = 4096
  721. Global Const $ps_join_miter = 8192
  722. Global Const $ps_join_round = 0
  723. Global Const $ps_geometric = 65536
  724. Global Const $ps_cosmetic = 0
  725. Global Const $lwa_alpha = 2
  726. Global Const $lwa_colorkey = 1
  727. Global Const $rgn_and = 1
  728. Global Const $rgn_or = 2
  729. Global Const $rgn_xor = 3
  730. Global Const $rgn_diff = 4
  731. Global Const $rgn_copy = 5
  732. Global Const $errorregion = 0
  733. Global Const $nullregion = 1
  734. Global Const $simpleregion = 2
  735. Global Const $complexregion = 3
  736. Global Const $transparent = 1
  737. Global Const $opaque = 2
  738. Global Const $ccm_first = 8192
  739. Global Const $ccm_getunicodeformat = ($ccm_first + 6)
  740. Global Const $ccm_setunicodeformat = ($ccm_first + 5)
  741. Global Const $ccm_setbkcolor = $ccm_first + 1
  742. Global Const $ccm_setcolorscheme = $ccm_first + 2
  743. Global Const $ccm_getcolorscheme = $ccm_first + 3
  744. Global Const $ccm_getdroptarget = $ccm_first + 4
  745. Global Const $ccm_setwindowtheme = $ccm_first + 11
  746. Global Const $ga_parent = 1
  747. Global Const $ga_root = 2
  748. Global Const $ga_rootowner = 3
  749. Global Const $sm_cxscreen = 0
  750. Global Const $sm_cyscreen = 1
  751. Global Const $sm_cxvscroll = 2
  752. Global Const $sm_cyhscroll = 3
  753. Global Const $sm_cycaption = 4
  754. Global Const $sm_cxborder = 5
  755. Global Const $sm_cyborder = 6
  756. Global Const $sm_cxdlgframe = 7
  757. Global Const $sm_cydlgframe = 8
  758. Global Const $sm_cyvthumb = 9
  759. Global Const $sm_cxhthumb = 10
  760. Global Const $sm_cxicon = 11
  761. Global Const $sm_cyicon = 12
  762. Global Const $sm_cxcursor = 13
  763. Global Const $sm_cycursor = 14
  764. Global Const $sm_cymenu = 15
  765. Global Const $sm_cxfullscreen = 16
  766. Global Const $sm_cyfullscreen = 17
  767. Global Const $sm_cykanjiwindow = 18
  768. Global Const $sm_mousepresent = 19
  769. Global Const $sm_cyvscroll = 20
  770. Global Const $sm_cxhscroll = 21
  771. Global Const $sm_debug = 22
  772. Global Const $sm_swapbutton = 23
  773. Global Const $sm_reserved1 = 24
  774. Global Const $sm_reserved2 = 25
  775. Global Const $sm_reserved3 = 26
  776. Global Const $sm_reserved4 = 27
  777. Global Const $sm_cxmin = 28
  778. Global Const $sm_cymin = 29
  779. Global Const $sm_cxsize = 30
  780. Global Const $sm_cysize = 31
  781. Global Const $sm_cxframe = 32
  782. Global Const $sm_cyframe = 33
  783. Global Const $sm_cxmintrack = 34
  784. Global Const $sm_cymintrack = 35
  785. Global Const $sm_cxdoubleclk = 36
  786. Global Const $sm_cydoubleclk = 37
  787. Global Const $sm_cxiconspacing = 38
  788. Global Const $sm_cyiconspacing = 39
  789. Global Const $sm_menudropalignment = 40
  790. Global Const $sm_penwindows = 41
  791. Global Const $sm_dbcsenabled = 42
  792. Global Const $sm_cmousebuttons = 43
  793. Global Const $sm_secure = 44
  794. Global Const $sm_cxedge = 45
  795. Global Const $sm_cyedge = 46
  796. Global Const $sm_cxminspacing = 47
  797. Global Const $sm_cyminspacing = 48
  798. Global Const $sm_cxsmicon = 49
  799. Global Const $sm_cysmicon = 50
  800. Global Const $sm_cysmcaption = 51
  801. Global Const $sm_cxsmsize = 52
  802. Global Const $sm_cysmsize = 53
  803. Global Const $sm_cxmenusize = 54
  804. Global Const $sm_cymenusize = 55
  805. Global Const $sm_arrange = 56
  806. Global Const $sm_cxminimized = 57
  807. Global Const $sm_cyminimized = 58
  808. Global Const $sm_cxmaxtrack = 59
  809. Global Const $sm_cymaxtrack = 60
  810. Global Const $sm_cxmaximized = 61
  811. Global Const $sm_cymaximized = 62
  812. Global Const $sm_network = 63
  813. Global Const $sm_cleanboot = 67
  814. Global Const $sm_cxdrag = 68
  815. Global Const $sm_cydrag = 69
  816. Global Const $sm_showsounds = 70
  817. Global Const $sm_cxmenucheck = 71
  818. Global Const $sm_cymenucheck = 72
  819. Global Const $sm_slowmachine = 73
  820. Global Const $sm_mideastenabled = 74
  821. Global Const $sm_mousewheelpresent = 75
  822. Global Const $sm_xvirtualscreen = 76
  823. Global Const $sm_yvirtualscreen = 77
  824. Global Const $sm_cxvirtualscreen = 78
  825. Global Const $sm_cyvirtualscreen = 79
  826. Global Const $sm_cmonitors = 80
  827. Global Const $sm_samedisplayformat = 81
  828. Global Const $sm_immenabled = 82
  829. Global Const $sm_cxfocusborder = 83
  830. Global Const $sm_cyfocusborder = 84
  831. Global Const $sm_tabletpc = 86
  832. Global Const $sm_mediacenter = 87
  833. Global Const $sm_starter = 88
  834. Global Const $sm_serverr2 = 89
  835. Global Const $sm_cmetrics = 90
  836. Global Const $sm_remotesession = 4096
  837. Global Const $sm_shuttingdown = 8192
  838. Global Const $sm_remotecontrol = 8193
  839. Global Const $sm_caretblinkingenabled = 8194
  840. Global Const $blackness = 66
  841. Global Const $captureblt = 1073741824
  842. Global Const $dstinvert = 5570569
  843. Global Const $mergecopy = 12583114
  844. Global Const $mergepaint = 12255782
  845. Global Const $nomirrorbitmap = -2147483648
  846. Global Const $notsrccopy = 3342344
  847. Global Const $notsrcerase = 1114278
  848. Global Const $patcopy = 15728673
  849. Global Const $patinvert = 5898313
  850. Global Const $patpaint = 16452105
  851. Global Const $srcand = 8913094
  852. Global Const $srccopy = 13369376
  853. Global Const $srcerase = 4457256
  854. Global Const $srcinvert = 6684742
  855. Global Const $srcpaint = 15597702
  856. Global Const $whiteness = 16711778
  857. Global Const $dt_bottom = 8
  858. Global Const $dt_calcrect = 1024
  859. Global Const $dt_center = 1
  860. Global Const $dt_editcontrol = 8192
  861. Global Const $dt_end_ellipsis = 32768
  862. Global Const $dt_expandtabs = 64
  863. Global Const $dt_externalleading = 512
  864. Global Const $dt_hideprefix = 1048576
  865. Global Const $dt_internal = 4096
  866. Global Const $dt_left = 0
  867. Global Const $dt_modifystring = 65536
  868. Global Const $dt_noclip = 256
  869. Global Const $dt_nofullwidthcharbreak = 524288
  870. Global Const $dt_noprefix = 2048
  871. Global Const $dt_path_ellipsis = 16384
  872. Global Const $dt_prefixonly = 2097152
  873. Global Const $dt_right = 2
  874. Global Const $dt_rtlreading = 131072
  875. Global Const $dt_singleline = 32
  876. Global Const $dt_tabstop = 128
  877. Global Const $dt_top = 0
  878. Global Const $dt_vcenter = 4
  879. Global Const $dt_wordbreak = 16
  880. Global Const $dt_word_ellipsis = 262144
  881. Global Const $rdw_erase = 4
  882. Global Const $rdw_frame = 1024
  883. Global Const $rdw_internalpaint = 2
  884. Global Const $rdw_invalidate = 1
  885. Global Const $rdw_noerase = 32
  886. Global Const $rdw_noframe = 2048
  887. Global Const $rdw_nointernalpaint = 16
  888. Global Const $rdw_validate = 8
  889. Global Const $rdw_erasenow = 512
  890. Global Const $rdw_updatenow = 256
  891. Global Const $rdw_allchildren = 128
  892. Global Const $rdw_nochildren = 64
  893. Global Const $wm_renderformat = 773
  894. Global Const $wm_renderallformats = 774
  895. Global Const $wm_destroyclipboard = 775
  896. Global Const $wm_drawclipboard = 776
  897. Global Const $wm_paintclipboard = 777
  898. Global Const $wm_vscrollclipboard = 778
  899. Global Const $wm_sizeclipboard = 779
  900. Global Const $wm_askcbformatname = 780
  901. Global Const $wm_changecbchain = 781
  902. Global Const $wm_hscrollclipboard = 782
  903. Global Const $hterror = -2
  904. Global Const $httransparent = -1
  905. Global Const $htnowhere = 0
  906. Global Const $htclient = 1
  907. Global Const $htcaption = 2
  908. Global Const $htsysmenu = 3
  909. Global Const $htgrowbox = 4
  910. Global Const $htsize = $htgrowbox
  911. Global Const $htmenu = 5
  912. Global Const $hthscroll = 6
  913. Global Const $htvscroll = 7
  914. Global Const $htminbutton = 8
  915. Global Const $htmaxbutton = 9
  916. Global Const $htleft = 10
  917. Global Const $htright = 11
  918. Global Const $httop = 12
  919. Global Const $httopleft = 13
  920. Global Const $httopright = 14
  921. Global Const $htbottom = 15
  922. Global Const $htbottomleft = 16
  923. Global Const $htbottomright = 17
  924. Global Const $htborder = 18
  925. Global Const $htreduce = $htminbutton
  926. Global Const $htzoom = $htmaxbutton
  927. Global Const $htsizefirst = $htleft
  928. Global Const $htsizelast = $htbottomright
  929. Global Const $htobject = 19
  930. Global Const $htclose = 20
  931. Global Const $hthelp = 21
  932. Global Const $color_scrollbar = 0
  933. Global Const $color_background = 1
  934. Global Const $color_activecaption = 2
  935. Global Const $color_inactivecaption = 3
  936. Global Const $color_menu = 4
  937. Global Const $color_window = 5
  938. Global Const $color_windowframe = 6
  939. Global Const $color_menutext = 7
  940. Global Const $color_windowtext = 8
  941. Global Const $color_captiontext = 9
  942. Global Const $color_activeborder = 10
  943. Global Const $color_inactiveborder = 11
  944. Global Const $color_appworkspace = 12
  945. Global Const $color_highlight = 13
  946. Global Const $color_highlighttext = 14
  947. Global Const $color_btnface = 15
  948. Global Const $color_btnshadow = 16
  949. Global Const $color_graytext = 17
  950. Global Const $color_btntext = 18
  951. Global Const $color_inactivecaptiontext = 19
  952. Global Const $color_btnhighlight = 20
  953. Global Const $color_3ddkshadow = 21
  954. Global Const $color_3dlight = 22
  955. Global Const $color_infotext = 23
  956. Global Const $color_infobk = 24
  957. Global Const $color_hotlight = 26
  958. Global Const $color_gradientactivecaption = 27
  959. Global Const $color_gradientinactivecaption = 28
  960. Global Const $color_menuhilight = 29
  961. Global Const $color_menubar = 30
  962. Global Const $color_desktop = 1
  963. Global Const $color_3dface = 15
  964. Global Const $color_3dshadow = 16
  965. Global Const $color_3dhighlight = 20
  966. Global Const $color_3dhilight = 20
  967. Global Const $color_btnhilight = 20
  968. Global Const $hinst_commctrl = -1
  969. Global Const $idb_std_small_color = 0
  970. Global Const $idb_std_large_color = 1
  971. Global Const $idb_view_small_color = 4
  972. Global Const $idb_view_large_color = 5
  973. Global Const $idb_hist_small_color = 8
  974. Global Const $idb_hist_large_color = 9
  975. Global Const $startf_forceofffeedback = 128
  976. Global Const $startf_forceonfeedback = 64
  977. Global Const $startf_preventpinning = 8192
  978. Global Const $startf_runfullscreen = 32
  979. Global Const $startf_titleisappid = 4096
  980. Global Const $startf_titleislinkname = 2048
  981. Global Const $startf_usecountchars = 8
  982. Global Const $startf_usefillattribute = 16
  983. Global Const $startf_usehotkey = 512
  984. Global Const $startf_useposition = 4
  985. Global Const $startf_useshowwindow = 1
  986. Global Const $startf_usesize = 2
  987. Global Const $startf_usestdhandles = 256
  988. Global Const $cdds_prepaint = 1
  989. Global Const $cdds_postpaint = 2
  990. Global Const $cdds_preerase = 3
  991. Global Const $cdds_posterase = 4
  992. Global Const $cdds_item = 65536
  993. Global Const $cdds_itemprepaint = 65537
  994. Global Const $cdds_itempostpaint = 65538
  995. Global Const $cdds_itempreerase = 65539
  996. Global Const $cdds_itemposterase = 65540
  997. Global Const $cdds_subitem = 131072
  998. Global Const $cdis_selected = 1
  999. Global Const $cdis_grayed = 2
  1000. Global Const $cdis_disabled = 4
  1001. Global Const $cdis_checked = 8
  1002. Global Const $cdis_focus = 16
  1003. Global Const $cdis_default = 32
  1004. Global Const $cdis_hot = 64
  1005. Global Const $cdis_marked = 128
  1006. Global Const $cdis_indeterminate = 256
  1007. Global Const $cdis_showkeyboardcues = 512
  1008. Global Const $cdis_nearhot = 1024
  1009. Global Const $cdis_othersidehot = 2048
  1010. Global Const $cdis_drophilited = 4096
  1011. Global Const $cdrf_dodefault = 0
  1012. Global Const $cdrf_newfont = 2
  1013. Global Const $cdrf_skipdefault = 4
  1014. Global Const $cdrf_notifypostpaint = 16
  1015. Global Const $cdrf_notifyitemdraw = 32
  1016. Global Const $cdrf_notifysubitemdraw = 32
  1017. Global Const $cdrf_notifyposterase = 64
  1018. Global Const $cdrf_doerase = 8
  1019. Global Const $cdrf_skippostpaint = 256
  1020. Global Const $gui_ss_default_gui = BitOR($ws_minimizebox, $ws_caption, $ws_popup, $ws_sysmenu)
  1021. Global Const $opt_coordsrelative = 0
  1022. Global Const $opt_coordsabsolute = 1
  1023. Global Const $opt_coordsclient = 2
  1024. Global Const $opt_errorsilent = 0
  1025. Global Const $opt_errorfatal = 1
  1026. Global Const $opt_capsnostore = 0
  1027. Global Const $opt_capsstore = 1
  1028. Global Const $opt_matchstart = 1
  1029. Global Const $opt_matchany = 2
  1030. Global Const $opt_matchexact = 3
  1031. Global Const $opt_matchadvanced = 4
  1032. Global Const $ccs_top = 1
  1033. Global Const $ccs_nomovey = 2
  1034. Global Const $ccs_bottom = 3
  1035. Global Const $ccs_noresize = 4
  1036. Global Const $ccs_noparentalign = 8
  1037. Global Const $ccs_nohilite = 16
  1038. Global Const $ccs_adjustable = 32
  1039. Global Const $ccs_nodivider = 64
  1040. Global Const $ccs_vert = 128
  1041. Global Const $ccs_left = 129
  1042. Global Const $ccs_nomovex = 130
  1043. Global Const $ccs_right = 131
  1044. Global Const $dt_drivetype = 1
  1045. Global Const $dt_ssdstatus = 2
  1046. Global Const $dt_bustype = 3
  1047. Global Const $proxy_ie = 0
  1048. Global Const $proxy_none = 1
  1049. Global Const $proxy_specified = 2
  1050. Global Const $objid_window = 0
  1051. Global Const $objid_titlebar = -2
  1052. Global Const $objid_sizegrip = -7
  1053. Global Const $objid_caret = -8
  1054. Global Const $objid_cursor = -9
  1055. Global Const $objid_alert = -10
  1056. Global Const $objid_sound = -11
  1057. Global Const $dlg_centerontop = 0
  1058. Global Const $dlg_notitle = 1
  1059. Global Const $dlg_notontop = 2
  1060. Global Const $dlg_textleft = 4
  1061. Global Const $dlg_textright = 8
  1062. Global Const $dlg_moveable = 16
  1063. Global Const $dlg_textvcenter = 32
  1064. Global Const $idc_unknown = 0
  1065. Global Const $idc_appstarting = 1
  1066. Global Const $idc_arrow = 2
  1067. Global Const $idc_cross = 3
  1068. Global Const $idc_hand = 32649
  1069. Global Const $idc_help = 4
  1070. Global Const $idc_ibeam = 5
  1071. Global Const $idc_icon = 6
  1072. Global Const $idc_no = 7
  1073. Global Const $idc_size = 8
  1074. Global Const $idc_sizeall = 9
  1075. Global Const $idc_sizenesw = 10
  1076. Global Const $idc_sizens = 11
  1077. Global Const $idc_sizenwse = 12
  1078. Global Const $idc_sizewe = 13
  1079. Global Const $idc_uparrow = 14
  1080. Global Const $idc_wait = 15
  1081. Global Const $idi_application = 32512
  1082. Global Const $idi_asterisk = 32516
  1083. Global Const $idi_exclamation = 32515
  1084. Global Const $idi_hand = 32513
  1085. Global Const $idi_question = 32514
  1086. Global Const $idi_winlogo = 32517
  1087. Global Const $idi_shield = 32518
  1088. Global Const $idi_error = $idi_hand
  1089. Global Const $idi_information = $idi_asterisk
  1090. Global Const $idi_warning = $idi_exclamation
  1091. Global Const $sd_logoff = 0
  1092. Global Const $sd_shutdown = 1
  1093. Global Const $sd_reboot = 2
  1094. Global Const $sd_force = 4
  1095. Global Const $sd_powerdown = 8
  1096. Global Const $sd_forcehung = 16
  1097. Global Const $sd_standby = 32
  1098. Global Const $sd_hibernate = 64
  1099. Global Const $stdin_child = 1
  1100. Global Const $stdout_child = 2
  1101. Global Const $stderr_child = 4
  1102. Global Const $stderr_merged = 8
  1103. Global Const $stdio_inherit_parent = 16
  1104. Global Const $run_create_new_console = 65536
  1105. Global Const $ubound_dimensions = 0
  1106. Global Const $ubound_rows = 1
  1107. Global Const $ubound_columns = 2
  1108. Global Const $mouseeventf_absolute = 32768
  1109. Global Const $mouseeventf_move = 1
  1110. Global Const $mouseeventf_leftdown = 2
  1111. Global Const $mouseeventf_leftup = 4
  1112. Global Const $mouseeventf_rightdown = 8
  1113. Global Const $mouseeventf_rightup = 16
  1114. Global Const $mouseeventf_middledown = 32
  1115. Global Const $mouseeventf_middleup = 64
  1116. Global Const $mouseeventf_wheel = 2048
  1117. Global Const $mouseeventf_xdown = 128
  1118. Global Const $mouseeventf_xup = 256
  1119. Global Const $reg_none = 0
  1120. Global Const $reg_sz = 1
  1121. Global Const $reg_expand_sz = 2
  1122. Global Const $reg_binary = 3
  1123. Global Const $reg_dword = 4
  1124. Global Const $reg_dword_little_endian = 4
  1125. Global Const $reg_dword_big_endian = 5
  1126. Global Const $reg_link = 6
  1127. Global Const $reg_multi_sz = 7
  1128. Global Const $reg_resource_list = 8
  1129. Global Const $reg_full_resource_descriptor = 9
  1130. Global Const $reg_resource_requirements_list = 10
  1131. Global Const $reg_qword = 11
  1132. Global Const $reg_qword_little_endian = 11
  1133. Global Const $hwnd_bottom = 1
  1134. Global Const $hwnd_notopmost = -2
  1135. Global Const $hwnd_top = 0
  1136. Global Const $hwnd_topmost = -1
  1137. Global Const $swp_nosize = 1
  1138. Global Const $swp_nomove = 2
  1139. Global Const $swp_nozorder = 4
  1140. Global Const $swp_noredraw = 8
  1141. Global Const $swp_noactivate = 16
  1142. Global Const $swp_framechanged = 32
  1143. Global Const $swp_drawframe = 32
  1144. Global Const $swp_showwindow = 64
  1145. Global Const $swp_hidewindow = 128
  1146. Global Const $swp_nocopybits = 256
  1147. Global Const $swp_noownerzorder = 512
  1148. Global Const $swp_noreposition = 512
  1149. Global Const $swp_nosendchanging = 1024
  1150. Global Const $swp_defererase = 8192
  1151. Global Const $swp_asyncwindowpos = 16384
  1152. Global Const $keyword_default = 1
  1153. Global Const $keyword_null = 2
  1154. Global Const $declared_local = -1
  1155. Global Const $declared_unknown = 0
  1156. Global Const $declared_global = 1
  1157. Global Const $assign_create = 0
  1158. Global Const $assign_forcelocal = 1
  1159. Global Const $assign_forceglobal = 2
  1160. Global Const $assign_existfail = 4
  1161. Global Const $bi_enable = 0
  1162. Global Const $bi_disable = 1
  1163. Global Const $break_enable = 1
  1164. Global Const $break_disable = 0
  1165. Global Const $cdtray_open = "open"
  1166. Global Const $cdtray_closed = "closed"
  1167. Global Const $send_default = 0
  1168. Global Const $send_raw = 1
  1169. Global Const $dir_default = 0
  1170. Global Const $dir_extended = 1
  1171. Global Const $dir_norecurse = 2
  1172. Global Const $dir_remove = 1
  1173. Global Const $dt_all = "ALL"
  1174. Global Const $dt_cdrom = "CDROM"
  1175. Global Const $dt_removable = "REMOVABLE"
  1176. Global Const $dt_fixed = "FIXED"
  1177. Global Const $dt_network = "NETWORK"
  1178. Global Const $dt_ramdisk = "RAMDISK"
  1179. Global Const $dt_unknown = "UNKNOWN"
  1180. Global Const $dt_undefined = 1
  1181. Global Const $dt_fat = "FAT"
  1182. Global Const $dt_fat32 = "FAT32"
  1183. Global Const $dt_exfat = "exFAT"
  1184. Global Const $dt_ntfs = "NTFS"
  1185. Global Const $dt_nwfs = "NWFS"
  1186. Global Const $dt_cdfs = "CDFS"
  1187. Global Const $dt_udf = "UDF"
  1188. Global Const $dma_default = 0
  1189. Global Const $dma_persistent = 1
  1190. Global Const $dma_authentication = 8
  1191. Global Const $ds_unknown = "UNKNOWN"
  1192. Global Const $ds_ready = "READY"
  1193. Global Const $ds_notready = "NOTREADY"
  1194. Global Const $ds_invalid = "INVALID"
  1195. Global Const $mouse_click_left = "left"
  1196. Global Const $mouse_click_right = "right"
  1197. Global Const $mouse_click_middle = "middle"
  1198. Global Const $mouse_click_main = "main"
  1199. Global Const $mouse_click_menu = "menu"
  1200. Global Const $mouse_click_primary = "primary"
  1201. Global Const $mouse_click_secondary = "secondary"
  1202. Global Const $mouse_wheel_up = "up"
  1203. Global Const $mouse_wheel_down = "down"
  1204. Global Const $number_auto = 0
  1205. Global Const $number_32bit = 1
  1206. Global Const $number_64bit = 2
  1207. Global Const $number_double = 3
  1208. Global Const $obj_name = 1
  1209. Global Const $obj_string = 2
  1210. Global Const $obj_progid = 3
  1211. Global Const $obj_file = 4
  1212. Global Const $obj_module = 5
  1213. Global Const $obj_clsid = 6
  1214. Global Const $obj_iid = 7
  1215. Global Const $exitclose_normal = 0
  1216. Global Const $exitclose_byexit = 1
  1217. Global Const $exitclose_byclick = 2
  1218. Global Const $exitclose_bylogoff = 3
  1219. Global Const $exitclose_bysutdown = 4
  1220. Global Const $process_stats_memory = 0
  1221. Global Const $process_stats_io = 1
  1222. Global Const $process_low = 0
  1223. Global Const $process_belownormal = 1
  1224. Global Const $process_normal = 2
  1225. Global Const $process_abovenormal = 3
  1226. Global Const $process_high = 4
  1227. Global Const $process_realtime = 5
  1228. Global Const $run_logon_noprofile = 0
  1229. Global Const $run_logon_profile = 1
  1230. Global Const $run_logon_network = 2
  1231. Global Const $run_logon_inherit = 4
  1232. Global Const $sound_nowait = 0
  1233. Global Const $sound_wait = 1
  1234. Global Const $shex_open = "open"
  1235. Global Const $shex_edit = "edit"
  1236. Global Const $shex_print = "print"
  1237. Global Const $shex_properties = "properties"
  1238. Global Const $tcp_data_default = 0
  1239. Global Const $tcp_data_binary = 1
  1240. Global Const $udp_open_default = 0
  1241. Global Const $udp_open_broadcast = 1
  1242. Global Const $udp_data_default = 0
  1243. Global Const $udp_data_binary = 1
  1244. Global Const $udp_data_array = 2
  1245. Global Const $tip_noicon = 0
  1246. Global Const $tip_infoicon = 1
  1247. Global Const $tip_warningicon = 2
  1248. Global Const $tip_erroricon = 3
  1249. Global Const $tip_balloon = 1
  1250. Global Const $tip_center = 2
  1251. Global Const $tip_forcevisible = 4
  1252. Global Const $windows_noontop = 0
  1253. Global Const $windows_ontop = 1
  1254. Global Const $mb_ok = 0
  1255. Global Const $mb_okcancel = 1
  1256. Global Const $mb_abortretryignore = 2
  1257. Global Const $mb_yesnocancel = 3
  1258. Global Const $mb_yesno = 4
  1259. Global Const $mb_retrycancel = 5
  1260. Global Const $mb_canceltrycontinue = 6
  1261. Global Const $mb_help = 16384
  1262. Global Const $mb_iconstop = 16
  1263. Global Const $mb_iconerror = 16
  1264. Global Const $mb_iconhand = 16
  1265. Global Const $mb_iconquestion = 32
  1266. Global Const $mb_iconexclamation = 48
  1267. Global Const $mb_iconwarning = 48
  1268. Global Const $mb_iconinformation = 64
  1269. Global Const $mb_iconasterisk = 64
  1270. Global Const $mb_usericon = 128
  1271. Global Const $mb_defbutton1 = 0
  1272. Global Const $mb_defbutton2 = 256
  1273. Global Const $mb_defbutton3 = 512
  1274. Global Const $mb_defbutton4 = 768
  1275. Global Const $mb_applmodal = 0
  1276. Global Const $mb_systemmodal = 4096
  1277. Global Const $mb_taskmodal = 8192
  1278. Global Const $mb_default_desktop_only = 131072
  1279. Global Const $mb_right = 524288
  1280. Global Const $mb_rtlreading = 1048576
  1281. Global Const $mb_setforeground = 65536
  1282. Global Const $mb_topmost = 262144
  1283. Global Const $mb_service_notification = 2097152
  1284. Global Const $mb_rightjustified = $mb_right
  1285. Global Const $idtimeout = -1
  1286. Global Const $idok = 1
  1287. Global Const $idcancel = 2
  1288. Global Const $idabort = 3
  1289. Global Const $idretry = 4
  1290. Global Const $idignore = 5
  1291. Global Const $idyes = 6
  1292. Global Const $idno = 7
  1293. Global Const $idclose = 8
  1294. Global Const $idhelp = 9
  1295. Global Const $idtryagain = 10
  1296. Global Const $idcontinue = 11
  1297. Global Const $str_nocasesense = 0
  1298. Global Const $str_casesense = 1
  1299. Global Const $str_nocasesensebasic = 2
  1300. Global Const $str_stripleading = 1
  1301. Global Const $str_striptrailing = 2
  1302. Global Const $str_stripspaces = 4
  1303. Global Const $str_stripall = 8
  1304. Global Const $str_chrsplit = 0
  1305. Global Const $str_entiresplit = 1
  1306. Global Const $str_nocount = 2
  1307. Global Const $str_regexpmatch = 0
  1308. Global Const $str_regexparraymatch = 1
  1309. Global Const $str_regexparrayfullmatch = 2
  1310. Global Const $str_regexparrayglobalmatch = 3
  1311. Global Const $str_regexparrayglobalfullmatch = 4
  1312. Global Const $str_endisstart = 0
  1313. Global Const $str_endnotstart = 1
  1314. Global Const $sb_ansi = 1
  1315. Global Const $sb_utf16le = 2
  1316. Global Const $sb_utf16be = 3
  1317. Global Const $sb_utf8 = 4
  1318. Global Const $se_utf16 = 0
  1319. Global Const $se_ansi = 1
  1320. Global Const $se_utf8 = 2
  1321. Global Const $str_utf16 = 0
  1322. Global Const $str_ucs2 = 1
  1323. Global Enum $arrayfill_force_default, $arrayfill_force_singleitem, $arrayfill_force_int, $arrayfill_force_number, $arrayfill_force_ptr, $arrayfill_force_hwnd, $arrayfill_force_string
  1324. Global Enum $arrayunique_nocount, $arrayunique_count
  1325. Global Enum $arrayunique_auto, $arrayunique_force32, $arrayunique_force64, $arrayunique_match, $arrayunique_distinct
  1326.  
  1327. Func _arrayadd(ByRef $aarray, $vvalue, $istart = 0, $sdelim_item = "|", $sdelim_row = @CRLF, $iforce = $arrayfill_force_default)
  1328. If $istart = Default Then $istart = 0
  1329. If $sdelim_item = Default Then $sdelim_item = "|"
  1330. If $sdelim_row = Default Then $sdelim_row = @CRLF
  1331. If $iforce = Default Then $iforce = $arrayfill_force_default
  1332. If NOT IsArray($aarray) Then Return SetError(1, 0, -1)
  1333. Local $idim_1 = UBound($aarray, $ubound_rows)
  1334. Local $hdatatype = 0
  1335. Switch $iforce
  1336. Case $arrayfill_force_int
  1337. $hdatatype = Int
  1338. Case $arrayfill_force_number
  1339. $hdatatype = Number
  1340. Case $arrayfill_force_ptr
  1341. $hdatatype = Ptr
  1342. Case $arrayfill_force_hwnd
  1343. $hdatatype = HWnd
  1344. Case $arrayfill_force_string
  1345. $hdatatype = String
  1346. EndSwitch
  1347. Switch UBound($aarray, $ubound_dimensions)
  1348. Case 1
  1349. If $iforce = $arrayfill_force_singleitem Then
  1350. ReDim $aarray[$idim_1 + 1]
  1351. $aarray[$idim_1] = $vvalue
  1352. Return $idim_1
  1353. EndIf
  1354. If IsArray($vvalue) Then
  1355. If UBound($vvalue, $ubound_dimensions) <> 1 Then Return SetError(5, 0, -1)
  1356. $hdatatype = 0
  1357. Else
  1358. Local $atmp = StringSplit($vvalue, $sdelim_item, $str_nocount + $str_entiresplit)
  1359. If UBound($atmp, $ubound_rows) = 1 Then
  1360. $atmp[0] = $vvalue
  1361. EndIf
  1362. $vvalue = $atmp
  1363. EndIf
  1364. Local $iadd = UBound($vvalue, $ubound_rows)
  1365. ReDim $aarray[$idim_1 + $iadd]
  1366. For $i = 0 To $iadd - 1
  1367. If IsFunc($hdatatype) Then
  1368. $aarray[$idim_1 + $i] = $hdatatype($vvalue[$i])
  1369. Else
  1370. $aarray[$idim_1 + $i] = $vvalue[$i]
  1371. EndIf
  1372. Next
  1373. Return $idim_1 + $iadd - 1
  1374. Case 2
  1375. Local $idim_2 = UBound($aarray, $ubound_columns)
  1376. If $istart < 0 OR $istart > $idim_2 - 1 Then Return SetError(4, 0, -1)
  1377. Local $ivaldim_1, $ivaldim_2 = 0, $icolcount
  1378. If IsArray($vvalue) Then
  1379. If UBound($vvalue, $ubound_dimensions) <> 2 Then Return SetError(5, 0, -1)
  1380. $ivaldim_1 = UBound($vvalue, $ubound_rows)
  1381. $ivaldim_2 = UBound($vvalue, $ubound_columns)
  1382. $hdatatype = 0
  1383. Else
  1384. Local $asplit_1 = StringSplit($vvalue, $sdelim_row, $str_nocount + $str_entiresplit)
  1385. $ivaldim_1 = UBound($asplit_1, $ubound_rows)
  1386. Local $atmp[$ivaldim_1][0], $asplit_2
  1387. For $i = 0 To $ivaldim_1 - 1
  1388. $asplit_2 = StringSplit($asplit_1[$i], $sdelim_item, $str_nocount + $str_entiresplit)
  1389. $icolcount = UBound($asplit_2)
  1390. If $icolcount > $ivaldim_2 Then
  1391. $ivaldim_2 = $icolcount
  1392. ReDim $atmp[$ivaldim_1][$ivaldim_2]
  1393. EndIf
  1394. For $j = 0 To $icolcount - 1
  1395. $atmp[$i][$j] = $asplit_2[$j]
  1396. Next
  1397. Next
  1398. $vvalue = $atmp
  1399. EndIf
  1400. If UBound($vvalue, $ubound_columns) + $istart > UBound($aarray, $ubound_columns) Then Return SetError(3, 0, -1)
  1401. ReDim $aarray[$idim_1 + $ivaldim_1][$idim_2]
  1402. For $iwriteto_index = 0 To $ivaldim_1 - 1
  1403. For $j = 0 To $idim_2 - 1
  1404. If $j < $istart Then
  1405. $aarray[$iwriteto_index + $idim_1][$j] = ""
  1406. ElseIf $j - $istart > $ivaldim_2 - 1 Then
  1407. $aarray[$iwriteto_index + $idim_1][$j] = ""
  1408. Else
  1409. If IsFunc($hdatatype) Then
  1410. $aarray[$iwriteto_index + $idim_1][$j] = $hdatatype($vvalue[$iwriteto_index][$j - $istart])
  1411. Else
  1412. $aarray[$iwriteto_index + $idim_1][$j] = $vvalue[$iwriteto_index][$j - $istart]
  1413. EndIf
  1414. EndIf
  1415. Next
  1416. Next
  1417. Case Else
  1418. Return SetError(2, 0, -1)
  1419. EndSwitch
  1420. Return UBound($aarray, $ubound_rows) - 1
  1421. EndFunc
  1422.  
  1423. Func _arraybinarysearch(Const ByRef $aarray, $vvalue, $istart = 0, $iend = 0, $icolumn = 0)
  1424. If $istart = Default Then $istart = 0
  1425. If $iend = Default Then $iend = 0
  1426. If $icolumn = Default Then $icolumn = 0
  1427. If NOT IsArray($aarray) Then Return SetError(1, 0, -1)
  1428. Local $idim_1 = UBound($aarray, $ubound_rows)
  1429. If $idim_1 = 0 Then Return SetError(6, 0, -1)
  1430. If $iend < 1 OR $iend > $idim_1 - 1 Then $iend = $idim_1 - 1
  1431. If $istart < 0 Then $istart = 0
  1432. If $istart > $iend Then Return SetError(4, 0, -1)
  1433. Local $imid = Int(($iend + $istart) / 2)
  1434. Switch UBound($aarray, $ubound_dimensions)
  1435. Case 1
  1436. If $aarray[$istart] > $vvalue OR $aarray[$iend] < $vvalue Then Return SetError(2, 0, -1)
  1437. While $istart <= $imid AND $vvalue <> $aarray[$imid]
  1438. If $vvalue < $aarray[$imid] Then
  1439. $iend = $imid - 1
  1440. Else
  1441. $istart = $imid + 1
  1442. EndIf
  1443. $imid = Int(($iend + $istart) / 2)
  1444. WEnd
  1445. If $istart > $iend Then Return SetError(3, 0, -1)
  1446. Case 2
  1447. Local $idim_2 = UBound($aarray, $ubound_columns) - 1
  1448. If $icolumn < 0 OR $icolumn > $idim_2 Then Return SetError(7, 0, -1)
  1449. If $aarray[$istart][$icolumn] > $vvalue OR $aarray[$iend][$icolumn] < $vvalue Then Return SetError(2, 0, -1)
  1450. While $istart <= $imid AND $vvalue <> $aarray[$imid][$icolumn]
  1451. If $vvalue < $aarray[$imid][$icolumn] Then
  1452. $iend = $imid - 1
  1453. Else
  1454. $istart = $imid + 1
  1455. EndIf
  1456. $imid = Int(($iend + $istart) / 2)
  1457. WEnd
  1458. If $istart > $iend Then Return SetError(3, 0, -1)
  1459. Case Else
  1460. Return SetError(5, 0, -1)
  1461. EndSwitch
  1462. Return $imid
  1463. EndFunc
  1464.  
  1465. Func _arraycoldelete(ByRef $aarray, $icolumn, $bconvert = False)
  1466. If $bconvert = Default Then $bconvert = False
  1467. If NOT IsArray($aarray) Then Return SetError(1, 0, -1)
  1468. Local $idim_1 = UBound($aarray, $ubound_rows)
  1469. If UBound($aarray, $ubound_dimensions) <> 2 Then Return SetError(2, 0, -1)
  1470. Local $idim_2 = UBound($aarray, $ubound_columns)
  1471. Switch $idim_2
  1472. Case 2
  1473. If $icolumn < 0 OR $icolumn > 1 Then Return SetError(3, 0, -1)
  1474. If $bconvert Then
  1475. Local $atemparray[$idim_1]
  1476. For $i = 0 To $idim_1 - 1
  1477. $atemparray[$i] = $aarray[$i][(NOT $icolumn)]
  1478. Next
  1479. $aarray = $atemparray
  1480. Else
  1481. ContinueCase
  1482. EndIf
  1483. Case Else
  1484. If $icolumn < 0 OR $icolumn > $idim_2 - 1 Then Return SetError(3, 0, -1)
  1485. For $i = 0 To $idim_1 - 1
  1486. For $j = $icolumn To $idim_2 - 2
  1487. $aarray[$i][$j] = $aarray[$i][$j + 1]
  1488. Next
  1489. Next
  1490. ReDim $aarray[$idim_1][$idim_2 - 1]
  1491. EndSwitch
  1492. Return UBound($aarray, $ubound_columns)
  1493. EndFunc
  1494.  
  1495. Func _arraycolinsert(ByRef $aarray, $icolumn)
  1496. If NOT IsArray($aarray) Then Return SetError(1, 0, -1)
  1497. Local $idim_1 = UBound($aarray, $ubound_rows)
  1498. Switch UBound($aarray, $ubound_dimensions)
  1499. Case 1
  1500. Local $atemparray[$idim_1][2]
  1501. Switch $icolumn
  1502. Case 0, 1
  1503. For $i = 0 To $idim_1 - 1
  1504. $atemparray[$i][(NOT $icolumn)] = $aarray[$i]
  1505. Next
  1506. Case Else
  1507. Return SetError(3, 0, -1)
  1508. EndSwitch
  1509. $aarray = $atemparray
  1510. Case 2
  1511. Local $idim_2 = UBound($aarray, $ubound_columns)
  1512. If $icolumn < 0 OR $icolumn > $idim_2 Then Return SetError(3, 0, -1)
  1513. ReDim $aarray[$idim_1][$idim_2 + 1]
  1514. For $i = 0 To $idim_1 - 1
  1515. For $j = $idim_2 To $icolumn + 1 Step -1
  1516. $aarray[$i][$j] = $aarray[$i][$j - 1]
  1517. Next
  1518. $aarray[$i][$icolumn] = ""
  1519. Next
  1520. Case Else
  1521. Return SetError(2, 0, -1)
  1522. EndSwitch
  1523. Return UBound($aarray, $ubound_columns)
  1524. EndFunc
  1525.  
  1526. Func _arraycombinations(Const ByRef $aarray, $iset, $sdelimiter = "")
  1527. If $sdelimiter = Default Then $sdelimiter = ""
  1528. If NOT IsArray($aarray) Then Return SetError(1, 0, 0)
  1529. If UBound($aarray, $ubound_dimensions) <> 1 Then Return SetError(2, 0, 0)
  1530. Local $in = UBound($aarray)
  1531. Local $ir = $iset
  1532. Local $aidx[$ir]
  1533. For $i = 0 To $ir - 1
  1534. $aidx[$i] = $i
  1535. Next
  1536. Local $itotal = __array_combinations($in, $ir)
  1537. Local $ileft = $itotal
  1538. Local $aresult[$itotal + 1]
  1539. $aresult[0] = $itotal
  1540. Local $icount = 1
  1541. While $ileft > 0
  1542. __array_getnext($in, $ir, $ileft, $itotal, $aidx)
  1543. For $i = 0 To $iset - 1
  1544. $aresult[$icount] &= $aarray[$aidx[$i]] & $sdelimiter
  1545. Next
  1546. If $sdelimiter <> "" Then $aresult[$icount] = StringTrimRight($aresult[$icount], 1)
  1547. $icount += 1
  1548. WEnd
  1549. Return $aresult
  1550. EndFunc
  1551.  
  1552. Func _arrayconcatenate(ByRef $aarraytarget, Const ByRef $aarraysource, $istart = 0)
  1553. If $istart = Default Then $istart = 0
  1554. If NOT IsArray($aarraytarget) Then Return SetError(1, 0, -1)
  1555. If NOT IsArray($aarraysource) Then Return SetError(2, 0, -1)
  1556. Local $idim_total_tgt = UBound($aarraytarget, $ubound_dimensions)
  1557. Local $idim_total_src = UBound($aarraysource, $ubound_dimensions)
  1558. Local $idim_1_tgt = UBound($aarraytarget, $ubound_rows)
  1559. Local $idim_1_src = UBound($aarraysource, $ubound_rows)
  1560. If $istart < 0 OR $istart > $idim_1_src - 1 Then Return SetError(6, 0, -1)
  1561. Switch $idim_total_tgt
  1562. Case 1
  1563. If $idim_total_src <> 1 Then Return SetError(4, 0, -1)
  1564. ReDim $aarraytarget[$idim_1_tgt + $idim_1_src - $istart]
  1565. For $i = $istart To $idim_1_src - 1
  1566. $aarraytarget[$idim_1_tgt + $i - $istart] = $aarraysource[$i]
  1567. Next
  1568. Case 2
  1569. If $idim_total_src <> 2 Then Return SetError(4, 0, -1)
  1570. Local $idim_2_tgt = UBound($aarraytarget, $ubound_columns)
  1571. If UBound($aarraysource, $ubound_columns) <> $idim_2_tgt Then Return SetError(5, 0, -1)
  1572. ReDim $aarraytarget[$idim_1_tgt + $idim_1_src - $istart][$idim_2_tgt]
  1573. For $i = $istart To $idim_1_src - 1
  1574. For $j = 0 To $idim_2_tgt - 1
  1575. $aarraytarget[$idim_1_tgt + $i - $istart][$j] = $aarraysource[$i][$j]
  1576. Next
  1577. Next
  1578. Case Else
  1579. Return SetError(3, 0, -1)
  1580. EndSwitch
  1581. Return UBound($aarraytarget, $ubound_rows)
  1582. EndFunc
  1583.  
  1584. Func _arraydelete(ByRef $aarray, $vrange)
  1585. If NOT IsArray($aarray) Then Return SetError(1, 0, -1)
  1586. Local $idim_1 = UBound($aarray, $ubound_rows) - 1
  1587. If IsArray($vrange) Then
  1588. If UBound($vrange, $ubound_dimensions) <> 1 OR UBound($vrange, $ubound_rows) < 2 Then Return SetError(4, 0, -1)
  1589. Else
  1590. Local $inumber, $asplit_1, $asplit_2
  1591. $vrange = StringStripWS($vrange, 8)
  1592. $asplit_1 = StringSplit($vrange, ";")
  1593. $vrange = ""
  1594. For $i = 1 To $asplit_1[0]
  1595. If NOT StringRegExp($asplit_1[$i], "^\d+(-\d+)?$") Then Return SetError(3, 0, -1)
  1596. $asplit_2 = StringSplit($asplit_1[$i], "-")
  1597. Switch $asplit_2[0]
  1598. Case 1
  1599. $vrange &= $asplit_2[1] & ";"
  1600. Case 2
  1601. If Number($asplit_2[2]) >= Number($asplit_2[1]) Then
  1602. $inumber = $asplit_2[1] - 1
  1603. Do
  1604. $inumber += 1
  1605. $vrange &= $inumber & ";"
  1606. Until $inumber = $asplit_2[2]
  1607. EndIf
  1608. EndSwitch
  1609. Next
  1610. $vrange = StringSplit(StringTrimRight($vrange, 1), ";")
  1611. EndIf
  1612. If $vrange[1] < 0 OR $vrange[$vrange[0]] > $idim_1 Then Return SetError(5, 0, -1)
  1613. Local $icopyto_index = 0
  1614. Switch UBound($aarray, $ubound_dimensions)
  1615. Case 1
  1616. For $i = 1 To $vrange[0]
  1617. $aarray[$vrange[$i]] = ChrW(64177)
  1618. Next
  1619. For $ireadfrom_index = 0 To $idim_1
  1620. If $aarray[$ireadfrom_index] == ChrW(64177) Then
  1621. ContinueLoop
  1622. Else
  1623. If $ireadfrom_index <> $icopyto_index Then
  1624. $aarray[$icopyto_index] = $aarray[$ireadfrom_index]
  1625. EndIf
  1626. $icopyto_index += 1
  1627. EndIf
  1628. Next
  1629. ReDim $aarray[$idim_1 - $vrange[0] + 1]
  1630. Case 2
  1631. Local $idim_2 = UBound($aarray, $ubound_columns) - 1
  1632. For $i = 1 To $vrange[0]
  1633. $aarray[$vrange[$i]][0] = ChrW(64177)
  1634. Next
  1635. For $ireadfrom_index = 0 To $idim_1
  1636. If $aarray[$ireadfrom_index][0] == ChrW(64177) Then
  1637. ContinueLoop
  1638. Else
  1639. If $ireadfrom_index <> $icopyto_index Then
  1640. For $j = 0 To $idim_2
  1641. $aarray[$icopyto_index][$j] = $aarray[$ireadfrom_index][$j]
  1642. Next
  1643. EndIf
  1644. $icopyto_index += 1
  1645. EndIf
  1646. Next
  1647. ReDim $aarray[$idim_1 - $vrange[0] + 1][$idim_2 + 1]
  1648. Case Else
  1649. Return SetError(2, 0, False)
  1650. EndSwitch
  1651. Return UBound($aarray, $ubound_rows)
  1652. EndFunc
  1653.  
  1654. Func _arraydisplay(Const ByRef $aarray, $stitle = Default, $sarrayrange = Default, $iflags = Default, $vuser_separator = Default, $sheader = Default, $imax_colwidth = Default, $ialt_color = Default, $huser_function = Default)
  1655. If $stitle = Default Then $stitle = "ArrayDisplay"
  1656. If $sarrayrange = Default Then $sarrayrange = ""
  1657. If $iflags = Default Then $iflags = 0
  1658. If $vuser_separator = Default Then $vuser_separator = ""
  1659. If $sheader = Default Then $sheader = ""
  1660. If $imax_colwidth = Default Then $imax_colwidth = 350
  1661. If $ialt_color = Default Then $ialt_color = 0
  1662. If $huser_function = Default Then $huser_function = 0
  1663. Local $itranspose = BitAND($iflags, 1)
  1664. Local $icolalign = BitAND($iflags, 6)
  1665. Local $iverbose = BitAND($iflags, 8)
  1666. Local $ibuttonmargin = ((BitAND($iflags, 32)) ? (0) : ((BitAND($iflags, 16)) ? (20) : (40)))
  1667. Local $inorow = BitAND($iflags, 64)
  1668. Local $smsg = "", $iret = 1
  1669. If IsArray($aarray) Then
  1670. Local $idimension = UBound($aarray, $ubound_dimensions), $irowcount = UBound($aarray, $ubound_rows), $icolcount = UBound($aarray, $ubound_columns)
  1671. If $idimension > 2 Then
  1672. $smsg = "Larger than 2D array passed to function"
  1673. $iret = 2
  1674. EndIf
  1675. Else
  1676. $smsg = "No array variable passed to function"
  1677. EndIf
  1678. If $smsg Then
  1679. If $iverbose AND MsgBox($mb_systemmodal + $mb_iconerror + $mb_yesno, "ArrayDisplay Error: " & $stitle, $smsg & @CRLF & @CRLF & "Exit the script?") = $idyes Then
  1680. Exit
  1681. Else
  1682. Return SetError($iret, 0, "")
  1683. EndIf
  1684. EndIf
  1685. Local $icw_colwidth = Number($vuser_separator)
  1686. Local $sad_separator = ChrW(64177)
  1687. Local $scurr_separator = Opt("GUIDataSeparatorChar", $sad_separator)
  1688. If $vuser_separator = "" Then $vuser_separator = $scurr_separator
  1689. Local $vtmp, $irowlimit = 65525, $icollimit = 250
  1690. Local $idatarow = $irowcount
  1691. Local $idatacol = $icolcount
  1692. Local $iitem_start = 0, $iitem_end = $irowcount - 1, $isubitem_start = 0, $isubitem_end = (($idimension = 2) ? ($icolcount - 1) : (0))
  1693. Local $brange_flag = False, $avrangesplit
  1694. If $sarrayrange Then
  1695. Local $aarray_range = StringRegExp($sarrayrange & "||", "(?U)(.*)\|", 3)
  1696. If $aarray_range[0] Then
  1697. $avrangesplit = StringSplit($aarray_range[0], ":")
  1698. If @error Then
  1699. $iitem_end = Number($avrangesplit[1])
  1700. Else
  1701. $iitem_start = Number($avrangesplit[1])
  1702. $iitem_end = Number($avrangesplit[2])
  1703. EndIf
  1704. EndIf
  1705. If $iitem_start > $iitem_end Then
  1706. $vtmp = $iitem_start
  1707. $iitem_start = $iitem_end
  1708. $iitem_end = $vtmp
  1709. EndIf
  1710. If $iitem_start < 0 Then $iitem_start = 0
  1711. If $iitem_end > $irowcount - 1 Then $iitem_end = $irowcount - 1
  1712. If $iitem_start <> 0 OR $iitem_end <> $irowcount - 1 Then $brange_flag = True
  1713. If $idimension = 2 AND $aarray_range[1] Then
  1714. $avrangesplit = StringSplit($aarray_range[1], ":")
  1715. If @error Then
  1716. $isubitem_end = Number($avrangesplit[1])
  1717. Else
  1718. $isubitem_start = Number($avrangesplit[1])
  1719. $isubitem_end = Number($avrangesplit[2])
  1720. EndIf
  1721. If $isubitem_start > $isubitem_end Then
  1722. $vtmp = $isubitem_start
  1723. $isubitem_start = $isubitem_end
  1724. $isubitem_end = $vtmp
  1725. EndIf
  1726. If $isubitem_start < 0 Then $isubitem_start = 0
  1727. If $isubitem_end > $icolcount - 1 Then $isubitem_end = $icolcount - 1
  1728. If $isubitem_start <> 0 OR $isubitem_end <> $icolcount - 1 Then $brange_flag = True
  1729. EndIf
  1730. EndIf
  1731. Local $sdisplaydata = "[" & $idatarow
  1732. Local $btruncated = False
  1733. If $itranspose Then
  1734. If $iitem_end - $iitem_start > $icollimit Then
  1735. $btruncated = True
  1736. $iitem_end = $iitem_start + $icollimit - 1
  1737. EndIf
  1738. Else
  1739. If $iitem_end - $iitem_start > $irowlimit Then
  1740. $btruncated = True
  1741. $iitem_end = $iitem_start + $irowlimit - 1
  1742. EndIf
  1743. EndIf
  1744. If $btruncated Then
  1745. $sdisplaydata &= "*]"
  1746. Else
  1747. $sdisplaydata &= "]"
  1748. EndIf
  1749. If $idimension = 2 Then
  1750. $sdisplaydata &= " [" & $idatacol
  1751. If $itranspose Then
  1752. If $isubitem_end - $isubitem_start > $irowlimit Then
  1753. $btruncated = True
  1754. $isubitem_end = $isubitem_start + $irowlimit - 1
  1755. EndIf
  1756. Else
  1757. If $isubitem_end - $isubitem_start > $icollimit Then
  1758. $btruncated = True
  1759. $isubitem_end = $isubitem_start + $icollimit - 1
  1760. EndIf
  1761. EndIf
  1762. If $btruncated Then
  1763. $sdisplaydata &= "*]"
  1764. Else
  1765. $sdisplaydata &= "]"
  1766. EndIf
  1767. EndIf
  1768. Local $stipdata = ""
  1769. If $btruncated Then $stipdata &= "Truncated"
  1770. If $brange_flag Then
  1771. If $stipdata Then $stipdata &= " - "
  1772. $stipdata &= "Range set"
  1773. EndIf
  1774. If $itranspose Then
  1775. If $stipdata Then $stipdata &= " - "
  1776. $stipdata &= "Transposed"
  1777. EndIf
  1778. Local $asheader = StringSplit($sheader, $scurr_separator, $str_nocount)
  1779. If UBound($asheader) = 0 Then Local $asheader[1] = [""]
  1780. $sheader = "Row"
  1781. Local $iindex = $isubitem_start
  1782. If $itranspose Then
  1783. For $j = $iitem_start To $iitem_end
  1784. $sheader &= $sad_separator & "Col " & $j
  1785. Next
  1786. Else
  1787. If $asheader[0] Then
  1788. For $iindex = $isubitem_start To $isubitem_end
  1789. If $iindex >= UBound($asheader) Then ExitLoop
  1790. $sheader &= $sad_separator & $asheader[$iindex]
  1791. Next
  1792. EndIf
  1793. For $j = $iindex To $isubitem_end
  1794. $sheader &= $sad_separator & "Col " & $j
  1795. Next
  1796. EndIf
  1797. If $inorow Then $sheader = StringTrimLeft($sheader, 4)
  1798. If $iverbose AND ($iitem_end - $iitem_start + 1) * ($isubitem_end - $isubitem_start + 1) > 10000 Then
  1799. SplashTextOn("ArrayDisplay", "Preparing display" & @CRLF & @CRLF & "Please be patient", 300, 100)
  1800. EndIf
  1801. Local $ibuffer = 4094
  1802. If $itranspose Then
  1803. $vtmp = $iitem_start
  1804. $iitem_start = $isubitem_start
  1805. $isubitem_start = $vtmp
  1806. $vtmp = $iitem_end
  1807. $iitem_end = $isubitem_end
  1808. $isubitem_end = $vtmp
  1809. EndIf
  1810. Local $avarraytext[$iitem_end - $iitem_start + 1]
  1811. For $i = $iitem_start To $iitem_end
  1812. If NOT $inorow Then $avarraytext[$i - $iitem_start] = "[" & $i & "]"
  1813. For $j = $isubitem_start To $isubitem_end
  1814. If $idimension = 1 Then
  1815. If $itranspose Then
  1816. Switch VarGetType($aarray[$j])
  1817. Case "Array"
  1818. $vtmp = "{Array}"
  1819. Case Else
  1820. $vtmp = $aarray[$j]
  1821. EndSwitch
  1822. Else
  1823. Switch VarGetType($aarray[$i])
  1824. Case "Array"
  1825. $vtmp = "{Array}"
  1826. Case Else
  1827. $vtmp = $aarray[$i]
  1828. EndSwitch
  1829. EndIf
  1830. Else
  1831. If $itranspose Then
  1832. Switch VarGetType($aarray[$j][$i])
  1833. Case "Array"
  1834. $vtmp = "{Array}"
  1835. Case Else
  1836. $vtmp = $aarray[$j][$i]
  1837. EndSwitch
  1838. Else
  1839. Switch VarGetType($aarray[$i][$j])
  1840. Case "Array"
  1841. $vtmp = "{Array}"
  1842. Case Else
  1843. $vtmp = $aarray[$i][$j]
  1844. EndSwitch
  1845. EndIf
  1846. EndIf
  1847. If StringLen($vtmp) > $ibuffer Then $vtmp = StringLeft($vtmp, $ibuffer)
  1848. $avarraytext[$i - $iitem_start] &= $sad_separator & $vtmp
  1849. Next
  1850. If $inorow Then $avarraytext[$i - $iitem_start] = StringTrimLeft($avarraytext[$i - $iitem_start], 1)
  1851. Next
  1852. Local Const $_arrayconstant_gui_dockbottom = 64
  1853. Local Const $_arrayconstant_gui_dockborders = 102
  1854. Local Const $_arrayconstant_gui_dockheight = 512
  1855. Local Const $_arrayconstant_gui_dockleft = 2
  1856. Local Const $_arrayconstant_gui_dockright = 4
  1857. Local Const $_arrayconstant_gui_dockhcenter = 8
  1858. Local Const $_arrayconstant_gui_event_close = -3
  1859. Local Const $_arrayconstant_gui_focus = 256
  1860. Local Const $_arrayconstant_gui_bkcolor_lv_alternate = -33554432
  1861. Local Const $_arrayconstant_ss_center = 1
  1862. Local Const $_arrayconstant_ss_centerimage = 512
  1863. Local Const $_arrayconstant_lvm_getitemcount = (4096 + 4)
  1864. Local Const $_arrayconstant_lvm_getitemrect = (4096 + 14)
  1865. Local Const $_arrayconstant_lvm_getcolumnwidth = (4096 + 29)
  1866. Local Const $_arrayconstant_lvm_setcolumnwidth = (4096 + 30)
  1867. Local Const $_arrayconstant_lvm_getitemstate = (4096 + 44)
  1868. Local Const $_arrayconstant_lvm_getselectedcount = (4096 + 50)
  1869. Local Const $_arrayconstant_lvm_setextendedlistviewstyle = (4096 + 54)
  1870. Local Const $_arrayconstant_lvs_ex_gridlines = 1
  1871. Local Const $_arrayconstant_lvis_selected = 2
  1872. Local Const $_arrayconstant_lvs_showselalways = 8
  1873. Local Const $_arrayconstant_lvs_ex_fullrowselect = 32
  1874. Local Const $_arrayconstant_ws_ex_clientedge = 512
  1875. Local Const $_arrayconstant_ws_maximizebox = 65536
  1876. Local Const $_arrayconstant_ws_minimizebox = 131072
  1877. Local Const $_arrayconstant_ws_sizebox = 262144
  1878. Local Const $_arrayconstant_wm_setredraw = 11
  1879. Local Const $_arrayconstant_lvscw_autosize = -1
  1880. Local $icoordmode = Opt("GUICoordMode", 1)
  1881. Local $iorgwidth = 210, $iheight = 200, $iminsize = 250
  1882. Local $hgui = GUICreate($stitle, $iorgwidth, $iheight, Default, Default, BitOR($_arrayconstant_ws_sizebox, $_arrayconstant_ws_minimizebox, $_arrayconstant_ws_maximizebox))
  1883. Local $aiguisize = WinGetClientSize($hgui)
  1884. Local $ibuttonwidth_2 = $aiguisize[0] / 2
  1885. Local $ibuttonwidth_3 = $aiguisize[0] / 3
  1886. Local $idlistview = GUICtrlCreateListView($sheader, 0, 0, $aiguisize[0], $aiguisize[1] - $ibuttonmargin, $_arrayconstant_lvs_showselalways)
  1887. GUICtrlSetBkColor($idlistview, $_arrayconstant_gui_bkcolor_lv_alternate)
  1888. GUICtrlSendMsg($idlistview, $_arrayconstant_lvm_setextendedlistviewstyle, $_arrayconstant_lvs_ex_gridlines, $_arrayconstant_lvs_ex_gridlines)
  1889. GUICtrlSendMsg($idlistview, $_arrayconstant_lvm_setextendedlistviewstyle, $_arrayconstant_lvs_ex_fullrowselect, $_arrayconstant_lvs_ex_fullrowselect)
  1890. GUICtrlSendMsg($idlistview, $_arrayconstant_lvm_setextendedlistviewstyle, $_arrayconstant_ws_ex_clientedge, $_arrayconstant_ws_ex_clientedge)
  1891. Local $idcopy_id = 9999, $idcopy_data = 99999, $iddata_label = 99999, $iduser_func = 99999, $idexit_script = 99999
  1892. If $ibuttonmargin Then
  1893. $idcopy_id = GUICtrlCreateButton("Copy Data && Hdr/Row", 0, $aiguisize[1] - $ibuttonmargin, $ibuttonwidth_2, 20)
  1894. $idcopy_data = GUICtrlCreateButton("Copy Data Only", $ibuttonwidth_2, $aiguisize[1] - $ibuttonmargin, $ibuttonwidth_2, 20)
  1895. If $ibuttonmargin = 40 Then
  1896. Local $ibuttonwidth_var = $ibuttonwidth_2
  1897. Local $ioffset = $ibuttonwidth_2
  1898. If IsFunc($huser_function) Then
  1899. $iduser_func = GUICtrlCreateButton("Run User Func", $ibuttonwidth_3, $aiguisize[1] - 20, $ibuttonwidth_3, 20)
  1900. $ibuttonwidth_var = $ibuttonwidth_3
  1901. $ioffset = $ibuttonwidth_3 * 2
  1902. EndIf
  1903. $idexit_script = GUICtrlCreateButton("Exit Script", $ioffset, $aiguisize[1] - 20, $ibuttonwidth_var, 20)
  1904. $iddata_label = GUICtrlCreateLabel($sdisplaydata, 0, $aiguisize[1] - 20, $ibuttonwidth_var, 18, BitOR($_arrayconstant_ss_center, $_arrayconstant_ss_centerimage))
  1905. Select
  1906. Case $btruncated OR $itranspose OR $brange_flag
  1907. GUICtrlSetColor($iddata_label, 16711680)
  1908. GUICtrlSetTip($iddata_label, $stipdata)
  1909. EndSelect
  1910. EndIf
  1911. EndIf
  1912. GUICtrlSetResizing($idlistview, $_arrayconstant_gui_dockborders)
  1913. GUICtrlSetResizing($idcopy_id, $_arrayconstant_gui_dockleft + $_arrayconstant_gui_dockbottom + $_arrayconstant_gui_dockheight)
  1914. GUICtrlSetResizing($idcopy_data, $_arrayconstant_gui_dockright + $_arrayconstant_gui_dockbottom + $_arrayconstant_gui_dockheight)
  1915. GUICtrlSetResizing($iddata_label, $_arrayconstant_gui_dockleft + $_arrayconstant_gui_dockbottom + $_arrayconstant_gui_dockheight)
  1916. GUICtrlSetResizing($iduser_func, $_arrayconstant_gui_dockhcenter + $_arrayconstant_gui_dockbottom + $_arrayconstant_gui_dockheight)
  1917. GUICtrlSetResizing($idexit_script, $_arrayconstant_gui_dockright + $_arrayconstant_gui_dockbottom + $_arrayconstant_gui_dockheight)
  1918. GUICtrlSendMsg($idlistview, $_arrayconstant_wm_setredraw, 0, 0)
  1919. Local $iditem
  1920. For $i = 0 To UBound($avarraytext) - 1
  1921. $iditem = GUICtrlCreateListViewItem($avarraytext[$i], $idlistview)
  1922. If $ialt_color Then
  1923. GUICtrlSetBkColor($iditem, $ialt_color)
  1924. EndIf
  1925. Next
  1926. If $icolalign Then
  1927. Local Const $_arrayconstant_lvcf_fmt = 1
  1928. Local Const $_arrayconstant_lvm_setcolumnw = (4096 + 96)
  1929. Local $tcolumn = DllStructCreate("uint Mask;int Fmt;int CX;ptr Text;int TextMax;int SubItem;int Image;int Order;int cxMin;int cxDefault;int cxIdeal")
  1930. DllStructSetData($tcolumn, "Mask", $_arrayconstant_lvcf_fmt)
  1931. DllStructSetData($tcolumn, "Fmt", $icolalign / 2)
  1932. Local $pcolumn = DllStructGetPtr($tcolumn)
  1933. For $i = 1 To $isubitem_end - $isubitem_start + 1
  1934. GUICtrlSendMsg($idlistview, $_arrayconstant_lvm_setcolumnw, $i, $pcolumn)
  1935. Next
  1936. EndIf
  1937. GUICtrlSendMsg($idlistview, $_arrayconstant_wm_setredraw, 1, 0)
  1938. Local $iborder = 45
  1939. If UBound($avarraytext) > 20 Then
  1940. $iborder += 20
  1941. EndIf
  1942. Local $iwidth = $iborder, $icolwidth = 0, $aicolwidth[$isubitem_end - $isubitem_start + 2], $imin_colwidth = 55
  1943. For $i = 0 To $isubitem_end - $isubitem_start + 1
  1944. GUICtrlSendMsg($idlistview, $_arrayconstant_lvm_setcolumnwidth, $i, $_arrayconstant_lvscw_autosize)
  1945. $icolwidth = GUICtrlSendMsg($idlistview, $_arrayconstant_lvm_getcolumnwidth, $i, 0)
  1946. If $icolwidth < $imin_colwidth Then
  1947. GUICtrlSendMsg($idlistview, $_arrayconstant_lvm_setcolumnwidth, $i, $imin_colwidth)
  1948. $icolwidth = $imin_colwidth
  1949. EndIf
  1950. $iwidth += $icolwidth
  1951. $aicolwidth[$i] = $icolwidth
  1952. Next
  1953. If $inorow Then $iwidth -= 55
  1954. If $iwidth > @DesktopWidth - 100 Then
  1955. $iwidth = $iborder
  1956. For $i = 0 To $isubitem_end - $isubitem_start + 1
  1957. If $aicolwidth[$i] > $imax_colwidth Then
  1958. GUICtrlSendMsg($idlistview, $_arrayconstant_lvm_setcolumnwidth, $i, $imax_colwidth)
  1959. $iwidth += $imax_colwidth
  1960. Else
  1961. $iwidth += $aicolwidth[$i]
  1962. EndIf
  1963. Next
  1964. EndIf
  1965. If $iwidth > @DesktopWidth - 100 Then
  1966. $iwidth = @DesktopWidth - 100
  1967. ElseIf $iwidth < $iminsize Then
  1968. $iwidth = $iminsize
  1969. EndIf
  1970. Local $trect = DllStructCreate("struct; long Left;long Top;long Right;long Bottom; endstruct")
  1971. DllCall("user32.dll", "struct*", "SendMessageW", "hwnd", GUICtrlGetHandle($idlistview), "uint", $_arrayconstant_lvm_getitemrect, "wparam", 0, "struct*", $trect)
  1972. Local $aiwin_pos = WinGetPos($hgui)
  1973. Local $ailv_pos = ControlGetPos($hgui, "", $idlistview)
  1974. $iheight = ((UBound($avarraytext) + 2) * (DllStructGetData($trect, "Bottom") - DllStructGetData($trect, "Top"))) + $aiwin_pos[3] - $ailv_pos[3]
  1975. If $iheight > @DesktopHeight - 100 Then
  1976. $iheight = @DesktopHeight - 100
  1977. ElseIf $iheight < $iminsize Then
  1978. $iheight = $iminsize
  1979. EndIf
  1980. If $iverbose Then SplashOff()
  1981. GUISetState(@SW_HIDE, $hgui)
  1982. WinMove($hgui, "", (@DesktopWidth - $iwidth) / 2, (@DesktopHeight - $iheight) / 2, $iwidth, $iheight)
  1983. GUISetState(@SW_SHOW, $hgui)
  1984. Local $ioneventmode = Opt("GUIOnEventMode", 0), $imsg
  1985. While 1
  1986. $imsg = GUIGetMsg()
  1987. Switch $imsg
  1988. Case $_arrayconstant_gui_event_close
  1989. ExitLoop
  1990. Case $idcopy_id, $idcopy_data
  1991. Local $isel_count = GUICtrlSendMsg($idlistview, $_arrayconstant_lvm_getselectedcount, 0, 0)
  1992. If $iverbose AND (NOT $isel_count) AND ($iitem_end - $iitem_start) * ($isubitem_end - $isubitem_start) > 10000 Then
  1993. SplashTextOn("ArrayDisplay", "Copying data" & @CRLF & @CRLF & "Please be patient", 300, 100)
  1994. EndIf
  1995. Local $sclip = "", $sitem, $asplit
  1996. For $i = 0 To $iitem_end - $iitem_start
  1997. If $isel_count AND NOT (GUICtrlSendMsg($idlistview, $_arrayconstant_lvm_getitemstate, $i, $_arrayconstant_lvis_selected)) Then
  1998. ContinueLoop
  1999. EndIf
  2000. $sitem = $avarraytext[$i]
  2001. If $imsg = $idcopy_data Then
  2002. $sitem = StringRegExpReplace($sitem, "^\[\d+\].(.*)$", "$1")
  2003. EndIf
  2004. If $icw_colwidth Then
  2005. $asplit = StringSplit($sitem, $sad_separator)
  2006. $sitem = ""
  2007. For $j = 1 To $asplit[0]
  2008. $sitem &= StringFormat("%-" & $icw_colwidth + 1 & "s", StringLeft($asplit[$j], $icw_colwidth))
  2009. Next
  2010. Else
  2011. $sitem = StringReplace($sitem, $sad_separator, $vuser_separator)
  2012. EndIf
  2013. $sclip &= $sitem & @CRLF
  2014. Next
  2015. If $imsg = $idcopy_id Then
  2016. If $icw_colwidth Then
  2017. $asplit = StringSplit($sheader, $sad_separator)
  2018. $sitem = ""
  2019. For $j = 1 To $asplit[0]
  2020. $sitem &= StringFormat("%-" & $icw_colwidth + 1 & "s", StringLeft($asplit[$j], $icw_colwidth))
  2021. Next
  2022. Else
  2023. $sitem = StringReplace($sheader, $sad_separator, $vuser_separator)
  2024. EndIf
  2025. $sclip = $sitem & @CRLF & $sclip
  2026. EndIf
  2027. ClipPut($sclip)
  2028. SplashOff()
  2029. GUICtrlSetState($idlistview, $_arrayconstant_gui_focus)
  2030. Case $iduser_func
  2031. Local $aiselitems[$irowlimit] = [0]
  2032. For $i = 0 To GUICtrlSendMsg($idlistview, $_arrayconstant_lvm_getitemcount, 0, 0)
  2033. If GUICtrlSendMsg($idlistview, $_arrayconstant_lvm_getitemstate, $i, $_arrayconstant_lvis_selected) Then
  2034. $aiselitems[0] += 1
  2035. $aiselitems[$aiselitems[0]] = $i + $iitem_start
  2036. EndIf
  2037. Next
  2038. ReDim $aiselitems[$aiselitems[0] + 1]
  2039. $huser_function($aarray, $aiselitems)
  2040. GUICtrlSetState($idlistview, $_arrayconstant_gui_focus)
  2041. Case $idexit_script
  2042. GUIDelete($hgui)
  2043. Exit
  2044. EndSwitch
  2045. WEnd
  2046. GUIDelete($hgui)
  2047. Opt("GUICoordMode", $icoordmode)
  2048. Opt("GUIOnEventMode", $ioneventmode)
  2049. Opt("GUIDataSeparatorChar", $scurr_separator)
  2050. Return 1
  2051. EndFunc
  2052.  
  2053. Func _arrayextract(Const ByRef $aarray, $istart_row = -1, $iend_row = -1, $istart_col = -1, $iend_col = -1)
  2054. If $istart_row = Default Then $istart_row = -1
  2055. If $iend_row = Default Then $iend_row = -1
  2056. If $istart_col = Default Then $istart_col = -1
  2057. If $iend_col = Default Then $iend_col = -1
  2058. If NOT IsArray($aarray) Then Return SetError(1, 0, -1)
  2059. Local $idim_1 = UBound($aarray, $ubound_rows) - 1
  2060. If $iend_row = -1 Then $iend_row = $idim_1
  2061. If $istart_row = -1 Then $istart_row = 0
  2062. If $istart_row < -1 OR $iend_row < -1 Then Return SetError(3, 0, -1)
  2063. If $istart_row > $idim_1 OR $iend_row > $idim_1 Then Return SetError(3, 0, -1)
  2064. If $istart_row > $iend_row Then Return SetError(4, 0, -1)
  2065. Switch UBound($aarray, $ubound_dimensions)
  2066. Case 1
  2067. Local $aretarray[$iend_row - $istart_row + 1]
  2068. For $i = 0 To $iend_row - $istart_row
  2069. $aretarray[$i] = $aarray[$i + $istart_row]
  2070. Next
  2071. Return $aretarray
  2072. Case 2
  2073. Local $idim_2 = UBound($aarray, $ubound_columns) - 1
  2074. If $iend_col = -1 Then $iend_col = $idim_2
  2075. If $istart_col = -1 Then $istart_col = 0
  2076. If $istart_col < -1 OR $iend_col < -1 Then Return SetError(5, 0, -1)
  2077. If $istart_col > $idim_2 OR $iend_col > $idim_2 Then Return SetError(5, 0, -1)
  2078. If $istart_col > $iend_col Then Return SetError(6, 0, -1)
  2079. If $istart_col = $iend_col Then
  2080. Local $aretarray[$iend_row - $istart_row + 1]
  2081. Else
  2082. Local $aretarray[$iend_row - $istart_row + 1][$iend_col - $istart_col + 1]
  2083. EndIf
  2084. For $i = 0 To $iend_row - $istart_row
  2085. For $j = 0 To $iend_col - $istart_col
  2086. If $istart_col = $iend_col Then
  2087. $aretarray[$i] = $aarray[$i + $istart_row][$j + $istart_col]
  2088. Else
  2089. $aretarray[$i][$j] = $aarray[$i + $istart_row][$j + $istart_col]
  2090. EndIf
  2091. Next
  2092. Next
  2093. Return $aretarray
  2094. Case Else
  2095. Return SetError(2, 0, -1)
  2096. EndSwitch
  2097. Return 1
  2098. EndFunc
  2099.  
  2100. Func _arrayfindall(Const ByRef $aarray, $vvalue, $istart = 0, $iend = 0, $icase = 0, $icompare = 0, $isubitem = 0, $brow = False)
  2101. If $istart = Default Then $istart = 0
  2102. If $iend = Default Then $iend = 0
  2103. If $icase = Default Then $icase = 0
  2104. If $icompare = Default Then $icompare = 0
  2105. If $isubitem = Default Then $isubitem = 0
  2106. If $brow = Default Then $brow = False
  2107. $istart = _arraysearch($aarray, $vvalue, $istart, $iend, $icase, $icompare, 1, $isubitem, $brow)
  2108. If @error Then Return SetError(@error, 0, -1)
  2109. Local $iindex = 0, $avresult[UBound($aarray, ($brow ? $ubound_columns : $ubound_rows))]
  2110. Do
  2111. $avresult[$iindex] = $istart
  2112. $iindex += 1
  2113. $istart = _arraysearch($aarray, $vvalue, $istart + 1, $iend, $icase, $icompare, 1, $isubitem, $brow)
  2114. Until @error
  2115. ReDim $avresult[$iindex]
  2116. Return $avresult
  2117. EndFunc
  2118.  
  2119. Func _arrayinsert(ByRef $aarray, $vrange, $vvalue = "", $istart = 0, $sdelim_item = "|", $sdelim_row = @CRLF, $iforce = $arrayfill_force_default)
  2120. If $vvalue = Default Then $vvalue = ""
  2121. If $istart = Default Then $istart = 0
  2122. If $sdelim_item = Default Then $sdelim_item = "|"
  2123. If $sdelim_row = Default Then $sdelim_row = @CRLF
  2124. If $iforce = Default Then $iforce = $arrayfill_force_default
  2125. If NOT IsArray($aarray) Then Return SetError(1, 0, -1)
  2126. Local $idim_1 = UBound($aarray, $ubound_rows) - 1
  2127. Local $hdatatype = 0
  2128. Switch $iforce
  2129. Case $arrayfill_force_int
  2130. $hdatatype = Int
  2131. Case $arrayfill_force_number
  2132. $hdatatype = Number
  2133. Case $arrayfill_force_ptr
  2134. $hdatatype = Ptr
  2135. Case $arrayfill_force_hwnd
  2136. $hdatatype = HWnd
  2137. Case $arrayfill_force_string
  2138. $hdatatype = String
  2139. EndSwitch
  2140. Local $asplit_1, $asplit_2
  2141. If IsArray($vrange) Then
  2142. If UBound($vrange, $ubound_dimensions) <> 1 OR UBound($vrange, $ubound_rows) < 2 Then Return SetError(4, 0, -1)
  2143. Else
  2144. Local $inumber
  2145. $vrange = StringStripWS($vrange, 8)
  2146. $asplit_1 = StringSplit($vrange, ";")
  2147. $vrange = ""
  2148. For $i = 1 To $asplit_1[0]
  2149. If NOT StringRegExp($asplit_1[$i], "^\d+(-\d+)?$") Then Return SetError(3, 0, -1)
  2150. $asplit_2 = StringSplit($asplit_1[$i], "-")
  2151. Switch $asplit_2[0]
  2152. Case 1
  2153. $vrange &= $asplit_2[1] & ";"
  2154. Case 2
  2155. If Number($asplit_2[2]) >= Number($asplit_2[1]) Then
  2156. $inumber = $asplit_2[1] - 1
  2157. Do
  2158. $inumber += 1
  2159. $vrange &= $inumber & ";"
  2160. Until $inumber = $asplit_2[2]
  2161. EndIf
  2162. EndSwitch
  2163. Next
  2164. $vrange = StringSplit(StringTrimRight($vrange, 1), ";")
  2165. EndIf
  2166. If $vrange[1] < 0 OR $vrange[$vrange[0]] > $idim_1 Then Return SetError(5, 0, -1)
  2167. For $i = 2 To $vrange[0]
  2168. If $vrange[$i] < $vrange[$i - 1] Then Return SetError(3, 0, -1)
  2169. Next
  2170. Local $icopyto_index = $idim_1 + $vrange[0]
  2171. Local $iinsertpoint_index = $vrange[0]
  2172. Local $iinsert_index = $vrange[$iinsertpoint_index]
  2173. Switch UBound($aarray, $ubound_dimensions)
  2174. Case 1
  2175. If $iforce = $arrayfill_force_singleitem Then
  2176. ReDim $aarray[$idim_1 + $vrange[0] + 1]
  2177. For $ireadfromindex = $idim_1 To 0 Step -1
  2178. $aarray[$icopyto_index] = $aarray[$ireadfromindex]
  2179. $icopyto_index -= 1
  2180. $iinsert_index = $vrange[$iinsertpoint_index]
  2181. While $ireadfromindex = $iinsert_index
  2182. $aarray[$icopyto_index] = $vvalue
  2183. $icopyto_index -= 1
  2184. $iinsertpoint_index -= 1
  2185. If $iinsertpoint_index < 1 Then ExitLoop 2
  2186. $iinsert_index = $vrange[$iinsertpoint_index]
  2187. WEnd
  2188. Next
  2189. Return $idim_1 + $vrange[0] + 1
  2190. EndIf
  2191. ReDim $aarray[$idim_1 + $vrange[0] + 1]
  2192. If IsArray($vvalue) Then
  2193. If UBound($vvalue, $ubound_dimensions) <> 1 Then Return SetError(5, 0, -1)
  2194. $hdatatype = 0
  2195. Else
  2196. Local $atmp = StringSplit($vvalue, $sdelim_item, $str_nocount + $str_entiresplit)
  2197. If UBound($atmp, $ubound_rows) = 1 Then
  2198. $atmp[0] = $vvalue
  2199. $hdatatype = 0
  2200. EndIf
  2201. $vvalue = $atmp
  2202. EndIf
  2203. For $ireadfromindex = $idim_1 To 0 Step -1
  2204. $aarray[$icopyto_index] = $aarray[$ireadfromindex]
  2205. $icopyto_index -= 1
  2206. $iinsert_index = $vrange[$iinsertpoint_index]
  2207. While $ireadfromindex = $iinsert_index
  2208. If $iinsertpoint_index <= UBound($vvalue, $ubound_rows) Then
  2209. If IsFunc($hdatatype) Then
  2210. $aarray[$icopyto_index] = $hdatatype($vvalue[$iinsertpoint_index - 1])
  2211. Else
  2212. $aarray[$icopyto_index] = $vvalue[$iinsertpoint_index - 1]
  2213. EndIf
  2214. Else
  2215. $aarray[$icopyto_index] = ""
  2216. EndIf
  2217. $icopyto_index -= 1
  2218. $iinsertpoint_index -= 1
  2219. If $iinsertpoint_index = 0 Then ExitLoop 2
  2220. $iinsert_index = $vrange[$iinsertpoint_index]
  2221. WEnd
  2222. Next
  2223. Case 2
  2224. Local $idim_2 = UBound($aarray, $ubound_columns)
  2225. If $istart < 0 OR $istart > $idim_2 - 1 Then Return SetError(6, 0, -1)
  2226. Local $ivaldim_1, $ivaldim_2
  2227. If IsArray($vvalue) Then
  2228. If UBound($vvalue, $ubound_dimensions) <> 2 Then Return SetError(7, 0, -1)
  2229. $ivaldim_1 = UBound($vvalue, $ubound_rows)
  2230. $ivaldim_2 = UBound($vvalue, $ubound_columns)
  2231. $hdatatype = 0
  2232. Else
  2233. $asplit_1 = StringSplit($vvalue, $sdelim_row, $str_nocount + $str_entiresplit)
  2234. $ivaldim_1 = UBound($asplit_1, $ubound_rows)
  2235. StringReplace($asplit_1[0], $sdelim_item, "")
  2236. $ivaldim_2 = @extended + 1
  2237. Local $atmp[$ivaldim_1][$ivaldim_2]
  2238. For $i = 0 To $ivaldim_1 - 1
  2239. $asplit_2 = StringSplit($asplit_1[$i], $sdelim_item, $str_nocount + $str_entiresplit)
  2240. For $j = 0 To $ivaldim_2 - 1
  2241. $atmp[$i][$j] = $asplit_2[$j]
  2242. Next
  2243. Next
  2244. $vvalue = $atmp
  2245. EndIf
  2246. If UBound($vvalue, $ubound_columns) + $istart > UBound($aarray, $ubound_columns) Then Return SetError(8, 0, -1)
  2247. ReDim $aarray[$idim_1 + $vrange[0] + 1][$idim_2]
  2248. For $ireadfromindex = $idim_1 To 0 Step -1
  2249. For $j = 0 To $idim_2 - 1
  2250. $aarray[$icopyto_index][$j] = $aarray[$ireadfromindex][$j]
  2251. Next
  2252. $icopyto_index -= 1
  2253. $iinsert_index = $vrange[$iinsertpoint_index]
  2254. While $ireadfromindex = $iinsert_index
  2255. For $j = 0 To $idim_2 - 1
  2256. If $j < $istart Then
  2257. $aarray[$icopyto_index][$j] = ""
  2258. ElseIf $j - $istart > $ivaldim_2 - 1 Then
  2259. $aarray[$icopyto_index][$j] = ""
  2260. Else
  2261. If $iinsertpoint_index - 1 < $ivaldim_1 Then
  2262. If IsFunc($hdatatype) Then
  2263. $aarray[$icopyto_index][$j] = $hdatatype($vvalue[$iinsertpoint_index - 1][$j - $istart])
  2264. Else
  2265. $aarray[$icopyto_index][$j] = $vvalue[$iinsertpoint_index - 1][$j - $istart]
  2266. EndIf
  2267. Else
  2268. $aarray[$icopyto_index][$j] = ""
  2269. EndIf
  2270. EndIf
  2271. Next
  2272. $icopyto_index -= 1
  2273. $iinsertpoint_index -= 1
  2274. If $iinsertpoint_index = 0 Then ExitLoop 2
  2275. $iinsert_index = $vrange[$iinsertpoint_index]
  2276. WEnd
  2277. Next
  2278. Case Else
  2279. Return SetError(2, 0, -1)
  2280. EndSwitch
  2281. Return UBound($aarray, $ubound_rows)
  2282. EndFunc
  2283.  
  2284. Func _arraymax(Const ByRef $aarray, $icompnumeric = 0, $istart = -1, $iend = -1, $isubitem = 0)
  2285. Local $iresult = _arraymaxindex($aarray, $icompnumeric, $istart, $iend, $isubitem)
  2286. If @error Then Return SetError(@error, 0, "")
  2287. If UBound($aarray, $ubound_dimensions) = 1 Then
  2288. Return $aarray[$iresult]
  2289. Else
  2290. Return $aarray[$iresult][$isubitem]
  2291. EndIf
  2292. EndFunc
  2293.  
  2294. Func _arraymaxindex(Const ByRef $aarray, $icompnumeric = 0, $istart = -1, $iend = -1, $isubitem = 0)
  2295. If $icompnumeric = Default Then $icompnumeric = 0
  2296. If $istart = Default Then $istart = -1
  2297. If $iend = Default Then $iend = -1
  2298. If $isubitem = Default Then $isubitem = 0
  2299. Local $iret = __array_minmaxindex($aarray, $icompnumeric, $istart, $iend, $isubitem, __array_greaterthan)
  2300. Return SetError(@error, 0, $iret)
  2301. EndFunc
  2302.  
  2303. Func _arraymin(Const ByRef $aarray, $icompnumeric = 0, $istart = -1, $iend = -1, $isubitem = 0)
  2304. Local $iresult = _arrayminindex($aarray, $icompnumeric, $istart, $iend, $isubitem)
  2305. If @error Then Return SetError(@error, 0, "")
  2306. If UBound($aarray, $ubound_dimensions) = 1 Then
  2307. Return $aarray[$iresult]
  2308. Else
  2309. Return $aarray[$iresult][$isubitem]
  2310. EndIf
  2311. EndFunc
  2312.  
  2313. Func _arrayminindex(Const ByRef $aarray, $icompnumeric = 0, $istart = -1, $iend = -1, $isubitem = 0)
  2314. If $icompnumeric = Default Then $icompnumeric = 0
  2315. If $istart = Default Then $istart = -1
  2316. If $iend = Default Then $iend = -1
  2317. If $isubitem = Default Then $isubitem = 0
  2318. Local $iret = __array_minmaxindex($aarray, $icompnumeric, $istart, $iend, $isubitem, __array_lessthan)
  2319. Return SetError(@error, 0, $iret)
  2320. EndFunc
  2321.  
  2322. Func _arraypermute(ByRef $aarray, $sdelimiter = "")
  2323. If $sdelimiter = Default Then $sdelimiter = ""
  2324. If NOT IsArray($aarray) Then Return SetError(1, 0, 0)
  2325. If UBound($aarray, $ubound_dimensions) <> 1 Then Return SetError(2, 0, 0)
  2326. Local $isize = UBound($aarray), $ifactorial = 1, $aidx[$isize], $aresult[1], $icount = 1
  2327. If UBound($aarray) Then
  2328. For $i = 0 To $isize - 1
  2329. $aidx[$i] = $i
  2330. Next
  2331. For $i = $isize To 1 Step -1
  2332. $ifactorial *= $i
  2333. Next
  2334. ReDim $aresult[$ifactorial + 1]
  2335. $aresult[0] = $ifactorial
  2336. __array_exeterinternal($aarray, 0, $isize, $sdelimiter, $aidx, $aresult, $icount)
  2337. Else
  2338. $aresult[0] = 0
  2339. EndIf
  2340. Return $aresult
  2341. EndFunc
  2342.  
  2343. Func _arraypop(ByRef $aarray)
  2344. If (NOT IsArray($aarray)) Then Return SetError(1, 0, "")
  2345. If UBound($aarray, $ubound_dimensions) <> 1 Then Return SetError(2, 0, "")
  2346. Local $iubound = UBound($aarray) - 1
  2347. If $iubound = -1 Then Return SetError(3, 0, "")
  2348. Local $slastval = $aarray[$iubound]
  2349. If $iubound > -1 Then
  2350. ReDim $aarray[$iubound]
  2351. EndIf
  2352. Return $slastval
  2353. EndFunc
  2354.  
  2355. Func _arraypush(ByRef $aarray, $vvalue, $idirection = 0)
  2356. If $idirection = Default Then $idirection = 0
  2357. If (NOT IsArray($aarray)) Then Return SetError(1, 0, 0)
  2358. If UBound($aarray, $ubound_dimensions) <> 1 Then Return SetError(3, 0, 0)
  2359. Local $iubound = UBound($aarray) - 1
  2360. If IsArray($vvalue) Then
  2361. Local $iubounds = UBound($vvalue)
  2362. If ($iubounds - 1) > $iubound Then Return SetError(2, 0, 0)
  2363. If $idirection Then
  2364. For $i = $iubound To $iubounds Step -1
  2365. $aarray[$i] = $aarray[$i - $iubounds]
  2366. Next
  2367. For $i = 0 To $iubounds - 1
  2368. $aarray[$i] = $vvalue[$i]
  2369. Next
  2370. Else
  2371. For $i = 0 To $iubound - $iubounds
  2372. $aarray[$i] = $aarray[$i + $iubounds]
  2373. Next
  2374. For $i = 0 To $iubounds - 1
  2375. $aarray[$i + $iubound - $iubounds + 1] = $vvalue[$i]
  2376. Next
  2377. EndIf
  2378. Else
  2379. If $iubound > -1 Then
  2380. If $idirection Then
  2381. For $i = $iubound To 1 Step -1
  2382. $aarray[$i] = $aarray[$i - 1]
  2383. Next
  2384. $aarray[0] = $vvalue
  2385. Else
  2386. For $i = 0 To $iubound - 1
  2387. $aarray[$i] = $aarray[$i + 1]
  2388. Next
  2389. $aarray[$iubound] = $vvalue
  2390. EndIf
  2391. EndIf
  2392. EndIf
  2393. Return 1
  2394. EndFunc
  2395.  
  2396. Func _arrayreverse(ByRef $aarray, $istart = 0, $iend = 0)
  2397. If $istart = Default Then $istart = 0
  2398. If $iend = Default Then $iend = 0
  2399. If NOT IsArray($aarray) Then Return SetError(1, 0, 0)
  2400. If UBound($aarray, $ubound_dimensions) <> 1 Then Return SetError(3, 0, 0)
  2401. If NOT UBound($aarray) Then Return SetError(4, 0, 0)
  2402. Local $vtmp, $iubound = UBound($aarray) - 1
  2403. If $iend < 1 OR $iend > $iubound Then $iend = $iubound
  2404. If $istart < 0 Then $istart = 0
  2405. If $istart > $iend Then Return SetError(2, 0, 0)
  2406. For $i = $istart To Int(($istart + $iend - 1) / 2)
  2407. $vtmp = $aarray[$i]
  2408. $aarray[$i] = $aarray[$iend]
  2409. $aarray[$iend] = $vtmp
  2410. $iend -= 1
  2411. Next
  2412. Return 1
  2413. EndFunc
  2414.  
  2415. Func _arraysearch(Const ByRef $aarray, $vvalue, $istart = 0, $iend = 0, $icase = 0, $icompare = 0, $iforward = 1, $isubitem = -1, $brow = False)
  2416. If $istart = Default Then $istart = 0
  2417. If $iend = Default Then $iend = 0
  2418. If $icase = Default Then $icase = 0
  2419. If $icompare = Default Then $icompare = 0
  2420. If $iforward = Default Then $iforward = 1
  2421. If $isubitem = Default Then $isubitem = -1
  2422. If $brow = Default Then $brow = False
  2423. If NOT IsArray($aarray) Then Return SetError(1, 0, -1)
  2424. Local $idim_1 = UBound($aarray) - 1
  2425. If $idim_1 = -1 Then Return SetError(3, 0, -1)
  2426. Local $idim_2 = UBound($aarray, $ubound_columns) - 1
  2427. Local $bcomptype = False
  2428. If $icompare = 2 Then
  2429. $icompare = 0
  2430. $bcomptype = True
  2431. EndIf
  2432. If $brow Then
  2433. If UBound($aarray, $ubound_dimensions) = 1 Then Return SetError(5, 0, -1)
  2434. If $iend < 1 OR $iend > $idim_2 Then $iend = $idim_2
  2435. If $istart < 0 Then $istart = 0
  2436. If $istart > $iend Then Return SetError(4, 0, -1)
  2437. Else
  2438. If $iend < 1 OR $iend > $idim_1 Then $iend = $idim_1
  2439. If $istart < 0 Then $istart = 0
  2440. If $istart > $iend Then Return SetError(4, 0, -1)
  2441. EndIf
  2442. Local $istep = 1
  2443. If NOT $iforward Then
  2444. Local $itmp = $istart
  2445. $istart = $iend
  2446. $iend = $itmp
  2447. $istep = -1
  2448. EndIf
  2449. Switch UBound($aarray, $ubound_dimensions)
  2450. Case 1
  2451. If NOT $icompare Then
  2452. If NOT $icase Then
  2453. For $i = $istart To $iend Step $istep
  2454. If $bcomptype AND VarGetType($aarray[$i]) <> VarGetType($vvalue) Then ContinueLoop
  2455. If $aarray[$i] = $vvalue Then Return $i
  2456. Next
  2457. Else
  2458. For $i = $istart To $iend Step $istep
  2459. If $bcomptype AND VarGetType($aarray[$i]) <> VarGetType($vvalue) Then ContinueLoop
  2460. If $aarray[$i] == $vvalue Then Return $i
  2461. Next
  2462. EndIf
  2463. Else
  2464. For $i = $istart To $iend Step $istep
  2465. If $icompare = 3 Then
  2466. If StringRegExp($aarray[$i], $vvalue) Then Return $i
  2467. Else
  2468. If StringInStr($aarray[$i], $vvalue, $icase) > 0 Then Return $i
  2469. EndIf
  2470. Next
  2471. EndIf
  2472. Case 2
  2473. Local $idim_sub
  2474. If $brow Then
  2475. $idim_sub = $idim_1
  2476. If $isubitem > $idim_sub Then $isubitem = $idim_sub
  2477. If $isubitem < 0 Then
  2478. $isubitem = 0
  2479. Else
  2480. $idim_sub = $isubitem
  2481. EndIf
  2482. Else
  2483. $idim_sub = $idim_2
  2484. If $isubitem > $idim_sub Then $isubitem = $idim_sub
  2485. If $isubitem < 0 Then
  2486. $isubitem = 0
  2487. Else
  2488. $idim_sub = $isubitem
  2489. EndIf
  2490. EndIf
  2491. For $j = $isubitem To $idim_sub
  2492. If NOT $icompare Then
  2493. If NOT $icase Then
  2494. For $i = $istart To $iend Step $istep
  2495. If $brow Then
  2496. If $bcomptype AND VarGetType($aarray[$j][$j]) <> VarGetType($vvalue) Then ContinueLoop
  2497. If $aarray[$j][$i] = $vvalue Then Return $i
  2498. Else
  2499. If $bcomptype AND VarGetType($aarray[$i][$j]) <> VarGetType($vvalue) Then ContinueLoop
  2500. If $aarray[$i][$j] = $vvalue Then Return $i
  2501. EndIf
  2502. Next
  2503. Else
  2504. For $i = $istart To $iend Step $istep
  2505. If $brow Then
  2506. If $bcomptype AND VarGetType($aarray[$j][$i]) <> VarGetType($vvalue) Then ContinueLoop
  2507. If $aarray[$j][$i] == $vvalue Then Return $i
  2508. Else
  2509. If $bcomptype AND VarGetType($aarray[$i][$j]) <> VarGetType($vvalue) Then ContinueLoop
  2510. If $aarray[$i][$j] == $vvalue Then Return $i
  2511. EndIf
  2512. Next
  2513. EndIf
  2514. Else
  2515. For $i = $istart To $iend Step $istep
  2516. If $icompare = 3 Then
  2517. If $brow Then
  2518. If StringRegExp($aarray[$j][$i], $vvalue) Then Return $i
  2519. Else
  2520. If StringRegExp($aarray[$i][$j], $vvalue) Then Return $i
  2521. EndIf
  2522. Else
  2523. If $brow Then
  2524. If StringInStr($aarray[$j][$i], $vvalue, $icase) > 0 Then Return $i
  2525. Else
  2526. If StringInStr($aarray[$i][$j], $vvalue, $icase) > 0 Then Return $i
  2527. EndIf
  2528. EndIf
  2529. Next
  2530. EndIf
  2531. Next
  2532. Case Else
  2533. Return SetError(2, 0, -1)
  2534. EndSwitch
  2535. Return SetError(6, 0, -1)
  2536. EndFunc
  2537.  
  2538. Func _arrayshuffle(ByRef $aarray, $istart_row = 0, $iend_row = 0, $icol = -1)
  2539. If $istart_row = Default Then $istart_row = 0
  2540. If $iend_row = Default Then $iend_row = 0
  2541. If $icol = Default Then $icol = -1
  2542. If NOT IsArray($aarray) Then Return SetError(1, 0, -1)
  2543. Local $idim_1 = UBound($aarray, $ubound_rows)
  2544. If $iend_row = 0 Then $iend_row = $idim_1 - 1
  2545. If $istart_row < 0 OR $istart_row > $idim_1 - 1 Then Return SetError(3, 0, -1)
  2546. If $iend_row < 1 OR $iend_row > $idim_1 - 1 Then Return SetError(3, 0, -1)
  2547. If $istart_row > $iend_row Then Return SetError(4, 0, -1)
  2548. Local $vtmp, $irand
  2549. Switch UBound($aarray, $ubound_dimensions)
  2550. Case 1
  2551. For $i = $iend_row To $istart_row + 1 Step -1
  2552. $irand = Random($istart_row, $i, 1)
  2553. $vtmp = $aarray[$i]
  2554. $aarray[$i] = $aarray[$irand]
  2555. $aarray[$irand] = $vtmp
  2556. Next
  2557. Return 1
  2558. Case 2
  2559. Local $idim_2 = UBound($aarray, $ubound_columns)
  2560. If $icol < -1 OR $icol > $idim_2 - 1 Then Return SetError(5, 0, -1)
  2561. Local $icol_start, $icol_end
  2562. If $icol = -1 Then
  2563. $icol_start = 0
  2564. $icol_end = $idim_2 - 1
  2565. Else
  2566. $icol_start = $icol
  2567. $icol_end = $icol
  2568. EndIf
  2569. For $i = $iend_row To $istart_row + 1 Step -1
  2570. $irand = Random($istart_row, $i, 1)
  2571. For $j = $icol_start To $icol_end
  2572. $vtmp = $aarray[$i][$j]
  2573. $aarray[$i][$j] = $aarray[$irand][$j]
  2574. $aarray[$irand][$j] = $vtmp
  2575. Next
  2576. Next
  2577. Return 1
  2578. Case Else
  2579. Return SetError(2, 0, -1)
  2580. EndSwitch
  2581. EndFunc
  2582.  
  2583. Func _arraysort(ByRef $aarray, $idescending = 0, $istart = 0, $iend = 0, $isubitem = 0, $ipivot = 0)
  2584. If $idescending = Default Then $idescending = 0
  2585. If $istart = Default Then $istart = 0
  2586. If $iend = Default Then $iend = 0
  2587. If $isubitem = Default Then $isubitem = 0
  2588. If $ipivot = Default Then $ipivot = 0
  2589. If NOT IsArray($aarray) Then Return SetError(1, 0, 0)
  2590. Local $iubound = UBound($aarray) - 1
  2591. If $iubound = -1 Then Return SetError(5, 0, 0)
  2592. If $iend = Default Then $iend = 0
  2593. If $iend < 1 OR $iend > $iubound OR $iend = Default Then $iend = $iubound
  2594. If $istart < 0 OR $istart = Default Then $istart = 0
  2595. If $istart > $iend Then Return SetError(2, 0, 0)
  2596. If $idescending = Default Then $idescending = 0
  2597. If $ipivot = Default Then $ipivot = 0
  2598. If $isubitem = Default Then $isubitem = 0
  2599. Switch UBound($aarray, $ubound_dimensions)
  2600. Case 1
  2601. If $ipivot Then
  2602. __arraydualpivotsort($aarray, $istart, $iend)
  2603. Else
  2604. __arrayquicksort1d($aarray, $istart, $iend)
  2605. EndIf
  2606. If $idescending Then _arrayreverse($aarray, $istart, $iend)
  2607. Case 2
  2608. If $ipivot Then Return SetError(6, 0, 0)
  2609. Local $isubmax = UBound($aarray, $ubound_columns) - 1
  2610. If $isubitem > $isubmax Then Return SetError(3, 0, 0)
  2611. If $idescending Then
  2612. $idescending = -1
  2613. Else
  2614. $idescending = 1
  2615. EndIf
  2616. __arrayquicksort2d($aarray, $idescending, $istart, $iend, $isubitem, $isubmax)
  2617. Case Else
  2618. Return SetError(4, 0, 0)
  2619. EndSwitch
  2620. Return 1
  2621. EndFunc
  2622.  
  2623. Func __arrayquicksort1d(ByRef $aarray, Const ByRef $istart, Const ByRef $iend)
  2624. If $iend <= $istart Then Return
  2625. Local $vtmp
  2626. If ($iend - $istart) < 15 Then
  2627. Local $vcur
  2628. For $i = $istart + 1 To $iend
  2629. $vtmp = $aarray[$i]
  2630. If IsNumber($vtmp) Then
  2631. For $j = $i - 1 To $istart Step -1
  2632. $vcur = $aarray[$j]
  2633. If ($vtmp >= $vcur AND IsNumber($vcur)) OR (NOT IsNumber($vcur) AND StringCompare($vtmp, $vcur) >= 0) Then ExitLoop
  2634. $aarray[$j + 1] = $vcur
  2635. Next
  2636. Else
  2637. For $j = $i - 1 To $istart Step -1
  2638. If (StringCompare($vtmp, $aarray[$j]) >= 0) Then ExitLoop
  2639. $aarray[$j + 1] = $aarray[$j]
  2640. Next
  2641. EndIf
  2642. $aarray[$j + 1] = $vtmp
  2643. Next
  2644. Return
  2645. EndIf
  2646. Local $l = $istart, $r = $iend, $vpivot = $aarray[Int(($istart + $iend) / 2)], $bnum = IsNumber($vpivot)
  2647. Do
  2648. If $bnum Then
  2649. While ($aarray[$l] < $vpivot AND IsNumber($aarray[$l])) OR (NOT IsNumber($aarray[$l]) AND StringCompare($aarray[$l], $vpivot) < 0)
  2650. $l += 1
  2651. WEnd
  2652. While ($aarray[$r] > $vpivot AND IsNumber($aarray[$r])) OR (NOT IsNumber($aarray[$r]) AND StringCompare($aarray[$r], $vpivot) > 0)
  2653. $r -= 1
  2654. WEnd
  2655. Else
  2656. While (StringCompare($aarray[$l], $vpivot) < 0)
  2657. $l += 1
  2658. WEnd
  2659. While (StringCompare($aarray[$r], $vpivot) > 0)
  2660. $r -= 1
  2661. WEnd
  2662. EndIf
  2663. If $l <= $r Then
  2664. $vtmp = $aarray[$l]
  2665. $aarray[$l] = $aarray[$r]
  2666. $aarray[$r] = $vtmp
  2667. $l += 1
  2668. $r -= 1
  2669. EndIf
  2670. Until $l > $r
  2671. __arrayquicksort1d($aarray, $istart, $r)
  2672. __arrayquicksort1d($aarray, $l, $iend)
  2673. EndFunc
  2674.  
  2675. Func __arrayquicksort2d(ByRef $aarray, Const ByRef $istep, Const ByRef $istart, Const ByRef $iend, Const ByRef $isubitem, Const ByRef $isubmax)
  2676. If $iend <= $istart Then Return
  2677. Local $vtmp, $l = $istart, $r = $iend, $vpivot = $aarray[Int(($istart + $iend) / 2)][$isubitem], $bnum = IsNumber($vpivot)
  2678. Do
  2679. If $bnum Then
  2680. While ($istep * ($aarray[$l][$isubitem] - $vpivot) < 0 AND IsNumber($aarray[$l][$isubitem])) OR (NOT IsNumber($aarray[$l][$isubitem]) AND $istep * StringCompare($aarray[$l][$isubitem], $vpivot) < 0)
  2681. $l += 1
  2682. WEnd
  2683. While ($istep * ($aarray[$r][$isubitem] - $vpivot) > 0 AND IsNumber($aarray[$r][$isubitem])) OR (NOT IsNumber($aarray[$r][$isubitem]) AND $istep * StringCompare($aarray[$r][$isubitem], $vpivot) > 0)
  2684. $r -= 1
  2685. WEnd
  2686. Else
  2687. While ($istep * StringCompare($aarray[$l][$isubitem], $vpivot) < 0)
  2688. $l += 1
  2689. WEnd
  2690. While ($istep * StringCompare($aarray[$r][$isubitem], $vpivot) > 0)
  2691. $r -= 1
  2692. WEnd
  2693. EndIf
  2694. If $l <= $r Then
  2695. For $i = 0 To $isubmax
  2696. $vtmp = $aarray[$l][$i]
  2697. $aarray[$l][$i] = $aarray[$r][$i]
  2698. $aarray[$r][$i] = $vtmp
  2699. Next
  2700. $l += 1
  2701. $r -= 1
  2702. EndIf
  2703. Until $l > $r
  2704. __arrayquicksort2d($aarray, $istep, $istart, $r, $isubitem, $isubmax)
  2705. __arrayquicksort2d($aarray, $istep, $l, $iend, $isubitem, $isubmax)
  2706. EndFunc
  2707.  
  2708. Func __arraydualpivotsort(ByRef $aarray, $ipivot_left, $ipivot_right, $bleftmost = True)
  2709. If $ipivot_left > $ipivot_right Then Return
  2710. Local $ilength = $ipivot_right - $ipivot_left + 1
  2711. Local $i, $j, $k, $iai, $iak, $ia1, $ia2, $ilast
  2712. If $ilength < 45 Then
  2713. If $bleftmost Then
  2714. $i = $ipivot_left
  2715. While $i < $ipivot_right
  2716. $j = $i
  2717. $iai = $aarray[$i + 1]
  2718. While $iai < $aarray[$j]
  2719. $aarray[$j + 1] = $aarray[$j]
  2720. $j -= 1
  2721. If $j + 1 = $ipivot_left Then ExitLoop
  2722. WEnd
  2723. $aarray[$j + 1] = $iai
  2724. $i += 1
  2725. WEnd
  2726. Else
  2727. While 1
  2728. If $ipivot_left >= $ipivot_right Then Return 1
  2729. $ipivot_left += 1
  2730. If $aarray[$ipivot_left] < $aarray[$ipivot_left - 1] Then ExitLoop
  2731. WEnd
  2732. While 1
  2733. $k = $ipivot_left
  2734. $ipivot_left += 1
  2735. If $ipivot_left > $ipivot_right Then ExitLoop
  2736. $ia1 = $aarray[$k]
  2737. $ia2 = $aarray[$ipivot_left]
  2738. If $ia1 < $ia2 Then
  2739. $ia2 = $ia1
  2740. $ia1 = $aarray[$ipivot_left]
  2741. EndIf
  2742. $k -= 1
  2743. While $ia1 < $aarray[$k]
  2744. $aarray[$k + 2] = $aarray[$k]
  2745. $k -= 1
  2746. WEnd
  2747. $aarray[$k + 2] = $ia1
  2748. While $ia2 < $aarray[$k]
  2749. $aarray[$k + 1] = $aarray[$k]
  2750. $k -= 1
  2751. WEnd
  2752. $aarray[$k + 1] = $ia2
  2753. $ipivot_left += 1
  2754. WEnd
  2755. $ilast = $aarray[$ipivot_right]
  2756. $ipivot_right -= 1
  2757. While $ilast < $aarray[$ipivot_right]
  2758. $aarray[$ipivot_right + 1] = $aarray[$ipivot_right]
  2759. $ipivot_right -= 1
  2760. WEnd
  2761. $aarray[$ipivot_right + 1] = $ilast
  2762. EndIf
  2763. Return 1
  2764. EndIf
  2765. Local $iseventh = BitShift($ilength, 3) + BitShift($ilength, 6) + 1
  2766. Local $ie1, $ie2, $ie3, $ie4, $ie5, $t
  2767. $ie3 = Ceiling(($ipivot_left + $ipivot_right) / 2)
  2768. $ie2 = $ie3 - $iseventh
  2769. $ie1 = $ie2 - $iseventh
  2770. $ie4 = $ie3 + $iseventh
  2771. $ie5 = $ie4 + $iseventh
  2772. If $aarray[$ie2] < $aarray[$ie1] Then
  2773. $t = $aarray[$ie2]
  2774. $aarray[$ie2] = $aarray[$ie1]
  2775. $aarray[$ie1] = $t
  2776. EndIf
  2777. If $aarray[$ie3] < $aarray[$ie2] Then
  2778. $t = $aarray[$ie3]
  2779. $aarray[$ie3] = $aarray[$ie2]
  2780. $aarray[$ie2] = $t
  2781. If $t < $aarray[$ie1] Then
  2782. $aarray[$ie2] = $aarray[$ie1]
  2783. $aarray[$ie1] = $t
  2784. EndIf
  2785. EndIf
  2786. If $aarray[$ie4] < $aarray[$ie3] Then
  2787. $t = $aarray[$ie4]
  2788. $aarray[$ie4] = $aarray[$ie3]
  2789. $aarray[$ie3] = $t
  2790. If $t < $aarray[$ie2] Then
  2791. $aarray[$ie3] = $aarray[$ie2]
  2792. $aarray[$ie2] = $t
  2793. If $t < $aarray[$ie1] Then
  2794. $aarray[$ie2] = $aarray[$ie1]
  2795. $aarray[$ie1] = $t
  2796. EndIf
  2797. EndIf
  2798. EndIf
  2799. If $aarray[$ie5] < $aarray[$ie4] Then
  2800. $t = $aarray[$ie5]
  2801. $aarray[$ie5] = $aarray[$ie4]
  2802. $aarray[$ie4] = $t
  2803. If $t < $aarray[$ie3] Then
  2804. $aarray[$ie4] = $aarray[$ie3]
  2805. $aarray[$ie3] = $t
  2806. If $t < $aarray[$ie2] Then
  2807. $aarray[$ie3] = $aarray[$ie2]
  2808. $aarray[$ie2] = $t
  2809. If $t < $aarray[$ie1] Then
  2810. $aarray[$ie2] = $aarray[$ie1]
  2811. $aarray[$ie1] = $t
  2812. EndIf
  2813. EndIf
  2814. EndIf
  2815. EndIf
  2816. Local $iless = $ipivot_left
  2817. Local $igreater = $ipivot_right
  2818. If (($aarray[$ie1] <> $aarray[$ie2]) AND ($aarray[$ie2] <> $aarray[$ie3]) AND ($aarray[$ie3] <> $aarray[$ie4]) AND ($aarray[$ie4] <> $aarray[$ie5])) Then
  2819. Local $ipivot_1 = $aarray[$ie2]
  2820. Local $ipivot_2 = $aarray[$ie4]
  2821. $aarray[$ie2] = $aarray[$ipivot_left]
  2822. $aarray[$ie4] = $aarray[$ipivot_right]
  2823. Do
  2824. $iless += 1
  2825. Until $aarray[$iless] >= $ipivot_1
  2826. Do
  2827. $igreater -= 1
  2828. Until $aarray[$igreater] <= $ipivot_2
  2829. $k = $iless
  2830. While $k <= $igreater
  2831. $iak = $aarray[$k]
  2832. If $iak < $ipivot_1 Then
  2833. $aarray[$k] = $aarray[$iless]
  2834. $aarray[$iless] = $iak
  2835. $iless += 1
  2836. ElseIf $iak > $ipivot_2 Then
  2837. While $aarray[$igreater] > $ipivot_2
  2838. $igreater -= 1
  2839. If $igreater + 1 = $k Then ExitLoop 2
  2840. WEnd
  2841. If $aarray[$igreater] < $ipivot_1 Then
  2842. $aarray[$k] = $aarray[$iless]
  2843. $aarray[$iless] = $aarray[$igreater]
  2844. $iless += 1
  2845. Else
  2846. $aarray[$k] = $aarray[$igreater]
  2847. EndIf
  2848. $aarray[$igreater] = $iak
  2849. $igreater -= 1
  2850. EndIf
  2851. $k += 1
  2852. WEnd
  2853. $aarray[$ipivot_left] = $aarray[$iless - 1]
  2854. $aarray[$iless - 1] = $ipivot_1
  2855. $aarray[$ipivot_right] = $aarray[$igreater + 1]
  2856. $aarray[$igreater + 1] = $ipivot_2
  2857. __arraydualpivotsort($aarray, $ipivot_left, $iless - 2, True)
  2858. __arraydualpivotsort($aarray, $igreater + 2, $ipivot_right, False)
  2859. If ($iless < $ie1) AND ($ie5 < $igreater) Then
  2860. While $aarray[$iless] = $ipivot_1
  2861. $iless += 1
  2862. WEnd
  2863. While $aarray[$igreater] = $ipivot_2
  2864. $igreater -= 1
  2865. WEnd
  2866. $k = $iless
  2867. While $k <= $igreater
  2868. $iak = $aarray[$k]
  2869. If $iak = $ipivot_1 Then
  2870. $aarray[$k] = $aarray[$iless]
  2871. $aarray[$iless] = $iak
  2872. $iless += 1
  2873. ElseIf $iak = $ipivot_2 Then
  2874. While $aarray[$igreater] = $ipivot_2
  2875. $igreater -= 1
  2876. If $igreater + 1 = $k Then ExitLoop 2
  2877. WEnd
  2878. If $aarray[$igreater] = $ipivot_1 Then
  2879. $aarray[$k] = $aarray[$iless]
  2880. $aarray[$iless] = $ipivot_1
  2881. $iless += 1
  2882. Else
  2883. $aarray[$k] = $aarray[$igreater]
  2884. EndIf
  2885. $aarray[$igreater] = $iak
  2886. $igreater -= 1
  2887. EndIf
  2888. $k += 1
  2889. WEnd
  2890. EndIf
  2891. __arraydualpivotsort($aarray, $iless, $igreater, False)
  2892. Else
  2893. Local $ipivot = $aarray[$ie3]
  2894. $k = $iless
  2895. While $k <= $igreater
  2896. If $aarray[$k] = $ipivot Then
  2897. $k += 1
  2898. ContinueLoop
  2899. EndIf
  2900. $iak = $aarray[$k]
  2901. If $iak < $ipivot Then
  2902. $aarray[$k] = $aarray[$iless]
  2903. $aarray[$iless] = $iak
  2904. $iless += 1
  2905. Else
  2906. While $aarray[$igreater] > $ipivot
  2907. $igreater -= 1
  2908. WEnd
  2909. If $aarray[$igreater] < $ipivot Then
  2910. $aarray[$k] = $aarray[$iless]
  2911. $aarray[$iless] = $aarray[$igreater]
  2912. $iless += 1
  2913. Else
  2914. $aarray[$k] = $ipivot
  2915. EndIf
  2916. $aarray[$igreater] = $iak
  2917. $igreater -= 1
  2918. EndIf
  2919. $k += 1
  2920. WEnd
  2921. __arraydualpivotsort($aarray, $ipivot_left, $iless - 1, True)
  2922. __arraydualpivotsort($aarray, $igreater + 1, $ipivot_right, False)
  2923. EndIf
  2924. EndFunc
  2925.  
  2926. Func _arrayswap(ByRef $aarray, $iindex_1, $iindex_2, $bcol = False, $istart = -1, $iend = -1)
  2927. If $bcol = Default Then $bcol = False
  2928. If $istart = Default Then $istart = -1
  2929. If $iend = Default Then $iend = -1
  2930. If NOT IsArray($aarray) Then Return SetError(1, 0, -1)
  2931. Local $idim_1 = UBound($aarray, $ubound_rows) - 1
  2932. Local $idim_2 = UBound($aarray, $ubound_columns) - 1
  2933. If $idim_2 = -1 Then
  2934. $bcol = False
  2935. $istart = -1
  2936. $iend = -1
  2937. EndIf
  2938. If $istart > $iend Then Return SetError(5, 0, -1)
  2939. If $bcol Then
  2940. If $iindex_1 < 0 OR $iindex_2 > $idim_2 Then Return SetError(3, 0, -1)
  2941. If $istart = -1 Then $istart = 0
  2942. If $iend = -1 Then $iend = $idim_1
  2943. Else
  2944. If $iindex_1 < 0 OR $iindex_2 > $idim_1 Then Return SetError(3, 0, -1)
  2945. If $istart = -1 Then $istart = 0
  2946. If $iend = -1 Then $iend = $idim_2
  2947. EndIf
  2948. Local $vtmp
  2949. Switch UBound($aarray, $ubound_dimensions)
  2950. Case 1
  2951. $vtmp = $aarray[$iindex_1]
  2952. $aarray[$iindex_1] = $aarray[$iindex_2]
  2953. $aarray[$iindex_2] = $vtmp
  2954. Case 2
  2955. If $istart < -1 OR $iend < -1 Then Return SetError(4, 0, -1)
  2956. If $bcol Then
  2957. If $istart > $idim_1 OR $iend > $idim_1 Then Return SetError(4, 0, -1)
  2958. For $j = $istart To $iend
  2959. $vtmp = $aarray[$j][$iindex_1]
  2960. $aarray[$j][$iindex_1] = $aarray[$j][$iindex_2]
  2961. $aarray[$j][$iindex_2] = $vtmp
  2962. Next
  2963. Else
  2964. If $istart > $idim_2 OR $iend > $idim_2 Then Return SetError(4, 0, -1)
  2965. For $j = $istart To $iend
  2966. $vtmp = $aarray[$iindex_1][$j]
  2967. $aarray[$iindex_1][$j] = $aarray[$iindex_2][$j]
  2968. $aarray[$iindex_2][$j] = $vtmp
  2969. Next
  2970. EndIf
  2971. Case Else
  2972. Return SetError(2, 0, -1)
  2973. EndSwitch
  2974. Return 1
  2975. EndFunc
  2976.  
  2977. Func _arraytoclip(Const ByRef $aarray, $sdelim_col = "|", $istart_row = -1, $iend_row = -1, $sdelim_row = @CRLF, $istart_col = -1, $iend_col = -1)
  2978. Local $sresult = _arraytostring($aarray, $sdelim_col, $istart_row, $iend_row, $sdelim_row, $istart_col, $iend_col)
  2979. If @error Then Return SetError(@error, 0, 0)
  2980. If ClipPut($sresult) Then Return 1
  2981. Return SetError(-1, 0, 0)
  2982. EndFunc
  2983.  
  2984. Func _arraytostring(Const ByRef $aarray, $sdelim_col = "|", $istart_row = -1, $iend_row = -1, $sdelim_row = @CRLF, $istart_col = -1, $iend_col = -1)
  2985. If $sdelim_col = Default Then $sdelim_col = "|"
  2986. If $sdelim_row = Default Then $sdelim_row = @CRLF
  2987. If $istart_row = Default Then $istart_row = -1
  2988. If $iend_row = Default Then $iend_row = -1
  2989. If $istart_col = Default Then $istart_col = -1
  2990. If $iend_col = Default Then $iend_col = -1
  2991. If NOT IsArray($aarray) Then Return SetError(1, 0, -1)
  2992. Local $idim_1 = UBound($aarray, $ubound_rows) - 1
  2993. If $istart_row = -1 Then $istart_row = 0
  2994. If $iend_row = -1 Then $iend_row = $idim_1
  2995. If $istart_row < -1 OR $iend_row < -1 Then Return SetError(3, 0, -1)
  2996. If $istart_row > $idim_1 OR $iend_row > $idim_1 Then Return SetError(3, 0, "")
  2997. If $istart_row > $iend_row Then Return SetError(4, 0, -1)
  2998. Local $sret = ""
  2999. Switch UBound($aarray, $ubound_dimensions)
  3000. Case 1
  3001. For $i = $istart_row To $iend_row
  3002. $sret &= $aarray[$i] & $sdelim_col
  3003. Next
  3004. Return StringTrimRight($sret, StringLen($sdelim_col))
  3005. Case 2
  3006. Local $idim_2 = UBound($aarray, $ubound_columns) - 1
  3007. If $istart_col = -1 Then $istart_col = 0
  3008. If $iend_col = -1 Then $iend_col = $idim_2
  3009. If $istart_col < -1 OR $iend_col < -1 Then Return SetError(5, 0, -1)
  3010. If $istart_col > $idim_2 OR $iend_col > $idim_2 Then Return SetError(5, 0, -1)
  3011. If $istart_col > $iend_col Then Return SetError(6, 0, -1)
  3012. For $i = $istart_row To $iend_row
  3013. For $j = $istart_col To $iend_col
  3014. $sret &= $aarray[$i][$j] & $sdelim_col
  3015. Next
  3016. $sret = StringTrimRight($sret, StringLen($sdelim_col)) & $sdelim_row
  3017. Next
  3018. Return StringTrimRight($sret, StringLen($sdelim_row))
  3019. Case Else
  3020. Return SetError(2, 0, -1)
  3021. EndSwitch
  3022. Return 1
  3023. EndFunc
  3024.  
  3025. Func _arraytranspose(ByRef $aarray)
  3026. Switch UBound($aarray, 0)
  3027. Case 0
  3028. Return SetError(2, 0, 0)
  3029. Case 1
  3030. Local $atemp[1][UBound($aarray)]
  3031. For $i = 0 To UBound($aarray) - 1
  3032. $atemp[0][$i] = $aarray[$i]
  3033. Next
  3034. $aarray = $atemp
  3035. Case 2
  3036. Local $idim_1 = UBound($aarray, 1), $idim_2 = UBound($aarray, 2)
  3037. If $idim_1 <> $idim_2 Then
  3038. Local $atemp[$idim_2][$idim_1]
  3039. For $i = 0 To $idim_1 - 1
  3040. For $j = 0 To $idim_2 - 1
  3041. $atemp[$j][$i] = $aarray[$i][$j]
  3042. Next
  3043. Next
  3044. $aarray = $atemp
  3045. Else
  3046. Local $velement
  3047. For $i = 0 To $idim_1 - 1
  3048. For $j = $i + 1 To $idim_2 - 1
  3049. $velement = $aarray[$i][$j]
  3050. $aarray[$i][$j] = $aarray[$j][$i]
  3051. $aarray[$j][$i] = $velement
  3052. Next
  3053. Next
  3054. EndIf
  3055. Case Else
  3056. Return SetError(1, 0, 0)
  3057. EndSwitch
  3058. Return 1
  3059. EndFunc
  3060.  
  3061. Func _arraytrim(ByRef $aarray, $itrimnum, $idirection = 0, $istart = 0, $iend = 0, $isubitem = 0)
  3062. If $idirection = Default Then $idirection = 0
  3063. If $istart = Default Then $istart = 0
  3064. If $iend = Default Then $iend = 0
  3065. If $isubitem = Default Then $isubitem = 0
  3066. If NOT IsArray($aarray) Then Return SetError(1, 0, 0)
  3067. Local $idim_1 = UBound($aarray, $ubound_rows) - 1
  3068. If $iend = 0 Then $iend = $idim_1
  3069. If $istart > $iend Then Return SetError(3, 0, -1)
  3070. If $istart < 0 OR $iend < 0 Then Return SetError(3, 0, -1)
  3071. If $istart > $idim_1 OR $iend > $idim_1 Then Return SetError(3, 0, -1)
  3072. If $istart > $iend Then Return SetError(4, 0, -1)
  3073. Switch UBound($aarray, $ubound_dimensions)
  3074. Case 1
  3075. If $idirection Then
  3076. For $i = $istart To $iend
  3077. $aarray[$i] = StringTrimRight($aarray[$i], $itrimnum)
  3078. Next
  3079. Else
  3080. For $i = $istart To $iend
  3081. $aarray[$i] = StringTrimLeft($aarray[$i], $itrimnum)
  3082. Next
  3083. EndIf
  3084. Case 2
  3085. Local $idim_2 = UBound($aarray, $ubound_columns) - 1
  3086. If $isubitem < 0 OR $isubitem > $idim_2 Then Return SetError(5, 0, -1)
  3087. If $idirection Then
  3088. For $i = $istart To $iend
  3089. $aarray[$i][$isubitem] = StringTrimRight($aarray[$i][$isubitem], $itrimnum)
  3090. Next
  3091. Else
  3092. For $i = $istart To $iend
  3093. $aarray[$i][$isubitem] = StringTrimLeft($aarray[$i][$isubitem], $itrimnum)
  3094. Next
  3095. EndIf
  3096. Case Else
  3097. Return SetError(2, 0, 0)
  3098. EndSwitch
  3099. Return 1
  3100. EndFunc
  3101.  
  3102. Func _arrayunique(Const ByRef $aarray, $icolumn = 0, $ibase = 0, $icase = 0, $icount = $arrayunique_count, $iinttype = $arrayunique_auto)
  3103. If $icolumn = Default Then $icolumn = 0
  3104. If $ibase = Default Then $ibase = 0
  3105. If $icase = Default Then $icase = 0
  3106. If $icount = Default Then $icount = $arrayunique_count
  3107. If UBound($aarray, $ubound_rows) = 0 Then Return SetError(1, 0, 0)
  3108. Local $idims = UBound($aarray, $ubound_dimensions), $inumcolumns = UBound($aarray, $ubound_columns)
  3109. If $idims > 2 Then Return SetError(2, 0, 0)
  3110. If $ibase < 0 OR $ibase > 1 OR (NOT IsInt($ibase)) Then Return SetError(3, 0, 0)
  3111. If $icase < 0 OR $icase > 1 OR (NOT IsInt($icase)) Then Return SetError(3, 0, 0)
  3112. If $icount < 0 OR $icount > 1 OR (NOT IsInt($icount)) Then Return SetError(4, 0, 0)
  3113. If $iinttype < 0 OR $iinttype > 4 OR (NOT IsInt($iinttype)) Then Return SetError(5, 0, 0)
  3114. If $icolumn < 0 OR ($inumcolumns = 0 AND $icolumn > 0) OR ($inumcolumns > 0 AND $icolumn >= $inumcolumns) Then Return SetError(6, 0, 0)
  3115. If $iinttype = $arrayunique_auto Then
  3116. Local $vfirstelem = (($idims = 1) ? ($aarray[$ibase]) : ($aarray[$icolumn][$ibase]))
  3117. If IsInt($vfirstelem) Then
  3118. Switch VarGetType($vfirstelem)
  3119. Case "Int32"
  3120. $iinttype = $arrayunique_force32
  3121. Case "Int64"
  3122. $iinttype = $arrayunique_force64
  3123. EndSwitch
  3124. Else
  3125. $iinttype = $arrayunique_force32
  3126. EndIf
  3127. EndIf
  3128. ObjEvent("AutoIt.Error", "__ArrayUnique_AutoErrFunc")
  3129. Local $odictionary = ObjCreate("Scripting.Dictionary")
  3130. $odictionary.comparemode = Number(NOT $icase)
  3131. Local $velem, $stype, $vkey, $bcomerror = False
  3132. For $i = $ibase To UBound($aarray) - 1
  3133. If $idims = 1 Then
  3134. $velem = $aarray[$i]
  3135. Else
  3136. $velem = $aarray[$i][$icolumn]
  3137. EndIf
  3138. Switch $iinttype
  3139. Case $arrayunique_force32
  3140. $odictionary.item($velem)
  3141. If @error Then
  3142. $bcomerror = True
  3143. ExitLoop
  3144. EndIf
  3145. Case $arrayunique_force64
  3146. $stype = VarGetType($velem)
  3147. If $stype = "Int32" Then
  3148. $bcomerror = True
  3149. ExitLoop
  3150. EndIf
  3151. $vkey = "#" & $stype & "#" & String($velem)
  3152. If NOT $odictionary.item($vkey) Then
  3153. $odictionary($vkey) = $velem
  3154. EndIf
  3155. Case $arrayunique_match
  3156. $stype = VarGetType($velem)
  3157. If StringLeft($stype, 3) = "Int" Then
  3158. $vkey = "#Int#" & String($velem)
  3159. Else
  3160. $vkey = "#" & $stype & "#" & String($velem)
  3161. EndIf
  3162. If NOT $odictionary.item($vkey) Then
  3163. $odictionary($vkey) = $velem
  3164. EndIf
  3165. Case $arrayunique_distinct
  3166. $vkey = "#" & VarGetType($velem) & "#" & String($velem)
  3167. If NOT $odictionary.item($vkey) Then
  3168. $odictionary($vkey) = $velem
  3169. EndIf
  3170. EndSwitch
  3171. Next
  3172. Local $avalues, $j = 0
  3173. If $bcomerror Then
  3174. Return SetError(7, 0, 0)
  3175. ElseIf $iinttype <> $arrayunique_force32 Then
  3176. Local $avalues[$odictionary.count]
  3177. For $vkey In $odictionary.keys()
  3178. $avalues[$j] = $odictionary($vkey)
  3179. If StringLeft($vkey, 5) = "#Ptr#" Then
  3180. $avalues[$j] = Ptr($avalues[$j])
  3181. EndIf
  3182. $j += 1
  3183. Next
  3184. Else
  3185. $avalues = $odictionary.keys()
  3186. EndIf
  3187. If $icount Then
  3188. _arrayinsert($avalues, 0, $odictionary.count)
  3189. EndIf
  3190. Return $avalues
  3191. EndFunc
  3192.  
  3193. Func _array1dtohistogram($aarray, $isizing = 100)
  3194. If UBound($aarray, 0) > 1 Then Return SetError(1, 0, "")
  3195. $isizing = $isizing * 8
  3196. Local $t, $n, $imin = 0, $imax = 0, $ioffset = 0
  3197. For $i = 0 To UBound($aarray) - 1
  3198. $t = $aarray[$i]
  3199. $t = IsNumber($t) ? Round($t) : 0
  3200. If $t < $imin Then $imin = $t
  3201. If $t > $imax Then $imax = $t
  3202. Next
  3203. Local $irange = Int(Round(($imax - $imin) / 8)) * 8
  3204. Local $ispaceratio = 4
  3205. For $i = 0 To UBound($aarray) - 1
  3206. $t = $aarray[$i]
  3207. If $t Then
  3208. $n = Abs(Round(($isizing * $t) / $irange) / 8)
  3209. $aarray[$i] = ""
  3210. If $t > 0 Then
  3211. If $imin Then
  3212. $ioffset = Int(Abs(Round(($isizing * $imin) / $irange) / 8) / 8 * $ispaceratio)
  3213. $aarray[$i] = __array_stringrepeat(ChrW(32), $ioffset)
  3214. EndIf
  3215. Else
  3216. If $imin <> $t Then
  3217. $ioffset = Int(Abs(Round(($isizing * ($t - $imin)) / $irange) / 8) / 8 * $ispaceratio)
  3218. $aarray[$i] = __array_stringrepeat(ChrW(32), $ioffset)
  3219. EndIf
  3220. EndIf
  3221. $aarray[$i] &= __array_stringrepeat(ChrW(9608), Int($n / 8))
  3222. $n = Mod($n, 8)
  3223. If $n > 0 Then $aarray[$i] &= ChrW(9608 + 8 - $n)
  3224. $aarray[$i] &= " " & $t
  3225. Else
  3226. $aarray[$i] = ""
  3227. EndIf
  3228. Next
  3229. Return $aarray
  3230. EndFunc
  3231.  
  3232. Func __array_stringrepeat($sstring, $irepeatcount)
  3233. $irepeatcount = Int($irepeatcount)
  3234. If StringLen($sstring) < 1 OR $irepeatcount <= 0 Then Return SetError(1, 0, "")
  3235. Local $sresult = ""
  3236. While $irepeatcount > 1
  3237. If BitAND($irepeatcount, 1) Then $sresult &= $sstring
  3238. $sstring &= $sstring
  3239. $irepeatcount = BitShift($irepeatcount, 1)
  3240. WEnd
  3241. Return $sstring & $sresult
  3242. EndFunc
  3243.  
  3244. Func __array_exeterinternal(ByRef $aarray, $istart, $isize, $sdelimiter, ByRef $aidx, ByRef $aresult, ByRef $icount)
  3245. If $istart == $isize - 1 Then
  3246. For $i = 0 To $isize - 1
  3247. $aresult[$icount] &= $aarray[$aidx[$i]] & $sdelimiter
  3248. Next
  3249. If $sdelimiter <> "" Then $aresult[$icount] = StringTrimRight($aresult[$icount], StringLen($sdelimiter))
  3250. $icount += 1
  3251. Else
  3252. Local $itemp
  3253. For $i = $istart To $isize - 1
  3254. $itemp = $aidx[$i]
  3255. $aidx[$i] = $aidx[$istart]
  3256. $aidx[$istart] = $itemp
  3257. __array_exeterinternal($aarray, $istart + 1, $isize, $sdelimiter, $aidx, $aresult, $icount)
  3258. $aidx[$istart] = $aidx[$i]
  3259. $aidx[$i] = $itemp
  3260. Next
  3261. EndIf
  3262. EndFunc
  3263.  
  3264. Func __array_combinations($in, $ir)
  3265. Local $i_total = 1
  3266. For $i = $ir To 1 Step -1
  3267. $i_total *= ($in / $i)
  3268. $in -= 1
  3269. Next
  3270. Return Round($i_total)
  3271. EndFunc
  3272.  
  3273. Func __array_getnext($in, $ir, ByRef $ileft, $itotal, ByRef $aidx)
  3274. If $ileft == $itotal Then
  3275. $ileft -= 1
  3276. Return
  3277. EndIf
  3278. Local $i = $ir - 1
  3279. While $aidx[$i] == $in - $ir + $i
  3280. $i -= 1
  3281. WEnd
  3282. $aidx[$i] += 1
  3283. For $j = $i + 1 To $ir - 1
  3284. $aidx[$j] = $aidx[$i] + $j - $i
  3285. Next
  3286. $ileft -= 1
  3287. EndFunc
  3288.  
  3289. Func __array_minmaxindex(Const ByRef $aarray, $icompnumeric, $istart, $iend, $isubitem, $fucomparison)
  3290. If $icompnumeric = Default Then $icompnumeric = 0
  3291. If $icompnumeric <> 1 Then $icompnumeric = 0
  3292. If $istart = Default Then $istart = 0
  3293. If $iend = Default Then $iend = 0
  3294. If $isubitem = Default Then $isubitem = 0
  3295. If NOT IsArray($aarray) Then Return SetError(1, 0, -1)
  3296. Local $idim_1 = UBound($aarray, $ubound_rows) - 1
  3297. If $idim_1 < 0 Then Return SetError(1, 0, -1)
  3298. If $iend = -1 Then $iend = $idim_1
  3299. If $istart = -1 Then $istart = 0
  3300. If $istart < -1 OR $iend < -1 Then Return SetError(3, 0, -1)
  3301. If $istart > $idim_1 OR $iend > $idim_1 Then Return SetError(3, 0, -1)
  3302. If $istart > $iend Then Return SetError(4, 0, -1)
  3303. If $idim_1 < 0 Then Return SetError(5, 0, -1)
  3304. Local $imaxminindex = $istart
  3305. Switch UBound($aarray, $ubound_dimensions)
  3306. Case 1
  3307. If $icompnumeric Then
  3308. For $i = $istart To $iend
  3309. If $fucomparison(Number($aarray[$i]), Number($aarray[$imaxminindex])) Then $imaxminindex = $i
  3310. Next
  3311. Else
  3312. For $i = $istart To $iend
  3313. If $fucomparison($aarray[$i], $aarray[$imaxminindex]) Then $imaxminindex = $i
  3314. Next
  3315. EndIf
  3316. Case 2
  3317. If $isubitem < 0 OR $isubitem > UBound($aarray, $ubound_columns) - 1 Then Return SetError(6, 0, -1)
  3318. If $icompnumeric Then
  3319. For $i = $istart To $iend
  3320. If $fucomparison(Number($aarray[$i][$isubitem]), Number($aarray[$imaxminindex][$isubitem])) Then $imaxminindex = $i
  3321. Next
  3322. Else
  3323. For $i = $istart To $iend
  3324. If $fucomparison($aarray[$i][$isubitem], $aarray[$imaxminindex][$isubitem]) Then $imaxminindex = $i
  3325. Next
  3326. EndIf
  3327. Case Else
  3328. Return SetError(2, 0, -1)
  3329. EndSwitch
  3330. Return $imaxminindex
  3331. EndFunc
  3332.  
  3333. Func __array_greaterthan($vvalue1, $vvalue2)
  3334. Return $vvalue1 > $vvalue2
  3335. EndFunc
  3336.  
  3337. Func __array_lessthan($vvalue1, $vvalue2)
  3338. Return $vvalue1 < $vvalue2
  3339. EndFunc
  3340.  
  3341. Func __arrayunique_autoerrfunc()
  3342. EndFunc
  3343.  
  3344. Global Const $fc_nooverwrite = 0
  3345. Global Const $fc_overwrite = 1
  3346. Global Const $fc_createpath = 8
  3347. Global Const $ft_modified = 0
  3348. Global Const $ft_created = 1
  3349. Global Const $ft_accessed = 2
  3350. Global Const $ft_array = 0
  3351. Global Const $ft_string = 1
  3352. Global Const $fsf_createbutton = 1
  3353. Global Const $fsf_newdialog = 2
  3354. Global Const $fsf_editcontrol = 4
  3355. Global Const $ft_nonrecursive = 0
  3356. Global Const $ft_recursive = 1
  3357. Global Const $fo_read = 0
  3358. Global Const $fo_append = 1
  3359. Global Const $fo_overwrite = 2
  3360. Global Const $fo_createpath = 8
  3361. Global Const $fo_binary = 16
  3362. Global Const $fo_unicode = 32
  3363. Global Const $fo_utf16_le = 32
  3364. Global Const $fo_utf16_be = 64
  3365. Global Const $fo_utf8 = 128
  3366. Global Const $fo_utf8_nobom = 256
  3367. Global Const $fo_ansi = 512
  3368. Global Const $fo_utf16_le_nobom = 1024
  3369. Global Const $fo_utf16_be_nobom = 2048
  3370. Global Const $fo_utf8_full = 16384
  3371. Global Const $fo_fullfile_detect = 16384
  3372. Global Const $eof = -1
  3373. Global Const $fd_filemustexist = 1
  3374. Global Const $fd_pathmustexist = 2
  3375. Global Const $fd_multiselect = 4
  3376. Global Const $fd_promptcreatenew = 8
  3377. Global Const $fd_promptoverwrite = 16
  3378. Global Const $create_new = 1
  3379. Global Const $create_always = 2
  3380. Global Const $open_existing = 3
  3381. Global Const $open_always = 4
  3382. Global Const $truncate_existing = 5
  3383. Global Const $invalid_set_file_pointer = -1
  3384. Global Const $file_begin = 0
  3385. Global Const $file_current = 1
  3386. Global Const $file_end = 2
  3387. Global Const $file_attribute_readonly = 1
  3388. Global Const $file_attribute_hidden = 2
  3389. Global Const $file_attribute_system = 4
  3390. Global Const $file_attribute_directory = 16
  3391. Global Const $file_attribute_archive = 32
  3392. Global Const $file_attribute_device = 64
  3393. Global Const $file_attribute_normal = 128
  3394. Global Const $file_attribute_temporary = 256
  3395. Global Const $file_attribute_sparse_file = 512
  3396. Global Const $file_attribute_reparse_point = 1024
  3397. Global Const $file_attribute_compressed = 2048
  3398. Global Const $file_attribute_offline = 4096
  3399. Global Const $file_attribute_not_content_indexed = 8192
  3400. Global Const $file_attribute_encrypted = 16384
  3401. Global Const $file_share_read = 1
  3402. Global Const $file_share_write = 2
  3403. Global Const $file_share_delete = 4
  3404. Global Const $file_share_readwrite = BitOR($file_share_read, $file_share_write)
  3405. Global Const $file_share_any = BitOR($file_share_read, $file_share_write, $file_share_delete)
  3406. Global Const $generic_all = 268435456
  3407. Global Const $generic_execute = 536870912
  3408. Global Const $generic_write = 1073741824
  3409. Global Const $generic_read = -2147483648
  3410. Global Const $generic_readwrite = BitOR($generic_read, $generic_write)
  3411. Global Const $file_encoding_utf16le = 32
  3412. Global Const $fe_entire_utf8 = 1
  3413. Global Const $fe_partialfirst_utf8 = 2
  3414. Global Const $fn_fullpath = 0
  3415. Global Const $fn_relativepath = 1
  3416. Global Const $fv_comments = "Comments"
  3417. Global Const $fv_companyname = "CompanyName"
  3418. Global Const $fv_filedescription = "FileDescription"
  3419. Global Const $fv_fileversion = "FileVersion"
  3420. Global Const $fv_internalname = "InternalName"
  3421. Global Const $fv_legalcopyright = "LegalCopyright"
  3422. Global Const $fv_legaltrademarks = "LegalTrademarks"
  3423. Global Const $fv_originalfilename = "OriginalFilename"
  3424. Global Const $fv_productname = "ProductName"
  3425. Global Const $fv_productversion = "ProductVersion"
  3426. Global Const $fv_privatebuild = "PrivateBuild"
  3427. Global Const $fv_specialbuild = "SpecialBuild"
  3428. Global Const $frta_nocount = 0
  3429. Global Const $frta_count = 1
  3430. Global Const $frta_intarrays = 2
  3431. Global Const $frta_entiresplit = 4
  3432. Global Const $flta_filesfolders = 0
  3433. Global Const $flta_files = 1
  3434. Global Const $flta_folders = 2
  3435. Global Const $fltar_filesfolders = 0
  3436. Global Const $fltar_files = 1
  3437. Global Const $fltar_folders = 2
  3438. Global Const $fltar_nohidden = 4
  3439. Global Const $fltar_nosystem = 8
  3440. Global Const $fltar_nolink = 16
  3441. Global Const $fltar_norecur = 0
  3442. Global Const $fltar_recur = 1
  3443. Global Const $fltar_nosort = 0
  3444. Global Const $fltar_sort = 1
  3445. Global Const $fltar_fastsort = 2
  3446. Global Const $fltar_nopath = 0
  3447. Global Const $fltar_relpath = 1
  3448. Global Const $fltar_fullpath = 2
  3449.  
  3450. Func _filecountlines($sfilepath)
  3451. Local $hfileopen = FileOpen($sfilepath, $fo_read)
  3452. If $hfileopen = -1 Then Return SetError(1, 0, 0)
  3453. Local $sfileread = StringStripWS(FileRead($hfileopen), $str_striptrailing)
  3454. FileClose($hfileopen)
  3455. Return UBound(StringRegExp($sfileread, "\R", $str_regexparrayglobalmatch)) + 1 - Int($sfileread = "")
  3456. EndFunc
  3457.  
  3458. Func _filecreate($sfilepath)
  3459. Local $hfileopen = FileOpen($sfilepath, BitOR($fo_overwrite, $fo_createpath))
  3460. If $hfileopen = -1 Then Return SetError(1, 0, 0)
  3461. Local $ifilewrite = FileWrite($hfileopen, "")
  3462. FileClose($hfileopen)
  3463. If NOT $ifilewrite Then Return SetError(2, 0, 0)
  3464. Return 1
  3465. EndFunc
  3466.  
  3467. Func _filelisttoarray($sfilepath, $sfilter = "*", $iflag = $flta_filesfolders, $breturnpath = False)
  3468. Local $sdelimiter = "|", $sfilelist = "", $sfilename = "", $sfullpath = ""
  3469. $sfilepath = StringRegExpReplace($sfilepath, "[\\/]+$", "") & "\"
  3470. If $iflag = Default Then $iflag = $flta_filesfolders
  3471. If $breturnpath Then $sfullpath = $sfilepath
  3472. If $sfilter = Default Then $sfilter = "*"
  3473. If NOT FileExists($sfilepath) Then Return SetError(1, 0, 0)
  3474. If StringRegExp($sfilter, "[\\/:><\|]|(?s)^\s*$") Then Return SetError(2, 0, 0)
  3475. If NOT ($iflag = 0 OR $iflag = 1 OR $iflag = 2) Then Return SetError(3, 0, 0)
  3476. Local $hsearch = FileFindFirstFile($sfilepath & $sfilter)
  3477. If @error Then Return SetError(4, 0, 0)
  3478. While 1
  3479. $sfilename = FileFindNextFile($hsearch)
  3480. If @error Then ExitLoop
  3481. If ($iflag + @extended = 2) Then ContinueLoop
  3482. $sfilelist &= $sdelimiter & $sfullpath & $sfilename
  3483. WEnd
  3484. FileClose($hsearch)
  3485. If $sfilelist = "" Then Return SetError(4, 0, 0)
  3486. Return StringSplit(StringTrimLeft($sfilelist, 1), $sdelimiter)
  3487. EndFunc
  3488.  
  3489. Func _filelisttoarrayrec($sfilepath, $smask = "*", $ireturn = $fltar_filesfolders, $irecur = $fltar_norecur, $isort = $fltar_nosort, $ireturnpath = $fltar_relpath)
  3490. If NOT FileExists($sfilepath) Then Return SetError(1, 1, "")
  3491. If $smask = Default Then $smask = "*"
  3492. If $ireturn = Default Then $ireturn = $fltar_filesfolders
  3493. If $irecur = Default Then $irecur = $fltar_norecur
  3494. If $isort = Default Then $isort = $fltar_nosort
  3495. If $ireturnpath = Default Then $ireturnpath = $fltar_relpath
  3496. If $irecur > 1 OR NOT IsInt($irecur) Then Return SetError(1, 6, "")
  3497. Local $blongpath = False
  3498. If StringLeft($sfilepath, 4) == "\\?\" Then
  3499. $blongpath = True
  3500. EndIf
  3501. Local $sfolderslash = ""
  3502. If StringRight($sfilepath, 1) = "\" Then
  3503. $sfolderslash = "\"
  3504. Else
  3505. $sfilepath = $sfilepath & "\"
  3506. EndIf
  3507. Local $asfoldersearchlist[100] = [1]
  3508. $asfoldersearchlist[1] = $sfilepath
  3509. Local $ihide_hs = 0, $shide_hs = ""
  3510. If BitAND($ireturn, 4) Then
  3511. $ihide_hs += 2
  3512. $shide_hs &= "H"
  3513. $ireturn -= 4
  3514. EndIf
  3515. If BitAND($ireturn, 8) Then
  3516. $ihide_hs += 4
  3517. $shide_hs &= "S"
  3518. $ireturn -= 8
  3519. EndIf
  3520. Local $ihide_link = 0
  3521. If BitAND($ireturn, 16) Then
  3522. $ihide_link = 1024
  3523. $ireturn -= 16
  3524. EndIf
  3525. Local $imaxlevel = 0
  3526. If $irecur < 0 Then
  3527. StringReplace($sfilepath, "\", "", 0, $str_nocasesensebasic)
  3528. $imaxlevel = @extended - $irecur
  3529. EndIf
  3530. Local $sexclude_list = "", $sexclude_list_folder = "", $sinclude_list = "*"
  3531. Local $amasksplit = StringSplit($smask, "|")
  3532. Switch $amasksplit[0]
  3533. Case 3
  3534. $sexclude_list_folder = $amasksplit[3]
  3535. ContinueCase
  3536. Case 2
  3537. $sexclude_list = $amasksplit[2]
  3538. ContinueCase
  3539. Case 1
  3540. $sinclude_list = $amasksplit[1]
  3541. EndSwitch
  3542. Local $sinclude_file_mask = ".+"
  3543. If $sinclude_list <> "*" Then
  3544. If NOT __fltar_listtomask($sinclude_file_mask, $sinclude_list) Then Return SetError(1, 2, "")
  3545. EndIf
  3546. Local $sinclude_folder_mask = ".+"
  3547. Switch $ireturn
  3548. Case 0
  3549. Switch $irecur
  3550. Case 0
  3551. $sinclude_folder_mask = $sinclude_file_mask
  3552. EndSwitch
  3553. Case 2
  3554. $sinclude_folder_mask = $sinclude_file_mask
  3555. EndSwitch
  3556. Local $sexclude_file_mask = ":"
  3557. If $sexclude_list <> "" Then
  3558. If NOT __fltar_listtomask($sexclude_file_mask, $sexclude_list) Then Return SetError(1, 3, "")
  3559. EndIf
  3560. Local $sexclude_folder_mask = ":"
  3561. If $irecur Then
  3562. If $sexclude_list_folder Then
  3563. If NOT __fltar_listtomask($sexclude_folder_mask, $sexclude_list_folder) Then Return SetError(1, 4, "")
  3564. EndIf
  3565. If $ireturn = 2 Then
  3566. $sexclude_folder_mask = $sexclude_file_mask
  3567. EndIf
  3568. Else
  3569. $sexclude_folder_mask = $sexclude_file_mask
  3570. EndIf
  3571. If NOT ($ireturn = 0 OR $ireturn = 1 OR $ireturn = 2) Then Return SetError(1, 5, "")
  3572. If NOT ($isort = 0 OR $isort = 1 OR $isort = 2) Then Return SetError(1, 7, "")
  3573. If NOT ($ireturnpath = 0 OR $ireturnpath = 1 OR $ireturnpath = 2) Then Return SetError(1, 8, "")
  3574. If $ihide_link Then
  3575. Local $tfile_data = DllStructCreate("struct;align 4;dword FileAttributes;uint64 CreationTime;uint64 LastAccessTime;uint64 LastWriteTime;" & "dword FileSizeHigh;dword FileSizeLow;dword Reserved0;dword Reserved1;wchar FileName[260];wchar AlternateFileName[14];endstruct")
  3576. Local $hdll = DllOpen("kernel32.dll"), $adll_ret
  3577. EndIf
  3578. Local $asreturnlist[100] = [0]
  3579. Local $asfilematchlist = $asreturnlist, $asrootfilematchlist = $asreturnlist, $asfoldermatchlist = $asreturnlist
  3580. Local $bfolder = False, $hsearch = 0, $scurrentpath = "", $sname = "", $sretpath = ""
  3581. Local $iattribs = 0, $sattribs = ""
  3582. Local $asfolderfilesectionlist[100][2] = [[0, 0]]
  3583. While $asfoldersearchlist[0] > 0
  3584. $scurrentpath = $asfoldersearchlist[$asfoldersearchlist[0]]
  3585. $asfoldersearchlist[0] -= 1
  3586. Switch $ireturnpath
  3587. Case 1
  3588. $sretpath = StringReplace($scurrentpath, $sfilepath, "")
  3589. Case 2
  3590. If $blongpath Then
  3591. $sretpath = StringTrimLeft($scurrentpath, 4)
  3592. Else
  3593. $sretpath = $scurrentpath
  3594. EndIf
  3595. EndSwitch
  3596. If $ihide_link Then
  3597. $adll_ret = DllCall($hdll, "handle", "FindFirstFileW", "wstr", $scurrentpath & "*", "struct*", $tfile_data)
  3598. If @error OR NOT $adll_ret[0] Then
  3599. ContinueLoop
  3600. EndIf
  3601. $hsearch = $adll_ret[0]
  3602. Else
  3603. $hsearch = FileFindFirstFile($scurrentpath & "*")
  3604. If $hsearch = -1 Then
  3605. ContinueLoop
  3606. EndIf
  3607. EndIf
  3608. If $ireturn = 0 AND $isort AND $ireturnpath Then
  3609. __fltar_addtolist($asfolderfilesectionlist, $sretpath, $asfilematchlist[0] + 1)
  3610. EndIf
  3611. $sattribs = ""
  3612. While 1
  3613. If $ihide_link Then
  3614. $adll_ret = DllCall($hdll, "int", "FindNextFileW", "handle", $hsearch, "struct*", $tfile_data)
  3615. If @error OR NOT $adll_ret[0] Then
  3616. ExitLoop
  3617. EndIf
  3618. $sname = DllStructGetData($tfile_data, "FileName")
  3619. If $sname = ".." Then
  3620. ContinueLoop
  3621. EndIf
  3622. $iattribs = DllStructGetData($tfile_data, "FileAttributes")
  3623. If $ihide_hs AND BitAND($iattribs, $ihide_hs) Then
  3624. ContinueLoop
  3625. EndIf
  3626. If BitAND($iattribs, $ihide_link) Then
  3627. ContinueLoop
  3628. EndIf
  3629. $bfolder = False
  3630. If BitAND($iattribs, 16) Then
  3631. $bfolder = True
  3632. EndIf
  3633. Else
  3634. $bfolder = False
  3635. $sname = FileFindNextFile($hsearch, 1)
  3636. If @error Then
  3637. ExitLoop
  3638. EndIf
  3639. $sattribs = @extended
  3640. If StringInStr($sattribs, "D") Then
  3641. $bfolder = True
  3642. EndIf
  3643. If StringRegExp($sattribs, "[" & $shide_hs & "]") Then
  3644. ContinueLoop
  3645. EndIf
  3646. EndIf
  3647. If $bfolder Then
  3648. Select
  3649. Case $irecur < 0
  3650. StringReplace($scurrentpath, "\", "", 0, $str_nocasesensebasic)
  3651. If @extended < $imaxlevel Then
  3652. ContinueCase
  3653. EndIf
  3654. Case $irecur = 1
  3655. If NOT StringRegExp($sname, $sexclude_folder_mask) Then
  3656. __fltar_addtolist($asfoldersearchlist, $scurrentpath & $sname & "\")
  3657. EndIf
  3658. EndSelect
  3659. EndIf
  3660. If $isort Then
  3661. If $bfolder Then
  3662. If StringRegExp($sname, $sinclude_folder_mask) AND NOT StringRegExp($sname, $sexclude_folder_mask) Then
  3663. __fltar_addtolist($asfoldermatchlist, $sretpath & $sname & $sfolderslash)
  3664. EndIf
  3665. Else
  3666. If StringRegExp($sname, $sinclude_file_mask) AND NOT StringRegExp($sname, $sexclude_file_mask) Then
  3667. If $scurrentpath = $sfilepath Then
  3668. __fltar_addtolist($asrootfilematchlist, $sretpath & $sname)
  3669. Else
  3670. __fltar_addtolist($asfilematchlist, $sretpath & $sname)
  3671. EndIf
  3672. EndIf
  3673. EndIf
  3674. Else
  3675. If $bfolder Then
  3676. If $ireturn <> 1 AND StringRegExp($sname, $sinclude_folder_mask) AND NOT StringRegExp($sname, $sexclude_folder_mask) Then
  3677. __fltar_addtolist($asreturnlist, $sretpath & $sname & $sfolderslash)
  3678. EndIf
  3679. Else
  3680. If $ireturn <> 2 AND StringRegExp($sname, $sinclude_file_mask) AND NOT StringRegExp($sname, $sexclude_file_mask) Then
  3681. __fltar_addtolist($asreturnlist, $sretpath & $sname)
  3682. EndIf
  3683. EndIf
  3684. EndIf
  3685. WEnd
  3686. If $ihide_link Then
  3687. DllCall($hdll, "int", "FindClose", "ptr", $hsearch)
  3688. Else
  3689. FileClose($hsearch)
  3690. EndIf
  3691. WEnd
  3692. If $ihide_link Then
  3693. DllClose($hdll)
  3694. EndIf
  3695. If $isort Then
  3696. Switch $ireturn
  3697. Case 2
  3698. If $asfoldermatchlist[0] = 0 Then Return SetError(1, 9, "")
  3699. ReDim $asfoldermatchlist[$asfoldermatchlist[0] + 1]
  3700. $asreturnlist = $asfoldermatchlist
  3701. __arraydualpivotsort($asreturnlist, 1, $asreturnlist[0])
  3702. Case 1
  3703. If $asrootfilematchlist[0] = 0 AND $asfilematchlist[0] = 0 Then Return SetError(1, 9, "")
  3704. If $ireturnpath = 0 Then
  3705. __fltar_addfilelists($asreturnlist, $asrootfilematchlist, $asfilematchlist)
  3706. __arraydualpivotsort($asreturnlist, 1, $asreturnlist[0])
  3707. Else
  3708. __fltar_addfilelists($asreturnlist, $asrootfilematchlist, $asfilematchlist, 1)
  3709. EndIf
  3710. Case 0
  3711. If $asrootfilematchlist[0] = 0 AND $asfoldermatchlist[0] = 0 Then Return SetError(1, 9, "")
  3712. If $ireturnpath = 0 Then
  3713. __fltar_addfilelists($asreturnlist, $asrootfilematchlist, $asfilematchlist)
  3714. $asreturnlist[0] += $asfoldermatchlist[0]
  3715. ReDim $asfoldermatchlist[$asfoldermatchlist[0] + 1]
  3716. _arrayconcatenate($asreturnlist, $asfoldermatchlist, 1)
  3717. __arraydualpivotsort($asreturnlist, 1, $asreturnlist[0])
  3718. Else
  3719. Local $asreturnlist[$asfilematchlist[0] + $asrootfilematchlist[0] + $asfoldermatchlist[0] + 1]
  3720. $asreturnlist[0] = $asfilematchlist[0] + $asrootfilematchlist[0] + $asfoldermatchlist[0]
  3721. __arraydualpivotsort($asrootfilematchlist, 1, $asrootfilematchlist[0])
  3722. For $i = 1 To $asrootfilematchlist[0]
  3723. $asreturnlist[$i] = $asrootfilematchlist[$i]
  3724. Next
  3725. Local $inextinsertionindex = $asrootfilematchlist[0] + 1
  3726. __arraydualpivotsort($asfoldermatchlist, 1, $asfoldermatchlist[0])
  3727. Local $sfoldertofind = ""
  3728. For $i = 1 To $asfoldermatchlist[0]
  3729. $asreturnlist[$inextinsertionindex] = $asfoldermatchlist[$i]
  3730. $inextinsertionindex += 1
  3731. If $sfolderslash Then
  3732. $sfoldertofind = $asfoldermatchlist[$i]
  3733. Else
  3734. $sfoldertofind = $asfoldermatchlist[$i] & "\"
  3735. EndIf
  3736. Local $ifilesectionendindex = 0, $ifilesectionstartindex = 0
  3737. For $j = 1 To $asfolderfilesectionlist[0][0]
  3738. If $sfoldertofind = $asfolderfilesectionlist[$j][0] Then
  3739. $ifilesectionstartindex = $asfolderfilesectionlist[$j][1]
  3740. If $j = $asfolderfilesectionlist[0][0] Then
  3741. $ifilesectionendindex = $asfilematchlist[0]
  3742. Else
  3743. $ifilesectionendindex = $asfolderfilesectionlist[$j + 1][1] - 1
  3744. EndIf
  3745. If $isort = 1 Then
  3746. __arraydualpivotsort($asfilematchlist, $ifilesectionstartindex, $ifilesectionendindex)
  3747. EndIf
  3748. For $k = $ifilesectionstartindex To $ifilesectionendindex
  3749. $asreturnlist[$inextinsertionindex] = $asfilematchlist[$k]
  3750. $inextinsertionindex += 1
  3751. Next
  3752. ExitLoop
  3753. EndIf
  3754. Next
  3755. Next
  3756. EndIf
  3757. EndSwitch
  3758. Else
  3759. If $asreturnlist[0] = 0 Then Return SetError(1, 9, "")
  3760. ReDim $asreturnlist[$asreturnlist[0] + 1]
  3761. EndIf
  3762. Return $asreturnlist
  3763. EndFunc
  3764.  
  3765. Func __fltar_addfilelists(ByRef $astarget, $assource_1, $assource_2, $isort = 0)
  3766. ReDim $assource_1[$assource_1[0] + 1]
  3767. If $isort = 1 Then __arraydualpivotsort($assource_1, 1, $assource_1[0])
  3768. $astarget = $assource_1
  3769. $astarget[0] += $assource_2[0]
  3770. ReDim $assource_2[$assource_2[0] + 1]
  3771. If $isort = 1 Then __arraydualpivotsort($assource_2, 1, $assource_2[0])
  3772. _arrayconcatenate($astarget, $assource_2, 1)
  3773. EndFunc
  3774.  
  3775. Func __fltar_addtolist(ByRef $alist, $vvalue_0, $vvalue_1 = -1)
  3776. If $vvalue_1 = -1 Then
  3777. $alist[0] += 1
  3778. If UBound($alist) <= $alist[0] Then ReDim $alist[UBound($alist) * 2]
  3779. $alist[$alist[0]] = $vvalue_0
  3780. Else
  3781. $alist[0][0] += 1
  3782. If UBound($alist) <= $alist[0][0] Then ReDim $alist[UBound($alist) * 2][2]
  3783. $alist[$alist[0][0]][0] = $vvalue_0
  3784. $alist[$alist[0][0]][1] = $vvalue_1
  3785. EndIf
  3786. EndFunc
  3787.  
  3788. Func __fltar_listtomask(ByRef $smask, $slist)
  3789. If StringRegExp($slist, "\\|/|:|\<|\>|\|") Then Return 0
  3790. $slist = StringReplace(StringStripWS(StringRegExpReplace($slist, "\s*;\s*", ";"), $str_stripleading + $str_striptrailing), ";", "|")
  3791. $slist = StringReplace(StringReplace(StringRegExpReplace($slist, "[][$^.{}()+\-]", "\\$0"), "?", "."), "*", ".*?")
  3792. $smask = "(?i)^(" & $slist & ")\z"
  3793. Return 1
  3794. EndFunc
  3795.  
  3796. Func _fileprint($sfilepath, $ishow = @SW_HIDE)
  3797. If $ishow = Default Then $ishow = @SW_HIDE
  3798. Return ShellExecute($sfilepath, "", @WorkingDir, "print", $ishow)
  3799. EndFunc
  3800.  
  3801. Func _filereadtoarray($sfilepath, ByRef $vreturn, $iflags = $frta_count, $sdelimiter = "")
  3802. $vreturn = 0
  3803. If $iflags = Default Then $iflags = $frta_count
  3804. If $sdelimiter = Default Then $sdelimiter = ""
  3805. Local $bexpand = True
  3806. If BitAND($iflags, $frta_intarrays) Then
  3807. $bexpand = False
  3808. $iflags -= $frta_intarrays
  3809. EndIf
  3810. Local $ientire = $str_chrsplit
  3811. If BitAND($iflags, $frta_entiresplit) Then
  3812. $ientire = $str_entiresplit
  3813. $iflags -= $frta_entiresplit
  3814. EndIf
  3815. Local $inocount = 0
  3816. If $iflags <> $frta_count Then
  3817. $iflags = $frta_nocount
  3818. $inocount = $str_nocount
  3819. EndIf
  3820. If $sdelimiter Then
  3821. Local $alines = FILEREADTOARRAY($sfilepath)
  3822. If @error Then Return SetError(@error, 0, 0)
  3823. Local $idim_1 = UBound($alines) + $iflags
  3824. If $bexpand Then
  3825. Local $idim_2 = UBound(StringSplit($alines[0], $sdelimiter, $ientire + $str_nocount))
  3826. Local $atemp_array[$idim_1][$idim_2]
  3827. Local $ifields, $asplit
  3828. For $i = 0 To $idim_1 - $iflags - 1
  3829. $asplit = StringSplit($alines[$i], $sdelimiter, $ientire + $str_nocount)
  3830. $ifields = UBound($asplit)
  3831. If $ifields <> $idim_2 Then
  3832. Return SetError(3, 0, 0)
  3833. EndIf
  3834. For $j = 0 To $ifields - 1
  3835. $atemp_array[$i + $iflags][$j] = $asplit[$j]
  3836. Next
  3837. Next
  3838. If $idim_2 < 2 Then Return SetError(4, 0, 0)
  3839. If $iflags Then
  3840. $atemp_array[0][0] = $idim_1 - $iflags
  3841. $atemp_array[0][1] = $idim_2
  3842. EndIf
  3843. Else
  3844. Local $atemp_array[$idim_1]
  3845. For $i = 0 To $idim_1 - $iflags - 1
  3846. $atemp_array[$i + $iflags] = StringSplit($alines[$i], $sdelimiter, $ientire + $inocount)
  3847. Next
  3848. If $iflags Then
  3849. $atemp_array[0] = $idim_1 - $iflags
  3850. EndIf
  3851. EndIf
  3852. $vreturn = $atemp_array
  3853. Else
  3854. If $iflags Then
  3855. Local $hfileopen = FileOpen($sfilepath, $fo_read)
  3856. If $hfileopen = -1 Then Return SetError(1, 0, 0)
  3857. Local $sfileread = FileRead($hfileopen)
  3858. FileClose($hfileopen)
  3859. If StringLen($sfileread) Then
  3860. $vreturn = StringRegExp(@LF & $sfileread, "(?|(\N+)\z|(\N*)(?:\R))", 3)
  3861. $vreturn[0] = UBound($vreturn) - 1
  3862. Else
  3863. Return SetError(2, 0, 0)
  3864. EndIf
  3865. Else
  3866. $vreturn = FILEREADTOARRAY($sfilepath)
  3867. If @error Then
  3868. $vreturn = 0
  3869. Return SetError(@error, 0, 0)
  3870. EndIf
  3871. EndIf
  3872. EndIf
  3873. Return 1
  3874. EndFunc
  3875.  
  3876. Func _filewritefromarray($sfilepath, Const ByRef $aarray, $ibase = Default, $iubound = Default, $sdelimiter = "|")
  3877. Local $ireturn = 0
  3878. If NOT IsArray($aarray) Then Return SetError(2, 0, $ireturn)
  3879. Local $idims = UBound($aarray, $ubound_dimensions)
  3880. If $idims > 2 Then Return SetError(4, 0, 0)
  3881. Local $ilast = UBound($aarray) - 1
  3882. If $iubound = Default OR $iubound > $ilast Then $iubound = $ilast
  3883. If $ibase < 0 OR $ibase = Default Then $ibase = 0
  3884. If $ibase > $iubound Then Return SetError(5, 0, $ireturn)
  3885. If $sdelimiter = Default Then $sdelimiter = "|"
  3886. Local $hfileopen = $sfilepath
  3887. If IsString($sfilepath) Then
  3888. $hfileopen = FileOpen($sfilepath, $fo_overwrite)
  3889. If $hfileopen = -1 Then Return SetError(1, 0, $ireturn)
  3890. EndIf
  3891. Local $ierror = 0
  3892. $ireturn = 1
  3893. Switch $idims
  3894. Case 1
  3895. For $i = $ibase To $iubound
  3896. If NOT FileWrite($hfileopen, $aarray[$i] & @CRLF) Then
  3897. $ierror = 3
  3898. $ireturn = 0
  3899. ExitLoop
  3900. EndIf
  3901. Next
  3902. Case 2
  3903. Local $stemp = ""
  3904. For $i = $ibase To $iubound
  3905. $stemp = $aarray[$i][0]
  3906. For $j = 1 To UBound($aarray, $ubound_columns) - 1
  3907. $stemp &= $sdelimiter & $aarray[$i][$j]
  3908. Next
  3909. If NOT FileWrite($hfileopen, $stemp & @CRLF) Then
  3910. $ierror = 3
  3911. $ireturn = 0
  3912. ExitLoop
  3913. EndIf
  3914. Next
  3915. EndSwitch
  3916. If IsString($sfilepath) Then FileClose($hfileopen)
  3917. Return SetError($ierror, 0, $ireturn)
  3918. EndFunc
  3919.  
  3920. Func _filewritelog($slogpath, $slogmsg, $iflag = -1)
  3921. Local $iopenmode = $fo_append
  3922. Local $sdatenow = @YEAR & "-" & @MON & "-" & @MDAY
  3923. Local $stimenow = @HOUR & ":" & @MIN & ":" & @SEC
  3924. Local $smsg = $sdatenow & " " & $stimenow & " : " & $slogmsg
  3925. If $iflag = Default Then $iflag = -1
  3926. If $iflag <> -1 Then
  3927. $iopenmode = $fo_overwrite
  3928. $smsg &= @CRLF & FileRead($slogpath)
  3929. EndIf
  3930. Local $hfileopen = $slogpath
  3931. If IsString($slogpath) Then
  3932. $hfileopen = FileOpen($slogpath, $iopenmode)
  3933. EndIf
  3934. If $hfileopen = -1 Then Return SetError(1, 0, 0)
  3935. Local $ireturn = FileWriteLine($hfileopen, $smsg)
  3936. If IsString($slogpath) Then $ireturn = FileClose($hfileopen)
  3937. If $ireturn <= 0 Then Return SetError(2, $ireturn, 0)
  3938. Return $ireturn
  3939. EndFunc
  3940.  
  3941. Func _filewritetoline($sfilepath, $iline, $stext, $boverwrite = False)
  3942. If $iline <= 0 Then Return SetError(4, 0, 0)
  3943. If NOT IsString($stext) Then
  3944. $stext = String($stext)
  3945. If $stext = "" Then Return SetError(6, 0, 0)
  3946. EndIf
  3947. If $boverwrite = Default Then $boverwrite = False
  3948. If NOT (IsBool($boverwrite) OR $boverwrite = 0 OR $boverwrite = 1) Then Return SetError(5, 0, 0)
  3949. If NOT FileExists($sfilepath) Then Return SetError(2, 0, 0)
  3950. Local $aarray = FILEREADTOARRAY($sfilepath)
  3951. Local $iubound = UBound($aarray) - 1
  3952. If ($iubound + 1) < $iline Then Return SetError(1, 0, 0)
  3953. Local $hfileopen = FileOpen($sfilepath, FileGetEncoding($sfilepath) + $fo_overwrite)
  3954. If $hfileopen = -1 Then Return SetError(3, 0, 0)
  3955. Local $sdata = ""
  3956. $iline -= 1
  3957. For $i = 0 To $iubound
  3958. If $i = $iline Then
  3959. If $boverwrite Then
  3960. If $stext Then $sdata &= $stext & @CRLF
  3961. Else
  3962. $sdata &= $stext & @CRLF & $aarray[$i] & @CRLF
  3963. EndIf
  3964. ElseIf $i < $iubound Then
  3965. $sdata &= $aarray[$i] & @CRLF
  3966. ElseIf $i = $iubound Then
  3967. $sdata &= $aarray[$i]
  3968. EndIf
  3969. Next
  3970. FileWrite($hfileopen, $sdata)
  3971. FileClose($hfileopen)
  3972. Return 1
  3973. EndFunc
  3974.  
  3975. Func _pathfull($srelativepath, $sbasepath = @WorkingDir)
  3976. If NOT $srelativepath OR $srelativepath = "." Then Return $sbasepath
  3977. Local $sfullpath = StringReplace($srelativepath, "/", "\")
  3978. Local Const $sfullpathconst = $sfullpath
  3979. Local $spath
  3980. Local $brootonly = StringLeft($sfullpath, 1) = "\" AND StringMid($sfullpath, 2, 1) <> "\"
  3981. If $sbasepath = Default Then $sbasepath = @WorkingDir
  3982. For $i = 1 To 2
  3983. $spath = StringLeft($sfullpath, 2)
  3984. If $spath = "\\" Then
  3985. $sfullpath = StringTrimLeft($sfullpath, 2)
  3986. Local $nserverlen = StringInStr($sfullpath, "\") - 1
  3987. $spath = "\\" & StringLeft($sfullpath, $nserverlen)
  3988. $sfullpath = StringTrimLeft($sfullpath, $nserverlen)
  3989. ExitLoop
  3990. ElseIf StringRight($spath, 1) = ":" Then
  3991. $sfullpath = StringTrimLeft($sfullpath, 2)
  3992. ExitLoop
  3993. Else
  3994. $sfullpath = $sbasepath & "\" & $sfullpath
  3995. EndIf
  3996. Next
  3997. If StringLeft($sfullpath, 1) <> "\" Then
  3998. If StringLeft($sfullpathconst, 2) = StringLeft($sbasepath, 2) Then
  3999. $sfullpath = $sbasepath & "\" & $sfullpath
  4000. Else
  4001. $sfullpath = "\" & $sfullpath
  4002. EndIf
  4003. EndIf
  4004. Local $atemp = StringSplit($sfullpath, "\")
  4005. Local $apathparts[$atemp[0]], $j = 0
  4006. For $i = 2 To $atemp[0]
  4007. If $atemp[$i] = ".." Then
  4008. If $j Then $j -= 1
  4009. ElseIf NOT ($atemp[$i] = "" AND $i <> $atemp[0]) AND $atemp[$i] <> "." Then
  4010. $apathparts[$j] = $atemp[$i]
  4011. $j += 1
  4012. EndIf
  4013. Next
  4014. $sfullpath = $spath
  4015. If NOT $brootonly Then
  4016. For $i = 0 To $j - 1
  4017. $sfullpath &= "\" & $apathparts[$i]
  4018. Next
  4019. Else
  4020. $sfullpath &= $sfullpathconst
  4021. If StringInStr($sfullpath, "..") Then $sfullpath = _pathfull($sfullpath)
  4022. EndIf
  4023. Do
  4024. $sfullpath = StringReplace($sfullpath, ".\", "\")
  4025. Until @extended = 0
  4026. Return $sfullpath
  4027. EndFunc
  4028.  
  4029. Func _pathgetrelative($sfrom, $sto)
  4030. If StringRight($sfrom, 1) <> "\" Then $sfrom &= "\"
  4031. If StringRight($sto, 1) <> "\" Then $sto &= "\"
  4032. If $sfrom = $sto Then Return SetError(1, 0, StringTrimRight($sto, 1))
  4033. Local $asfrom = StringSplit($sfrom, "\")
  4034. Local $asto = StringSplit($sto, "\")
  4035. If $asfrom[1] <> $asto[1] Then Return SetError(2, 0, StringTrimRight($sto, 1))
  4036. Local $i = 2
  4037. Local $idiff = 1
  4038. While 1
  4039. If $asfrom[$i] <> $asto[$i] Then
  4040. $idiff = $i
  4041. ExitLoop
  4042. EndIf
  4043. $i += 1
  4044. WEnd
  4045. $i = 1
  4046. Local $srelpath = ""
  4047. For $j = 1 To $asto[0]
  4048. If $i >= $idiff Then
  4049. $srelpath &= "\" & $asto[$i]
  4050. EndIf
  4051. $i += 1
  4052. Next
  4053. $srelpath = StringTrimLeft($srelpath, 1)
  4054. $i = 1
  4055. For $j = 1 To $asfrom[0]
  4056. If $i > $idiff Then
  4057. $srelpath = "..\" & $srelpath
  4058. EndIf
  4059. $i += 1
  4060. Next
  4061. If StringRight($srelpath, 1) == "\" Then $srelpath = StringTrimRight($srelpath, 1)
  4062. Return $srelpath
  4063. EndFunc
  4064.  
  4065. Func _pathmake($sdrive, $sdir, $sfilename, $sextension)
  4066. If StringLen($sdrive) Then
  4067. If NOT (StringLeft($sdrive, 2) = "\\") Then $sdrive = StringLeft($sdrive, 1) & ":"
  4068. EndIf
  4069. If StringLen($sdir) Then
  4070. If NOT (StringRight($sdir, 1) = "\") AND NOT (StringRight($sdir, 1) = "/") Then $sdir = $sdir & "\"
  4071. Else
  4072. $sdir = "\"
  4073. EndIf
  4074. If StringLen($sdir) Then
  4075. If NOT (StringLeft($sdir, 1) = "\") AND NOT (StringLeft($sdir, 1) = "/") Then $sdir = "\" & $sdir
  4076. EndIf
  4077. If StringLen($sextension) Then
  4078. If NOT (StringLeft($sextension, 1) = ".") Then $sextension = "." & $sextension
  4079. EndIf
  4080. Return $sdrive & $sdir & $sfilename & $sextension
  4081. EndFunc
  4082.  
  4083. Func _pathsplit($sfilepath, ByRef $sdrive, ByRef $sdir, ByRef $sfilename, ByRef $sextension)
  4084. Local $aarray = StringRegExp($sfilepath, "^\h*((?:\\\\\?\\)*(\\\\[^\?\/\\]+|[A-Za-z]:)?(.*[\/\\]\h*)?((?:[^\.\/\\]|(?(?=\.[^\/\\]*\.)\.))*)?([^\/\\]*))$", $str_regexparraymatch)
  4085. If @error Then
  4086. ReDim $aarray[5]
  4087. $aarray[0] = $sfilepath
  4088. EndIf
  4089. $sdrive = $aarray[1]
  4090. If StringLeft($aarray[2], 1) == "/" Then
  4091. $sdir = StringRegExpReplace($aarray[2], "\h*[\/\\]+\h*", "\/")
  4092. Else
  4093. $sdir = StringRegExpReplace($aarray[2], "\h*[\/\\]+\h*", "\\")
  4094. EndIf
  4095. $aarray[2] = $sdir
  4096. $sfilename = $aarray[3]
  4097. $sextension = $aarray[4]
  4098. Return $aarray
  4099. EndFunc
  4100.  
  4101. Func _replacestringinfile($sfilepath, $ssearchstring, $sreplacestring, $icasesensitive = 0, $ioccurance = 1)
  4102. If StringInStr(FileGetAttrib($sfilepath), "R") Then Return SetError(1, 0, -1)
  4103. Local $hfileopen = FileOpen($sfilepath, $fo_read)
  4104. If $hfileopen = -1 Then Return SetError(2, 0, -1)
  4105. Local $sfileread = FileRead($hfileopen)
  4106. FileClose($hfileopen)
  4107. If $icasesensitive = Default Then $icasesensitive = 0
  4108. If $ioccurance = Default Then $ioccurance = 1
  4109. $sfileread = StringReplace($sfileread, $ssearchstring, $sreplacestring, 1 - $ioccurance, $icasesensitive)
  4110. Local $ireturn = @extended
  4111. If $ireturn Then
  4112. Local $ifileencoding = FileGetEncoding($sfilepath)
  4113. $hfileopen = FileOpen($sfilepath, $ifileencoding + $fo_overwrite)
  4114. If $hfileopen = -1 Then Return SetError(3, 0, -1)
  4115. FileWrite($hfileopen, $sfileread)
  4116. FileClose($hfileopen)
  4117. EndIf
  4118. Return $ireturn
  4119. EndFunc
  4120.  
  4121. Func _tempfile($sdirectoryname = @TempDir, $sfileprefix = "~", $sfileextension = ".tmp", $irandomlength = 7)
  4122. If $irandomlength = Default OR $irandomlength <= 0 Then $irandomlength = 7
  4123. If $sdirectoryname = Default OR (NOT FileExists($sdirectoryname)) Then $sdirectoryname = @TempDir
  4124. If $sfileextension = Default Then $sfileextension = ".tmp"
  4125. If $sfileprefix = Default Then $sfileprefix = "~"
  4126. If NOT FileExists($sdirectoryname) Then $sdirectoryname = @ScriptDir
  4127. $sdirectoryname = StringRegExpReplace($sdirectoryname, "[\\/]+$", "")
  4128. $sfileextension = StringRegExpReplace($sfileextension, "^\.+", "")
  4129. $sfileprefix = StringRegExpReplace($sfileprefix, '[\\/:*?"<>|]', "")
  4130. Local $stempname = ""
  4131. Do
  4132. $stempname = ""
  4133. While StringLen($stempname) < $irandomlength
  4134. $stempname &= Chr(Random(97, 122, 1))
  4135. WEnd
  4136. $stempname = $sdirectoryname & "\" & $sfileprefix & $stempname & "." & $sfileextension
  4137. Until NOT FileExists($stempname)
  4138. Return $stempname
  4139. EndFunc
  4140.  
  4141. Global Const $dllver_platform_windows = 1
  4142. Global Const $dllver_platform_nt = 2
  4143. Global Const $shcne_allevents = 2147483647
  4144. Global Const $shcne_assocchanged = 134217728
  4145. Global Const $shcne_attributes = 2048
  4146. Global Const $shcne_create = 2
  4147. Global Const $shcne_delete = 4
  4148. Global Const $shcne_driveadd = 256
  4149. Global Const $shcne_driveaddgui = 65536
  4150. Global Const $shcne_driveremoved = 128
  4151. Global Const $shcne_extended_event = 67108864
  4152. Global Const $shcne_freespace = 262144
  4153. Global Const $shcne_mediainserted = 32
  4154. Global Const $shcne_mediaremoved = 64
  4155. Global Const $shcne_mkdir = 8
  4156. Global Const $shcne_netshare = 512
  4157. Global Const $shcne_netunshare = 1024
  4158. Global Const $shcne_renamefolder = 131072
  4159. Global Const $shcne_renameitem = 1
  4160. Global Const $shcne_rmdir = 16
  4161. Global Const $shcne_serverdisconnect = 16384
  4162. Global Const $shcne_updatedir = 4096
  4163. Global Const $shcne_updateimage = 32768
  4164. Global Const $shcne_updateitem = 8192
  4165. Global Const $shcne_diskevents = 145439
  4166. Global Const $shcne_globalevents = 201687520
  4167. Global Const $shcne_interrupt = -2147483648
  4168. Global Const $shcnf_dword = 3
  4169. Global Const $shcnf_idlist = 0
  4170. Global Const $shcnf_path = 1
  4171. Global Const $shcnf_printer = 2
  4172. Global Const $shcnf_flush = 4096
  4173. Global Const $shcnf_flushnowait = 8192
  4174. Global Const $shcnf_notifyrecursive = 65536
  4175. Global Const $shcnrf_interruptlevel = 1
  4176. Global Const $shcnrf_shelllevel = 2
  4177. Global Const $shcnrf_recursiveinterrupt = 4096
  4178. Global Const $shcnrf_newdelivery = 32768
  4179. Global Const $sherb_noconfirmation = 1
  4180. Global Const $sherb_noprogressui = 2
  4181. Global Const $sherb_nosound = 4
  4182. Global Const $sherb_no_ui = BitOR($sherb_noconfirmation, $sherb_noprogressui, $sherb_nosound)
  4183. Global Const $see_mask_default = 0
  4184. Global Const $see_mask_classname = 1
  4185. Global Const $see_mask_classkey = 3
  4186. Global Const $see_mask_idlist = 4
  4187. Global Const $see_mask_invokeidlist = 12
  4188. Global Const $see_mask_icon = 16
  4189. Global Const $see_mask_hotkey = 32
  4190. Global Const $see_mask_nocloseprocess = 64
  4191. Global Const $see_mask_connectnetdrv = 128
  4192. Global Const $see_mask_noasync = 256
  4193. Global Const $see_mask_flag_ddewait = $see_mask_noasync
  4194. Global Const $see_mask_doenvsubst = 512
  4195. Global Const $see_mask_flag_no_ui = 1024
  4196. Global Const $see_mask_unicode = 16384
  4197. Global Const $see_mask_no_console = 32768
  4198. Global Const $see_mask_asyncok = 1048576
  4199. Global Const $see_mask_noqueryclassstore = 16777216
  4200. Global Const $see_mask_hmonitor = 2097152
  4201. Global Const $see_mask_nozonechecks = 8388608
  4202. Global Const $see_mask_waitforinputidle = 33554432
  4203. Global Const $see_mask_flag_log_usage = 67108864
  4204. Global Const $se_err_accessdenied = 5
  4205. Global Const $se_err_associncomplete = 27
  4206. Global Const $se_err_ddebusy = 30
  4207. Global Const $se_err_ddefail = 29
  4208. Global Const $se_err_ddetimeout = 28
  4209. Global Const $se_err_dllnotfound = 32
  4210. Global Const $se_err_fnf = 2
  4211. Global Const $se_err_noassoc = 31
  4212. Global Const $se_err_oom = 8
  4213. Global Const $se_err_pnf = 3
  4214. Global Const $se_err_share = 26
  4215. Global Const $fo_copy = 2
  4216. Global Const $fo_delete = 3
  4217. Global Const $fo_move = 1
  4218. Global Const $fo_rename = 4
  4219. Global Const $fof_allowundo = 64
  4220. Global Const $fof_confirmmouse = 2
  4221. Global Const $fof_filesonly = 128
  4222. Global Const $fof_multidestfiles = 1
  4223. Global Const $fof_noconfirmation = 16
  4224. Global Const $fof_noconfirmmkdir = 512
  4225. Global Const $fof_no_connected_elements = 8192
  4226. Global Const $fof_nocopysecurityattribs = 2048
  4227. Global Const $fof_noerrorui = 1024
  4228. Global Const $fof_norecursereparse = 32768
  4229. Global Const $fof_norecursion = 4096
  4230. Global Const $fof_renameoncollision = 8
  4231. Global Const $fof_silent = 4
  4232. Global Const $fof_simpleprogress = 256
  4233. Global Const $fof_wantmappinghandle = 32
  4234. Global Const $fof_wantnukewarning = 16384
  4235. Global Const $fof_no_ui = BitOR($fof_noconfirmation, $fof_noconfirmmkdir, $fof_noerrorui, $fof_silent)
  4236. Global Const $shgfi_addoverlays = 32
  4237. Global Const $shgfi_attr_specified = 131072
  4238. Global Const $shgfi_attributes = 2048
  4239. Global Const $shgfi_displayname = 512
  4240. Global Const $shgfi_exetype = 8192
  4241. Global Const $shgfi_icon = 256
  4242. Global Const $shgfi_iconlocation = 4096
  4243. Global Const $shgfi_largeicon = 0
  4244. Global Const $shgfi_linkoverlay = 32768
  4245. Global Const $shgfi_openicon = 2
  4246. Global Const $shgfi_overlayindex = 64
  4247. Global Const $shgfi_pidl = 8
  4248. Global Const $shgfi_selected = 65536
  4249. Global Const $shgfi_shelliconsize = 4
  4250. Global Const $shgfi_smallicon = 1
  4251. Global Const $shgfi_sysiconindex = 16384
  4252. Global Const $shgfi_typename = 1024
  4253. Global Const $shgfi_usefileattributes = 16
  4254. Global Const $sfgao_cancopy = 1
  4255. Global Const $sfgao_canmove = 2
  4256. Global Const $sfgao_canlink = 4
  4257. Global Const $sfgao_storage = 8
  4258. Global Const $sfgao_canrename = 16
  4259. Global Const $sfgao_candelete = 32
  4260. Global Const $sfgao_haspropsheet = 64
  4261. Global Const $sfgao_droptarget = 256
  4262. Global Const $sfgao_capabilitymask = BitOR($sfgao_cancopy, $sfgao_canmove, $sfgao_canlink, $sfgao_canrename, $sfgao_candelete, $sfgao_haspropsheet, $sfgao_droptarget)
  4263. Global Const $sfgao_system = 4096
  4264. Global Const $sfgao_encrypted = 8192
  4265. Global Const $sfgao_isslow = 16384
  4266. Global Const $sfgao_ghosted = 32768
  4267. Global Const $sfgao_link = 65536
  4268. Global Const $sfgao_share = 131072
  4269. Global Const $sfgao_readonly = 262144
  4270. Global Const $sfgao_hidden = 524288
  4271. Global Const $sfgao_displayattrmask = BitOR($sfgao_isslow, $sfgao_ghosted, $sfgao_link, $sfgao_share, $sfgao_readonly, $sfgao_hidden)
  4272. Global Const $sfgao_nonenumerated = 1048576
  4273. Global Const $sfgao_newcontent = 2097152
  4274. Global Const $sfgao_stream = 4194304
  4275. Global Const $sfgao_storageancestor = 8388608
  4276. Global Const $sfgao_validate = 16777216
  4277. Global Const $sfgao_removable = 33554432
  4278. Global Const $sfgao_compressed = 67108864
  4279. Global Const $sfgao_browsable = 134217728
  4280. Global Const $sfgao_filesysancestor = 268435456
  4281. Global Const $sfgao_folder = 536870912
  4282. Global Const $sfgao_filesystem = 1073741824
  4283. Global Const $sfgao_storagecapmask = BitOR($sfgao_storage, $sfgao_link, $sfgao_readonly, $sfgao_stream, $sfgao_storageancestor, $sfgao_filesysancestor, $sfgao_folder, $sfgao_filesystem)
  4284. Global Const $sfgao_hassubfolder = -2147483648
  4285. Global Const $sfgao_contentsmask = $sfgao_hassubfolder
  4286. Global Const $sfgao_pkeysfgaomask = BitOR($sfgao_isslow, $sfgao_readonly, $sfgao_hassubfolder, $sfgao_validate)
  4287. Global Const $ido_shgioi_default = 268435452
  4288. Global Const $ido_shgioi_link = 268435454
  4289. Global Const $ido_shgioi_share = 268435455
  4290. Global Const $ido_shgioi_slowfile = 268435453
  4291. Global Const $fcsm_viewid = 1
  4292. Global Const $fcsm_webviewtemplate = 2
  4293. Global Const $fcsm_infotip = 4
  4294. Global Const $fcsm_clsid = 8
  4295. Global Const $fcsm_iconfile = 16
  4296. Global Const $fcsm_logo = 32
  4297. Global Const $fcsm_flags = 64
  4298. Global Const $fcs_read = 1
  4299. Global Const $fcs_forcewrite = 2
  4300. Global Const $fcs_write = BitOR($fcs_read, $fcs_forcewrite)
  4301. Global Const $ssf_autocheckselect = 8388608
  4302. Global Const $ssf_desktophtml = 512
  4303. Global Const $ssf_dontprettypath = 2048
  4304. Global Const $ssf_doubleclickinwebview = 128
  4305. Global Const $ssf_hideicons = 16384
  4306. Global Const $ssf_iconsonly = 16777216
  4307. Global Const $ssf_mapnetdrvbutton = 4096
  4308. Global Const $ssf_noconfirmrecycle = 32768
  4309. Global Const $ssf_nonetcrawling = 1048576
  4310. Global Const $ssf_sepprocess = 524288
  4311. Global Const $ssf_showallobjects = 1
  4312. Global Const $ssf_showcompcolor = 8
  4313. Global Const $ssf_showextensions = 2
  4314. Global Const $ssf_showinfotip = 8192
  4315. Global Const $ssf_showsuperhidden = 262144
  4316. Global Const $ssf_showsysfiles = 32
  4317. Global Const $ssf_showtypeoverlay = 33554432
  4318. Global Const $ssf_startpanelon = 2097152
  4319. Global Const $ssf_win95classic = 1024
  4320. Global Const $ssf_webview = 131072
  4321. Global Const $csidl_admintools = 48
  4322. Global Const $csidl_altstartup = 29
  4323. Global Const $csidl_appdata = 26
  4324. Global Const $csidl_bitbucket = 10
  4325. Global Const $csidl_cdburn_area = 59
  4326. Global Const $csidl_common_admintools = 47
  4327. Global Const $csidl_common_altstartup = 30
  4328. Global Const $csidl_common_appdata = 35
  4329. Global Const $csidl_common_desktopdirectory = 25
  4330. Global Const $csidl_common_documents = 46
  4331. Global Const $csidl_common_favorites = 31
  4332. Global Const $csidl_common_music = 53
  4333. Global Const $csidl_common_pictures = 54
  4334. Global Const $csidl_common_programs = 23
  4335. Global Const $csidl_common_startmenu = 22
  4336. Global Const $csidl_common_startup = 24
  4337. Global Const $csidl_common_templates = 45
  4338. Global Const $csidl_common_video = 55
  4339. Global Const $csidl_computersnearme = 61
  4340. Global Const $csidl_connections = 49
  4341. Global Const $csidl_controls = 3
  4342. Global Const $csidl_cookies = 33
  4343. Global Const $csidl_desktop = 0
  4344. Global Const $csidl_desktopdirectory = 16
  4345. Global Const $csidl_drives = 17
  4346. Global Const $csidl_favorites = 6
  4347. Global Const $csidl_fonts = 20
  4348. Global Const $csidl_internet_cache = 32
  4349. Global Const $csidl_history = 34
  4350. Global Const $csidl_local_appdata = 28
  4351. Global Const $csidl_mymusic = 13
  4352. Global Const $csidl_mypictures = 39
  4353. Global Const $csidl_myvideo = 14
  4354. Global Const $csidl_nethood = 19
  4355. Global Const $csidl_personal = 5
  4356. Global Const $csidl_printers = 4
  4357. Global Const $csidl_printhood = 27
  4358. Global Const $csidl_profile = 40
  4359. Global Const $csidl_program_files = 38
  4360. Global Const $csidl_program_files_common = 43
  4361. Global Const $csidl_program_files_commonx86 = 44
  4362. Global Const $csidl_program_filesx86 = 42
  4363. Global Const $csidl_programs = 2
  4364. Global Const $csidl_recent = 8
  4365. Global Const $csidl_sendto = 9
  4366. Global Const $csidl_startmenu = 11
  4367. Global Const $csidl_startup = 7
  4368. Global Const $csidl_system = 37
  4369. Global Const $csidl_systemx86 = 41
  4370. Global Const $csidl_templates = 21
  4371. Global Const $csidl_windows = 36
  4372. Global Const $siid_docnoassoc = 0
  4373. Global Const $siid_docassoc = 1
  4374. Global Const $siid_application = 2
  4375. Global Const $siid_folder = 3
  4376. Global Const $siid_folderopen = 4
  4377. Global Const $siid_drive525 = 5
  4378. Global Const $siid_drive35 = 6
  4379. Global Const $siid_driveremove = 7
  4380. Global Const $siid_drivefixed = 8
  4381. Global Const $siid_drivenet = 9
  4382. Global Const $siid_drivenetdisabled = 10
  4383. Global Const $siid_drivecd = 11
  4384. Global Const $siid_driveram = 12
  4385. Global Const $siid_world = 13
  4386. Global Const $siid_server = 15
  4387. Global Const $siid_printer = 16
  4388. Global Const $siid_mynetwork = 17
  4389. Global Const $siid_find = 22
  4390. Global Const $siid_help = 23
  4391. Global Const $siid_share = 28
  4392. Global Const $siid_link = 29
  4393. Global Const $siid_slowfile = 30
  4394. Global Const $siid_recycler = 31
  4395. Global Const $siid_recyclerfull = 32
  4396. Global Const $siid_mediacdaudio = 40
  4397. Global Const $siid_lock = 47
  4398. Global Const $siid_autolist = 49
  4399. Global Const $siid_printernet = 50
  4400. Global Const $siid_servershare = 51
  4401. Global Const $siid_printerfax = 52
  4402. Global Const $siid_printerfaxnet = 53
  4403. Global Const $siid_printerfile = 54
  4404. Global Const $siid_stack = 55
  4405. Global Const $siid_mediasvcd = 56
  4406. Global Const $siid_stuffedfolder = 57
  4407. Global Const $siid_driveunknown = 58
  4408. Global Const $siid_drivedvd = 59
  4409. Global Const $siid_mediadvd = 60
  4410. Global Const $siid_mediadvdram = 61
  4411. Global Const $siid_mediadvdrw = 62
  4412. Global Const $siid_mediadvdr = 63
  4413. Global Const $siid_mediadvdrom = 64
  4414. Global Const $siid_mediacdaudioplus = 65
  4415. Global Const $siid_mediacdrw = 66
  4416. Global Const $siid_mediacdr = 67
  4417. Global Const $siid_mediacdburn = 68
  4418. Global Const $siid_mediablankcd = 69
  4419. Global Const $siid_mediacdrom = 70
  4420. Global Const $siid_audiofiles = 71
  4421. Global Const $siid_imagefiles = 72
  4422. Global Const $siid_videofiles = 73
  4423. Global Const $siid_mixedfiles = 74
  4424. Global Const $siid_folderback = 75
  4425. Global Const $siid_folderfront = 76
  4426. Global Const $siid_shield = 77
  4427. Global Const $siid_warning = 78
  4428. Global Const $siid_info = 79
  4429. Global Const $siid_error = 80
  4430. Global Const $siid_key = 81
  4431. Global Const $siid_software = 82
  4432. Global Const $siid_rename = 83
  4433. Global Const $siid_delete = 84
  4434. Global Const $siid_mediaaudiodvd = 85
  4435. Global Const $siid_mediamoviedvd = 86
  4436. Global Const $siid_mediaenhancedcd = 87
  4437. Global Const $siid_mediaenhanceddvd = 88
  4438. Global Const $siid_mediahddvd = 89
  4439. Global Const $siid_mediabluray = 90
  4440. Global Const $siid_mediavcd = 91
  4441. Global Const $siid_mediadvdplusr = 92
  4442. Global Const $siid_mediadvdplusrw = 93
  4443. Global Const $siid_desktoppc = 94
  4444. Global Const $siid_mobilepc = 95
  4445. Global Const $siid_users = 96
  4446. Global Const $siid_mediasmartmedia = 97
  4447. Global Const $siid_mediacompactflash = 98
  4448. Global Const $siid_devicecellphone = 99
  4449. Global Const $siid_devicecamera = 100
  4450. Global Const $siid_devicevideocamera = 101
  4451. Global Const $siid_deviceaudioplayer = 102
  4452. Global Const $siid_networkconnect = 103
  4453. Global Const $siid_internet = 104
  4454. Global Const $siid_zipfile = 105
  4455. Global Const $siid_settings = 106
  4456. Global Const $siid_drivehddvd = 132
  4457. Global Const $siid_drivebd = 133
  4458. Global Const $siid_mediahddvdrom = 134
  4459. Global Const $siid_mediahddvdr = 135
  4460. Global Const $siid_mediahddvdram = 136
  4461. Global Const $siid_mediabdrom = 137
  4462. Global Const $siid_mediabdr = 138
  4463. Global Const $siid_mediabdre = 139
  4464. Global Const $siid_clustereddrive = 140
  4465. Global Const $siid_max_icons = 174
  4466. Global Const $shgsi_iconlocation = 0
  4467. Global Const $shgsi_icon = $shgfi_icon
  4468. Global Const $shgsi_sysiconindex = $shgfi_sysiconindex
  4469. Global Const $shgsi_linkoverlay = $shgfi_linkoverlay
  4470. Global Const $shgsi_selected = $shgfi_selected
  4471. Global Const $shgsi_largeicon = $shgfi_largeicon
  4472. Global Const $shgsi_smallicon = $shgfi_smallicon
  4473. Global Const $shgsi_shelliconsize = $shgfi_shelliconsize
  4474. Global Const $nim_add = 0
  4475. Global Const $nim_modify = 1
  4476. Global Const $nim_delete = 2
  4477. Global Const $nim_setfocus = 3
  4478. Global Const $nim_setversion = 4
  4479. Global Const $nif_message = 1
  4480. Global Const $nif_icon = 2
  4481. Global Const $nif_tip = 4
  4482. Global Const $nif_state = 8
  4483. Global Const $nif_info = 16
  4484. Global Const $nif_guid = 32
  4485. Global Const $nif_realtime = 64
  4486. Global Const $nif_showtip = 128
  4487. Global Const $nis_hidden = 1
  4488. Global Const $nis_sharedicon = 2
  4489. Global Const $niif_none = 0
  4490. Global Const $niif_info = 1
  4491. Global Const $niif_warning = 2
  4492. Global Const $niif_error = 3
  4493. Global Const $niif_user = 4
  4494. Global Const $niif_nosound = 16
  4495. Global Const $niif_large_icon = 16
  4496. Global Const $niif_respect_quiet_time = 128
  4497. Global Const $niif_icon_mask = 15
  4498. Global Const $shop_printername = 1
  4499. Global Const $shop_filepath = 2
  4500. Global Const $shop_volumeguid = 4
  4501. Global Const $ofasi_edit = 1
  4502. Global Const $ofasi_opendesktop = 2
  4503. Global Const $quns_not_present = 1
  4504. Global Const $quns_busy = 2
  4505. Global Const $quns_running_d3d_full_screen = 3
  4506. Global Const $quns_presentation_mode = 4
  4507. Global Const $quns_accepts_notifications = 5
  4508. Global Const $quns_quiet_time = 6
  4509. Global Const $rest_norun = 1
  4510. Global Const $rest_noclose = 2
  4511. Global Const $rest_nosaveset = 3
  4512. Global Const $rest_nofilemenu = 4
  4513. Global Const $rest_nosetfolders = 5
  4514. Global Const $rest_nosettaskbar = 6
  4515. Global Const $rest_nodesktop = 7
  4516. Global Const $rest_nofind = 8
  4517. Global Const $rest_nodrives = 9
  4518. Global Const $rest_nodriveautorun = 10
  4519. Global Const $rest_nodrivetypeautorun = 11
  4520. Global Const $rest_nonethood = 12
  4521. Global Const $rest_startbanner = 13
  4522. Global Const $rest_restrictrun = 14
  4523. Global Const $rest_noprintertabs = 15
  4524. Global Const $rest_noprinterdelete = 16
  4525. Global Const $rest_noprinteradd = 17
  4526. Global Const $rest_nostartmenusubfolders = 18
  4527. Global Const $rest_mydocsonnet = 19
  4528. Global Const $rest_noexittodos = 20
  4529. Global Const $rest_enforceshellextsecurity = 21
  4530. Global Const $rest_linkresolveignorelinkinfo = 22
  4531. Global Const $rest_nocommongroups = 23
  4532. Global Const $rest_separatedesktopprocess = 24
  4533. Global Const $rest_noweb = 25
  4534. Global Const $rest_notraycontextmenu = 26
  4535. Global Const $rest_noviewcontextmenu = 27
  4536. Global Const $rest_nonetconnectdisconnect = 28
  4537. Global Const $rest_startmenulogoff = 29
  4538. Global Const $rest_nosettingsassist = 30
  4539. Global Const $rest_nointerneticon = 31
  4540. Global Const $rest_norecentdocshistory = 32
  4541. Global Const $rest_norecentdocsmenu = 33
  4542. Global Const $rest_noactivedesktop = 34
  4543. Global Const $rest_noactivedesktopchanges = 35
  4544. Global Const $rest_nofavoritesmenu = 36
  4545. Global Const $rest_clearrecentdocsonexit = 37
  4546. Global Const $rest_classicshell = 38
  4547. Global Const $rest_nocustomizewebview = 39
  4548. Global Const $rest_nohtmlwallpaper = 40
  4549. Global Const $rest_nochangingwallpaper = 41
  4550. Global Const $rest_nodeskcomp = 42
  4551. Global Const $rest_noadddeskcomp = 43
  4552. Global Const $rest_nodeldeskcomp = 44
  4553. Global Const $rest_noclosedeskcomp = 45
  4554. Global Const $rest_noclose_dragdropband = 46
  4555. Global Const $rest_nomovingband = 47
  4556. Global Const $rest_noeditdeskcomp = 48
  4557. Global Const $rest_noresolvesearch = 49
  4558. Global Const $rest_noresolvetrack = 50
  4559. Global Const $rest_forcecopyaclwithfile = 51
  4560. Global Const $rest_nologo3channelnotify = 52
  4561. Global Const $rest_noforgetsoftwareupdate = 53
  4562. Global Const $rest_nosetactivedesktop = 54
  4563. Global Const $rest_noupdatewindows = 55
  4564. Global Const $rest_nochangestarmenu = 56
  4565. Global Const $rest_nofolderoptions = 57
  4566. Global Const $rest_hasfindcomputers = 58
  4567. Global Const $rest_intellimenus = 59
  4568. Global Const $rest_rundlgmemcheckbox = 60
  4569. Global Const $rest_arp_showpostsetup = 61
  4570. Global Const $rest_nocsc = 62
  4571. Global Const $rest_nocontrolpanel = 63
  4572. Global Const $rest_enumworkgroup = 64
  4573. Global Const $rest_arp_noarp = 65
  4574. Global Const $rest_arp_noremovepage = 66
  4575. Global Const $rest_arp_noaddpage = 67
  4576. Global Const $rest_arp_nowinsetuppage = 68
  4577. Global Const $rest_greymsiads = 69
  4578. Global Const $rest_nochangemappeddrivelabel = 70
  4579. Global Const $rest_nochangemappeddrivecomment = 71
  4580. Global Const $rest_maxrecentdocs = 72
  4581. Global Const $rest_nonetworkconnections = 73
  4582. Global Const $rest_forcestartmenulogoff = 74
  4583. Global Const $rest_nowebview = 75
  4584. Global Const $rest_nocustomizethisfolder = 76
  4585. Global Const $rest_noencryption = 77
  4586. Global Const $rest_dontshowsuperhidden = 78
  4587. Global Const $rest_noshellsearchbutton = 79
  4588. Global Const $rest_nohardwaretab = 80
  4589. Global Const $rest_norunasinstallprompt = 81
  4590. Global Const $rest_promptrunasinstallnetpath = 82
  4591. Global Const $rest_nomanagemycomputerverb = 83
  4592. Global Const $rest_norecentdocsnethood = 84
  4593. Global Const $rest_disallowrun = 85
  4594. Global Const $rest_nowelcomescreen = 86
  4595. Global Const $rest_restrictcpl = 87
  4596. Global Const $rest_disallowcpl = 88
  4597. Global Const $rest_nosmballoontip = 89
  4598. Global Const $rest_nosmhelp = 90
  4599. Global Const $rest_nowinkeys = 91
  4600. Global Const $rest_noencryptonmove = 92
  4601. Global Const $rest_nolocalmachinerun = 93
  4602. Global Const $rest_nocurrentuserrun = 94
  4603. Global Const $rest_nolocalmachinerunonce = 95
  4604. Global Const $rest_nocurrentuserrunonce = 96
  4605. Global Const $rest_forceactivedesktopon = 97
  4606. Global Const $rest_nocomputersnearme = 98
  4607. Global Const $rest_noviewondrive = 99
  4608. Global Const $rest_nonetcrawl = 100
  4609. Global Const $rest_noshareddocuments = 101
  4610. Global Const $rest_nosmmydocs = 102
  4611. Global Const $rest_nosmmypics = 103
  4612. Global Const $rest_allowbitbuckdrives = 104
  4613. Global Const $rest_nonlegacyshellmode = 105
  4614. Global Const $rest_nocontrolpanelbarricade = 106
  4615. Global Const $rest_nostartpage = 107
  4616. Global Const $rest_noautotraynotify = 108
  4617. Global Const $rest_notaskgrouping = 109
  4618. Global Const $rest_nocdburning = 110
  4619. Global Const $rest_mycompnoprop = 111
  4620. Global Const $rest_mydocsnoprop = 112
  4621. Global Const $rest_nostartpanel = 113
  4622. Global Const $rest_nodisplayappearancepage = 114
  4623. Global Const $rest_nothemestab = 115
  4624. Global Const $rest_novisualstylechoice = 116
  4625. Global Const $rest_nosizechoice = 117
  4626. Global Const $rest_nocolorchoice = 118
  4627. Global Const $rest_setvisualstyle = 119
  4628. Global Const $rest_startrunnohomepath = 120
  4629. Global Const $rest_nousernameinstartpanel = 121
  4630. Global Const $rest_nomycomputericon = 122
  4631. Global Const $rest_nosmnetworkplaces = 123
  4632. Global Const $rest_nosmpinnedlist = 124
  4633. Global Const $rest_nosmmymusic = 125
  4634. Global Const $rest_nosmejectpc = 126
  4635. Global Const $rest_nosmmoreprograms = 127
  4636. Global Const $rest_nosmmfuprograms = 128
  4637. Global Const $rest_notrayitemsdisplay = 129
  4638. Global Const $rest_notoolbarsontaskbar = 130
  4639. Global Const $rest_nosmconfigureprograms = 131
  4640. Global Const $rest_hideclock = 132
  4641. Global Const $rest_nolowdiskspacechecks = 133
  4642. Global Const $rest_noentirenetwork = 134
  4643. Global Const $rest_nodesktopcleanup = 135
  4644. Global Const $rest_bitbucknukeondelete = 136
  4645. Global Const $rest_bitbuckconfirmdelete = 137
  4646. Global Const $rest_bitbucknoprop = 138
  4647. Global Const $rest_nodispbackground = 139
  4648. Global Const $rest_nodispscreensavepg = 140
  4649. Global Const $rest_nodispsettingspg = 141
  4650. Global Const $rest_nodispscreensavepreview = 142
  4651. Global Const $rest_nodisplaycpl = 143
  4652. Global Const $rest_hiderunasverb = 144
  4653. Global Const $rest_nothumbnailcache = 145
  4654. Global Const $rest_nostrcmplogical = 146
  4655. Global Const $rest_nopublishwizard = 147
  4656. Global Const $rest_noonlineprintswizard = 148
  4657. Global Const $rest_nowebservices = 149
  4658. Global Const $rest_allowunhashedwebview = 150
  4659. Global Const $rest_allowlegacywebview = 151
  4660. Global Const $rest_revertwebviewsecurity = 152
  4661. Global Const $rest_inheritconsolehandles = 153
  4662. Global Const $rest_sortmaxitemcount = 154
  4663. Global Const $rest_noremoterecursiveevents = 155
  4664. Global Const $rest_noremotechangenotify = 156
  4665. Global Const $rest_nosimplenetidlist = 157
  4666. Global Const $rest_noenumentirenetwork = 158
  4667. Global Const $rest_nodetailsthumbnailonnetwork = 159
  4668. Global Const $rest_nointernetopenwith = 160
  4669. Global Const $rest_allowlegacylmzbehavior = 161
  4670. Global Const $rest_dontretrybadnetname = 162
  4671. Global Const $rest_allowfileclsidjunctions = 163
  4672. Global Const $rest_noupnpinstall = 164
  4673. Global Const $rest_arp_dontgrouppatches = 165
  4674. Global Const $rest_arp_nochooseprogramspage = 166
  4675. Global Const $rest_nodisconnect = 167
  4676. Global Const $rest_nosecurity = 168
  4677. Global Const $rest_nofileassociate = 169
  4678. Global Const $rest_allowcommenttoggle = 170
  4679. Global Const $rest_usedesktopinicache = 171
  4680. Global Const $gil_dontcache = 16
  4681. Global Const $gil_notfilename = 8
  4682. Global Const $gil_perclass = 4
  4683. Global Const $gil_perinstance = 2
  4684. Global Const $gil_simulatedoc = 1
  4685. Global Const $gil_shield = 512
  4686. Global Const $gil_forcenoshield = 1024
  4687. Global Const $folderid_addnewprograms = "{DE61D971-5EBC-4F02-A3A9-6C82895E5C04}"
  4688. Global Const $folderid_admintools = "{724EF170-A42D-4FEF-9F26-B60E846FBA4F}"
  4689. Global Const $folderid_appupdates = "{A305CE99-F527-492B-8B1A-7E76FA98D6E4}"
  4690. Global Const $folderid_cdburning = "{9E52AB10-F80D-49DF-ACB8-4330F5687855}"
  4691. Global Const $folderid_changeremoveprograms = "{DF7266AC-9274-4867-8D55-3BD661DE872D}"
  4692. Global Const $folderid_commonadmintools = "{D0384E7D-BAC3-4797-8F14-CBA229B392B5}"
  4693. Global Const $folderid_commonoemlinks = "{C1BAE2D0-10DF-4334-BEDD-7AA20B227A9D}"
  4694. Global Const $folderid_commonprograms = "{0139D44E-6AFE-49F2-8690-3DAFCAE6FFB8}"
  4695. Global Const $folderid_commonstartmenu = "{A4115719-D62E-491D-AA7C-E74B8BE3B067}"
  4696. Global Const $folderid_commonstartup = "{82A5EA35-D9CD-47C5-9629-E15D2F714E6E}"
  4697. Global Const $folderid_commontemplates = "{B94237E7-57AC-4347-9151-B08C6C32D1F7}"
  4698. Global Const $folderid_computerfolder = "{0AC0837C-BBF8-452A-850D-79D08E667CA7}"
  4699. Global Const $folderid_conflictfolder = "{4BFEFB45-347D-4006-A5BE-AC0CB0567192}"
  4700. Global Const $folderid_connectionsfolder = "{6F0CD92B-2E97-45D1-88FF-B0D186B8DEDD}"
  4701. Global Const $folderid_contacts = "{56784854-C6CB-462B-8169-88E350ACB882}"
  4702. Global Const $folderid_controlpanelfolder = "{82A74AEB-AEB4-465C-A014-D097EE346D63}"
  4703. Global Const $folderid_cookies = "{2B0F765D-C0E9-4171-908E-08A611B84FF6}"
  4704. Global Const $folderid_desktop = "{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}"
  4705. Global Const $folderid_devicemetadatastore = "{5CE4A5E9-E4EB-479D-B89F-130C02886155}"
  4706. Global Const $folderid_documentslibrary = "{7B0DB17D-9CD2-4A93-9733-46CC89022E7C}"
  4707. Global Const $folderid_downloads = "{374DE290-123F-4565-9164-39C4925E467B}"
  4708. Global Const $folderid_favorites = "{1777F761-68AD-4D8A-87BD-30B759FA33DD}"
  4709. Global Const $folderid_fonts = "{FD228CB7-AE11-4AE3-864C-16F3910AB8FE}"
  4710. Global Const $folderid_games = "{CAC52C1A-B53D-4EDC-92D7-6B2E8AC19434}"
  4711. Global Const $folderid_gametasks = "{054FAE61-4DD8-4787-80B6-090220C4B700}"
  4712. Global Const $folderid_history = "{D9DC8A3B-B784-432E-A781-5A1130A75963}"
  4713. Global Const $folderid_homegroup = "{52528A6B-B9E3-4ADD-B60D-588C2DBA842D}"
  4714. Global Const $folderid_implicitappshortcuts = "{BCB5256F-79F6-4CEE-B725-DC34E402FD46}"
  4715. Global Const $folderid_internetcache = "{352481E8-33BE-4251-BA85-6007CAEDCF9D}"
  4716. Global Const $folderid_internetfolder = "{4D9F7874-4E0C-4904-967B-40B0D20C3E4B}"
  4717. Global Const $folderid_libraries = "{1B3EA5DC-B587-4786-B4EF-BD1DC332AEAE}"
  4718. Global Const $folderid_links = "{BFB9D5E0-C6A9-404C-B2B2-AE6DB6AF4968}"
  4719. Global Const $folderid_localappdata = "{F1B32785-6FBA-4FCF-9D55-7B8E7F157091}"
  4720. Global Const $folderid_localappdatalow = "{A520A1A4-1780-4FF6-BD18-167343C5AF16}"
  4721. Global Const $folderid_localizedresourcesdir = "{2A00375E-224C-49DE-B8D1-440DF7EF3DDC}"
  4722. Global Const $folderid_music = "{4BD8D571-6D19-48D3-BE97-422220080E43}"
  4723. Global Const $folderid_musiclibrary = "{2112AB0A-C86A-4FFE-A368-0DE96E47012E}"
  4724. Global Const $folderid_nethood = "{C5ABBF53-E17F-4121-8900-86626FC2C973}"
  4725. Global Const $folderid_networkfolder = "{D20BEEC4-5CA8-4905-AE3B-BF251EA09B53}"
  4726. Global Const $folderid_originalimages = "{2C36C0AA-5812-4B87-BFD0-4CD0DFB19B39}"
  4727. Global Const $folderid_photoalbums = "{69D2CF90-FC33-4FB7-9A0C-EBB0F0FCB43C}"
  4728. Global Const $folderid_pictureslibrary = "{A990AE9F-A03B-4E80-94BC-9912D7504104}"
  4729. Global Const $folderid_pictures = "{33E28130-4E1E-4676-835A-98395C3BC3BB}"
  4730. Global Const $folderid_playlists = "{DE92C1C7-837F-4F69-A3BB-86E631204A23}"
  4731. Global Const $folderid_printersfolder = "{76FC4E2D-D6AD-4519-A663-37BD56068185}"
  4732. Global Const $folderid_printhood = "{9274BD8D-CFD1-41C3-B35E-B13F55A758F4}"
  4733. Global Const $folderid_profile = "{5E6C858F-0E22-4760-9AFE-EA3317B67173}"
  4734. Global Const $folderid_programdata = "{62AB5D82-FDC1-4DC3-A9DD-070D1D495D97}"
  4735. Global Const $folderid_programfiles = "{905E63B6-C1BF-494E-B29C-65B732D3D21A}"
  4736. Global Const $folderid_programfilesx64 = "{6D809377-6AF0-444B-8957-A3773F02200E}"
  4737. Global Const $folderid_programfilesx86 = "{7C5A40EF-A0FB-4BFC-874A-C0F2E0B9FA8E}"
  4738. Global Const $folderid_programfilescommon = "{F7F1ED05-9F6D-47A2-AAAE-29D317C6F066}"
  4739. Global Const $folderid_programfilescommonx64 = "{6365D5A7-0F0D-45E5-87F6-0DA56B6A4F7D}"
  4740. Global Const $folderid_programfilescommonx86 = "{DE974D24-D9C6-4D3E-BF91-F4455120B917}"
  4741. Global Const $folderid_programs = "{A77F5D77-2E2B-44C3-A6A2-ABA601054A51}"
  4742. Global Const $folderid_public = "{DFDF76A2-C82A-4D63-906A-5644AC457385}"
  4743. Global Const $folderid_publicdesktop = "{C4AA340D-F20F-4863-AFEF-F87EF2E6BA25}"
  4744. Global Const $folderid_publicdocuments = "{ED4824AF-DCE4-45A8-81E2-FC7965083634}"
  4745. Global Const $folderid_publicdownloads = "{3D644C9B-1FB8-4F30-9B45-F670235F79C0}"
  4746. Global Const $folderid_publicgametasks = "{DEBF2536-E1A8-4C59-B6A2-414586476AEA}"
  4747. Global Const $folderid_publiclibraries = "{48DAF80B-E6CF-4F4E-B800-0E69D84EE384}"
  4748. Global Const $folderid_publicmusic = "{3214FAB5-9757-4298-BB61-92A9DEAA44FF}"
  4749. Global Const $folderid_publicpictures = "{B6EBFB86-6907-413C-9AF7-4FC2ABF07CC5}"
  4750. Global Const $folderid_publicringtones = "{E555AB60-153B-4D17-9F04-A5FE99FC15EC}"
  4751. Global Const $folderid_publicvideos = "{2400183A-6185-49FB-A2D8-4A392A602BA3}"
  4752. Global Const $folderid_quicklaunch = "{52A4F021-7B75-48A9-9F6B-4B87A210BC8F}"
  4753. Global Const $folderid_recent = "{AE50C081-EBD2-438A-8655-8A092E34987A}"
  4754. Global Const $folderid_recordedtvlibrary = "{1A6FDBA2-F42D-4358-A798-B74D745926C5}"
  4755. Global Const $folderid_recyclebinfolder = "{B7534046-3ECB-4C18-BE4E-64CD4CB7D6AC}"
  4756. Global Const $folderid_resourcedir = "{8AD10C31-2ADB-4296-A8F7-E4701232C972}"
  4757. Global Const $folderid_ringtones = "{C870044B-F49E-4126-A9C3-B52A1FF411E8}"
  4758. Global Const $folderid_roamingappdata = "{3EB685DB-65F9-4CF6-A03A-E3EF65729F3D}"
  4759. Global Const $folderid_samplemusic = "{B250C668-F57D-4EE1-A63C-290EE7D1AA1F}"
  4760. Global Const $folderid_samplepictures = "{C4900540-2379-4C75-844B-64E6FAF8716B}"
  4761. Global Const $folderid_sampleplaylists = "{15CA69B3-30EE-49C1-ACE1-6B5EC372AFB5}"
  4762. Global Const $folderid_samplevideos = "{859EAD94-2E85-48AD-A71A-0969CB56A6CD}"
  4763. Global Const $folderid_savedgames = "{4C5C32FF-BB9D-43B0-B5B4-2D72E54EAAA4}"
  4764. Global Const $folderid_savedsearches = "{7D1D3A04-DEBB-4115-95CF-2F29DA2920DA}"
  4765. Global Const $folderid_search_csc = "{EE32E446-31CA-4ABA-814F-A5EBD2FD6D5E}"
  4766. Global Const $folderid_search_mapi = "{98EC0E18-2098-4D44-8644-66979315A281}"
  4767. Global Const $folderid_searchhome = "{190337D1-B8CA-4121-A639-6D472D16972A}"
  4768. Global Const $folderid_sendto = "{8983036C-27C0-404B-8F08-102D10DCFD74}"
  4769. Global Const $folderid_sidebardefaultparts = "{7B396E54-9EC5-4300-BE0A-2482EBAE1A26}"
  4770. Global Const $folderid_sidebarparts = "{A75D362E-50FC-4FB7-AC2C-A8BEAA314493}"
  4771. Global Const $folderid_startmenu = "{625B53C3-AB48-4EC1-BA1F-A1EF4146FC19}"
  4772. Global Const $folderid_startup = "{B97D20BB-F46A-4C97-BA10-5E3608430854}"
  4773. Global Const $folderid_syncmanagerfolder = "{43668BF8-C14E-49B2-97C9-747784D784B7}"
  4774. Global Const $folderid_syncresultsfolder = "{289A9A43-BE44-4057-A41B-587A76D7E7F9}"
  4775. Global Const $folderid_syncsetupfolder = "{0F214138-B1D3-4A90-BBA9-27CBC0C5389A}"
  4776. Global Const $folderid_system = "{1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}"
  4777. Global Const $folderid_systemx86 = "{D65231B0-B2F1-4857-A4CE-A8E7C6EA7D27}"
  4778. Global Const $folderid_templates = "{A63293E8-664E-48DB-A079-DF759E0509F7}"
  4779. Global Const $folderid_userpinned = "{9E3995AB-1F9C-4F13-B827-48B24B6C7174}"
  4780. Global Const $folderid_userprofiles = "{0762D272-C50A-4BB0-A382-697DCD729B80}"
  4781. Global Const $folderid_userprogramfiles = "{5CD7AEE2-2219-4A67-B85D-6C9CE15660CB}"
  4782. Global Const $folderid_userprogramfilescommon = "{BCBD3057-CA5C-4622-B42D-BC56DB0AE516}"
  4783. Global Const $folderid_usersfiles = "{F3CE0F7C-4901-4ACC-8648-D5D44B04EF8F}"
  4784. Global Const $folderid_userslibraries = "{A302545D-DEFF-464B-ABE8-61C8648D939B}"
  4785. Global Const $folderid_videos = "{18989B1D-99B5-455B-841C-AB7C74E4DDFC}"
  4786. Global Const $folderid_videoslibrary = "{491E922F-5643-4AF4-A7EB-4E7A138D8174}"
  4787. Global Const $folderid_windows = "{F38BF404-1D43-42F2-9305-67DE0B28FC23}"
  4788. Global Const $kf_flag_alias_only = -2147483648
  4789. Global Const $kf_flag_create = 32768
  4790. Global Const $kf_flag_dont_verify = 16384
  4791. Global Const $kf_flag_dont_unexpand = 8192
  4792. Global Const $kf_flag_no_alias = 4096
  4793. Global Const $kf_flag_init = 2048
  4794. Global Const $kf_flag_default_path = 1024
  4795. Global Const $kf_flag_no_appcontainer_redirection = 65536
  4796. Global Const $kf_flag_not_parent_relative = 512
  4797. Global Const $kf_flag_simple_idlist = 256
  4798. Global Const $coinit_apartmentthreaded = 2
  4799. Global Const $coinit_disable_ole1dde = 4
  4800. Global Const $coinit_multithreaded = 0
  4801. Global Const $coinit_speed_over_memory = 8
  4802. Global Const $tagpoint = "struct;long X;long Y;endstruct"
  4803. Global Const $tagrect = "struct;long Left;long Top;long Right;long Bottom;endstruct"
  4804. Global Const $tagsize = "struct;long X;long Y;endstruct"
  4805. Global Const $tagmargins = "int cxLeftWidth;int cxRightWidth;int cyTopHeight;int cyBottomHeight"
  4806. Global Const $tagfiletime = "struct;dword Lo;dword Hi;endstruct"
  4807. Global Const $tagsystemtime = "struct;word Year;word Month;word Dow;word Day;word Hour;word Minute;word Second;word MSeconds;endstruct"
  4808. 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"
  4809. Global Const $tagnmhdr = "struct;hwnd hWndFrom;uint_ptr IDFrom;INT Code;endstruct"
  4810. Global Const $tagcomboboxexitem = "uint Mask;int_ptr Item;ptr Text;int TextMax;int Image;int SelectedImage;int OverlayImage;" & "int Indent;lparam Param"
  4811. Global Const $tagnmcbedragbegin = $tagnmhdr & ";int ItemID;wchar szText[260]"
  4812. Global Const $tagnmcbeendedit = $tagnmhdr & ";bool fChanged;int NewSelection;wchar szText[260];int Why"
  4813. Global Const $tagnmcomboboxex = $tagnmhdr & ";uint Mask;int_ptr Item;ptr Text;int TextMax;int Image;" & "int SelectedImage;int OverlayImage;int Indent;lparam Param"
  4814. 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"
  4815. Global Const $tagnmdatetimechange = $tagnmhdr & ";dword Flag;" & $tagsystemtime
  4816. Global Const $tagnmdatetimeformat = $tagnmhdr & ";ptr Format;" & $tagsystemtime & ";ptr pDisplay;wchar Display[64]"
  4817. Global Const $tagnmdatetimeformatquery = $tagnmhdr & ";ptr Format;struct;long SizeX;long SizeY;endstruct"
  4818. Global Const $tagnmdatetimekeydown = $tagnmhdr & ";int VirtKey;ptr Format;" & $tagsystemtime
  4819. Global Const $tagnmdatetimestring = $tagnmhdr & ";ptr UserString;" & $tagsystemtime & ";dword Flags"
  4820. 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"
  4821. Global Const $taggdip_effectparams_blur = "float Radius; bool ExpandEdge"
  4822. Global Const $taggdip_effectparams_brightnesscontrast = "int BrightnessLevel; int ContrastLevel"
  4823. Global Const $taggdip_effectparams_colorbalance = "int CyanRed; int MagentaGreen; int YellowBlue"
  4824. Global Const $taggdip_effectparams_colorcurve = "int Adjustment; int Channel; int AdjustValue"
  4825. Global Const $taggdip_effectparams_colorlut = "byte LutB[256]; byte LutG[256]; byte LutR[256]; byte LutA[256]"
  4826. Global Const $taggdip_effectparams_huesaturationlightness = "int HueLevel; int SaturationLevel; int LightnessLevel"
  4827. Global Const $taggdip_effectparams_levels = "int Highlight; int Midtone; int Shadow"
  4828. Global Const $taggdip_effectparams_redeyecorrection = "uint NumberOfAreas; ptr Areas"
  4829. Global Const $taggdip_effectparams_sharpen = "float Radius; float Amount"
  4830. Global Const $taggdip_effectparams_tint = "int Hue; int Amount"
  4831. Global Const $taggdipbitmapdata = "uint Width;uint Height;int Stride;int Format;ptr Scan0;uint_ptr Reserved"
  4832. Global Const $taggdipcolormatrix = "float m[25]"
  4833. Global Const $taggdipencoderparam = "struct;byte GUID[16];ulong NumberOfValues;ulong Type;ptr Values;endstruct"
  4834. Global Const $taggdipencoderparams = "uint Count;" & $taggdipencoderparam
  4835. Global Const $taggdiprectf = "struct;float X;float Y;float Width;float Height;endstruct"
  4836. Global Const $taggdipstartupinput = "uint Version;ptr Callback;bool NoThread;bool NoCodecs"
  4837. Global Const $taggdipstartupoutput = "ptr HookProc;ptr UnhookProc"
  4838. 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"
  4839. Global Const $taggdippencoderparams = "uint Count;byte Params[1]"
  4840. 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"
  4841. Global Const $tagnmhddispinfo = $tagnmhdr & ";int Item;uint Mask;ptr Text;int TextMax;int Image;lparam lParam"
  4842. Global Const $tagnmhdfilterbtnclick = $tagnmhdr & ";int Item;" & $tagrect
  4843. Global Const $tagnmheader = $tagnmhdr & ";int Item;int Button;ptr pItem"
  4844. Global Const $taggetipaddress = "byte Field4;byte Field3;byte Field2;byte Field1"
  4845. Global Const $tagnmipaddress = $tagnmhdr & ";int Field;int Value"
  4846. Global Const $taglvfindinfo = "struct;uint Flags;ptr Text;lparam Param;" & $tagpoint & ";uint Direction;endstruct"
  4847. Global Const $taglvhittestinfo = $tagpoint & ";uint Flags;int Item;int SubItem;int iGroup"
  4848. 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"
  4849. Global Const $tagnmlistview = $tagnmhdr & ";int Item;int SubItem;uint NewState;uint OldState;uint Changed;" & "struct;long ActionX;long ActionY;endstruct;lparam Param"
  4850. 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"
  4851. Global Const $tagnmlvdispinfo = $tagnmhdr & ";" & $taglvitem
  4852. Global Const $tagnmlvfinditem = $tagnmhdr & ";int Start;" & $taglvfindinfo
  4853. Global Const $tagnmlvgetinfotip = $tagnmhdr & ";dword Flags;ptr Text;int TextMax;int Item;int SubItem;lparam lParam"
  4854. Global Const $tagnmitemactivate = $tagnmhdr & ";int Index;int SubItem;uint NewState;uint OldState;uint Changed;" & $tagpoint & ";lparam lParam;uint KeyFlags"
  4855. Global Const $tagnmlvkeydown = "align 1;" & $tagnmhdr & ";word VKey;uint Flags"
  4856. Global Const $tagnmlvscroll = $tagnmhdr & ";int DX;int DY"
  4857. Global Const $tagmchittestinfo = "uint Size;" & $tagpoint & ";uint Hit;" & $tagsystemtime & ";" & $tagrect & ";int iOffset;int iRow;int iCol"
  4858. 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"
  4859. 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"
  4860. 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"
  4861. Global Const $tagnmdaystate = $tagnmhdr & ";" & $tagsystemtime & ";int DayState;ptr pDayState"
  4862. 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"
  4863. Global Const $tagnmobjectnotify = $tagnmhdr & ";int Item;ptr piid;ptr pObject;long Result;dword dwFlags"
  4864. Global Const $tagnmtckeydown = "align 1;" & $tagnmhdr & ";word VKey;uint Flags"
  4865. 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"
  4866. Global Const $tagtvitemex = "struct;" & $tagtvitem & ";int Integral;uint uStateEx;hwnd hwnd;int iExpandedImage;int iReserved;endstruct"
  4867. 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"
  4868. Global Const $tagnmtvcustomdraw = "struct;" & $tagnmhdr & ";dword DrawStage;handle HDC;" & $tagrect & ";dword_ptr ItemSpec;uint ItemState;lparam ItemParam;endstruct" & ";dword ClrText;dword ClrTextBk;int Level"
  4869. Global Const $tagnmtvdispinfo = $tagnmhdr & ";" & $tagtvitem
  4870. Global Const $tagnmtvgetinfotip = $tagnmhdr & ";ptr Text;int TextMax;handle hItem;lparam lParam"
  4871. Global Const $tagnmtvitemchange = $tagnmhdr & ";uint Changed;handle hItem;uint StateNew;uint StateOld;lparam lParam;"
  4872. Global Const $tagtvhittestinfo = $tagpoint & ";uint Flags;handle Item"
  4873. Global Const $tagnmtvkeydown = "align 1;" & $tagnmhdr & ";word VKey;uint Flags"
  4874. Global Const $tagnmmouse = $tagnmhdr & ";dword_ptr ItemSpec;dword_ptr ItemData;" & $tagpoint & ";lparam HitInfo"
  4875. Global Const $tagtoken_privileges = "dword Count;align 4;int64 LUID;dword Attributes"
  4876. Global Const $tagimageinfo = "handle hBitmap;handle hMask;int Unused1;int Unused2;" & $tagrect
  4877. Global Const $tagmenuinfo = "dword Size;INT Mask;dword Style;uint YMax;handle hBack;dword ContextHelpID;ulong_ptr MenuData"
  4878. 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"
  4879. 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")
  4880. Global Const $tagnmrebarautobreak = $tagnmhdr & ";uint uBand;uint wID;lparam lParam;uint uMsg;uint fStyleCurrent;bool fAutoBreak"
  4881. 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"
  4882. Global Const $tagnmrebar = $tagnmhdr & ";dword dwMask;uint uBand;uint fStyle;uint wID;lparam lParam"
  4883. Global Const $tagnmrebarchevron = $tagnmhdr & ";uint uBand;uint wID;lparam lParam;" & $tagrect & ";lparam lParamNM"
  4884. 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"
  4885. Global Const $tagcolorscheme = "dword Size;dword BtnHighlight;dword BtnShadow"
  4886. 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
  4887. Global Const $tagnmtbhotitem = $tagnmhdr & ";int idOld;int idNew;dword dwFlags"
  4888. Global Const $tagtbbutton = "int Bitmap;int Command;byte State;byte Style;dword_ptr Param;int_ptr String"
  4889. Global Const $tagtbbuttoninfo = "uint Size;dword Mask;int Command;int Image;byte State;byte Style;word CX;dword_ptr Param;ptr Text;int TextMax"
  4890. Global Const $tagnetresource = "dword Scope;dword Type;dword DisplayType;dword Usage;ptr LocalName;ptr RemoteName;ptr Comment;ptr Provider"
  4891. Global Const $tagoverlapped = "ulong_ptr Internal;ulong_ptr InternalHigh;struct;dword Offset;dword OffsetHigh;endstruct;handle hEvent"
  4892. 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"
  4893. 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"
  4894. Global Const $tagbitmapinfo = $tagbitmapinfoheader & ";dword biRGBQuad[1]"
  4895. Global Const $tagblendfunction = "byte Op;byte Flags;byte Alpha;byte Format"
  4896. Global Const $tagguid = "struct;ulong Data1;ushort Data2;ushort Data3;byte Data4[8];endstruct"
  4897. Global Const $tagwindowplacement = "uint length;uint flags;uint showCmd;long ptMinPosition[2];long ptMaxPosition[2];long rcNormalPosition[4]"
  4898. Global Const $tagwindowpos = "hwnd hWnd;hwnd InsertAfter;int X;int Y;int CX;int CY;uint Flags"
  4899. Global Const $tagscrollinfo = "uint cbSize;uint fMask;int nMin;int nMax;uint nPage;int nPos;int nTrackPos"
  4900. Global Const $tagscrollbarinfo = "dword cbSize;" & $tagrect & ";int dxyLineButton;int xyThumbTop;" & "int xyThumbBottom;int reserved;dword rgstate[6]"
  4901. 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"
  4902. Global Const $tagkbdllhookstruct = "dword vkCode;dword scanCode;dword flags;dword time;ulong_ptr dwExtraInfo"
  4903. Global Const $tagprocess_information = "handle hProcess;handle hThread;dword ProcessID;dword ThreadID"
  4904. 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"
  4905. Global Const $tagsecurity_attributes = "dword Length;ptr Descriptor;bool InheritHandle"
  4906. 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]"
  4907. 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"
  4908.  
  4909. Func _winapi_getlasterror(Const $_icurrenterror = @error, Const $_icurrentextended = @extended)
  4910. Local $aresult = DllCall("kernel32.dll", "dword", "GetLastError")
  4911. Return SetError($_icurrenterror, $_icurrentextended, $aresult[0])
  4912. EndFunc
  4913.  
  4914. Func _winapi_setlasterror($ierrorcode, Const $_icurrenterror = @error, Const $_icurrentextended = @extended)
  4915. DllCall("kernel32.dll", "none", "SetLastError", "dword", $ierrorcode)
  4916. Return SetError($_icurrenterror, $_icurrentextended, NULL )
  4917. EndFunc
  4918.  
  4919. Func __comerrorformating($ocomerror, $sprefix = @TAB)
  4920. Local Const $str_striptrailing = 2
  4921. 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)
  4922. Return $serror
  4923. EndFunc
  4924.  
  4925. #Region Global Variables and Constants
  4926. Global $__g_venum, $__g_vext = 0
  4927. Global $__g_hheap = 0, $__g_irgbmode = 1
  4928. Global Const $tagosversioninfo = "struct;dword OSVersionInfoSize;dword MajorVersion;dword MinorVersion;dword BuildNumber;dword PlatformId;wchar CSDVersion[128];endstruct"
  4929. Global Const $__winver = __winver()
  4930. #EndRegion Global Variables and Constants
  4931. #Region Functions list
  4932. #EndRegion Functions list
  4933. #Region Public Functions
  4934.  
  4935. Func _winapi_arraytostruct(Const ByRef $adata, $istart = 0, $iend = -1)
  4936. If __checkerrorarraybounds($adata, $istart, $iend) Then Return SetError(@error + 10, @extended, 0)
  4937. Local $tagstruct = ""
  4938. For $i = $istart To $iend
  4939. $tagstruct &= "wchar[" & (StringLen($adata[$i]) + 1) & "];"
  4940. Next
  4941. Local $tdata = DllStructCreate($tagstruct & "wchar[1]")
  4942. Local $icount = 1
  4943. For $i = $istart To $iend
  4944. DllStructSetData($tdata, $icount, $adata[$i])
  4945. $icount += 1
  4946. Next
  4947. DllStructSetData($tdata, $icount, ChrW(0))
  4948. Return $tdata
  4949. EndFunc
  4950.  
  4951. Func _winapi_createmargins($ileftwidth, $irightwidth, $itopheight, $ibottomheight)
  4952. Local $tmargins = DllStructCreate($tagmargins)
  4953. DllStructSetData($tmargins, 1, $ileftwidth)
  4954. DllStructSetData($tmargins, 2, $irightwidth)
  4955. DllStructSetData($tmargins, 3, $itopheight)
  4956. DllStructSetData($tmargins, 4, $ibottomheight)
  4957. Return $tmargins
  4958. EndFunc
  4959.  
  4960. Func _winapi_createpoint($ix, $iy)
  4961. Local $tpoint = DllStructCreate($tagpoint)
  4962. DllStructSetData($tpoint, 1, $ix)
  4963. DllStructSetData($tpoint, 2, $iy)
  4964. Return $tpoint
  4965. EndFunc
  4966.  
  4967. Func _winapi_createrect($ileft, $itop, $iright, $ibottom)
  4968. Local $trect = DllStructCreate($tagrect)
  4969. DllStructSetData($trect, 1, $ileft)
  4970. DllStructSetData($trect, 2, $itop)
  4971. DllStructSetData($trect, 3, $iright)
  4972. DllStructSetData($trect, 4, $ibottom)
  4973. Return $trect
  4974. EndFunc
  4975.  
  4976. Func _winapi_createrectex($ix, $iy, $iwidth, $iheight)
  4977. Local $trect = DllStructCreate($tagrect)
  4978. DllStructSetData($trect, 1, $ix)
  4979. DllStructSetData($trect, 2, $iy)
  4980. DllStructSetData($trect, 3, $ix + $iwidth)
  4981. DllStructSetData($trect, 4, $iy + $iheight)
  4982. Return $trect
  4983. EndFunc
  4984.  
  4985. Func _winapi_createsize($iwidth, $iheight)
  4986. Local $tsize = DllStructCreate($tagsize)
  4987. DllStructSetData($tsize, 1, $iwidth)
  4988. DllStructSetData($tsize, 2, $iheight)
  4989. Return $tsize
  4990. EndFunc
  4991.  
  4992. Func _winapi_fatalexit($icode)
  4993. DllCall("kernel32.dll", "none", "FatalExit", "int", $icode)
  4994. If @error Then Return SetError(@error, @extended)
  4995. EndFunc
  4996.  
  4997. Func _winapi_getbitmapdimension($hbitmap)
  4998. Local Const $tagbitmap = "struct;long bmType;long bmWidth;long bmHeight;long bmWidthBytes;ushort bmPlanes;ushort bmBitsPixel;ptr bmBits;endstruct"
  4999. Local $tobj = DllStructCreate($tagbitmap)
  5000. Local $aret = DllCall("gdi32.dll", "int", "GetObject", "handle", $hbitmap, "int", DllStructGetSize($tobj), "struct*", $tobj)
  5001. If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
  5002. Return _winapi_createsize(DllStructGetData($tobj, "bmWidth"), DllStructGetData($tobj, "bmHeight"))
  5003. EndFunc
  5004.  
  5005. Func _winapi_getstring($pstring, $bunicode = True)
  5006. Local $ilength = _winapi_strlen($pstring, $bunicode)
  5007. If @error OR NOT $ilength Then Return SetError(@error + 10, @extended, "")
  5008. Local $tstring = DllStructCreate(__iif($bunicode, "wchar", "char") & "[" & ($ilength + 1) & "]", $pstring)
  5009. If @error Then Return SetError(@error, @extended, "")
  5010. Return SetExtended($ilength, DllStructGetData($tstring, 1))
  5011. EndFunc
  5012.  
  5013. Func _winapi_isbadreadptr($paddress, $ilength)
  5014. Local $aret = DllCall("kernel32.dll", "bool", "IsBadReadPtr", "struct*", $paddress, "uint_ptr", $ilength)
  5015. If @error Then Return SetError(@error, @extended, False)
  5016. Return $aret[0]
  5017. EndFunc
  5018.  
  5019. Func _winapi_isbadwriteptr($paddress, $ilength)
  5020. Local $aret = DllCall("kernel32.dll", "bool", "IsBadWritePtr", "struct*", $paddress, "uint_ptr", $ilength)
  5021. If @error Then Return SetError(@error, @extended, False)
  5022. Return $aret[0]
  5023. EndFunc
  5024.  
  5025. Func _winapi_iswow64process($ipid = 0)
  5026. If NOT $ipid Then $ipid = @AutoItPID
  5027. Local $hprocess = DllCall("kernel32.dll", "handle", "OpenProcess", "dword", __iif($__winver < 1536, 1024, 4096), "bool", 0, "dword", $ipid)
  5028. If @error OR NOT $hprocess[0] Then Return SetError(@error + 20, @extended, False)
  5029. Local $aret = DllCall("kernel32.dll", "bool", "IsWow64Process", "handle", $hprocess[0], "bool*", 0)
  5030. If __checkerrorclosehandle($aret, $hprocess[0]) Then Return SetError(@error, @extended, False)
  5031. Return $aret[2]
  5032. EndFunc
  5033.  
  5034. Func _winapi_movememory($pdestination, $psource, $ilength)
  5035. If _winapi_isbadreadptr($psource, $ilength) Then Return SetError(10, @extended, 0)
  5036. If _winapi_isbadwriteptr($pdestination, $ilength) Then Return SetError(11, @extended, 0)
  5037. DllCall("ntdll.dll", "none", "RtlMoveMemory", "struct*", $pdestination, "struct*", $psource, "ulong_ptr", $ilength)
  5038. If @error Then Return SetError(@error, @extended, 0)
  5039. Return 1
  5040. EndFunc
  5041.  
  5042. Func _winapi_pathisdirectory($sfilepath)
  5043. Local $aret = DllCall("shlwapi.dll", "bool", "PathIsDirectoryW", "wstr", $sfilepath)
  5044. If @error Then Return SetError(@error, @extended, False)
  5045. Return $aret[0]
  5046. EndFunc
  5047.  
  5048. Func _winapi_strlen($pstring, $bunicode = True)
  5049. Local $w = ""
  5050. If $bunicode Then $w = "W"
  5051. Local $aret = DllCall("kernel32.dll", "int", "lstrlen" & $w, "struct*", $pstring)
  5052. If @error Then Return SetError(@error, @extended, 0)
  5053. Return $aret[0]
  5054. EndFunc
  5055.  
  5056. Func _winapi_structtoarray(ByRef $tstruct, $iitems = 0)
  5057. Local $isize = 2 * Floor(DllStructGetSize($tstruct) / 2)
  5058. Local $pstruct = DllStructGetPtr($tstruct)
  5059. If NOT $isize OR NOT $pstruct Then Return SetError(1, 0, 0)
  5060. Local $tdata, $ilength, $ioffset = 0
  5061. Local $aresult[101] = [0]
  5062. While 1
  5063. $ilength = _winapi_strlen($pstruct + $ioffset)
  5064. If NOT $ilength Then
  5065. ExitLoop
  5066. EndIf
  5067. If 2 * (1 + $ilength) + $ioffset > $isize Then Return SetError(3, 0, 0)
  5068. $tdata = DllStructCreate("wchar[" & (1 + $ilength) & "]", $pstruct + $ioffset)
  5069. If @error Then Return SetError(@error + 10, 0, 0)
  5070. __inc($aresult)
  5071. $aresult[$aresult[0]] = DllStructGetData($tdata, 1)
  5072. If $aresult[0] = $iitems Then
  5073. ExitLoop
  5074. EndIf
  5075. $ioffset += 2 * (1 + $ilength)
  5076. If $ioffset >= $isize Then Return SetError(3, 0, 0)
  5077. WEnd
  5078. If NOT $aresult[0] Then Return SetError(2, 0, 0)
  5079. __inc($aresult, -1)
  5080. Return $aresult
  5081. EndFunc
  5082.  
  5083. Func _winapi_swapdword($ivalue)
  5084. Local $tstruct1 = DllStructCreate("dword;dword")
  5085. Local $tstruct2 = DllStructCreate("byte[4];byte[4]", DllStructGetPtr($tstruct1))
  5086. DllStructSetData($tstruct1, 1, $ivalue)
  5087. For $i = 1 To 4
  5088. DllStructSetData($tstruct2, 2, DllStructGetData($tstruct2, 1, 5 - $i), $i)
  5089. Next
  5090. Return DllStructGetData($tstruct1, 2)
  5091. EndFunc
  5092.  
  5093. Func _winapi_swapqword($ivalue)
  5094. Local $tstruct1 = DllStructCreate("int64;int64")
  5095. Local $tstruct2 = DllStructCreate("byte[8];byte[8]", DllStructGetPtr($tstruct1))
  5096. DllStructSetData($tstruct1, 1, $ivalue)
  5097. For $i = 1 To 8
  5098. DllStructSetData($tstruct2, 2, DllStructGetData($tstruct2, 1, 9 - $i), $i)
  5099. Next
  5100. Return DllStructGetData($tstruct1, 2)
  5101. EndFunc
  5102.  
  5103. Func _winapi_swapword($ivalue)
  5104. Local $tstruct1 = DllStructCreate("word;word")
  5105. Local $tstruct2 = DllStructCreate("byte[2];byte[2]", DllStructGetPtr($tstruct1))
  5106. DllStructSetData($tstruct1, 1, $ivalue)
  5107. For $i = 1 To 2
  5108. DllStructSetData($tstruct2, 2, DllStructGetData($tstruct2, 1, 3 - $i), $i)
  5109. Next
  5110. Return DllStructGetData($tstruct1, 2)
  5111. EndFunc
  5112.  
  5113. Func _winapi_switchcolor($icolor)
  5114. If $icolor = -1 Then Return $icolor
  5115. Return BitOR(BitAND($icolor, 65280), BitShift(BitAND($icolor, 255), -16), BitShift(BitAND($icolor, 16711680), 16))
  5116. EndFunc
  5117.  
  5118. Func _winapi_zeromemory($pmemory, $ilength)
  5119. If _winapi_isbadwriteptr($pmemory, $ilength) Then Return SetError(11, @extended, 0)
  5120. DllCall("ntdll.dll", "none", "RtlZeroMemory", "struct*", $pmemory, "ulong_ptr", $ilength)
  5121. If @error Then Return SetError(@error, @extended, 0)
  5122. Return 1
  5123. EndFunc
  5124.  
  5125. #EndRegion Public Functions
  5126. #Region Internal Functions
  5127.  
  5128. Func __checkerrorarraybounds(Const ByRef $adata, ByRef $istart, ByRef $iend, $ndim = 1, $idim = $ubound_dimensions)
  5129. If NOT IsArray($adata) Then Return SetError(1, 0, 1)
  5130. If UBound($adata, $idim) <> $ndim Then Return SetError(2, 0, 1)
  5131. If $istart < 0 Then $istart = 0
  5132. Local $iubound = UBound($adata) - 1
  5133. If $iend < 1 OR $iend > $iubound Then $iend = $iubound
  5134. If $istart > $iend Then Return SetError(4, 0, 1)
  5135. Return 0
  5136. EndFunc
  5137.  
  5138. Func __checkerrorclosehandle($aret, $hfile, $blasterror = 0, $icurerr = @error, $icurext = @extended)
  5139. If NOT $icurerr AND NOT $aret[0] Then $icurerr = 10
  5140. Local $ilasterror = _winapi_getlasterror()
  5141. DllCall("kernel32.dll", "bool", "CloseHandle", "handle", $hfile)
  5142. If $icurerr Then _winapi_setlasterror($ilasterror)
  5143. If $blasterror Then $icurext = $ilasterror
  5144. Return SetError($icurerr, $icurext, $icurerr)
  5145. EndFunc
  5146.  
  5147. Func __dll($spath, $bpin = False)
  5148. Local $aret = DllCall("kernel32.dll", "bool", "GetModuleHandleExW", "dword", __iif($bpin, 1, 2), "wstr", $spath, "ptr*", 0)
  5149. If NOT $aret[3] Then
  5150. Local $aresult = DllCall("kernel32.dll", "handle", "LoadLibraryW", "wstr", $spath)
  5151. If NOT $aresult[0] Then Return 0
  5152. EndIf
  5153. Return 1
  5154. EndFunc
  5155.  
  5156. Func __enumwindowsproc($hwnd, $bvisible)
  5157. Local $aresult
  5158. If $bvisible Then
  5159. $aresult = DllCall("user32.dll", "bool", "IsWindowVisible", "hwnd", $hwnd)
  5160. If NOT $aresult[0] Then
  5161. Return 1
  5162. EndIf
  5163. EndIf
  5164. __inc($__g_venum)
  5165. $__g_venum[$__g_venum[0][0]][0] = $hwnd
  5166. $aresult = DllCall("user32.dll", "int", "GetClassNameW", "hwnd", $hwnd, "wstr", "", "int", 4096)
  5167. $__g_venum[$__g_venum[0][0]][1] = $aresult[2]
  5168. Return 1
  5169. EndFunc
  5170.  
  5171. Func __fatalexit($icode, $stext = "")
  5172. If $stext Then MsgBox($mb_systemmodal, "AutoIt", $stext)
  5173. _winapi_fatalexit($icode)
  5174. EndFunc
  5175.  
  5176. Func __heapalloc($isize, $babort = False)
  5177. Local $aret
  5178. If NOT $__g_hheap Then
  5179. $aret = DllCall("kernel32.dll", "handle", "HeapCreate", "dword", 0, "ulong_ptr", 0, "ulong_ptr", 0)
  5180. If @error OR NOT $aret[0] Then __fatalexit(1, "Error allocating memory.")
  5181. $__g_hheap = $aret[0]
  5182. EndIf
  5183. $aret = DllCall("kernel32.dll", "ptr", "HeapAlloc", "handle", $__g_hheap, "dword", 8, "ulong_ptr", $isize)
  5184. If @error OR NOT $aret[0] Then
  5185. If $babort Then __fatalexit(1, "Error allocating memory.")
  5186. Return SetError(@error + 30, @extended, 0)
  5187. EndIf
  5188. Return $aret[0]
  5189. EndFunc
  5190.  
  5191. Func __heapfree(ByRef $pmemory, $bcheck = False, $icurerr = @error, $icurext = @extended)
  5192. If $bcheck AND (NOT __heapvalidate($pmemory)) Then Return SetError(@error, @extended, 0)
  5193. Local $aret = DllCall("kernel32.dll", "int", "HeapFree", "handle", $__g_hheap, "dword", 0, "ptr", $pmemory)
  5194. If @error OR NOT $aret[0] Then Return SetError(@error + 40, @extended, 0)
  5195. $pmemory = 0
  5196. Return SetError($icurerr, $icurext, 1)
  5197. EndFunc
  5198.  
  5199. Func __heaprealloc($pmemory, $isize, $bamount = False, $babort = False)
  5200. Local $aret, $pret
  5201. If __heapvalidate($pmemory) Then
  5202. If $bamount AND (__heapsize($pmemory) >= $isize) Then Return SetExtended(1, Ptr($pmemory))
  5203. $aret = DllCall("kernel32.dll", "ptr", "HeapReAlloc", "handle", $__g_hheap, "dword", 8, "ptr", $pmemory, "ulong_ptr", $isize)
  5204. If @error OR NOT $aret[0] Then
  5205. If $babort Then __fatalexit(1, "Error allocating memory.")
  5206. Return SetError(@error + 20, @extended, Ptr($pmemory))
  5207. EndIf
  5208. $pret = $aret[0]
  5209. Else
  5210. $pret = __heapalloc($isize, $babort)
  5211. If @error Then Return SetError(@error, @extended, 0)
  5212. EndIf
  5213. Return $pret
  5214. EndFunc
  5215.  
  5216. Func __heapsize($pmemory, $bcheck = False)
  5217. If $bcheck AND (NOT __heapvalidate($pmemory)) Then Return SetError(@error, @extended, 0)
  5218. Local $aret = DllCall("kernel32.dll", "ulong_ptr", "HeapSize", "handle", $__g_hheap, "dword", 0, "ptr", $pmemory)
  5219. If @error OR ($aret[0] = Ptr(-1)) Then Return SetError(@error + 50, @extended, 0)
  5220. Return $aret[0]
  5221. EndFunc
  5222.  
  5223. Func __heapvalidate($pmemory)
  5224. If (NOT $__g_hheap) OR (NOT Ptr($pmemory)) Then Return SetError(9, 0, False)
  5225. Local $aret = DllCall("kernel32.dll", "int", "HeapValidate", "handle", $__g_hheap, "dword", 0, "ptr", $pmemory)
  5226. If @error Then Return SetError(@error, @extended, False)
  5227. Return $aret[0]
  5228. EndFunc
  5229.  
  5230. Func __inc(ByRef $adata, $iincrement = 100)
  5231. Select
  5232. Case UBound($adata, $ubound_columns)
  5233. If $iincrement < 0 Then
  5234. ReDim $adata[$adata[0][0] + 1][UBound($adata, $ubound_columns)]
  5235. Else
  5236. $adata[0][0] += 1
  5237. If $adata[0][0] > UBound($adata) - 1 Then
  5238. ReDim $adata[$adata[0][0] + $iincrement][UBound($adata, $ubound_columns)]
  5239. EndIf
  5240. EndIf
  5241. Case UBound($adata, $ubound_rows)
  5242. If $iincrement < 0 Then
  5243. ReDim $adata[$adata[0] + 1]
  5244. Else
  5245. $adata[0] += 1
  5246. If $adata[0] > UBound($adata) - 1 Then
  5247. ReDim $adata[$adata[0] + $iincrement]
  5248. EndIf
  5249. EndIf
  5250. Case Else
  5251. Return 0
  5252. EndSelect
  5253. Return 1
  5254. EndFunc
  5255.  
  5256. Func __iif($btest, $vtrue, $vfalse)
  5257. Return $btest ? $vtrue : $vfalse
  5258. EndFunc
  5259.  
  5260. Func __init($ddata)
  5261. Local $ilength = BinaryLen($ddata)
  5262. Local $aret = DllCall("kernel32.dll", "ptr", "VirtualAlloc", "ptr", 0, "ulong_ptr", $ilength, "dword", 4096, "dword", 64)
  5263. If @error OR NOT $aret[0] Then __fatalexit(1, "Error allocating memory.")
  5264. Local $tdata = DllStructCreate("byte[" & $ilength & "]", $aret[0])
  5265. DllStructSetData($tdata, 1, $ddata)
  5266. Return $aret[0]
  5267. EndFunc
  5268.  
  5269. Func __rgb($icolor)
  5270. If $__g_irgbmode Then
  5271. $icolor = _winapi_switchcolor($icolor)
  5272. EndIf
  5273. Return $icolor
  5274. EndFunc
  5275.  
  5276. Func __winver()
  5277. Local $tosvi = DllStructCreate($tagosversioninfo)
  5278. DllStructSetData($tosvi, 1, DllStructGetSize($tosvi))
  5279. Local $aret = DllCall("kernel32.dll", "bool", "GetVersionExW", "struct*", $tosvi)
  5280. If @error OR NOT $aret[0] Then Return SetError(@error, @extended, 0)
  5281. Return BitOR(BitShift(DllStructGetData($tosvi, 2), -8), DllStructGetData($tosvi, 3))
  5282. EndFunc
  5283.  
  5284. #EndRegion Internal Functions
  5285. #Region Global Variables and Constants
  5286. Global Const $__tagwinapicom_guid = "struct;ulong Data1;ushort Data2;ushort Data3;byte Data4[8];endstruct"
  5287. #EndRegion Global Variables and Constants
  5288. #Region Functions list
  5289. #EndRegion Functions list
  5290. #Region Public Functions
  5291.  
  5292. Func _winapi_clsidfromprogid($sprogid)
  5293. Local $tguid = DllStructCreate($__tagwinapicom_guid)
  5294. Local $areturn = DllCall("ole32.dll", "long", "CLSIDFromProgID", "wstr", $sprogid, "struct*", $tguid)
  5295. If @error Then Return SetError(@error, @extended, "")
  5296. If $areturn[0] Then Return SetError(10, $areturn[0], "")
  5297. $areturn = DllCall("ole32.dll", "int", "StringFromGUID2", "struct*", $tguid, "wstr", "", "int", 39)
  5298. If @error OR NOT $areturn[0] Then Return SetError(@error + 20, @extended, "")
  5299. Return $areturn[2]
  5300. EndFunc
  5301.  
  5302. Func _winapi_coinitialize($iflags = 0)
  5303. Local $areturn = DllCall("ole32.dll", "long", "CoInitializeEx", "ptr", 0, "dword", $iflags)
  5304. If @error Then Return SetError(@error, @extended, 0)
  5305. If $areturn[0] Then Return SetError(10, $areturn[0], 0)
  5306. Return 1
  5307. EndFunc
  5308.  
  5309. Func _winapi_cotaskmemalloc($isize)
  5310. Local $areturn = DllCall("ole32.dll", "ptr", "CoTaskMemAlloc", "uint_ptr", $isize)
  5311. If @error Then Return SetError(@error, @extended, 0)
  5312. Return $areturn[0]
  5313. EndFunc
  5314.  
  5315. Func _winapi_cotaskmemfree($pmemory)
  5316. DllCall("ole32.dll", "none", "CoTaskMemFree", "ptr", $pmemory)
  5317. If @error Then Return SetError(@error, @extended, 0)
  5318. Return 1
  5319. EndFunc
  5320.  
  5321. Func _winapi_cotaskmemrealloc($pmemory, $isize)
  5322. Local $areturn = DllCall("ole32.dll", "ptr", "CoTaskMemRealloc", "ptr", $pmemory, "ulong_ptr", $isize)
  5323. If @error Then Return SetError(@error, @extended, 0)
  5324. Return $areturn[0]
  5325. EndFunc
  5326.  
  5327. Func _winapi_couninitialize()
  5328. DllCall("ole32.dll", "none", "CoUninitialize")
  5329. If @error Then Return SetError(@error, @extended, 0)
  5330. Return 1
  5331. EndFunc
  5332.  
  5333. Func _winapi_createguid()
  5334. Local $tguid = DllStructCreate($__tagwinapicom_guid)
  5335. Local $areturn = DllCall("ole32.dll", "long", "CoCreateGuid", "struct*", $tguid)
  5336. If @error Then Return SetError(@error, @extended, "")
  5337. If $areturn[0] Then Return SetError(10, $areturn[0], "")
  5338. $areturn = DllCall("ole32.dll", "int", "StringFromGUID2", "struct*", $tguid, "wstr", "", "int", 65536)
  5339. If @error OR NOT $areturn[0] Then Return SetError(@error + 20, @extended, "")
  5340. Return $areturn[2]
  5341. EndFunc
  5342.  
  5343. Func _winapi_createstreamonhglobal($hglobal = 0, $bdeleteonrelease = True)
  5344. Local $areturn = DllCall("ole32.dll", "long", "CreateStreamOnHGlobal", "handle", $hglobal, "bool", $bdeleteonrelease, "ptr*", 0)
  5345. If @error Then Return SetError(@error, @extended, 0)
  5346. If $areturn[0] Then Return SetError(10, $areturn[0], 0)
  5347. Return $areturn[3]
  5348. EndFunc
  5349.  
  5350. Func _winapi_gethglobalfromstream($pstream)
  5351. Local $areturn = DllCall("ole32.dll", "uint", "GetHGlobalFromStream", "ptr", $pstream, "ptr*", 0)
  5352. If @error Then Return SetError(@error, @extended, 0)
  5353. If $areturn[0] Then Return SetError(10, $areturn[0], 0)
  5354. Return $areturn[2]
  5355. EndFunc
  5356.  
  5357. Func _winapi_progidfromclsid($sclsid)
  5358. Local $tguid = DllStructCreate($__tagwinapicom_guid)
  5359. Local $areturn = DllCall("ole32.dll", "uint", "CLSIDFromString", "wstr", $sclsid, "struct*", $tguid)
  5360. If @error OR $areturn[0] Then Return SetError(@error + 20, @extended, "")
  5361. $areturn = DllCall("ole32.dll", "uint", "ProgIDFromCLSID", "struct*", $tguid, "ptr*", 0)
  5362. If @error Then Return SetError(@error, @extended, "")
  5363. If $areturn[0] Then Return SetError(10, $areturn[0], "")
  5364. Local $sid = _winapi_getstring($areturn[2])
  5365. _winapi_cotaskmemfree($areturn[2])
  5366. Return $sid
  5367. EndFunc
  5368.  
  5369. Func _winapi_releasestream($pstream)
  5370. 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", "")
  5371. If @error Then Return SetError(@error, @extended, 0)
  5372. If $areturn[0] Then Return SetError(10, $areturn[0], 0)
  5373. Return 1
  5374. EndFunc
  5375.  
  5376. #EndRegion Public Functions
  5377. Global Const $url_scheme_invalid = -1
  5378. Global Const $url_scheme_unknown = 0
  5379. Global Const $url_scheme_ftp = 1
  5380. Global Const $url_scheme_http = 2
  5381. Global Const $url_scheme_gopher = 3
  5382. Global Const $url_scheme_mailto = 4
  5383. Global Const $url_scheme_news = 5
  5384. Global Const $url_scheme_nntp = 6
  5385. Global Const $url_scheme_telnet = 7
  5386. Global Const $url_scheme_wais = 8
  5387. Global Const $url_scheme_file = 9
  5388. Global Const $url_scheme_mk = 10
  5389. Global Const $url_scheme_https = 11
  5390. Global Const $url_scheme_shell = 12
  5391. Global Const $url_scheme_snews = 13
  5392. Global Const $url_scheme_local = 14
  5393. Global Const $url_scheme_javascript = 15
  5394. Global Const $url_scheme_vbscript = 16
  5395. Global Const $url_scheme_about = 17
  5396. Global Const $url_scheme_res = 18
  5397. Global Const $url_scheme_msshellrooted = 19
  5398. Global Const $url_scheme_msshellidlist = 20
  5399. Global Const $url_scheme_mshelp = 21
  5400. Global Const $url_scheme_msshelldevice = 22
  5401. Global Const $url_scheme_wildcard = 23
  5402. Global Const $url_scheme_search_ms = 24
  5403. Global Const $url_scheme_search = 25
  5404. Global Const $url_scheme_knownfolder = 26
  5405. Global Const $gct_invalid = 0
  5406. Global Const $gct_lfnchar = 1
  5407. Global Const $gct_separator = 8
  5408. Global Const $gct_shortchar = 2
  5409. Global Const $gct_wild = 4
  5410. Global Const $url_apply_default = 1
  5411. Global Const $url_apply_guessscheme = 2
  5412. Global Const $url_apply_guessfile = 4
  5413. Global Const $url_apply_forceapply = 8
  5414. Global Const $url_dont_simplify = 134217728
  5415. Global Const $url_escape_as_utf8 = 262144
  5416. Global Const $url_escape_percent = 4096
  5417. Global Const $url_escape_spaces_only = 67108864
  5418. Global Const $url_escape_unsafe = 536870912
  5419. Global Const $url_no_meta = 134217728
  5420. Global Const $url_pluggable_protocol = 1073741824
  5421. Global Const $url_unescape = 268435456
  5422. Global Const $url_part_hostname = 2
  5423. Global Const $url_part_password = 4
  5424. Global Const $url_part_port = 5
  5425. Global Const $url_part_query = 6
  5426. Global Const $url_part_scheme = 1
  5427. Global Const $url_part_username = 3
  5428. Global Const $urlis_appliable = 4
  5429. Global Const $urlis_directory = 5
  5430. Global Const $urlis_fileurl = 3
  5431. Global Const $urlis_hasquery = 6
  5432. Global Const $urlis_nohistory = 2
  5433. Global Const $urlis_opaque = 1
  5434. Global Const $urlis_url = 0
  5435. #Region Functions list
  5436. #EndRegion Functions list
  5437. #Region Public Functions
  5438.  
  5439. Func _winapi_commandlinetoargv($scmd)
  5440. Local $aresult[1] = [0]
  5441. $scmd = StringStripWS($scmd, $str_stripleading + $str_striptrailing)
  5442. If NOT $scmd Then
  5443. Return $aresult
  5444. EndIf
  5445. Local $aret = DllCall("shell32.dll", "ptr", "CommandLineToArgvW", "wstr", $scmd, "int*", 0)
  5446. If @error OR NOT $aret[0] OR (NOT $aret[2]) Then Return SetError(@error + 10, @extended, 0)
  5447. Local $tptr = DllStructCreate("ptr[" & $aret[2] & "]", $aret[0])
  5448. Dim $aresult[$aret[2] + 1] = [$aret[2]]
  5449. For $i = 1 To $aret[2]
  5450. $aresult[$i] = _winapi_getstring(DllStructGetData($tptr, 1, $i))
  5451. Next
  5452. DllCall("kernel32.dll", "handle", "LocalFree", "handle", $aret[0])
  5453. Return $aresult
  5454. EndFunc
  5455.  
  5456. Func _winapi_isnameinexpression($sstring, $spattern, $bcasesensitive = False)
  5457. If NOT $bcasesensitive Then $spattern = StringUpper($spattern)
  5458. Local $tus1 = __us($spattern)
  5459. Local $tus2 = __us($sstring)
  5460. Local $aret = DllCall("ntdll.dll", "boolean", "RtlIsNameInExpression", "struct*", $tus1, "struct*", $tus2, "boolean", NOT $bcasesensitive, "ptr", 0)
  5461. If @error Then Return SetError(@error, @extended, False)
  5462. Return $aret[0]
  5463. EndFunc
  5464.  
  5465. Func _winapi_parseurl($surl)
  5466. Local $tagparsedurl = "dword Size;ptr Protocol;uint cchProtocol;ptr Suffix;uint cchSuffix;uint Scheme"
  5467. Local $tpurl = DllStructCreate($tagparsedurl)
  5468. DllStructSetData($tpurl, 1, DllStructGetSize($tpurl))
  5469. Local $turl = DllStructCreate("wchar[4096]")
  5470. DllStructSetData($turl, 1, $surl)
  5471. Local $aret = DllCall("shlwapi.dll", "long", "ParseURLW", "struct*", $turl, "struct*", $tpurl)
  5472. If @error Then Return SetError(@error, @extended, "")
  5473. If $aret[0] Then Return SetError(10, $aret[0], "")
  5474. Local $aresult[3]
  5475. $aresult[0] = DllStructGetData(DllStructCreate("wchar[" & DllStructGetData($tpurl, 3) & "]", DllStructGetData($tpurl, 2)), 1)
  5476. $aresult[1] = DllStructGetData(DllStructCreate("wchar[" & DllStructGetData($tpurl, 5) & "]", DllStructGetData($tpurl, 4)), 1)
  5477. $aresult[2] = DllStructGetData($tpurl, 6)
  5478. Return $aresult
  5479. EndFunc
  5480.  
  5481. Func _winapi_parseusername($suser)
  5482. If NOT __dll("credui.dll") Then Return SetError(103, 0, 0)
  5483. Local $aret = DllCall("credui.dll", "dword", "CredUIParseUserNameW", "wstr", $suser, "wstr", "", "ulong", 4096, "wstr", "", "ulong", 4096)
  5484. If @error Then Return SetError(@error, @extended, 0)
  5485. Switch $aret[0]
  5486. Case 0
  5487. Case 1315
  5488. If StringStripWS($suser, $str_stripleading + $str_striptrailing) Then
  5489. $aret[2] = $suser
  5490. $aret[4] = ""
  5491. Else
  5492. ContinueCase
  5493. EndIf
  5494. Case Else
  5495. Return SetError(10, $aret[0], 0)
  5496. EndSwitch
  5497. Local $aresult[2]
  5498. $aresult[0] = $aret[4]
  5499. $aresult[1] = $aret[2]
  5500. Return $aresult
  5501. EndFunc
  5502.  
  5503. Func _winapi_pathaddbackslash($sfilepath)
  5504. Local $tpath = DllStructCreate("wchar[260]")
  5505. DllStructSetData($tpath, 1, $sfilepath)
  5506. Local $aret = DllCall("shlwapi.dll", "ptr", "PathAddBackslashW", "struct*", $tpath)
  5507. If @error OR NOT $aret[0] Then Return SetError(@error, @extended, "")
  5508. Return DllStructGetData($tpath, 1)
  5509. EndFunc
  5510.  
  5511. Func _winapi_pathaddextension($sfilepath, $sext = "")
  5512. Local $tpath = DllStructCreate("wchar[260]")
  5513. DllStructSetData($tpath, 1, $sfilepath)
  5514. Local $stypeofext = "wstr"
  5515. If NOT StringStripWS($sext, $str_stripleading + $str_striptrailing) Then
  5516. $stypeofext = "ptr"
  5517. $sext = 0
  5518. EndIf
  5519. Local $aret = DllCall("shlwapi.dll", "bool", "PathAddExtensionW", "struct*", $tpath, $stypeofext, $sext)
  5520. If @error Then Return SetError(@error, @extended, "")
  5521. Return SetExtended($aret[0], DllStructGetData($tpath, 1))
  5522. EndFunc
  5523.  
  5524. Func _winapi_pathappend($sfilepath, $smore)
  5525. Local $tpath = DllStructCreate("wchar[260]")
  5526. DllStructSetData($tpath, 1, $sfilepath)
  5527. Local $aret = DllCall("shlwapi.dll", "bool", "PathAppendW", "struct*", $tpath, "wstr", $smore)
  5528. If @error OR NOT $aret[0] Then Return SetError(@error, @extended, "")
  5529. Return DllStructGetData($tpath, 1)
  5530. EndFunc
  5531.  
  5532. Func _winapi_pathbuildroot($idrive)
  5533. Local $aret = DllCall("shlwapi.dll", "ptr", "PathBuildRootW", "wstr", "", "int", $idrive)
  5534. If @error Then Return SetError(@error, @extended, "")
  5535. Return $aret[1]
  5536. EndFunc
  5537.  
  5538. Func _winapi_pathcanonicalize($sfilepath)
  5539. Local $aret = DllCall("shlwapi.dll", "bool", "PathCanonicalizeW", "wstr", "", "wstr", $sfilepath)
  5540. If @error OR NOT $aret[0] Then Return SetError(@error, @extended, $sfilepath)
  5541. Return $aret[1]
  5542. EndFunc
  5543.  
  5544. Func _winapi_pathcommonprefix($spath1, $spath2)
  5545. Local $aret = DllCall("shlwapi.dll", "int", "PathCommonPrefixW", "wstr", $spath1, "wstr", $spath2, "wstr", "")
  5546. If @error Then Return SetError(@error, @extended, "")
  5547. Return SetExtended($aret[0], $aret[3])
  5548. EndFunc
  5549.  
  5550. Func _winapi_pathcompactpath($hwnd, $sfilepath, $iwidth = 0)
  5551. If $iwidth < 1 Then
  5552. Local $trect = DllStructCreate($tagrect)
  5553. DllCall("user32.dll", "bool", "GetClientRect", "hwnd", $hwnd, "struct*", $trect)
  5554. $iwidth += DllStructGetData($trect, "Right") - DllStructGetData($trect, "Left")
  5555. EndIf
  5556. Local $aret = DllCall("user32.dll", "handle", "GetDC", "hwnd", $hwnd)
  5557. If @error OR NOT $aret[0] Then Return SetError(@error + 20, @extended, $sfilepath)
  5558. Local $hdc = $aret[0]
  5559. Local Const $wm_getfont = 49
  5560. $aret = DllCall("user32.dll", "ptr", "SendMessage", "hwnd", $hwnd, "uint", $wm_getfont, "wparam", 0, "lparam", 0)
  5561. Local $hback = DllCall("gdi32.dll", "handle", "SelectObject", "handle", $hdc, "handle", $aret[0])
  5562. Local $ierror = 0
  5563. $aret = DllCall("shlwapi.dll", "bool", "PathCompactPathW", "handle", $hdc, "wstr", $sfilepath, "int", $iwidth)
  5564. If @error OR NOT $aret[0] Then $ierror = @error + 10
  5565. DllCall("gdi32.dll", "handle", "SelectObject", "handle", $hdc, "handle", $hback[0])
  5566. DllCall("user32.dll", "int", "ReleaseDC", "hwnd", $hwnd, "handle", $hdc)
  5567. If $ierror Then Return SetError($ierror, 0, $sfilepath)
  5568. Return $aret[2]
  5569. EndFunc
  5570.  
  5571. Func _winapi_pathcompactpathex($sfilepath, $imax)
  5572. Local $aret = DllCall("shlwapi.dll", "bool", "PathCompactPathExW", "wstr", "", "wstr", $sfilepath, "uint", $imax + 1, "dword", 0)
  5573. If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, $sfilepath)
  5574. Return $aret[1]
  5575. EndFunc
  5576.  
  5577. Func _winapi_pathcreatefromurl($surl)
  5578. Local $aret = DllCall("shlwapi.dll", "long", "PathCreateFromUrlW", "wstr", $surl, "wstr", "", "dword*", 4096, "dword", 0)
  5579. If @error Then Return SetError(@error, @extended, "")
  5580. If $aret[0] Then Return SetError(10, $aret[0], "")
  5581. Return $aret[2]
  5582. EndFunc
  5583.  
  5584. Func _winapi_pathfindextension($sfilepath)
  5585. Local $aret = DllCall("shlwapi.dll", "wstr", "PathFindExtensionW", "wstr", $sfilepath)
  5586. If @error Then Return SetError(@error, @extended, "")
  5587. Return $aret[0]
  5588. EndFunc
  5589.  
  5590. Func _winapi_pathfindfilename($sfilepath)
  5591. Local $aret = DllCall("shlwapi.dll", "wstr", "PathFindFileNameW", "wstr", $sfilepath)
  5592. If @error Then Return SetError(@error, @extended, $sfilepath)
  5593. Return $aret[0]
  5594. EndFunc
  5595.  
  5596. Func _winapi_pathfindnextcomponent($sfilepath)
  5597. Local $tpath = DllStructCreate("wchar[" & (StringLen($sfilepath) + 1) & "]")
  5598. DllStructSetData($tpath, 1, $sfilepath)
  5599. Local $aret = DllCall("shlwapi.dll", "ptr", "PathFindNextComponentW", "struct*", $tpath)
  5600. If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, "")
  5601. Return _winapi_getstring($aret[0])
  5602. EndFunc
  5603.  
  5604. Func _winapi_pathgetargs($sfilepath)
  5605. Local $tpath = DllStructCreate("wchar[" & (StringLen($sfilepath) + 1) & "]")
  5606. DllStructSetData($tpath, 1, $sfilepath)
  5607. Local $aret = DllCall("shlwapi.dll", "ptr", "PathGetArgsW", "struct*", $tpath)
  5608. If @error OR NOT $aret[0] Then Return SetError(@error, @extended, "")
  5609. Return _winapi_getstring($aret[0])
  5610. EndFunc
  5611.  
  5612. Func _winapi_pathgetchartype($schar)
  5613. Local $aret = DllCall("shlwapi.dll", "uint", "PathGetCharTypeW", "word", AscW($schar))
  5614. If @error Then Return SetError(@error, @extended, -1)
  5615. Return $aret[0]
  5616. EndFunc
  5617.  
  5618. Func _winapi_pathgetdrivenumber($sfilepath)
  5619. Local $aret = DllCall("shlwapi.dll", "int", "PathGetDriveNumberW", "wstr", $sfilepath)
  5620. If @error OR ($aret[0] = -1) Then Return SetError(@error, @extended, "")
  5621. Return Chr($aret[0] + 65) & ":"
  5622. EndFunc
  5623.  
  5624. Func _winapi_pathiscontenttype($sfilepath, $stype)
  5625. Local $aret = DllCall("shlwapi.dll", "bool", "PathIsContentTypeW", "wstr", $sfilepath, "wstr", $stype)
  5626. If @error Then Return SetError(@error, @extended, False)
  5627. Return $aret[0]
  5628. EndFunc
  5629.  
  5630. Func _winapi_pathisexe($sfilepath)
  5631. Local $aret = DllCall("shell32.dll", "bool", "PathIsExe", "wstr", $sfilepath)
  5632. If @error Then Return SetError(@error, @extended, False)
  5633. Return $aret[0]
  5634. EndFunc
  5635.  
  5636. Func _winapi_pathisfilespec($sfilepath)
  5637. Local $aret = DllCall("shlwapi.dll", "bool", "PathIsFileSpecW", "wstr", $sfilepath)
  5638. If @error Then Return SetError(@error, @extended, False)
  5639. Return $aret[0]
  5640. EndFunc
  5641.  
  5642. Func _winapi_pathislfnfilespec($sfilepath)
  5643. Local $aret = DllCall("shlwapi.dll", "bool", "PathIsLFNFileSpecW", "wstr", $sfilepath)
  5644. If @error Then Return SetError(@error, @extended, False)
  5645. Return $aret[0]
  5646. EndFunc
  5647.  
  5648. Func _winapi_pathisrelative($sfilepath)
  5649. Local $aret = DllCall("shlwapi.dll", "bool", "PathIsRelativeW", "wstr", $sfilepath)
  5650. If @error Then Return SetError(@error, @extended, False)
  5651. Return $aret[0]
  5652. EndFunc
  5653.  
  5654. Func _winapi_pathisroot($sfilepath)
  5655. Local $aret = DllCall("shlwapi.dll", "bool", "PathIsRootW", "wstr", $sfilepath)
  5656. If @error Then Return SetError(@error, @extended, False)
  5657. Return $aret[0]
  5658. EndFunc
  5659.  
  5660. Func _winapi_pathissameroot($spath1, $spath2)
  5661. Local $aret = DllCall("shlwapi.dll", "bool", "PathIsSameRootW", "wstr", $spath1, "wstr", $spath2)
  5662. If @error Then Return SetError(@error, @extended, False)
  5663. Return $aret[0]
  5664. EndFunc
  5665.  
  5666. Func _winapi_pathissystemfolder($sfilepath)
  5667. Local $aret = DllCall("shlwapi.dll", "bool", "PathIsSystemFolderW", "wstr", $sfilepath, "dword", 0)
  5668. If @error Then Return SetError(@error, @extended, False)
  5669. Return $aret[0]
  5670. EndFunc
  5671.  
  5672. Func _winapi_pathisunc($sfilepath)
  5673. Local $aret = DllCall("shlwapi.dll", "bool", "PathIsUNCW", "wstr", $sfilepath)
  5674. If @error Then Return SetError(@error, @extended, False)
  5675. Return $aret[0]
  5676. EndFunc
  5677.  
  5678. Func _winapi_pathisuncserver($sfilepath)
  5679. Local $aret = DllCall("shlwapi.dll", "bool", "PathIsUNCServerW", "wstr", $sfilepath)
  5680. If @error Then Return SetError(@error, @extended, False)
  5681. Return $aret[0]
  5682. EndFunc
  5683.  
  5684. Func _winapi_pathisuncservershare($sfilepath)
  5685. Local $aret = DllCall("shlwapi.dll", "bool", "PathIsUNCServerShareW", "wstr", $sfilepath)
  5686. If @error Then Return SetError(@error, @extended, False)
  5687. Return $aret[0]
  5688. EndFunc
  5689.  
  5690. Func _winapi_pathmakesystemfolder($sfilepath)
  5691. Local $aret = DllCall("shlwapi.dll", "bool", "PathMakeSystemFolderW", "wstr", $sfilepath)
  5692. If @error Then Return SetError(@error, @extended, False)
  5693. Return $aret[0]
  5694. EndFunc
  5695.  
  5696. Func _winapi_pathmatchspec($sfilepath, $sspec)
  5697. Local $aret = DllCall("shlwapi.dll", "bool", "PathMatchSpecW", "wstr", $sfilepath, "wstr", $sspec)
  5698. If @error Then Return SetError(@error, @extended, False)
  5699. Return $aret[0]
  5700. EndFunc
  5701.  
  5702. Func _winapi_pathparseiconlocation($sfilepath)
  5703. Local $aret = DllCall("shlwapi.dll", "int", "PathParseIconLocationW", "wstr", $sfilepath)
  5704. If @error Then Return SetError(@error, @extended, 0)
  5705. Local $aresult[2]
  5706. $aresult[0] = $aret[1]
  5707. $aresult[1] = $aret[0]
  5708. Return $aresult
  5709. EndFunc
  5710.  
  5711. Func _winapi_pathrelativepathto($spathfrom, $bdirfrom, $spathto, $bdirto)
  5712. If $bdirfrom Then
  5713. $bdirfrom = 16
  5714. EndIf
  5715. If $bdirto Then
  5716. $bdirto = 16
  5717. EndIf
  5718. Local $aret = DllCall("shlwapi.dll", "bool", "PathRelativePathToW", "wstr", "", "wstr", $spathfrom, "dword", $bdirfrom, "wstr", $spathto, "dword", $bdirto)
  5719. If @error OR NOT $aret[0] Then Return SetError(@error, @extended, "")
  5720. Return $aret[1]
  5721. EndFunc
  5722.  
  5723. Func _winapi_pathremoveargs($sfilepath)
  5724. Local $aret = DllCall("shlwapi.dll", "none", "PathRemoveArgsW", "wstr", $sfilepath)
  5725. If @error Then Return SetError(@error, @extended, "")
  5726. Return $aret[1]
  5727. EndFunc
  5728.  
  5729. Func _winapi_pathremovebackslash($sfilepath)
  5730. Local $aret = DllCall("shlwapi.dll", "ptr", "PathRemoveBackslashW", "wstr", $sfilepath)
  5731. If @error Then Return SetError(@error, @extended, "")
  5732. Return $aret[1]
  5733. EndFunc
  5734.  
  5735. Func _winapi_pathremoveextension($sfilepath)
  5736. Local $aret = DllCall("shlwapi.dll", "none", "PathRemoveExtensionW", "wstr", $sfilepath)
  5737. If @error Then Return SetError(@error, @extended, "")
  5738. Return $aret[1]
  5739. EndFunc
  5740.  
  5741. Func _winapi_pathremovefilespec($sfilepath)
  5742. Local $aret = DllCall("shlwapi.dll", "bool", "PathRemoveFileSpecW", "wstr", $sfilepath)
  5743. If @error Then Return SetError(@error, @extended, "")
  5744. Return SetExtended($aret[0], $aret[1])
  5745. EndFunc
  5746.  
  5747. Func _winapi_pathrenameextension($sfilepath, $sext)
  5748. Local $tpath = DllStructCreate("wchar[260]")
  5749. DllStructSetData($tpath, 1, $sfilepath)
  5750. Local $aret = DllCall("shlwapi.dll", "bool", "PathRenameExtensionW", "struct*", $tpath, "wstr", $sext)
  5751. If @error OR NOT $aret[0] Then Return SetError(@error, @extended, "")
  5752. Return DllStructGetData($tpath, 1)
  5753. EndFunc
  5754.  
  5755. Func _winapi_pathsearchandqualify($sfilepath, $bexists = False)
  5756. Local $aret = DllCall("shlwapi.dll", "bool", "PathSearchAndQualifyW", "wstr", $sfilepath, "wstr", "", "int", 4096)
  5757. If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, "")
  5758. If $bexists AND NOT FileExists($aret[2]) Then Return SetError(20, 0, "")
  5759. Return $aret[2]
  5760. EndFunc
  5761.  
  5762. Func _winapi_pathskiproot($sfilepath)
  5763. Local $tpath = DllStructCreate("wchar[" & (StringLen($sfilepath) + 1) & "]")
  5764. DllStructSetData($tpath, 1, $sfilepath)
  5765. Local $aret = DllCall("shlwapi.dll", "ptr", "PathSkipRootW", "struct*", $tpath)
  5766. If @error Then Return SetError(@error, @extended, "")
  5767. If NOT $aret[0] Then Return $sfilepath
  5768. Return _winapi_getstring($aret[0])
  5769. EndFunc
  5770.  
  5771. Func _winapi_pathstrippath($sfilepath)
  5772. Local $aret = DllCall("shlwapi.dll", "none", "PathStripPathW", "wstr", $sfilepath)
  5773. If @error Then Return SetError(@error, @extended, "")
  5774. Return $aret[1]
  5775. EndFunc
  5776.  
  5777. Func _winapi_pathstriptoroot($sfilepath)
  5778. Local $aret = DllCall("shlwapi.dll", "bool", "PathStripToRootW", "wstr", $sfilepath)
  5779. If @error OR NOT $aret[0] Then Return SetError(@error, @extended, "")
  5780. Return $aret[1]
  5781. EndFunc
  5782.  
  5783. Func _winapi_pathundecorate($sfilepath)
  5784. Local $aret = DllCall("shlwapi.dll", "none", "PathUndecorateW", "wstr", $sfilepath)
  5785. If @error Then Return SetError(@error, @extended, "")
  5786. Return $aret[1]
  5787. EndFunc
  5788.  
  5789. Func _winapi_pathunexpandenvstrings($sfilepath)
  5790. Local $aret = DllCall("shlwapi.dll", "bool", "PathUnExpandEnvStringsW", "wstr", $sfilepath, "wstr", "", "uint", 4096)
  5791. If @error OR NOT $aret[0] Then Return SetError(@error, @extended, "")
  5792. Return $aret[2]
  5793. EndFunc
  5794.  
  5795. Func _winapi_pathunmakesystemfolder($sfilepath)
  5796. Local $aret = DllCall("shlwapi.dll", "bool", "PathUnmakeSystemFolderW", "wstr", $sfilepath)
  5797. If @error Then Return SetError(@error, @extended, False)
  5798. Return $aret[0]
  5799. EndFunc
  5800.  
  5801. Func _winapi_pathunquotespaces($sfilepath)
  5802. Local $aret = DllCall("shlwapi.dll", "none", "PathUnquoteSpacesW", "wstr", $sfilepath)
  5803. If @error Then Return SetError(@error, @extended, "")
  5804. Return $aret[1]
  5805. EndFunc
  5806.  
  5807. Func _winapi_pathyetanothermakeuniquename($sfilepath)
  5808. Local $aret = DllCall("shell32.dll", "int", "PathYetAnotherMakeUniqueName", "wstr", "", "wstr", $sfilepath, "ptr", 0, "ptr", 0)
  5809. If @error OR NOT $aret[0] Then Return SetError(@error, @extended, "")
  5810. Return $aret[1]
  5811. EndFunc
  5812.  
  5813. Func _winapi_shellgetimagelist($bsmall = False)
  5814. Local $plarge, $psmall, $tptr = DllStructCreate("ptr")
  5815. If $bsmall Then
  5816. $plarge = 0
  5817. $psmall = DllStructGetPtr($tptr)
  5818. Else
  5819. $plarge = DllStructGetPtr($tptr)
  5820. $psmall = 0
  5821. EndIf
  5822. Local $aret = DllCall("shell32.dll", "int", "Shell_GetImageLists", "ptr", $plarge, "ptr", $psmall)
  5823. If @error OR NOT $aret[0] Then Return SetError(@error, @extended, 0)
  5824. Return DllStructGetData($tptr, 1)
  5825. EndFunc
  5826.  
  5827. Func _winapi_urlapplyscheme($surl, $iflags = 1)
  5828. Local $aret = DllCall("shlwapi.dll", "long", "UrlApplySchemeW", "wstr", $surl, "wstr", "", "dword*", 4096, "dword", $iflags)
  5829. If @error Then Return SetError(@error, @extended, "")
  5830. If $aret[0] Then Return SetError(10, $aret[0], "")
  5831. Return $aret[2]
  5832. EndFunc
  5833.  
  5834. Func _winapi_urlcanonicalize($surl, $iflags)
  5835. Local $aret = DllCall("shlwapi.dll", "long", "UrlCanonicalizeW", "wstr", $surl, "wstr", "", "dword*", 4096, "dword", $iflags)
  5836. If @error Then Return SetError(@error, @extended, "")
  5837. If $aret[0] Then Return SetError(10, $aret[0], "")
  5838. Return $aret[2]
  5839. EndFunc
  5840.  
  5841. Func _winapi_urlcombine($surl, $spart, $iflags = 0)
  5842. Local $aret = DllCall("shlwapi.dll", "long", "UrlCombineW", "wstr", $surl, "wstr", $spart, "wstr", "", "dword*", 4096, "dword", $iflags)
  5843. If @error Then Return SetError(@error, @extended, "")
  5844. If $aret[0] Then Return SetError(10, $aret[0], "")
  5845. Return $aret[3]
  5846. EndFunc
  5847.  
  5848. Func _winapi_urlcompare($surl1, $surl2, $bignoreslash = False)
  5849. Local $aret = DllCall("shlwapi.dll", "int", "UrlCompareW", "wstr", $surl1, "wstr", $surl2, "bool", $bignoreslash)
  5850. If @error Then Return SetError(@error, @extended, 0)
  5851. Return $aret[0]
  5852. EndFunc
  5853.  
  5854. Func _winapi_urlcreatefrompath($sfilepath)
  5855. Local $aret = DllCall("shlwapi.dll", "long", "UrlCreateFromPathW", "wstr", $sfilepath, "wstr", "", "dword*", 4096, "dword", 0)
  5856. If @error Then Return SetError(@error, @extended, "")
  5857. If $aret[0] < 0 OR $aret[0] > 1 Then
  5858. Return SetError(10, $aret[0], "")
  5859. EndIf
  5860. Return $aret[2]
  5861. EndFunc
  5862.  
  5863. Func _winapi_urlfixup($surl)
  5864. Local $aret = DllCall("shlwapi.dll", "long", "UrlFixupW", "wstr", $surl, "wstr", "", "dword", 4096)
  5865. If @error Then Return SetError(@error, @extended, "")
  5866. If $aret[0] Then Return SetError(10, $aret[0], "")
  5867. Return $aret[2]
  5868. EndFunc
  5869.  
  5870. Func _winapi_urlgetpart($surl, $ipart)
  5871. Local $aret = DllCall("shlwapi.dll", "long", "UrlGetPartW", "wstr", $surl, "wstr", "", "dword*", 4096, "dword", $ipart, "dword", 0)
  5872. If @error Then Return SetError(@error, @extended, "")
  5873. If $aret[0] Then Return SetError(10, $aret[0], "")
  5874. Return $aret[2]
  5875. EndFunc
  5876.  
  5877. Func _winapi_urlhash($surl, $ilength = 32)
  5878. If $ilength <= 0 OR $ilength > 256 Then Return SetError(256, 0, 0)
  5879. Local $tdata = DllStructCreate("byte[" & $ilength & "]")
  5880. Local $aret = DllCall("shlwapi.dll", "long", "UrlHashW", "wstr", $surl, "struct*", $tdata, "dword", $ilength)
  5881. If @error Then Return SetError(@error + 10, @extended, 0)
  5882. If $aret[0] Then Return SetError(10, $aret[0], 0)
  5883. Return DllStructGetData($tdata, 1)
  5884. EndFunc
  5885.  
  5886. Func _winapi_urlis($surl, $itype = 0)
  5887. Local $aret = DllCall("shlwapi.dll", "bool", "UrlIsW", "wstr", $surl, "uint", $itype)
  5888. If @error Then Return SetError(@error, @extended, False)
  5889. Return $aret[0]
  5890. EndFunc
  5891.  
  5892. #EndRegion Public Functions
  5893. #Region Internal Functions
  5894.  
  5895. Func __us($sstring, $ilength = 0)
  5896. If $ilength Then
  5897. $sstring = StringLeft($sstring, $ilength)
  5898. Else
  5899. $ilength = StringLen($sstring)
  5900. EndIf
  5901. Local $tus = DllStructCreate("ushort;ushort;ptr;wchar[" & ($ilength + 1) & "]")
  5902. DllStructSetData($tus, 1, 2 * StringLen($sstring))
  5903. DllStructSetData($tus, 2, 2 * $ilength)
  5904. DllStructSetData($tus, 3, DllStructGetPtr($tus, 4))
  5905. DllStructSetData($tus, 4, $sstring)
  5906. Return $tus
  5907. EndFunc
  5908.  
  5909. #EndRegion Internal Functions
  5910. #Region Global Variables and Constants
  5911. Global Const $tagnotifyicondata = "struct;dword Size;hwnd hWnd;uint ID;uint Flags;uint CallbackMessage;ptr hIcon;wchar Tip[128];dword State;dword StateMask;wchar Info[256];uint Version;wchar InfoTitle[64];dword InfoFlags;endstruct"
  5912. Global Const $tagnotifyicondata_v3 = $tagnotifyicondata & ";" & $tagguid
  5913. Global Const $tagnotifyicondata_v4 = $tagnotifyicondata_v3 & ";ptr hBalloonIcon;"
  5914. Global Const $tagshellexecuteinfo = "dword Size;ulong Mask;hwnd hWnd;ptr Verb;ptr File;ptr Parameters;ptr Directory;int Show;ulong_ptr hInstApp;ptr IDList;ptr Class;ulong_ptr hKeyClass;dword HotKey;ptr hMonitor;ptr hProcess"
  5915. Global Const $tagshfileinfo = "ptr hIcon;int iIcon;dword Attributes;wchar DisplayName[260];wchar TypeName[80]"
  5916. Global Const $tagshfileopstruct = "hwnd hWnd;uint Func;ptr From;ptr To;dword Flags;int fAnyOperationsAborted;ptr hNameMappings;ptr ProgressTitle"
  5917. Global Const $tagshfoldercustomsettings = "dword Size;dword Mask;ptr GUID;ptr WebViewTemplate;dword SizeWVT;ptr WebViewTemplateVersion;ptr InfoTip;dword SizeIT;ptr CLSID;dword Flags;ptr IconFile;dword SizeIF;int IconIndex;ptr Logo;dword SizeL"
  5918. Global Const $tagshstockiconinfo = "dword Size;ptr hIcon;int SysImageIndex;int iIcon;wchar Path[260]"
  5919. #EndRegion Global Variables and Constants
  5920. #Region Functions list
  5921. #EndRegion Functions list
  5922. #Region Public Functions
  5923.  
  5924. Func _winapi_defsubclassproc($hwnd, $imsg, $wparam, $lparam)
  5925. Local $aret = DllCall("comctl32.dll", "lresult", "DefSubclassProc", "hwnd", $hwnd, "uint", $imsg, "wparam", $wparam, "lparam", $lparam)
  5926. If @error Then Return SetError(@error, @extended, 0)
  5927. Return $aret[0]
  5928. EndFunc
  5929.  
  5930. Func _winapi_dllgetversion($sfilepath)
  5931. Local $tversion = DllStructCreate("dword[5]")
  5932. DllStructSetData($tversion, 1, DllStructGetSize($tversion), 1)
  5933. Local $aret = DllCall($sfilepath, "uint", "DllGetVersion", "struct*", $tversion)
  5934. If @error Then Return SetError(@error, @extended, 0)
  5935. If $aret[0] Then Return SetError(10, $aret[0], 0)
  5936. Local $aresult[4]
  5937. For $i = 0 To 3
  5938. $aresult[$i] = DllStructGetData($tversion, 1, $i + 2)
  5939. Next
  5940. Return $aresult
  5941. EndFunc
  5942.  
  5943. Func _winapi_getallusersprofiledirectory()
  5944. Local $aret = DllCall("userenv.dll", "bool", "GetAllUsersProfileDirectoryW", "wstr", "", "dword*", 4096)
  5945. If @error OR NOT $aret[0] Then Return SetError(@error, @extended, "")
  5946. Return $aret[1]
  5947. EndFunc
  5948.  
  5949. Func _winapi_getdefaultuserprofiledirectory()
  5950. Local $aret = DllCall("userenv.dll", "bool", "GetDefaultUserProfileDirectoryW", "wstr", "", "dword*", 4096)
  5951. If @error Then Return SetError(@error, @extended, "")
  5952. Return $aret[1]
  5953. EndFunc
  5954.  
  5955. Func _winapi_getwindowsubclass($hwnd, $psubclassproc, $idsubclass)
  5956. Local $aret = DllCall("comctl32.dll", "bool", "GetWindowSubclass", "hwnd", $hwnd, "ptr", $psubclassproc, "uint_ptr", $idsubclass, "dword_ptr*", 0)
  5957. If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
  5958. Return $aret[4]
  5959. EndFunc
  5960.  
  5961. Func _winapi_removewindowsubclass($hwnd, $psubclassproc, $idsubclass)
  5962. Local $aret = DllCall("comctl32.dll", "bool", "RemoveWindowSubclass", "hwnd", $hwnd, "ptr", $psubclassproc, "uint_ptr", $idsubclass)
  5963. If @error Then Return SetError(@error, @extended, False)
  5964. Return $aret[0]
  5965. EndFunc
  5966.  
  5967. Func _winapi_setcurrentprocessexplicitappusermodelid($sappid)
  5968. Local $aret = DllCall("shell32.dll", "long", "SetCurrentProcessExplicitAppUserModelID", "wstr", $sappid)
  5969. If @error Then Return SetError(@error, @extended, 0)
  5970. If $aret[0] Then Return SetError(10, $aret[0], 0)
  5971. Return 1
  5972. EndFunc
  5973.  
  5974. Func _winapi_setwindowsubclass($hwnd, $psubclassproc, $idsubclass, $pdata = 0)
  5975. Local $aret = DllCall("comctl32.dll", "bool", "SetWindowSubclass", "hwnd", $hwnd, "ptr", $psubclassproc, "uint_ptr", $idsubclass, "dword_ptr", $pdata)
  5976. If @error Then Return SetError(@error, @extended, 0)
  5977. Return $aret[0]
  5978. EndFunc
  5979.  
  5980. Func _winapi_shelladdtorecentdocs($sfilepath)
  5981. Local $stypeoffile = "wstr"
  5982. If StringStripWS($sfilepath, $str_stripleading + $str_striptrailing) Then
  5983. $sfilepath = _winapi_pathsearchandqualify($sfilepath, 1)
  5984. If NOT $sfilepath Then
  5985. Return SetError(1, 0, 0)
  5986. EndIf
  5987. Else
  5988. $stypeoffile = "ptr"
  5989. $sfilepath = 0
  5990. EndIf
  5991. DllCall("shell32.dll", "none", "SHAddToRecentDocs", "uint", 3, $stypeoffile, $sfilepath)
  5992. If @error Then Return SetError(@error, @extended, 0)
  5993. Return 1
  5994. EndFunc
  5995.  
  5996. Func _winapi_shellchangenotify($ievent, $iflags, $iitem1 = 0, $iitem2 = 0)
  5997. Local $stypeofitem1 = "dword_ptr", $stypeofitem2 = "dword_ptr"
  5998. If IsString($iitem1) Then
  5999. $stypeofitem1 = "wstr"
  6000. EndIf
  6001. If IsString($iitem2) Then
  6002. $stypeofitem2 = "wstr"
  6003. EndIf
  6004. DllCall("shell32.dll", "none", "SHChangeNotify", "long", $ievent, "uint", $iflags, $stypeofitem1, $iitem1, $stypeofitem2, $iitem2)
  6005. If @error Then Return SetError(@error, @extended, 0)
  6006. Return 1
  6007. EndFunc
  6008.  
  6009. Func _winapi_shellchangenotifyderegister($iid)
  6010. Local $aret = DllCall("shell32.dll", "bool", "SHChangeNotifyDeregister", "ulong", $iid)
  6011. If @error Then Return SetError(@error, @extended, False)
  6012. Return $aret[0]
  6013. EndFunc
  6014.  
  6015. Func _winapi_shellchangenotifyregister($hwnd, $imsg, $ievents, $isources, $apaths, $brecursive = False)
  6016. Local $ipath = $apaths, $tagstruct = ""
  6017. If IsArray($apaths) Then
  6018. If UBound($apaths, $ubound_columns) Then Return SetError(1, 0, 0)
  6019. Else
  6020. Dim $apaths[1] = [$ipath]
  6021. EndIf
  6022. For $i = 0 To UBound($apaths) - 1
  6023. If NOT _winapi_pathisdirectory($apaths[$i]) Then Return SetError(2, 0, 0)
  6024. Next
  6025. For $i = 0 To UBound($apaths) - 1
  6026. $tagstruct &= "ptr;int;"
  6027. Next
  6028. Local $tentry = DllStructCreate($tagstruct)
  6029. For $i = 0 To UBound($apaths) - 1
  6030. $apaths[$i] = _winapi_shellilcreatefrompath(_winapi_pathsearchandqualify($apaths[$i]))
  6031. DllStructSetData($tentry, 2 * $i + 1, $apaths[$i])
  6032. DllStructSetData($tentry, 2 * $i + 2, $brecursive)
  6033. Next
  6034. Local $ierror = 0
  6035. Local $aret = DllCall("shell32.dll", "ulong", "SHChangeNotifyRegister", "hwnd", $hwnd, "int", $isources, "long", $ievents, "uint", $imsg, "int", UBound($apaths), "struct*", $tentry)
  6036. If @error OR NOT $aret[0] Then $ierror = @error + 10
  6037. For $i = 0 To UBound($apaths) - 1
  6038. _winapi_cotaskmemfree($apaths[$i])
  6039. Next
  6040. Return SetError($ierror, 0, $aret[0])
  6041. EndFunc
  6042.  
  6043. Func _winapi_shellcreatedirectory($sfilepath, $hparent = 0, $tsecurity = 0)
  6044. Local $aret = DllCall("shell32.dll", "int", "SHCreateDirectoryExW", "hwnd", $hparent, "wstr", $sfilepath, "struct*", $tsecurity)
  6045. If @error Then Return SetError(@error, @extended, 0)
  6046. If $aret[0] Then Return SetError(10, $aret[0], 0)
  6047. Return 1
  6048. EndFunc
  6049.  
  6050. Func _winapi_shellemptyrecyclebin($sroot = "", $iflags = 0, $hparent = 0)
  6051. Local $aret = DllCall("shell32.dll", "long", "SHEmptyRecycleBinW", "hwnd", $hparent, "wstr", $sroot, "dword", $iflags)
  6052. If @error Then Return SetError(@error, @extended, 0)
  6053. If $aret[0] Then Return SetError(10, $aret[0], 0)
  6054. Return 1
  6055. EndFunc
  6056.  
  6057. Func _winapi_shellexecute($sfilepath, $sargs = "", $sdir = "", $sverb = "", $ishow = 1, $hparent = 0)
  6058. Local $stypeofargs = "wstr", $stypeofdir = "wstr", $stypeofverb = "wstr"
  6059. If NOT StringStripWS($sargs, $str_stripleading + $str_striptrailing) Then
  6060. $stypeofargs = "ptr"
  6061. $sargs = 0
  6062. EndIf
  6063. If NOT StringStripWS($sdir, $str_stripleading + $str_striptrailing) Then
  6064. $stypeofdir = "ptr"
  6065. $sdir = 0
  6066. EndIf
  6067. If NOT StringStripWS($sverb, $str_stripleading + $str_striptrailing) Then
  6068. $stypeofverb = "ptr"
  6069. $sverb = 0
  6070. EndIf
  6071. Local $aret = DllCall("shell32.dll", "ULONG_PTR", "ShellExecuteW", "hwnd", $hparent, $stypeofverb, $sverb, "wstr", $sfilepath, $stypeofargs, $sargs, $stypeofdir, $sdir, "int", $ishow)
  6072. If @error Then Return SetError(@error, @extended, False)
  6073. If $aret[0] <= 32 Then Return SetError(10, $aret[0], 0)
  6074. Return $aret[0]
  6075. EndFunc
  6076.  
  6077. Func _winapi_shellexecuteex(ByRef $tshexinfo)
  6078. Local $aret = DllCall("shell32.dll", "bool", "ShellExecuteExW", "struct*", $tshexinfo)
  6079. If @error Then Return SetError(@error, @extended, 0)
  6080. Return $aret[0]
  6081. EndFunc
  6082.  
  6083. Func _winapi_shellextractassociatedicon($sfilepath, $bsmall = False)
  6084. Local $iflags = 256
  6085. If NOT _winapi_pathisdirectory($sfilepath) Then
  6086. $iflags = BitOR($iflags, 16)
  6087. EndIf
  6088. If $bsmall Then
  6089. $iflags = BitOR($iflags, 1)
  6090. EndIf
  6091. Local $tshfileinfo = DllStructCreate($tagshfileinfo)
  6092. If NOT _winapi_shellgetfileinfo($sfilepath, $iflags, 0, $tshfileinfo) Then Return SetError(@error + 10, @extended, 0)
  6093. Return DllStructGetData($tshfileinfo, "hIcon")
  6094. EndFunc
  6095.  
  6096. Func _winapi_shellextracticon($sicon, $iindex, $iwidth, $iheight)
  6097. Local $aret = DllCall("shell32.dll", "int", "SHExtractIconsW", "wstr", $sicon, "int", $iindex, "int", $iwidth, "int", $iheight, "ptr*", 0, "ptr*", 0, "int", 1, "int", 0)
  6098. If @error OR NOT $aret[0] OR NOT $aret[5] Then Return SetError(@error, @extended, 0)
  6099. Return $aret[5]
  6100. EndFunc
  6101.  
  6102. Func _winapi_shellfileoperation($sfrom, $sto, $ifunc, $iflags, $stitle = "", $hparent = 0)
  6103. Local $idata
  6104. If NOT IsArray($sfrom) Then
  6105. $idata = $sfrom
  6106. Dim $sfrom[1] = [$idata]
  6107. EndIf
  6108. Local $tfrom = _winapi_arraytostruct($sfrom)
  6109. If @error Then Return SetError(@error + 20, @extended, 0)
  6110. If NOT IsArray($sto) Then
  6111. $idata = $sto
  6112. Dim $sto[1] = [$idata]
  6113. EndIf
  6114. Local $tto = _winapi_arraytostruct($sto)
  6115. If @error Then Return SetError(@error + 30, @extended, 0)
  6116. Local $tshfileopstruct = DllStructCreate($tagshfileopstruct)
  6117. DllStructSetData($tshfileopstruct, "hWnd", $hparent)
  6118. DllStructSetData($tshfileopstruct, "Func", $ifunc)
  6119. DllStructSetData($tshfileopstruct, "From", DllStructGetPtr($tfrom))
  6120. DllStructSetData($tshfileopstruct, "To", DllStructGetPtr($tto))
  6121. DllStructSetData($tshfileopstruct, "Flags", $iflags)
  6122. DllStructSetData($tshfileopstruct, "ProgressTitle", $stitle)
  6123. Local $aret = DllCall("shell32.dll", "int", "SHFileOperationW", "struct*", $tshfileopstruct)
  6124. If @error Then Return SetError(@error, @extended, 0)
  6125. If $aret[0] Then Return SetError(10, $aret[0], 0)
  6126. Return $tshfileopstruct
  6127. EndFunc
  6128.  
  6129. Func _winapi_shellflushsfcache()
  6130. DllCall("shell32.dll", "none", "SHFlushSFCache")
  6131. If @error Then Return SetError(@error, @extended, 0)
  6132. Return 1
  6133. EndFunc
  6134.  
  6135. Func _winapi_shellgetfileinfo($sfilepath, $iflags, $iattributes, ByRef $tshfileinfo)
  6136. Local $aret = DllCall("shell32.dll", "dword_ptr", "SHGetFileInfoW", "wstr", $sfilepath, "dword", $iattributes, "struct*", $tshfileinfo, "uint", DllStructGetSize($tshfileinfo), "uint", $iflags)
  6137. If @error Then Return SetError(@error, @extended, 0)
  6138. Return $aret[0]
  6139. EndFunc
  6140.  
  6141. Func _winapi_shellgeticonoverlayindex($sicon, $iindex)
  6142. Local $stypeoficon = "wstr"
  6143. If NOT StringStripWS($sicon, $str_stripleading + $str_striptrailing) Then
  6144. $stypeoficon = "ptr"
  6145. $sicon = 0
  6146. EndIf
  6147. Local $aret = DllCall("shell32.dll", "int", "SHGetIconOverlayIndexW", $stypeoficon, $sicon, "int", $iindex)
  6148. If @error OR ($aret[0] = -1) Then Return SetError(@error, @extended, -1)
  6149. Return $aret[0]
  6150. EndFunc
  6151.  
  6152. Func _winapi_shellgetknownfolderidlist($sguid, $iflags = 0, $htoken = 0)
  6153. Local $tguid = DllStructCreate($tagguid)
  6154. Local $aret = DllCall("ole32.dll", "uint", "CLSIDFromString", "wstr", $sguid, "struct*", $tguid)
  6155. If @error OR $aret[0] Then Return SetError(@error + 20, @extended, 0)
  6156. $aret = DllCall("shell32.dll", "uint", "SHGetKnownFolderIDList", "struct*", $tguid, "dword", $iflags, "handle", $htoken, "ptr*", 0)
  6157. If @error Then Return SetError(@error, @extended, 0)
  6158. If $aret[0] Then Return SetError(10, $aret[0], 0)
  6159. Return $aret[4]
  6160. EndFunc
  6161.  
  6162. Func _winapi_shellgetknownfolderpath($sguid, $iflags = 0, $htoken = 0)
  6163. Local $tguid = DllStructCreate($tagguid)
  6164. Local $aret = DllCall("ole32.dll", "long", "CLSIDFromString", "wstr", $sguid, "struct*", $tguid)
  6165. If @error OR $aret[0] Then Return SetError(@error + 20, @extended, "")
  6166. $aret = DllCall("shell32.dll", "long", "SHGetKnownFolderPath", "struct*", $tguid, "dword", $iflags, "handle", $htoken, "ptr*", 0)
  6167. If @error Then Return SetError(@error, @extended, "")
  6168. If $aret[0] Then Return SetError(10, $aret[0], "")
  6169. Local $spath = _winapi_getstring($aret[4])
  6170. _winapi_cotaskmemfree($aret[4])
  6171. Return $spath
  6172. EndFunc
  6173.  
  6174. Func _winapi_shellgetlocalizedname($sfilepath)
  6175. Local $aret = DllCall("shell32.dll", "long", "SHGetLocalizedName", "wstr", $sfilepath, "wstr", "", "uint*", 0, "int*", 0)
  6176. If @error Then Return SetError(@error, @extended, 0)
  6177. If $aret[0] Then Return SetError(10, $aret[0], 0)
  6178. Local $aresult[2]
  6179. Local $aret1 = DllCall("kernel32.dll", "dword", "ExpandEnvironmentStringsW", "wstr", $aret[2], "wstr", "", "dword", 4096)
  6180. $aresult[0] = $aret1[2]
  6181. $aresult[1] = $aret[4]
  6182. Return $aresult
  6183. EndFunc
  6184.  
  6185. Func _winapi_shellgetpathfromidlist($ppidl)
  6186. Local $aret = DllCall("shell32.dll", "bool", "SHGetPathFromIDListW", "struct*", $ppidl, "wstr", "")
  6187. If @error OR NOT $aret[0] Then Return SetError(@error, @extended, "")
  6188. Return $aret[2]
  6189. EndFunc
  6190.  
  6191. Func _winapi_shellgetsetfoldercustomsettings($sfilepath, $iflag, ByRef $tshfcs)
  6192. Local $sproc = "SHGetSetFolderCustomSettings"
  6193. If $__winver < 1536 Then $sproc &= "W"
  6194. Local $aret = DllCall("shell32.dll", "long", $sproc, "struct*", $tshfcs, "wstr", $sfilepath, "dword", $iflag)
  6195. If @error Then Return SetError(@error, @extended, 0)
  6196. If $aret[0] Then Return SetError(10, $aret[0], 0)
  6197. Return 1
  6198. EndFunc
  6199.  
  6200. Func _winapi_shellgetsettings($iflags)
  6201. Local $tshellstate = DllStructCreate("uint[8]")
  6202. DllCall("shell32.dll", "none", "SHGetSetSettings", "struct*", $tshellstate, "dword", $iflags, "bool", 0)
  6203. If @error Then Return SetError(@error, @extended, 0)
  6204. Local $ival1 = DllStructGetData($tshellstate, 1, 1)
  6205. Local $ival2 = DllStructGetData($tshellstate, 1, 8)
  6206. Local $iresult = 0
  6207. Local $aopt[20][2] = [[1, 1], [2, 2], [4, 32768], [8, 32], [16, 8], [32, 128], [64, 512], [128, 1024], [256, 2048], [1024, 4096], [2048, 8192], [4096, 16384], [8192, 131072], [32768, 262144], [65536, 1048576], [1, 524288], [2, 2097152], [8, 8388608], [16, 16777216], [32, 33554432]]
  6208. For $i = 0 To 14
  6209. If BitAND($ival1, $aopt[$i][0]) Then
  6210. $iresult += $aopt[$i][1]
  6211. EndIf
  6212. Next
  6213. For $i = 15 To 19
  6214. If BitAND($ival2, $aopt[$i][0]) Then
  6215. $iresult += $aopt[$i][1]
  6216. EndIf
  6217. Next
  6218. Return $iresult
  6219. EndFunc
  6220.  
  6221. Func _winapi_shellgetspecialfolderlocation($icsidl)
  6222. Local $aret = DllCall("shell32.dll", "long", "SHGetSpecialFolderLocation", "hwnd", 0, "int", $icsidl, "ptr*", 0)
  6223. If @error Then Return SetError(@error, @extended, 0)
  6224. If $aret[0] Then Return SetError(10, $aret[0], 0)
  6225. Return $aret[3]
  6226. EndFunc
  6227.  
  6228. Func _winapi_shellgetspecialfolderpath($icsidl, $bcreate = False)
  6229. Local $aret = DllCall("shell32.dll", "bool", "SHGetSpecialFolderPathW", "hwnd", 0, "wstr", "", "int", $icsidl, "bool", $bcreate)
  6230. If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, "")
  6231. Return $aret[2]
  6232. EndFunc
  6233.  
  6234. Func _winapi_shellgetstockiconinfo($isiid, $iflags)
  6235. Local $tshstockiconinfo = DllStructCreate($tagshstockiconinfo)
  6236. DllStructSetData($tshstockiconinfo, "Size", DllStructGetSize($tshstockiconinfo))
  6237. Local $aret = DllCall("shell32.dll", "long", "SHGetStockIconInfo", "int", $isiid, "uint", $iflags, "struct*", $tshstockiconinfo)
  6238. If @error Then Return SetError(@error, @extended, 0)
  6239. If $aret[0] Then Return SetError(10, $aret[0], 0)
  6240. Return $tshstockiconinfo
  6241. EndFunc
  6242.  
  6243. Func _winapi_shellilcreatefrompath($sfilepath)
  6244. Local $aret = DllCall("shell32.dll", "long", "SHILCreateFromPath", "wstr", $sfilepath, "ptr*", 0, "dword*", 0)
  6245. If @error Then Return SetError(@error, @extended, 0)
  6246. If $aret[0] Then Return SetError(10, $aret[0], 0)
  6247. Return $aret[2]
  6248. EndFunc
  6249.  
  6250. Func _winapi_shellnotifyicon($imessage, ByRef $tnotifyicondata)
  6251. Local $aret = DllCall("shell32.dll", "bool", "Shell_NotifyIconW", "dword", $imessage, "struct*", $tnotifyicondata)
  6252. If @error Then Return SetError(@error, @extended, False)
  6253. Return $aret[0]
  6254. EndFunc
  6255.  
  6256. Func _winapi_shellnotifyicongetrect($hwnd, $iid, $tguid = 0)
  6257. Local $tnii = DllStructCreate("dword;hwnd;uint;" & $tagguid)
  6258. DllStructSetData($tnii, 1, DllStructGetSize($tnii))
  6259. DllStructSetData($tnii, 2, $hwnd)
  6260. DllStructSetData($tnii, 3, $iid)
  6261. If IsDllStruct($tguid) Then
  6262. If NOT _winapi_movememory(DllStructGetPtr($tnii, 4), $tguid, 16) Then Return SetError(@error + 10, @extended, 0)
  6263. EndIf
  6264. Local $trect = DllStructCreate($tagrect)
  6265. Local $aret = DllCall("shell32.dll", "long", "Shell_NotifyIconGetRect", "struct*", $tnii, "struct*", $trect)
  6266. If @error Then Return SetError(@error, @extended, 0)
  6267. If $aret[0] Then Return SetError(10, $aret[0], 0)
  6268. Return $trect
  6269. EndFunc
  6270.  
  6271. Func _winapi_shellobjectproperties($sfilepath, $itype = 2, $sproperty = "", $hparent = 0)
  6272. Local $stypeofproperty = "wstr"
  6273. If NOT StringStripWS($sproperty, $str_stripleading + $str_striptrailing) Then
  6274. $stypeofproperty = "ptr"
  6275. $sproperty = 0
  6276. EndIf
  6277. Local $aret = DllCall("shell32.dll", "bool", "SHObjectProperties", "hwnd", $hparent, "dword", $itype, "wstr", $sfilepath, $stypeofproperty, $sproperty)
  6278. If @error Then Return SetError(@error, @extended, False)
  6279. Return $aret[0]
  6280. EndFunc
  6281.  
  6282. Func _winapi_shellopenfolderandselectitems($sfilepath, $anames = 0, $istart = 0, $iend = -1, $iflags = 0)
  6283. Local $ppidl, $aret, $tptr = 0, $icount = 0, $iobj = 0, $ierror = 0
  6284. $sfilepath = _winapi_pathremovebackslash(_winapi_pathsearchandqualify($sfilepath))
  6285. If IsArray($anames) Then
  6286. If $sfilepath AND NOT _winapi_pathisdirectory($sfilepath) Then Return SetError(@error + 20, @extended, 0)
  6287. EndIf
  6288. $ppidl = _winapi_shellilcreatefrompath($sfilepath)
  6289. If @error Then Return SetError(@error + 30, @extended, 0)
  6290. If NOT __checkerrorarraybounds($anames, $istart, $iend) Then
  6291. $tptr = DllStructCreate("ptr[" & ($iend - $istart + 1) & "]")
  6292. For $i = $istart To $iend
  6293. $icount += 1
  6294. If $anames[$i] Then
  6295. DllStructSetData($tptr, 1, _winapi_shellilcreatefrompath($sfilepath & "\" & $anames[$i]), $icount)
  6296. Else
  6297. DllStructSetData($tptr, 1, 0, $icount)
  6298. EndIf
  6299. Next
  6300. EndIf
  6301. If _winapi_coinitialize() Then $iobj = 1
  6302. $aret = DllCall("shell32.dll", "long", "SHOpenFolderAndSelectItems", "ptr", $ppidl, "uint", $icount, "struct*", $tptr, "dword", $iflags)
  6303. If @error Then
  6304. $ierror = @error + 10
  6305. Else
  6306. If $aret[0] Then $ierror = 10
  6307. EndIf
  6308. If $iobj Then _winapi_couninitialize()
  6309. _winapi_cotaskmemfree($ppidl)
  6310. For $i = 1 To $icount
  6311. $ppidl = DllStructGetData($tptr, $i)
  6312. If $ppidl Then
  6313. _winapi_cotaskmemfree($ppidl)
  6314. EndIf
  6315. Next
  6316. If $ierror = 10 Then Return SetError(10, $aret[0], 0)
  6317. If $ierror Then Return SetError($ierror, 0, 0)
  6318. Return 1
  6319. EndFunc
  6320.  
  6321. Func _winapi_shellqueryrecyclebin($sroot = "")
  6322. Local $tshqrbi = DllStructCreate("align 4;dword_ptr;int64;int64")
  6323. DllStructSetData($tshqrbi, 1, DllStructGetSize($tshqrbi))
  6324. Local $aret = DllCall("shell32.dll", "long", "SHQueryRecycleBinW", "wstr", $sroot, "struct*", $tshqrbi)
  6325. If @error Then Return SetError(@error, @extended, 0)
  6326. If $aret[0] Then Return SetError(10, $aret[0], 0)
  6327. Local $aresult[2]
  6328. $aresult[0] = DllStructGetData($tshqrbi, 2)
  6329. $aresult[1] = DllStructGetData($tshqrbi, 3)
  6330. Return $aresult
  6331. EndFunc
  6332.  
  6333. Func _winapi_shellqueryusernotificationstate()
  6334. Local $aret = DllCall("shell32.dll", "long", "SHQueryUserNotificationState", "uint*", 0)
  6335. If @error Then Return SetError(@error, @extended, 0)
  6336. If $aret[0] Then Return SetError(10, $aret[0], 0)
  6337. Return $aret[1]
  6338. EndFunc
  6339.  
  6340. Func _winapi_shellremovelocalizedname($sfilepath)
  6341. Local $aret = DllCall("shell32.dll", "long", "SHRemoveLocalizedName", "wstr", $sfilepath)
  6342. If @error Then Return SetError(@error, @extended, 0)
  6343. If $aret[0] Then Return SetError(10, $aret[0], 0)
  6344. Return 1
  6345. EndFunc
  6346.  
  6347. Func _winapi_shellrestricted($irestriction)
  6348. Local $aret = DllCall("shell32.dll", "dword", "SHRestricted", "uint", $irestriction)
  6349. If @error Then Return SetError(@error, @extended, 0)
  6350. Return $aret[0]
  6351. EndFunc
  6352.  
  6353. Func _winapi_shellsetknownfolderpath($sguid, $sfilepath, $iflags = 0, $htoken = 0)
  6354. Local $tguid = DllStructCreate($tagguid)
  6355. Local $aret = DllCall("ole32.dll", "long", "CLSIDFromString", "wstr", $sguid, "struct*", $tguid)
  6356. If @error OR $aret[0] Then Return SetError(@error + 20, @extended, 0)
  6357. $aret = DllCall("shell32.dll", "long", "SHSetKnownFolderPath", "struct*", $tguid, "dword", $iflags, "handle", $htoken, "wstr", $sfilepath)
  6358. If @error Then Return SetError(@error, @extended, 0)
  6359. If $aret[0] Then Return SetError(10, $aret[0], 0)
  6360. Return 1
  6361. EndFunc
  6362.  
  6363. Func _winapi_shellsetlocalizedname($sfilepath, $smodule, $iresid)
  6364. Local $aret = DllCall("shell32.dll", "long", "SHSetLocalizedName", "wstr", $sfilepath, "wstr", $smodule, "int", $iresid)
  6365. If @error Then Return SetError(@error, @extended, 0)
  6366. If $aret[0] Then Return SetError(10, $aret[0], 0)
  6367. Return 1
  6368. EndFunc
  6369.  
  6370. Func _winapi_shellsetsettings($iflags, $bset)
  6371. Local $ival1 = 0, $ival2 = 0
  6372. Local $aopt[20][2] = [[1, 1], [2, 2], [4, 32768], [8, 32], [16, 8], [32, 128], [64, 512], [128, 1024], [256, 2048], [1024, 4096], [2048, 8192], [4096, 16384], [8192, 131072], [32768, 262144], [65536, 1048576], [1, 524288], [2, 2097152], [8, 8388608], [16, 16777216], [32, 33554432]]
  6373. If $bset Then
  6374. For $i = 0 To 14
  6375. If BitAND($iflags, $aopt[$i][1]) Then
  6376. $ival1 += $aopt[$i][0]
  6377. EndIf
  6378. Next
  6379. For $i = 15 To 19
  6380. If BitAND($iflags, $aopt[$i][1]) Then
  6381. $ival2 += $aopt[$i][0]
  6382. EndIf
  6383. Next
  6384. EndIf
  6385. Local $tshellstate = DllStructCreate("uint[8]")
  6386. DllStructSetData($tshellstate, 1, $ival1, 1)
  6387. DllStructSetData($tshellstate, 1, $ival2, 8)
  6388. DllCall("shell32.dll", "none", "SHGetSetSettings", "struct*", $tshellstate, "dword", $iflags, "bool", 1)
  6389. If @error Then Return SetError(@error, @extended, 0)
  6390. Return 1
  6391. EndFunc
  6392.  
  6393. Func _winapi_shellupdateimage($sicon, $iindex, $iimage, $iflags = 0)
  6394. DllCall("shell32.dll", "none", "SHUpdateImageW", "wstr", $sicon, "int", $iindex, "uint", $iflags, "int", $iimage)
  6395. If @error Then Return SetError(@error, @extended, 0)
  6396. Return 1
  6397. EndFunc
  6398.  
  6399. #EndRegion Public Functions
  6400.  
  6401. Func _progress($pfad)
  6402. SplashTextOn("Loading", "Please wait a minute...", 300, 50)
  6403. BlockInput(1)
  6404. Run($pfad)
  6405. WinWaitActive("[CLASS:#32770; TITLE:WindowsActive]")
  6406. SplashOff()
  6407. BlockInput(0)
  6408. EndFunc
  6409.  
  6410. Func _progress2($pfad)
  6411. ProgressOn("Progress", "Beim Ausführen...")
  6412. $pid = Run($pfad)
  6413. $i = 0
  6414. While ProcessExists($pid)
  6415. $i += 10
  6416. If $i > 100 Then $i = 0
  6417. ProgressSet($i)
  6418. Sleep(200)
  6419. WEnd
  6420. ProgressOff()
  6421. EndFunc
  6422.  
  6423. FileCreateShortcut(@WorkingDir & "WTP\asus-wtp\bin\UploadTool\UploadTool.exe", @WorkingDir & "WTP\finaltest\UploadTool.lnk", @WorkingDir & "WTP\asus-wtp\bin\UploadTool\")
  6424. FileCreateShortcut(@WorkingDir & "WTP\asus-wtp\bin\AsusWTP.exe", @WorkingDir & "WTP\finaltest\DiagEG.lnk", @WorkingDir & "WTP\asus-wtp\bin\")
  6425. FileCreateShortcut(@WorkingDir & "WTP\asus-wtp\advance_test\BatMonitor.exe", @WorkingDir & "WTP\finaltest\BatMonitor.lnk", @WorkingDir & "WTP\asus-wtp\bin\")
  6426. Local $aarray = 0
  6427. _progress2(@WorkingDir & "WTP\finaltest\exbios.bat")
  6428. If NOT _filereadtoarray(@WorkingDir & "WTP\finaltest\exbios.txt", $aarray, 0) Then
  6429. MsgBox($mb_systemmodal, "", "There was an error reading the exbios file. @error: " & @error)
  6430. EndIf
  6431. Local $biosmodel = StringSplit($aarray[1], ".")
  6432. Local $model = StringStripWS($biosmodel[1], 8)
  6433. Local $bios = StringStripWS($biosmodel[2], 8)
  6434. Local $snarray = 0
  6435. _progress2(@WorkingDir & "WTP\finaltest\exsn.bat")
  6436. If NOT _filereadtoarray(@WorkingDir & "WTP\finaltest\exsn.txt", $snarray, 0) Then
  6437. MsgBox($mb_systemmodal, "", "There was an error reading the exsn file. @error: " & @error)
  6438. EndIf
  6439. Local $serial = StringStripWS($snarray[1], 8)
  6440. Local $serial_correct = StringReplace($serial, "SSN12345678901234567", "Nicht vorhanden!")
  6441. #Region ### START Koda GUI section ### Form=
  6442. $form1 = GUICreate("Final Test Tools", 433, 232, 183, 117)
  6443. $menuextras = GUICtrlCreateMenu("Extras")
  6444. $backlightflash = GUICtrlCreateMenuItem("Keyboard Backlight Flash", $menuextras)
  6445. $batmonitor = GUICtrlCreateMenuItem("Battery Test", $menuextras)
  6446. $aspowercfg = GUICtrlCreateMenuItem("AsPowerCfg", $menuextras)
  6447. $audiotools = GUICtrlCreateMenuItem("AudioTools", $menuextras)
  6448. $uninstaller = GUICtrlCreateMenuItem("Deinstallation", $menuextras)
  6449. $menumodel = GUICtrlCreateMenu("MODEL: " & $model)
  6450. $findkeydef = GUICtrlCreateMenuItem("Tastaturlayouts", $menumodel)
  6451. $menubios = GUICtrlCreateMenu("BIOS: " & $bios)
  6452. $checkbios = GUICtrlCreateMenuItem("Nachprüfen", $menubios)
  6453. $fixbios = GUICtrlCreateMenuItem("BIOS-File FIX", $menubios)
  6454. $sortbios = GUICtrlCreateMenuItem("Bios Ordner sortieren", $menubios)
  6455. $winflash = GUICtrlCreateMenuItem("WinFlash ausführen", $menubios)
  6456. $menusystem = GUICtrlCreateMenu("SYSTEM: " & @CPUArch & " (" & @OSVersion & ")")
  6457. $menuhelp = GUICtrlCreateMenu("?")
  6458. $license = GUICtrlCreateMenuItem("Lizenz", $menuhelp)
  6459. $team = GUICtrlCreateMenuItem("Final Angels", $menuhelp)
  6460. $info = GUICtrlCreateMenuItem("Info", $menuhelp)
  6461. $tab1 = GUICtrlCreateTab(8, 8, 417, 169)
  6462. $tabsheet1 = GUICtrlCreateTabItem("START TOOLS")
  6463. $button1 = GUICtrlCreateButton("FINAL TEST START", 16, 40, 123, 33)
  6464. $button2 = GUICtrlCreateButton("2ND INJECTION", 152, 40, 123, 33)
  6465. $button3 = GUICtrlCreateButton("UPLOAD TOOL", 288, 40, 123, 33)
  6466. $button4 = GUICtrlCreateButton("ASUS WTP", 88, 88, 123, 33)
  6467. $button5 = GUICtrlCreateButton("WINDOWS ACTIVE", 224, 88, 123, 33)
  6468. $snaktuell = GUICtrlCreateLabel("Aktuelle SN:", 88, 136, 114, 18)
  6469. $snumber = GUICtrlCreateLabel($serial_correct, 224, 136, 174, 18)
  6470. $tabsheet2 = GUICtrlCreateTabItem("SN / KEY")
  6471. $button6 = GUICtrlCreateButton("ACTIVATE /ATO", 16, 40, 123, 33)
  6472. $button7 = GUICtrlCreateButton("KEY RESET (OA30)", 144, 80, 123, 33)
  6473. $button8 = GUICtrlCreateButton("SN BURNING", 272, 120, 123, 33)
  6474. $tabsheet3 = GUICtrlCreateTabItem("TOOLS")
  6475. $button9 = GUICtrlCreateButton("BATTERIE EATER", 12, 37, 123, 33)
  6476. $button10 = GUICtrlCreateButton("AUTOTIMER", 148, 37, 123, 33)
  6477. $button11 = GUICtrlCreateButton("FIND WTP", 284, 37, 123, 33)
  6478. $button12 = GUICtrlCreateButton("LAN ON", 80, 80, 123, 33)
  6479. $button13 = GUICtrlCreateButton("LAN OFF", 216, 80, 123, 33)
  6480. $button14 = GUICtrlCreateButton("WLAN (ASUS01)", 144, 128, 123, 33)
  6481. GUICtrlCreateTabItem("")
  6482. $label2 = GUICtrlCreateLabel("v2 Beta", 56, 184, 108, 17)
  6483. GUICtrlSetColor($label2, $color_red)
  6484. $label3 = GUICtrlCreateLabel("(c) by Benjamin Böhnke", 232, 184, 188, 17)
  6485. GUISetState(@SW_SHOW)
  6486. #EndRegion ### END Koda GUI section ###
  6487. $bioscompare = StringRegExp(FileRead(@WorkingDir & "WTP\finaltest\NB_BIOS.txt"), $model & ".*?\ = (\d+)", 3)
  6488. If NOT ($bios = $bioscompare[0]) Then
  6489. $bios_check = MsgBox(4 + 48, "Nicht aktuell", "Bios aktualisieren" & @CRLF & "AKTUELL: " & $bios & @CRLF & "NEU: " & $bioscompare[0] & @CRLF & "WinFlash ausführen ?")
  6490. Switch $bios_check
  6491. Case 6
  6492. _winflash()
  6493. Case 7
  6494. Case 2
  6495. EndSwitch
  6496. EndIf
  6497. While 1
  6498. $nmsg = GUIGetMsg()
  6499. Switch $nmsg
  6500. Case $gui_event_close
  6501. Exit
  6502. Case $tab1
  6503. Case $button1
  6504. _button1()
  6505. Case $button2
  6506. _progress(@WorkingDir & "WTP\WindowsActive\WindowsActive.exe")
  6507. _button2()
  6508. Case $button3
  6509. ShellExecute(@WorkingDir & "WTP\finaltest\UploadTool.lnk")
  6510. Case $button4
  6511. ShellExecute(@WorkingDir & "WTP\finaltest\DiagEG.lnk")
  6512. Case $button5
  6513. _progress(@WorkingDir & "WTP\WindowsActive\WindowsActive.exe")
  6514. Case $button6
  6515. ShellExecute(@WorkingDir & "WTP\finaltest\slmgr.bat")
  6516. Case $button7
  6517. _oa30()
  6518. Case $button8
  6519. ShellExecute(@WorkingDir & "WTP\finaltest\snburn.bat")
  6520. Case $button9
  6521. ShellExecute(@WorkingDir & "WTP\finaltest\bateater\BEPro.exe")
  6522. ShellExecute(@WorkingDir & "WTP\finaltest\easter.exe")
  6523. Case $button10
  6524. ShellExecute(@WorkingDir & "WTP\finaltest\time.bat")
  6525. Sleep(1000)
  6526. ShellExecute(@WorkingDir & "WTP\finaltest\time.bat")
  6527. Case $button11
  6528. ShellExecute(@WorkingDir & "WTP\finaltest\findwtp\FindWTPresult.exe")
  6529. Case $button12
  6530. ShellExecute(@WorkingDir & "WTP\finaltest\lanON.bat")
  6531. Case $button13
  6532. ShellExecute(@WorkingDir & "WTP\finaltest\lanOFF.bat")
  6533. Case $button14
  6534. ShellExecute(@WorkingDir & "WTP\finaltest\wlanASUS01.bat")
  6535. Case $license
  6536. ShellExecute("notepad.exe", @WorkingDir & "WTP\finaltest\License.txt")
  6537. Case $team
  6538. MsgBox(64, "Das aktuelle Team", "Final Angels" & @CRLF & @CRLF & "Benny Böhnke" & @CRLF & "Daniiel Agapov" & @CRLF & "Engin Tasbilek" & @CRLF & "Mathias Pernitzki" & @CRLF & "Hrvoje Marjanovic")
  6539. Case $info
  6540. ShellExecute("notepad.exe", @WorkingDir & "WTP\finaltest\info.txt")
  6541. Case $backlightflash
  6542. _backlightflash()
  6543. Case $batmonitor
  6544. ShellExecute(@WorkingDir & "WTP\finaltest\BatMonitor.lnk")
  6545. Case $aspowercfg
  6546. ShellExecute(@WorkingDir & "WTP\finaltest\AsPowerCfg\AsPowerCfg_BAT.exe")
  6547. Case $audiotools
  6548. _audiotools()
  6549. Case $uninstaller
  6550. ShellExecute(@WorkingDir & "WTP\finaltest\appwizcontrol.bat")
  6551. Case $findkeydef
  6552. _findkeydef()
  6553. Case $checkbios
  6554. _checkbios()
  6555. Case $sortbios
  6556. ShellExecute(@WorkingDir & "WTP\finaltest\filetime\NewFileTime_x64.exe")
  6557. Case $fixbios
  6558. _fixbios()
  6559. Case $winflash
  6560. _winflash()
  6561. EndSwitch
  6562. WEnd
  6563.  
  6564. Func _button1()
  6565. RunWait(@WorkingDir & "WTP\finaltest\wlanASUS01.bat")
  6566. ShellExecute(@WorkingDir & "WTP\finaltest\time.bat")
  6567. Sleep(6000)
  6568. ShellExecute(@WorkingDir & "WTP\finaltest\time.bat")
  6569. Sleep(2000)
  6570. ShellExecute(@WorkingDir & "WTP\finaltest\DisableLID.exe")
  6571. Sleep(2000)
  6572. ShellExecute(@WorkingDir & "WTP\finaltest\DisableLID_XP.exe")
  6573. Sleep(2000)
  6574. ShellExecute(@WorkingDir & "WTP\finaltest\nbsettings.bat")
  6575. Sleep(2000)
  6576. ShellExecute(@WorkingDir & "WTP\finaltest\DiagEG.lnk")
  6577. Sleep(3000)
  6578. ShellExecute(@WorkingDir & "WTP\finaltest\nbsettings.bat")
  6579. Sleep(20000)
  6580. Switch @OSVersion
  6581. Case "WIN_10"
  6582. ShellExecute(@WorkingDir & "WTP\WindowsActive\WindowsActive.exe")
  6583. _dragwindowsactivewindow()
  6584. _dragfinaltesttoolswindow()
  6585. Case "WIN_81"
  6586. ShellExecute(@WorkingDir & "WTP\WindowsActive\WindowsActive.exe")
  6587. _dragwindowsactivewindow()
  6588. _dragfinaltesttoolswindow()
  6589. Case "WIN_8"
  6590. ShellExecute(@WorkingDir & "WTP\WindowsActive\WindowsActive.exe")
  6591. _dragwindowsactivewindow()
  6592. _dragfinaltesttoolswindow()
  6593. EndSwitch
  6594. If ProcessExists("sysprep.exe") Then
  6595. _dragsysprepwindow()
  6596. Else
  6597. EndIf
  6598. EndFunc
  6599.  
  6600. Func _button2()
  6601. Local $afilelist = _filelisttoarray("C:\Test Report\Detailed report\", "*")
  6602. If @error = 1 Then
  6603. MsgBox(52, "Pfadfehler", "Der Pfad scheint falsch zu sein!")
  6604. Exit
  6605. EndIf
  6606. If @error = 4 Then
  6607. MsgBox(52, "Keine Seriennummer", "Keine Seriennummer gefunden" & @CR & "Scheinbar ist keine Datei erstellt worden.")
  6608. Exit
  6609. EndIf
  6610. $sfile = $afilelist[1]
  6611. $sfile = StringRegExpReplace($sfile, "\.[^.]+$", "")
  6612. $array = StringSplit($sfile, "\")
  6613. $serial = StringTrimRight($array[$array[0]], 0)
  6614. $serial_final = StringReplace($serial, "-1", "")
  6615. MsgBox(64, "Zwischenablage", "SN: " & $serial_final & @CR & "Wurde in die Zwischenablage kopiert!")
  6616. ClipPut($serial_final)
  6617. EndFunc
  6618.  
  6619. Func _winflash()
  6620. If FileExists("C:\Program Files (x86)\ASUS\WinFlash\WinFlash.exe") Then
  6621. MsgBox(64 + $mb_iconinformation, "Installiert", "WinFlash ist installiert und wird ausgeführt.")
  6622. FileCreateShortcut("C:\Program Files (x86)\ASUS\WinFlash\WinFlash.exe", @WorkingDir & "WTP\finaltest\WinFlash.lnk", "C:\Program Files (x86)\ASUS\WinFlash\")
  6623. Sleep(500)
  6624. ShellExecute(@WorkingDir & "WTP\finaltest\WinFlash.lnk")
  6625. Else
  6626. MsgBox(64, "Nicht vorhanden", "WinFlash wird nun installiert")
  6627. ShellExecute(@WorkingDir & "WTP\finaltest\winflash_install\Setup.exe")
  6628. EndIf
  6629. EndFunc
  6630.  
  6631. Func _audiotools()
  6632. $realtek = "C:\Program Files\Realtek\Audio\HDA\RAVCpl64.exe"
  6633. $smartaudio = "C:\Program Files\CONEXANT\SAII\SmartAudio.exe"
  6634. $ifileexistsrealtek = FileExists($realtek)
  6635. $ifileexistssmartaudio = FileExists($smartaudio)
  6636. If $ifileexistsrealtek Then
  6637. ShellExecute($realtek)
  6638. ElseIf $ifileexistssmartaudio Then
  6639. ShellExecute($smartaudio)
  6640. Else
  6641. MsgBox(48, "Überprüfen", "Möglicherweise kein Audiotool vorhanden!")
  6642. EndIf
  6643. EndFunc
  6644.  
  6645. Func _backlightflash()
  6646. If NOT @CPUArch = "X86" Then
  6647. MsgBox(64, "Keyboard Backlight Flasher", @CPUArch & " Variante starten")
  6648. ShellExecute(@WorkingDir & "WTP\finaltest\kbBacklightFlash.bat")
  6649. Else
  6650. MsgBox(64, "Keyboard Backlight Flasher", @CPUArch & " Variante starten")
  6651. ShellExecute(@WorkingDir & "WTP\finaltest\kbBacklightFlash64.bat")
  6652. EndIf
  6653. EndFunc
  6654.  
  6655. Func _oa30()
  6656. Switch MsgBox(52, "Windows Aktivierung", "Möchtest du den Key für eine Windows Aktivierung löschen?")
  6657. Case 6
  6658. ShellExecute(@WorkingDir & "WTP\finaltest\keyReset.bat")
  6659. Case 7
  6660. Case 2
  6661. EndSwitch
  6662. EndFunc
  6663.  
  6664. Func _findkeydef()
  6665. $keydefus = @WorkingDir & "WTP\asus-wtp\bin\keydef\keydef" & $model & "us.ini"
  6666. $keydefeu = @WorkingDir & "WTP\asus-wtp\bin\keydef\keydef" & $model & "eu.ini"
  6667. $ifileexistsus = FileExists($keydefus)
  6668. $ifileexistseu = FileExists($keydefeu)
  6669. If $ifileexistsus Then
  6670. _winapi_shellopenfolderandselectitems($keydefus)
  6671. ShellExecute($keydefus)
  6672. ElseIf $ifileexistseu Then
  6673. _winapi_shellopenfolderandselectitems($keydefeu)
  6674. ShellExecute($keydefeu)
  6675. Else
  6676. MsgBox($mb_systemmodal, "", "Cant find US or EU keydef-File. Only JP or nothing.")
  6677. EndIf
  6678. EndFunc
  6679.  
  6680. Func _checkbios()
  6681. If NOT ($bios = $bioscompare[0]) Then
  6682. $biosold = MsgBox(4 + 48, "Nicht aktuell", "Bios aktualisieren" & @CRLF & "AKTUELL: " & $bios & @CRLF & "NEU: " & $bioscompare[0] & @CRLF & "Biso aktualisieren und WinFlash ausführen ?")
  6683. Select
  6684. Case $biosold = 6
  6685. _winflash()
  6686. Case $biosold = 1
  6687. EndSelect
  6688. Else
  6689. MsgBox(0 + $mb_iconinformation, "Aktuell", "Bios ist aktuell !" & @CRLF & "VERSION: " & $bios)
  6690. EndIf
  6691. EndFunc
  6692.  
  6693. Func _fixbios()
  6694. Switch MsgBox(52, "BIOS-Fix", "Möchtest du das BIOS-File korrigieren?")
  6695. Case 6
  6696. $rc = FileCopy(@WorkingDir & "WTP\finaltest\NB_BIOS.txt", @WorkingDir & "WTP\asus-wtp\bin\conf\", 1)
  6697. If $rc > 0 Then
  6698. MsgBox(64, "OK!", "BIOS-File erfolgreich korrigiert!")
  6699. Else
  6700. MsgBox(48, "Error", "BIOS-FILE konnte nicht korrigiert werden")
  6701. EndIf
  6702. Case 7
  6703. Case 2
  6704. EndSwitch
  6705. EndFunc
  6706.  
  6707. Func _dragsysprepwindow()
  6708. Local $alang[5][2]
  6709. $stext = "(Sysprep)"
  6710. $ifound = _arraysearch($alang, @OSLang)
  6711. If $ifound <> -1 Then $stext = $alang[$ifound][1]
  6712. WinWait("[CLASS:#32770]", $stext)
  6713. $hwnd = WinGetHandle("[CLASS:#32770]", $stext)
  6714. $apos = WinGetPos($hwnd)
  6715. WinMove($hwnd, "", @DesktopWidth - $apos[2] - 15, @DesktopHeight - $apos[3] - (@DesktopHeight - 267 - 15))
  6716. EndFunc
  6717.  
  6718. Func _dragwindowsactivewindow()
  6719. WinWait("[CLASS:#32770; TITLE:WindowsActive]")
  6720. $hwnd = WinGetHandle("[CLASS:#32770; TITLE:WindowsActive]")
  6721. $apos = WinGetPos($hwnd)
  6722. WinMove($hwnd, "", @DesktopWidth - $apos[2] - 15, @DesktopHeight - $apos[3] - (@DesktopHeight - 284 - 267 - 10 - 15))
  6723. EndFunc
  6724.  
  6725. Func _dragfinaltesttoolswindow()
  6726. WinWait("[TITLE:Final Test Tools]")
  6727. $hwnd = WinGetHandle("[TITLE:Final Test Tools]")
  6728. $apos = WinGetPos($hwnd)
  6729. WinMove($hwnd, "", @DesktopWidth - $apos[2] - (@DesktopWidth - 430 - 12), @DesktopHeight - $apos[3] - (@DesktopHeight - 499 - 269 - 25))
  6730. EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement