Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #RequireAdmin
- #Region
- #AutoIt3Wrapper_Icon=WTP\finaltest\redicon.ico
- #AutoIt3Wrapper_OutFile=FINALTESTv2.exe
- #EndRegion
- Global Const $bs_groupbox = 7
- Global Const $bs_bottom = 2048
- Global Const $bs_center = 768
- Global Const $bs_defpushbutton = 1
- Global Const $bs_left = 256
- Global Const $bs_multiline = 8192
- Global Const $bs_pushbox = 10
- Global Const $bs_pushlike = 4096
- Global Const $bs_right = 512
- Global Const $bs_rightbutton = 32
- Global Const $bs_top = 1024
- Global Const $bs_vcenter = 3072
- Global Const $bs_flat = 32768
- Global Const $bs_icon = 64
- Global Const $bs_bitmap = 128
- Global Const $bs_notify = 16384
- Global Const $bs_splitbutton = 12
- Global Const $bs_defsplitbutton = 13
- Global Const $bs_commandlink = 14
- Global Const $bs_defcommandlink = 15
- Global Const $bcsif_glyph = 1
- Global Const $bcsif_image = 2
- Global Const $bcsif_style = 4
- Global Const $bcsif_size = 8
- Global Const $bcss_nosplit = 1
- Global Const $bcss_stretch = 2
- Global Const $bcss_alignleft = 4
- Global Const $bcss_image = 8
- Global Const $button_imagelist_align_left = 0
- Global Const $button_imagelist_align_right = 1
- Global Const $button_imagelist_align_top = 2
- Global Const $button_imagelist_align_bottom = 3
- Global Const $button_imagelist_align_center = 4
- Global Const $bs_3state = 5
- Global Const $bs_auto3state = 6
- Global Const $bs_autocheckbox = 3
- Global Const $bs_checkbox = 2
- Global Const $bs_radiobutton = 4
- Global Const $bs_autoradiobutton = 9
- Global Const $bs_ownerdraw = 11
- Global Const $gui_ss_default_button = 0
- Global Const $gui_ss_default_checkbox = 0
- Global Const $gui_ss_default_group = 0
- Global Const $gui_ss_default_radio = 0
- Global Const $bcm_first = 5632
- Global Const $bcm_getidealsize = ($bcm_first + 1)
- Global Const $bcm_getimagelist = ($bcm_first + 3)
- Global Const $bcm_getnote = ($bcm_first + 10)
- Global Const $bcm_getnotelength = ($bcm_first + 11)
- Global Const $bcm_getsplitinfo = ($bcm_first + 8)
- Global Const $bcm_gettextmargin = ($bcm_first + 5)
- Global Const $bcm_setdropdownstate = ($bcm_first + 6)
- Global Const $bcm_setimagelist = ($bcm_first + 2)
- Global Const $bcm_setnote = ($bcm_first + 9)
- Global Const $bcm_setshield = ($bcm_first + 12)
- Global Const $bcm_setsplitinfo = ($bcm_first + 7)
- Global Const $bcm_settextmargin = ($bcm_first + 4)
- Global Const $bm_click = 245
- Global Const $bm_getcheck = 240
- Global Const $bm_getimage = 246
- Global Const $bm_getstate = 242
- Global Const $bm_setcheck = 241
- Global Const $bm_setdontclick = 248
- Global Const $bm_setimage = 247
- Global Const $bm_setstate = 243
- Global Const $bm_setstyle = 244
- Global Const $bcn_first = -1250
- Global Const $bcn_dropdown = ($bcn_first + 2)
- Global Const $bcn_hotitemchange = ($bcn_first + 1)
- Global Const $bn_clicked = 0
- Global Const $bn_paint = 1
- Global Const $bn_hilite = 2
- Global Const $bn_unhilite = 3
- Global Const $bn_disable = 4
- Global Const $bn_doubleclicked = 5
- Global Const $bn_setfocus = 6
- Global Const $bn_killfocus = 7
- Global Const $bn_pushed = $bn_hilite
- Global Const $bn_unpushed = $bn_unhilite
- Global Const $bn_dblclk = $bn_doubleclicked
- Global Const $bst_checked = 1
- Global Const $bst_indeterminate = 2
- Global Const $bst_unchecked = 0
- Global Const $bst_focus = 8
- Global Const $bst_pushed = 4
- Global Const $bst_dontclick = 128
- Global Const $gui_event_single = 0
- Global Const $gui_event_array = 1
- Global Const $gui_event_none = 0
- Global Const $gui_event_close = -3
- Global Const $gui_event_minimize = -4
- Global Const $gui_event_restore = -5
- Global Const $gui_event_maximize = -6
- Global Const $gui_event_primarydown = -7
- Global Const $gui_event_primaryup = -8
- Global Const $gui_event_secondarydown = -9
- Global Const $gui_event_secondaryup = -10
- Global Const $gui_event_mousemove = -11
- Global Const $gui_event_resized = -12
- Global Const $gui_event_dropped = -13
- Global Const $gui_rundefmsg = "GUI_RUNDEFMSG"
- Global Const $gui_avistop = 0
- Global Const $gui_avistart = 1
- Global Const $gui_aviclose = 2
- Global Const $gui_checked = 1
- Global Const $gui_indeterminate = 2
- Global Const $gui_unchecked = 4
- Global Const $gui_dropaccepted = 8
- Global Const $gui_nodropaccepted = 4096
- Global Const $gui_acceptfiles = $gui_dropaccepted
- Global Const $gui_show = 16
- Global Const $gui_hide = 32
- Global Const $gui_enable = 64
- Global Const $gui_disable = 128
- Global Const $gui_focus = 256
- Global Const $gui_nofocus = 8192
- Global Const $gui_defbutton = 512
- Global Const $gui_expand = 1024
- Global Const $gui_ontop = 2048
- Global Const $gui_fontnormal = 0
- Global Const $gui_fontitalic = 2
- Global Const $gui_fontunder = 4
- Global Const $gui_fontstrike = 8
- Global Const $gui_dockauto = 1
- Global Const $gui_dockleft = 2
- Global Const $gui_dockright = 4
- Global Const $gui_dockhcenter = 8
- Global Const $gui_docktop = 32
- Global Const $gui_dockbottom = 64
- Global Const $gui_dockvcenter = 128
- Global Const $gui_dockwidth = 256
- Global Const $gui_dockheight = 512
- Global Const $gui_docksize = 768
- Global Const $gui_dockmenubar = 544
- Global Const $gui_dockstatebar = 576
- Global Const $gui_dockall = 802
- Global Const $gui_dockborders = 102
- Global Const $gui_gr_close = 1
- Global Const $gui_gr_line = 2
- Global Const $gui_gr_bezier = 4
- Global Const $gui_gr_move = 6
- Global Const $gui_gr_color = 8
- Global Const $gui_gr_rect = 10
- Global Const $gui_gr_ellipse = 12
- Global Const $gui_gr_pie = 14
- Global Const $gui_gr_dot = 16
- Global Const $gui_gr_pixel = 18
- Global Const $gui_gr_hint = 20
- Global Const $gui_gr_refresh = 22
- Global Const $gui_gr_pensize = 24
- Global Const $gui_gr_nobkcolor = -2
- Global Const $gui_bkcolor_default = -1
- Global Const $gui_bkcolor_transparent = -2
- Global Const $gui_bkcolor_lv_alternate = -33554432
- Global Const $gui_read_default = 0
- Global Const $gui_read_extended = 1
- Global Const $gui_cursor_nooverride = 0
- Global Const $gui_cursor_override = 1
- Global Const $gui_ws_ex_parentdrag = 1048576
- Global Const $color_aqua = 65535
- Global Const $color_black = 0
- Global Const $color_blue = 255
- Global Const $color_cream = 16776176
- Global Const $color_fuchsia = 16711935
- Global Const $color_gray = 8421504
- Global Const $color_green = 32768
- Global Const $color_lime = 65280
- Global Const $color_maroon = 9116770
- Global Const $color_medblue = 708
- Global Const $color_medgray = 10526884
- Global Const $color_moneygreen = 12639424
- Global Const $color_navy = 128
- Global Const $color_olive = 8421376
- Global Const $color_purple = 8388736
- Global Const $color_red = 16711680
- Global Const $color_silver = 12632256
- Global Const $color_skyblue = 10930928
- Global Const $color_teal = 32896
- Global Const $color_white = 16777215
- Global Const $color_yellow = 16776960
- Global Const $clr_none = -1
- Global Const $clr_default = -16777216
- Global Const $clr_aqua = 16776960
- Global Const $clr_black = 0
- Global Const $clr_blue = 16711680
- Global Const $clr_cream = 15793151
- Global Const $clr_fuchsia = 16711935
- Global Const $clr_gray = 8421504
- Global Const $clr_green = 32768
- Global Const $clr_lime = 65280
- Global Const $clr_maroon = 6429835
- Global Const $clr_medblue = 12845568
- Global Const $clr_medgray = 10789024
- Global Const $clr_moneygreen = 12639424
- Global Const $clr_navy = 8388608
- Global Const $clr_olive = 32896
- Global Const $clr_purple = 8388736
- Global Const $clr_red = 255
- Global Const $clr_silver = 12632256
- Global Const $clr_skyblue = 15780518
- Global Const $clr_teal = 8421376
- Global Const $clr_white = 16777215
- Global Const $clr_yellow = 65535
- Global Const $cc_anycolor = 256
- Global Const $cc_fullopen = 2
- Global Const $cc_rgbinit = 1
- Global Const $tcs_ex_flatseparators = 1
- Global Const $tcs_ex_registerdrop = 2
- Global Const $tcht_nowhere = 1
- Global Const $tcht_onitemicon = 2
- Global Const $tcht_onitemlabel = 4
- Global Const $tcht_onitem = 6
- Global Const $tcif_text = 1
- Global Const $tcif_image = 2
- Global Const $tcif_rtlreading = 4
- Global Const $tcif_param = 8
- Global Const $tcif_state = 16
- Global Const $tcif_alldata = 27
- Global Const $tcis_buttonpressed = 1
- Global Const $tcis_highlighted = 2
- Global Const $tc_err = -1
- Global Const $tcs_bottom = 2
- Global Const $tcs_buttons = 256
- Global Const $tcs_fixedwidth = 1024
- Global Const $tcs_flatbuttons = 8
- Global Const $tcs_focusnever = 32768
- Global Const $tcs_focusonbuttondown = 4096
- Global Const $tcs_forceiconleft = 16
- Global Const $tcs_forcelabelleft = 32
- Global Const $tcs_hottrack = 64
- Global Const $tcs_multiline = 512
- Global Const $tcs_multiselect = 4
- Global Const $tcs_ownerdrawfixed = 8192
- Global Const $tcs_raggedright = 2048
- Global Const $tcs_right = 2
- Global Const $tcs_rightjustify = 0
- Global Const $tcs_scrollopposite = 1
- Global Const $tcs_singleline = 0
- Global Const $tcs_tabs = 0
- Global Const $tcs_tooltips = 16384
- Global Const $tcs_vertical = 128
- Global Const $gui_ss_default_tab = 0
- Global Const $tcm_first = 4864
- Global Const $tccm_first = 8192
- Global Const $tcm_adjustrect = ($tcm_first + 40)
- Global Const $tcm_deleteallitems = ($tcm_first + 9)
- Global Const $tcm_deleteitem = ($tcm_first + 8)
- Global Const $tcm_deselectall = ($tcm_first + 50)
- Global Const $tcm_getcurfocus = ($tcm_first + 47)
- Global Const $tcm_getcursel = ($tcm_first + 11)
- Global Const $tcm_getextendedstyle = ($tcm_first + 53)
- Global Const $tcm_getimagelist = ($tcm_first + 2)
- Global Const $tcm_getitema = ($tcm_first + 5)
- Global Const $tcm_getitemw = ($tcm_first + 60)
- Global Const $tcm_getitemcount = ($tcm_first + 4)
- Global Const $tcm_getitemrect = ($tcm_first + 10)
- Global Const $tcm_getrowcount = ($tcm_first + 44)
- Global Const $tcm_gettooltips = ($tcm_first + 45)
- Global Const $tccm_getunicodeformat = ($tccm_first + 6)
- Global Const $tcm_getunicodeformat = $tccm_getunicodeformat
- Global Const $tcm_highlightitem = ($tcm_first + 51)
- Global Const $tcm_hittest = ($tcm_first + 13)
- Global Const $tcm_insertitema = ($tcm_first + 7)
- Global Const $tcm_insertitemw = ($tcm_first + 62)
- Global Const $tcm_removeimage = ($tcm_first + 42)
- Global Const $tcm_setitema = ($tcm_first + 6)
- Global Const $tcm_setitemw = ($tcm_first + 61)
- Global Const $tcm_setitemextra = ($tcm_first + 14)
- Global Const $tcm_setitemsize = $tcm_first + 41
- Global Const $tcm_setcurfocus = ($tcm_first + 48)
- Global Const $tcm_setcursel = ($tcm_first + 12)
- Global Const $tcm_setextendedstyle = ($tcm_first + 52)
- Global Const $tcm_setimagelist = $tcm_first + 3
- Global Const $tcm_setmintabwidth = ($tcm_first + 49)
- Global Const $tcm_setpadding = ($tcm_first + 43)
- Global Const $tcm_settooltips = ($tcm_first + 46)
- Global Const $tccm_setunicodeformat = ($tccm_first + 5)
- Global Const $tcm_setunicodeformat = $tccm_setunicodeformat
- Global Const $tcn_first = -550
- Global Const $tcn_focuschange = ($tcn_first - 4)
- Global Const $tcn_getobject = ($tcn_first - 3)
- Global Const $tcn_keydown = ($tcn_first + 0)
- Global Const $tcn_selchange = ($tcn_first - 1)
- Global Const $tcn_selchanging = ($tcn_first - 2)
- Global Const $wc_animate = "SysAnimate32"
- Global Const $wc_button = "Button"
- Global Const $wc_combobox = "ComboBox"
- Global Const $wc_comboboxex = "ComboBoxEx32"
- Global Const $wc_datetimepick = "SysDateTimePick32"
- Global Const $wc_edit = "Edit"
- Global Const $wc_header = "SysHeader32"
- Global Const $wc_hotkey = "msctls_hotkey32"
- Global Const $wc_ipaddress = "SysIPAddress32"
- Global Const $wc_link = "SysLink"
- Global Const $wc_listbox = "ListBox"
- Global Const $wc_listview = "SysListView32"
- Global Const $wc_monthcal = "SysMonthCal32"
- Global Const $wc_nativefontctl = "NativeFontCtl"
- Global Const $wc_pagescroller = "SysPager"
- Global Const $wc_progress = "msctls_progress32"
- Global Const $wc_rebar = "ReBarWindow32"
- Global Const $wc_scrollbar = "ScrollBar"
- Global Const $wc_static = "Static"
- Global Const $wc_statusbar = "msctls_statusbar32"
- Global Const $wc_tabcontrol = "SysTabControl32"
- Global Const $wc_toolbar = "ToolbarWindow32"
- Global Const $wc_tooltips = "tooltips_class32"
- Global Const $wc_trackbar = "msctls_trackbar32"
- Global Const $wc_treeview = "SysTreeView32"
- Global Const $wc_updown = "msctls_updown32"
- Global Const $ws_overlapped = 0
- Global Const $ws_tiled = $ws_overlapped
- Global Const $ws_maximizebox = 65536
- Global Const $ws_minimizebox = 131072
- Global Const $ws_tabstop = 65536
- Global Const $ws_group = 131072
- Global Const $ws_sizebox = 262144
- Global Const $ws_thickframe = $ws_sizebox
- Global Const $ws_sysmenu = 524288
- Global Const $ws_hscroll = 1048576
- Global Const $ws_vscroll = 2097152
- Global Const $ws_dlgframe = 4194304
- Global Const $ws_border = 8388608
- Global Const $ws_caption = 12582912
- Global Const $ws_overlappedwindow = BitOR($ws_caption, $ws_maximizebox, $ws_minimizebox, $ws_overlapped, $ws_sysmenu, $ws_thickframe)
- Global Const $ws_tiledwindow = $ws_overlappedwindow
- Global Const $ws_maximize = 16777216
- Global Const $ws_clipchildren = 33554432
- Global Const $ws_clipsiblings = 67108864
- Global Const $ws_disabled = 134217728
- Global Const $ws_visible = 268435456
- Global Const $ws_minimize = 536870912
- Global Const $ws_iconic = $ws_minimize
- Global Const $ws_child = 1073741824
- Global Const $ws_childwindow = $ws_child
- Global Const $ws_popup = -2147483648
- Global Const $ws_popupwindow = -2138570752
- Global Const $ds_3dlook = 4
- Global Const $ds_absalign = 1
- Global Const $ds_center = 2048
- Global Const $ds_centermouse = 4096
- Global Const $ds_contexthelp = 8192
- Global Const $ds_control = 1024
- Global Const $ds_fixedsys = 8
- Global Const $ds_localedit = 32
- Global Const $ds_modalframe = 128
- Global Const $ds_nofailcreate = 16
- Global Const $ds_noidlemsg = 256
- Global Const $ds_setfont = 64
- Global Const $ds_setforeground = 512
- Global Const $ds_shellfont = BitOR($ds_fixedsys, $ds_setfont)
- Global Const $ds_sysmodal = 2
- Global Const $ws_ex_acceptfiles = 16
- Global Const $ws_ex_appwindow = 262144
- Global Const $ws_ex_composited = 33554432
- Global Const $ws_ex_controlparent = 65536
- Global Const $ws_ex_clientedge = 512
- Global Const $ws_ex_contexthelp = 1024
- Global Const $ws_ex_dlgmodalframe = 1
- Global Const $ws_ex_layered = 524288
- Global Const $ws_ex_layoutrtl = 4194304
- Global Const $ws_ex_left = 0
- Global Const $ws_ex_leftscrollbar = 16384
- Global Const $ws_ex_ltrreading = 0
- Global Const $ws_ex_mdichild = 64
- Global Const $ws_ex_noactivate = 134217728
- Global Const $ws_ex_noinheritlayout = 1048576
- Global Const $ws_ex_noparentnotify = 4
- Global Const $ws_ex_right = 4096
- Global Const $ws_ex_rightscrollbar = 0
- Global Const $ws_ex_rtlreading = 8192
- Global Const $ws_ex_staticedge = 131072
- Global Const $ws_ex_toolwindow = 128
- Global Const $ws_ex_topmost = 8
- Global Const $ws_ex_transparent = 32
- Global Const $ws_ex_windowedge = 256
- Global Const $ws_ex_overlappedwindow = BitOR($ws_ex_clientedge, $ws_ex_windowedge)
- Global Const $ws_ex_palettewindow = BitOR($ws_ex_toolwindow, $ws_ex_topmost, $ws_ex_windowedge)
- Global Const $wm_null = 0
- Global Const $wm_create = 1
- Global Const $wm_destroy = 2
- Global Const $wm_move = 3
- Global Const $wm_sizewait = 4
- Global Const $wm_size = 5
- Global Const $wm_activate = 6
- Global Const $wm_setfocus = 7
- Global Const $wm_killfocus = 8
- Global Const $wm_setvisible = 9
- Global Const $wm_enable = 10
- Global Const $wm_setredraw = 11
- Global Const $wm_settext = 12
- Global Const $wm_gettext = 13
- Global Const $wm_gettextlength = 14
- Global Const $wm_paint = 15
- Global Const $wm_close = 16
- Global Const $wm_queryendsession = 17
- Global Const $wm_quit = 18
- Global Const $wm_erasebkgnd = 20
- Global Const $wm_queryopen = 19
- Global Const $wm_syscolorchange = 21
- Global Const $wm_endsession = 22
- Global Const $wm_systemerror = 23
- Global Const $wm_showwindow = 24
- Global Const $wm_ctlcolor = 25
- Global Const $wm_settingchange = 26
- Global Const $wm_wininichange = 26
- Global Const $wm_devmodechange = 27
- Global Const $wm_activateapp = 28
- Global Const $wm_fontchange = 29
- Global Const $wm_timechange = 30
- Global Const $wm_cancelmode = 31
- Global Const $wm_setcursor = 32
- Global Const $wm_mouseactivate = 33
- Global Const $wm_childactivate = 34
- Global Const $wm_queuesync = 35
- Global Const $wm_getminmaxinfo = 36
- Global Const $wm_logoff = 37
- Global Const $wm_painticon = 38
- Global Const $wm_iconerasebkgnd = 39
- Global Const $wm_nextdlgctl = 40
- Global Const $wm_alttabactive = 41
- Global Const $wm_spoolerstatus = 42
- Global Const $wm_drawitem = 43
- Global Const $wm_measureitem = 44
- Global Const $wm_deleteitem = 45
- Global Const $wm_vkeytoitem = 46
- Global Const $wm_chartoitem = 47
- Global Const $wm_setfont = 48
- Global Const $wm_getfont = 49
- Global Const $wm_sethotkey = 50
- Global Const $wm_gethotkey = 51
- Global Const $wm_filesyschange = 52
- Global Const $wm_isactiveicon = 53
- Global Const $wm_queryparkicon = 54
- Global Const $wm_querydragicon = 55
- Global Const $wm_winhelp = 56
- Global Const $wm_compareitem = 57
- Global Const $wm_fullscreen = 58
- Global Const $wm_clientshutdown = 59
- Global Const $wm_ddemlevent = 60
- Global Const $wm_getobject = 61
- Global Const $wm_calcscroll = 63
- Global Const $wm_testing = 64
- Global Const $wm_compacting = 65
- Global Const $wm_otherwindowcreated = 66
- Global Const $wm_otherwindowdestroyed = 67
- Global Const $wm_commnotify = 68
- Global Const $wm_mediastatuschange = 69
- Global Const $wm_windowposchanging = 70
- Global Const $wm_windowposchanged = 71
- Global Const $wm_power = 72
- Global Const $wm_copyglobaldata = 73
- Global Const $wm_copydata = 74
- Global Const $wm_canceljournal = 75
- Global Const $wm_logonnotify = 76
- Global Const $wm_keyf1 = 77
- Global Const $wm_notify = 78
- Global Const $wm_access_window = 79
- Global Const $wm_inputlangchangerequest = 80
- Global Const $wm_inputlangchange = 81
- Global Const $wm_tcard = 82
- Global Const $wm_help = 83
- Global Const $wm_userchanged = 84
- Global Const $wm_notifyformat = 85
- Global Const $wm_qm_activate = 96
- Global Const $wm_hook_do_callback = 97
- Global Const $wm_syscopydata = 98
- Global Const $wm_finaldestroy = 112
- Global Const $wm_measureitem_clientdata = 113
- Global Const $wm_contextmenu = 123
- Global Const $wm_stylechanging = 124
- Global Const $wm_stylechanged = 125
- Global Const $wm_displaychange = 126
- Global Const $wm_geticon = 127
- Global Const $wm_seticon = 128
- Global Const $wm_nccreate = 129
- Global Const $wm_ncdestroy = 130
- Global Const $wm_nccalcsize = 131
- Global Const $wm_nchittest = 132
- Global Const $wm_ncpaint = 133
- Global Const $wm_ncactivate = 134
- Global Const $wm_getdlgcode = 135
- Global Const $wm_syncpaint = 136
- Global Const $wm_synctask = 137
- Global Const $wm_kludgeminrect = 139
- Global Const $wm_lpkdrawswitchwnd = 140
- Global Const $wm_uahdestroywindow = 144
- Global Const $wm_uahdrawmenu = 145
- Global Const $wm_uahdrawmenuitem = 146
- Global Const $wm_uahinitmenu = 147
- Global Const $wm_uahmeasuremenuitem = 148
- Global Const $wm_uahncpaintmenupopup = 149
- Global Const $wm_ncmousemove = 160
- Global Const $wm_nclbuttondown = 161
- Global Const $wm_nclbuttonup = 162
- Global Const $wm_nclbuttondblclk = 163
- Global Const $wm_ncrbuttondown = 164
- Global Const $wm_ncrbuttonup = 165
- Global Const $wm_ncrbuttondblclk = 166
- Global Const $wm_ncmbuttondown = 167
- Global Const $wm_ncmbuttonup = 168
- Global Const $wm_ncmbuttondblclk = 169
- Global Const $wm_ncxbuttondown = 171
- Global Const $wm_ncxbuttonup = 172
- Global Const $wm_ncxbuttondblclk = 173
- Global Const $wm_ncuahdrawcaption = 174
- Global Const $wm_ncuahdrawframe = 175
- Global Const $wm_input_device_change = 254
- Global Const $wm_input = 255
- Global Const $wm_keydown = 256
- Global Const $wm_keyfirst = 256
- Global Const $wm_keyup = 257
- Global Const $wm_char = 258
- Global Const $wm_deadchar = 259
- Global Const $wm_syskeydown = 260
- Global Const $wm_syskeyup = 261
- Global Const $wm_syschar = 262
- Global Const $wm_sysdeadchar = 263
- Global Const $wm_yomichar = 264
- Global Const $wm_keylast = 265
- Global Const $wm_unichar = 265
- Global Const $wm_convertrequest = 266
- Global Const $wm_convertresult = 267
- Global Const $wm_im_info = 268
- Global Const $wm_ime_startcomposition = 269
- Global Const $wm_ime_endcomposition = 270
- Global Const $wm_ime_composition = 271
- Global Const $wm_ime_keylast = 271
- Global Const $wm_initdialog = 272
- Global Const $wm_command = 273
- Global Const $wm_syscommand = 274
- Global Const $wm_timer = 275
- Global Const $wm_hscroll = 276
- Global Const $wm_vscroll = 277
- Global Const $wm_initmenu = 278
- Global Const $wm_initmenupopup = 279
- Global Const $wm_systimer = 280
- Global Const $wm_gesture = 281
- Global Const $wm_gesturenotify = 282
- Global Const $wm_gestureinput = 283
- Global Const $wm_gesturenotified = 284
- Global Const $wm_menuselect = 287
- Global Const $wm_menuchar = 288
- Global Const $wm_enteridle = 289
- Global Const $wm_menurbuttonup = 290
- Global Const $wm_menudrag = 291
- Global Const $wm_menugetobject = 292
- Global Const $wm_uninitmenupopup = 293
- Global Const $wm_menucommand = 294
- Global Const $wm_changeuistate = 295
- Global Const $wm_updateuistate = 296
- Global Const $wm_queryuistate = 297
- Global Const $wm_lbtrackpoint = 305
- Global Const $wm_ctlcolormsgbox = 306
- Global Const $wm_ctlcoloredit = 307
- Global Const $wm_ctlcolorlistbox = 308
- Global Const $wm_ctlcolorbtn = 309
- Global Const $wm_ctlcolordlg = 310
- Global Const $wm_ctlcolorscrollbar = 311
- Global Const $wm_ctlcolorstatic = 312
- Global Const $mn_gethmenu = 481
- Global Const $wm_parentnotify = 528
- Global Const $wm_entermenuloop = 529
- Global Const $wm_exitmenuloop = 530
- Global Const $wm_nextmenu = 531
- Global Const $wm_sizing = 532
- Global Const $wm_capturechanged = 533
- Global Const $wm_moving = 534
- Global Const $wm_powerbroadcast = 536
- Global Const $wm_devicechange = 537
- Global Const $wm_mdicreate = 544
- Global Const $wm_mdidestroy = 545
- Global Const $wm_mdiactivate = 546
- Global Const $wm_mdirestore = 547
- Global Const $wm_mdinext = 548
- Global Const $wm_mdimaximize = 549
- Global Const $wm_mditile = 550
- Global Const $wm_mdicascade = 551
- Global Const $wm_mdiiconarrange = 552
- Global Const $wm_mdigetactive = 553
- Global Const $wm_dropobject = 554
- Global Const $wm_querydropobject = 555
- Global Const $wm_begindrag = 556
- Global Const $wm_dragloop = 557
- Global Const $wm_dragselect = 558
- Global Const $wm_dragmove = 559
- Global Const $wm_mdisetmenu = 560
- Global Const $wm_entersizemove = 561
- Global Const $wm_exitsizemove = 562
- Global Const $wm_dropfiles = 563
- Global Const $wm_mdirefreshmenu = 564
- Global Const $wm_touch = 576
- Global Const $wm_ime_setcontext = 641
- Global Const $wm_ime_notify = 642
- Global Const $wm_ime_control = 643
- Global Const $wm_ime_compositionfull = 644
- Global Const $wm_ime_select = 645
- Global Const $wm_ime_char = 646
- Global Const $wm_ime_system = 647
- Global Const $wm_ime_request = 648
- Global Const $wm_ime_keydown = 656
- Global Const $wm_ime_keyup = 657
- Global Const $wm_ncmousehover = 672
- Global Const $wm_mousehover = 673
- Global Const $wm_ncmouseleave = 674
- Global Const $wm_mouseleave = 675
- Global Const $wm_wtssession_change = 689
- Global Const $wm_tablet_first = 704
- Global Const $wm_tablet_last = 735
- Global Const $wm_cut = 768
- Global Const $wm_copy = 769
- Global Const $wm_paste = 770
- Global Const $wm_clear = 771
- Global Const $wm_undo = 772
- Global Const $wm_paletteischanging = 784
- Global Const $wm_hotkey = 786
- Global Const $wm_palettechanged = 785
- Global Const $wm_sysmenu = 787
- Global Const $wm_hookmsg = 788
- Global Const $wm_exitprocess = 789
- Global Const $wm_wakethread = 790
- Global Const $wm_print = 791
- Global Const $wm_printclient = 792
- Global Const $wm_appcommand = 793
- Global Const $wm_querynewpalette = 783
- Global Const $wm_themechanged = 794
- Global Const $wm_uahinit = 795
- Global Const $wm_desktopnotify = 796
- Global Const $wm_clipboardupdate = 797
- Global Const $wm_dwmcompositionchanged = 798
- Global Const $wm_dwmncrenderingchanged = 799
- Global Const $wm_dwmcolorizationcolorchanged = 800
- Global Const $wm_dwmwindowmaximizedchange = 801
- Global Const $wm_dwmexileframe = 802
- Global Const $wm_dwmsendiconicthumbnail = 803
- Global Const $wm_magnification_started = 804
- Global Const $wm_magnification_ended = 805
- Global Const $wm_dwmsendiconiclivepreviewbitmap = 806
- Global Const $wm_dwmthumbnailsizechanged = 807
- Global Const $wm_magnification_output = 808
- Global Const $wm_measurecontrol = 816
- Global Const $wm_getactiontext = 817
- Global Const $wm_forwardkeydown = 819
- Global Const $wm_forwardkeyup = 820
- Global Const $wm_gettitlebarinfoex = 831
- Global Const $wm_notifywow = 832
- Global Const $wm_handheldfirst = 856
- Global Const $wm_handheldlast = 863
- Global Const $wm_afxfirst = 864
- Global Const $wm_afxlast = 895
- Global Const $wm_penwinfirst = 896
- Global Const $wm_penwinlast = 911
- Global Const $wm_dde_initiate = 992
- Global Const $wm_dde_terminate = 993
- Global Const $wm_dde_advise = 994
- Global Const $wm_dde_unadvise = 995
- Global Const $wm_dde_ack = 996
- Global Const $wm_dde_data = 997
- Global Const $wm_dde_request = 998
- Global Const $wm_dde_poke = 999
- Global Const $wm_dde_execute = 1000
- Global Const $wm_dbnotification = 1021
- Global Const $wm_netconnect = 1022
- Global Const $wm_hibernate = 1023
- Global Const $wm_user = 1024
- Global Const $wm_app = 32768
- Global Const $nm_first = 0
- Global Const $nm_outofmemory = $nm_first - 1
- Global Const $nm_click = $nm_first - 2
- Global Const $nm_dblclk = $nm_first - 3
- Global Const $nm_return = $nm_first - 4
- Global Const $nm_rclick = $nm_first - 5
- Global Const $nm_rdblclk = $nm_first - 6
- Global Const $nm_setfocus = $nm_first - 7
- Global Const $nm_killfocus = $nm_first - 8
- Global Const $nm_customdraw = $nm_first - 12
- Global Const $nm_hover = $nm_first - 13
- Global Const $nm_nchittest = $nm_first - 14
- Global Const $nm_keydown = $nm_first - 15
- Global Const $nm_releasedcapture = $nm_first - 16
- Global Const $nm_setcursor = $nm_first - 17
- Global Const $nm_char = $nm_first - 18
- Global Const $nm_tooltipscreated = $nm_first - 19
- Global Const $nm_ldown = $nm_first - 20
- Global Const $nm_rdown = $nm_first - 21
- Global Const $nm_themechanged = $nm_first - 22
- Global Const $wm_mousefirst = 512
- Global Const $wm_mousemove = 512
- Global Const $wm_lbuttondown = 513
- Global Const $wm_lbuttonup = 514
- Global Const $wm_lbuttondblclk = 515
- Global Const $wm_rbuttondown = 516
- Global Const $wm_rbuttonup = 517
- Global Const $wm_rbuttondblclk = 518
- Global Const $wm_mbuttondown = 519
- Global Const $wm_mbuttonup = 520
- Global Const $wm_mbuttondblclk = 521
- Global Const $wm_mousewheel = 522
- Global Const $wm_xbuttondown = 523
- Global Const $wm_xbuttonup = 524
- Global Const $wm_xbuttondblclk = 525
- Global Const $wm_mousehwheel = 526
- Global Const $ps_solid = 0
- Global Const $ps_dash = 1
- Global Const $ps_dot = 2
- Global Const $ps_dashdot = 3
- Global Const $ps_dashdotdot = 4
- Global Const $ps_null = 5
- Global Const $ps_insideframe = 6
- Global Const $ps_userstyle = 7
- Global Const $ps_alternate = 8
- Global Const $ps_endcap_round = 0
- Global Const $ps_endcap_square = 256
- Global Const $ps_endcap_flat = 512
- Global Const $ps_join_bevel = 4096
- Global Const $ps_join_miter = 8192
- Global Const $ps_join_round = 0
- Global Const $ps_geometric = 65536
- Global Const $ps_cosmetic = 0
- Global Const $lwa_alpha = 2
- Global Const $lwa_colorkey = 1
- Global Const $rgn_and = 1
- Global Const $rgn_or = 2
- Global Const $rgn_xor = 3
- Global Const $rgn_diff = 4
- Global Const $rgn_copy = 5
- Global Const $errorregion = 0
- Global Const $nullregion = 1
- Global Const $simpleregion = 2
- Global Const $complexregion = 3
- Global Const $transparent = 1
- Global Const $opaque = 2
- Global Const $ccm_first = 8192
- Global Const $ccm_getunicodeformat = ($ccm_first + 6)
- Global Const $ccm_setunicodeformat = ($ccm_first + 5)
- Global Const $ccm_setbkcolor = $ccm_first + 1
- Global Const $ccm_setcolorscheme = $ccm_first + 2
- Global Const $ccm_getcolorscheme = $ccm_first + 3
- Global Const $ccm_getdroptarget = $ccm_first + 4
- Global Const $ccm_setwindowtheme = $ccm_first + 11
- Global Const $ga_parent = 1
- Global Const $ga_root = 2
- Global Const $ga_rootowner = 3
- Global Const $sm_cxscreen = 0
- Global Const $sm_cyscreen = 1
- Global Const $sm_cxvscroll = 2
- Global Const $sm_cyhscroll = 3
- Global Const $sm_cycaption = 4
- Global Const $sm_cxborder = 5
- Global Const $sm_cyborder = 6
- Global Const $sm_cxdlgframe = 7
- Global Const $sm_cydlgframe = 8
- Global Const $sm_cyvthumb = 9
- Global Const $sm_cxhthumb = 10
- Global Const $sm_cxicon = 11
- Global Const $sm_cyicon = 12
- Global Const $sm_cxcursor = 13
- Global Const $sm_cycursor = 14
- Global Const $sm_cymenu = 15
- Global Const $sm_cxfullscreen = 16
- Global Const $sm_cyfullscreen = 17
- Global Const $sm_cykanjiwindow = 18
- Global Const $sm_mousepresent = 19
- Global Const $sm_cyvscroll = 20
- Global Const $sm_cxhscroll = 21
- Global Const $sm_debug = 22
- Global Const $sm_swapbutton = 23
- Global Const $sm_reserved1 = 24
- Global Const $sm_reserved2 = 25
- Global Const $sm_reserved3 = 26
- Global Const $sm_reserved4 = 27
- Global Const $sm_cxmin = 28
- Global Const $sm_cymin = 29
- Global Const $sm_cxsize = 30
- Global Const $sm_cysize = 31
- Global Const $sm_cxframe = 32
- Global Const $sm_cyframe = 33
- Global Const $sm_cxmintrack = 34
- Global Const $sm_cymintrack = 35
- Global Const $sm_cxdoubleclk = 36
- Global Const $sm_cydoubleclk = 37
- Global Const $sm_cxiconspacing = 38
- Global Const $sm_cyiconspacing = 39
- Global Const $sm_menudropalignment = 40
- Global Const $sm_penwindows = 41
- Global Const $sm_dbcsenabled = 42
- Global Const $sm_cmousebuttons = 43
- Global Const $sm_secure = 44
- Global Const $sm_cxedge = 45
- Global Const $sm_cyedge = 46
- Global Const $sm_cxminspacing = 47
- Global Const $sm_cyminspacing = 48
- Global Const $sm_cxsmicon = 49
- Global Const $sm_cysmicon = 50
- Global Const $sm_cysmcaption = 51
- Global Const $sm_cxsmsize = 52
- Global Const $sm_cysmsize = 53
- Global Const $sm_cxmenusize = 54
- Global Const $sm_cymenusize = 55
- Global Const $sm_arrange = 56
- Global Const $sm_cxminimized = 57
- Global Const $sm_cyminimized = 58
- Global Const $sm_cxmaxtrack = 59
- Global Const $sm_cymaxtrack = 60
- Global Const $sm_cxmaximized = 61
- Global Const $sm_cymaximized = 62
- Global Const $sm_network = 63
- Global Const $sm_cleanboot = 67
- Global Const $sm_cxdrag = 68
- Global Const $sm_cydrag = 69
- Global Const $sm_showsounds = 70
- Global Const $sm_cxmenucheck = 71
- Global Const $sm_cymenucheck = 72
- Global Const $sm_slowmachine = 73
- Global Const $sm_mideastenabled = 74
- Global Const $sm_mousewheelpresent = 75
- Global Const $sm_xvirtualscreen = 76
- Global Const $sm_yvirtualscreen = 77
- Global Const $sm_cxvirtualscreen = 78
- Global Const $sm_cyvirtualscreen = 79
- Global Const $sm_cmonitors = 80
- Global Const $sm_samedisplayformat = 81
- Global Const $sm_immenabled = 82
- Global Const $sm_cxfocusborder = 83
- Global Const $sm_cyfocusborder = 84
- Global Const $sm_tabletpc = 86
- Global Const $sm_mediacenter = 87
- Global Const $sm_starter = 88
- Global Const $sm_serverr2 = 89
- Global Const $sm_cmetrics = 90
- Global Const $sm_remotesession = 4096
- Global Const $sm_shuttingdown = 8192
- Global Const $sm_remotecontrol = 8193
- Global Const $sm_caretblinkingenabled = 8194
- Global Const $blackness = 66
- Global Const $captureblt = 1073741824
- Global Const $dstinvert = 5570569
- Global Const $mergecopy = 12583114
- Global Const $mergepaint = 12255782
- Global Const $nomirrorbitmap = -2147483648
- Global Const $notsrccopy = 3342344
- Global Const $notsrcerase = 1114278
- Global Const $patcopy = 15728673
- Global Const $patinvert = 5898313
- Global Const $patpaint = 16452105
- Global Const $srcand = 8913094
- Global Const $srccopy = 13369376
- Global Const $srcerase = 4457256
- Global Const $srcinvert = 6684742
- Global Const $srcpaint = 15597702
- Global Const $whiteness = 16711778
- Global Const $dt_bottom = 8
- Global Const $dt_calcrect = 1024
- Global Const $dt_center = 1
- Global Const $dt_editcontrol = 8192
- Global Const $dt_end_ellipsis = 32768
- Global Const $dt_expandtabs = 64
- Global Const $dt_externalleading = 512
- Global Const $dt_hideprefix = 1048576
- Global Const $dt_internal = 4096
- Global Const $dt_left = 0
- Global Const $dt_modifystring = 65536
- Global Const $dt_noclip = 256
- Global Const $dt_nofullwidthcharbreak = 524288
- Global Const $dt_noprefix = 2048
- Global Const $dt_path_ellipsis = 16384
- Global Const $dt_prefixonly = 2097152
- Global Const $dt_right = 2
- Global Const $dt_rtlreading = 131072
- Global Const $dt_singleline = 32
- Global Const $dt_tabstop = 128
- Global Const $dt_top = 0
- Global Const $dt_vcenter = 4
- Global Const $dt_wordbreak = 16
- Global Const $dt_word_ellipsis = 262144
- Global Const $rdw_erase = 4
- Global Const $rdw_frame = 1024
- Global Const $rdw_internalpaint = 2
- Global Const $rdw_invalidate = 1
- Global Const $rdw_noerase = 32
- Global Const $rdw_noframe = 2048
- Global Const $rdw_nointernalpaint = 16
- Global Const $rdw_validate = 8
- Global Const $rdw_erasenow = 512
- Global Const $rdw_updatenow = 256
- Global Const $rdw_allchildren = 128
- Global Const $rdw_nochildren = 64
- Global Const $wm_renderformat = 773
- Global Const $wm_renderallformats = 774
- Global Const $wm_destroyclipboard = 775
- Global Const $wm_drawclipboard = 776
- Global Const $wm_paintclipboard = 777
- Global Const $wm_vscrollclipboard = 778
- Global Const $wm_sizeclipboard = 779
- Global Const $wm_askcbformatname = 780
- Global Const $wm_changecbchain = 781
- Global Const $wm_hscrollclipboard = 782
- Global Const $hterror = -2
- Global Const $httransparent = -1
- Global Const $htnowhere = 0
- Global Const $htclient = 1
- Global Const $htcaption = 2
- Global Const $htsysmenu = 3
- Global Const $htgrowbox = 4
- Global Const $htsize = $htgrowbox
- Global Const $htmenu = 5
- Global Const $hthscroll = 6
- Global Const $htvscroll = 7
- Global Const $htminbutton = 8
- Global Const $htmaxbutton = 9
- Global Const $htleft = 10
- Global Const $htright = 11
- Global Const $httop = 12
- Global Const $httopleft = 13
- Global Const $httopright = 14
- Global Const $htbottom = 15
- Global Const $htbottomleft = 16
- Global Const $htbottomright = 17
- Global Const $htborder = 18
- Global Const $htreduce = $htminbutton
- Global Const $htzoom = $htmaxbutton
- Global Const $htsizefirst = $htleft
- Global Const $htsizelast = $htbottomright
- Global Const $htobject = 19
- Global Const $htclose = 20
- Global Const $hthelp = 21
- Global Const $color_scrollbar = 0
- Global Const $color_background = 1
- Global Const $color_activecaption = 2
- Global Const $color_inactivecaption = 3
- Global Const $color_menu = 4
- Global Const $color_window = 5
- Global Const $color_windowframe = 6
- Global Const $color_menutext = 7
- Global Const $color_windowtext = 8
- Global Const $color_captiontext = 9
- Global Const $color_activeborder = 10
- Global Const $color_inactiveborder = 11
- Global Const $color_appworkspace = 12
- Global Const $color_highlight = 13
- Global Const $color_highlighttext = 14
- Global Const $color_btnface = 15
- Global Const $color_btnshadow = 16
- Global Const $color_graytext = 17
- Global Const $color_btntext = 18
- Global Const $color_inactivecaptiontext = 19
- Global Const $color_btnhighlight = 20
- Global Const $color_3ddkshadow = 21
- Global Const $color_3dlight = 22
- Global Const $color_infotext = 23
- Global Const $color_infobk = 24
- Global Const $color_hotlight = 26
- Global Const $color_gradientactivecaption = 27
- Global Const $color_gradientinactivecaption = 28
- Global Const $color_menuhilight = 29
- Global Const $color_menubar = 30
- Global Const $color_desktop = 1
- Global Const $color_3dface = 15
- Global Const $color_3dshadow = 16
- Global Const $color_3dhighlight = 20
- Global Const $color_3dhilight = 20
- Global Const $color_btnhilight = 20
- Global Const $hinst_commctrl = -1
- Global Const $idb_std_small_color = 0
- Global Const $idb_std_large_color = 1
- Global Const $idb_view_small_color = 4
- Global Const $idb_view_large_color = 5
- Global Const $idb_hist_small_color = 8
- Global Const $idb_hist_large_color = 9
- Global Const $startf_forceofffeedback = 128
- Global Const $startf_forceonfeedback = 64
- Global Const $startf_preventpinning = 8192
- Global Const $startf_runfullscreen = 32
- Global Const $startf_titleisappid = 4096
- Global Const $startf_titleislinkname = 2048
- Global Const $startf_usecountchars = 8
- Global Const $startf_usefillattribute = 16
- Global Const $startf_usehotkey = 512
- Global Const $startf_useposition = 4
- Global Const $startf_useshowwindow = 1
- Global Const $startf_usesize = 2
- Global Const $startf_usestdhandles = 256
- Global Const $cdds_prepaint = 1
- Global Const $cdds_postpaint = 2
- Global Const $cdds_preerase = 3
- Global Const $cdds_posterase = 4
- Global Const $cdds_item = 65536
- Global Const $cdds_itemprepaint = 65537
- Global Const $cdds_itempostpaint = 65538
- Global Const $cdds_itempreerase = 65539
- Global Const $cdds_itemposterase = 65540
- Global Const $cdds_subitem = 131072
- Global Const $cdis_selected = 1
- Global Const $cdis_grayed = 2
- Global Const $cdis_disabled = 4
- Global Const $cdis_checked = 8
- Global Const $cdis_focus = 16
- Global Const $cdis_default = 32
- Global Const $cdis_hot = 64
- Global Const $cdis_marked = 128
- Global Const $cdis_indeterminate = 256
- Global Const $cdis_showkeyboardcues = 512
- Global Const $cdis_nearhot = 1024
- Global Const $cdis_othersidehot = 2048
- Global Const $cdis_drophilited = 4096
- Global Const $cdrf_dodefault = 0
- Global Const $cdrf_newfont = 2
- Global Const $cdrf_skipdefault = 4
- Global Const $cdrf_notifypostpaint = 16
- Global Const $cdrf_notifyitemdraw = 32
- Global Const $cdrf_notifysubitemdraw = 32
- Global Const $cdrf_notifyposterase = 64
- Global Const $cdrf_doerase = 8
- Global Const $cdrf_skippostpaint = 256
- Global Const $gui_ss_default_gui = BitOR($ws_minimizebox, $ws_caption, $ws_popup, $ws_sysmenu)
- Global Const $opt_coordsrelative = 0
- Global Const $opt_coordsabsolute = 1
- Global Const $opt_coordsclient = 2
- Global Const $opt_errorsilent = 0
- Global Const $opt_errorfatal = 1
- Global Const $opt_capsnostore = 0
- Global Const $opt_capsstore = 1
- Global Const $opt_matchstart = 1
- Global Const $opt_matchany = 2
- Global Const $opt_matchexact = 3
- Global Const $opt_matchadvanced = 4
- Global Const $ccs_top = 1
- Global Const $ccs_nomovey = 2
- Global Const $ccs_bottom = 3
- Global Const $ccs_noresize = 4
- Global Const $ccs_noparentalign = 8
- Global Const $ccs_nohilite = 16
- Global Const $ccs_adjustable = 32
- Global Const $ccs_nodivider = 64
- Global Const $ccs_vert = 128
- Global Const $ccs_left = 129
- Global Const $ccs_nomovex = 130
- Global Const $ccs_right = 131
- Global Const $dt_drivetype = 1
- Global Const $dt_ssdstatus = 2
- Global Const $dt_bustype = 3
- Global Const $proxy_ie = 0
- Global Const $proxy_none = 1
- Global Const $proxy_specified = 2
- Global Const $objid_window = 0
- Global Const $objid_titlebar = -2
- Global Const $objid_sizegrip = -7
- Global Const $objid_caret = -8
- Global Const $objid_cursor = -9
- Global Const $objid_alert = -10
- Global Const $objid_sound = -11
- Global Const $dlg_centerontop = 0
- Global Const $dlg_notitle = 1
- Global Const $dlg_notontop = 2
- Global Const $dlg_textleft = 4
- Global Const $dlg_textright = 8
- Global Const $dlg_moveable = 16
- Global Const $dlg_textvcenter = 32
- Global Const $idc_unknown = 0
- Global Const $idc_appstarting = 1
- Global Const $idc_arrow = 2
- Global Const $idc_cross = 3
- Global Const $idc_hand = 32649
- Global Const $idc_help = 4
- Global Const $idc_ibeam = 5
- Global Const $idc_icon = 6
- Global Const $idc_no = 7
- Global Const $idc_size = 8
- Global Const $idc_sizeall = 9
- Global Const $idc_sizenesw = 10
- Global Const $idc_sizens = 11
- Global Const $idc_sizenwse = 12
- Global Const $idc_sizewe = 13
- Global Const $idc_uparrow = 14
- Global Const $idc_wait = 15
- Global Const $idi_application = 32512
- Global Const $idi_asterisk = 32516
- Global Const $idi_exclamation = 32515
- Global Const $idi_hand = 32513
- Global Const $idi_question = 32514
- Global Const $idi_winlogo = 32517
- Global Const $idi_shield = 32518
- Global Const $idi_error = $idi_hand
- Global Const $idi_information = $idi_asterisk
- Global Const $idi_warning = $idi_exclamation
- Global Const $sd_logoff = 0
- Global Const $sd_shutdown = 1
- Global Const $sd_reboot = 2
- Global Const $sd_force = 4
- Global Const $sd_powerdown = 8
- Global Const $sd_forcehung = 16
- Global Const $sd_standby = 32
- Global Const $sd_hibernate = 64
- Global Const $stdin_child = 1
- Global Const $stdout_child = 2
- Global Const $stderr_child = 4
- Global Const $stderr_merged = 8
- Global Const $stdio_inherit_parent = 16
- Global Const $run_create_new_console = 65536
- Global Const $ubound_dimensions = 0
- Global Const $ubound_rows = 1
- Global Const $ubound_columns = 2
- Global Const $mouseeventf_absolute = 32768
- Global Const $mouseeventf_move = 1
- Global Const $mouseeventf_leftdown = 2
- Global Const $mouseeventf_leftup = 4
- Global Const $mouseeventf_rightdown = 8
- Global Const $mouseeventf_rightup = 16
- Global Const $mouseeventf_middledown = 32
- Global Const $mouseeventf_middleup = 64
- Global Const $mouseeventf_wheel = 2048
- Global Const $mouseeventf_xdown = 128
- Global Const $mouseeventf_xup = 256
- Global Const $reg_none = 0
- Global Const $reg_sz = 1
- Global Const $reg_expand_sz = 2
- Global Const $reg_binary = 3
- Global Const $reg_dword = 4
- Global Const $reg_dword_little_endian = 4
- Global Const $reg_dword_big_endian = 5
- Global Const $reg_link = 6
- Global Const $reg_multi_sz = 7
- Global Const $reg_resource_list = 8
- Global Const $reg_full_resource_descriptor = 9
- Global Const $reg_resource_requirements_list = 10
- Global Const $reg_qword = 11
- Global Const $reg_qword_little_endian = 11
- Global Const $hwnd_bottom = 1
- Global Const $hwnd_notopmost = -2
- Global Const $hwnd_top = 0
- Global Const $hwnd_topmost = -1
- Global Const $swp_nosize = 1
- Global Const $swp_nomove = 2
- Global Const $swp_nozorder = 4
- Global Const $swp_noredraw = 8
- Global Const $swp_noactivate = 16
- Global Const $swp_framechanged = 32
- Global Const $swp_drawframe = 32
- Global Const $swp_showwindow = 64
- Global Const $swp_hidewindow = 128
- Global Const $swp_nocopybits = 256
- Global Const $swp_noownerzorder = 512
- Global Const $swp_noreposition = 512
- Global Const $swp_nosendchanging = 1024
- Global Const $swp_defererase = 8192
- Global Const $swp_asyncwindowpos = 16384
- Global Const $keyword_default = 1
- Global Const $keyword_null = 2
- Global Const $declared_local = -1
- Global Const $declared_unknown = 0
- Global Const $declared_global = 1
- Global Const $assign_create = 0
- Global Const $assign_forcelocal = 1
- Global Const $assign_forceglobal = 2
- Global Const $assign_existfail = 4
- Global Const $bi_enable = 0
- Global Const $bi_disable = 1
- Global Const $break_enable = 1
- Global Const $break_disable = 0
- Global Const $cdtray_open = "open"
- Global Const $cdtray_closed = "closed"
- Global Const $send_default = 0
- Global Const $send_raw = 1
- Global Const $dir_default = 0
- Global Const $dir_extended = 1
- Global Const $dir_norecurse = 2
- Global Const $dir_remove = 1
- Global Const $dt_all = "ALL"
- Global Const $dt_cdrom = "CDROM"
- Global Const $dt_removable = "REMOVABLE"
- Global Const $dt_fixed = "FIXED"
- Global Const $dt_network = "NETWORK"
- Global Const $dt_ramdisk = "RAMDISK"
- Global Const $dt_unknown = "UNKNOWN"
- Global Const $dt_undefined = 1
- Global Const $dt_fat = "FAT"
- Global Const $dt_fat32 = "FAT32"
- Global Const $dt_exfat = "exFAT"
- Global Const $dt_ntfs = "NTFS"
- Global Const $dt_nwfs = "NWFS"
- Global Const $dt_cdfs = "CDFS"
- Global Const $dt_udf = "UDF"
- Global Const $dma_default = 0
- Global Const $dma_persistent = 1
- Global Const $dma_authentication = 8
- Global Const $ds_unknown = "UNKNOWN"
- Global Const $ds_ready = "READY"
- Global Const $ds_notready = "NOTREADY"
- Global Const $ds_invalid = "INVALID"
- Global Const $mouse_click_left = "left"
- Global Const $mouse_click_right = "right"
- Global Const $mouse_click_middle = "middle"
- Global Const $mouse_click_main = "main"
- Global Const $mouse_click_menu = "menu"
- Global Const $mouse_click_primary = "primary"
- Global Const $mouse_click_secondary = "secondary"
- Global Const $mouse_wheel_up = "up"
- Global Const $mouse_wheel_down = "down"
- Global Const $number_auto = 0
- Global Const $number_32bit = 1
- Global Const $number_64bit = 2
- Global Const $number_double = 3
- Global Const $obj_name = 1
- Global Const $obj_string = 2
- Global Const $obj_progid = 3
- Global Const $obj_file = 4
- Global Const $obj_module = 5
- Global Const $obj_clsid = 6
- Global Const $obj_iid = 7
- Global Const $exitclose_normal = 0
- Global Const $exitclose_byexit = 1
- Global Const $exitclose_byclick = 2
- Global Const $exitclose_bylogoff = 3
- Global Const $exitclose_bysutdown = 4
- Global Const $process_stats_memory = 0
- Global Const $process_stats_io = 1
- Global Const $process_low = 0
- Global Const $process_belownormal = 1
- Global Const $process_normal = 2
- Global Const $process_abovenormal = 3
- Global Const $process_high = 4
- Global Const $process_realtime = 5
- Global Const $run_logon_noprofile = 0
- Global Const $run_logon_profile = 1
- Global Const $run_logon_network = 2
- Global Const $run_logon_inherit = 4
- Global Const $sound_nowait = 0
- Global Const $sound_wait = 1
- Global Const $shex_open = "open"
- Global Const $shex_edit = "edit"
- Global Const $shex_print = "print"
- Global Const $shex_properties = "properties"
- Global Const $tcp_data_default = 0
- Global Const $tcp_data_binary = 1
- Global Const $udp_open_default = 0
- Global Const $udp_open_broadcast = 1
- Global Const $udp_data_default = 0
- Global Const $udp_data_binary = 1
- Global Const $udp_data_array = 2
- Global Const $tip_noicon = 0
- Global Const $tip_infoicon = 1
- Global Const $tip_warningicon = 2
- Global Const $tip_erroricon = 3
- Global Const $tip_balloon = 1
- Global Const $tip_center = 2
- Global Const $tip_forcevisible = 4
- Global Const $windows_noontop = 0
- Global Const $windows_ontop = 1
- Global Const $mb_ok = 0
- Global Const $mb_okcancel = 1
- Global Const $mb_abortretryignore = 2
- Global Const $mb_yesnocancel = 3
- Global Const $mb_yesno = 4
- Global Const $mb_retrycancel = 5
- Global Const $mb_canceltrycontinue = 6
- Global Const $mb_help = 16384
- Global Const $mb_iconstop = 16
- Global Const $mb_iconerror = 16
- Global Const $mb_iconhand = 16
- Global Const $mb_iconquestion = 32
- Global Const $mb_iconexclamation = 48
- Global Const $mb_iconwarning = 48
- Global Const $mb_iconinformation = 64
- Global Const $mb_iconasterisk = 64
- Global Const $mb_usericon = 128
- Global Const $mb_defbutton1 = 0
- Global Const $mb_defbutton2 = 256
- Global Const $mb_defbutton3 = 512
- Global Const $mb_defbutton4 = 768
- Global Const $mb_applmodal = 0
- Global Const $mb_systemmodal = 4096
- Global Const $mb_taskmodal = 8192
- Global Const $mb_default_desktop_only = 131072
- Global Const $mb_right = 524288
- Global Const $mb_rtlreading = 1048576
- Global Const $mb_setforeground = 65536
- Global Const $mb_topmost = 262144
- Global Const $mb_service_notification = 2097152
- Global Const $mb_rightjustified = $mb_right
- Global Const $idtimeout = -1
- Global Const $idok = 1
- Global Const $idcancel = 2
- Global Const $idabort = 3
- Global Const $idretry = 4
- Global Const $idignore = 5
- Global Const $idyes = 6
- Global Const $idno = 7
- Global Const $idclose = 8
- Global Const $idhelp = 9
- Global Const $idtryagain = 10
- Global Const $idcontinue = 11
- Global Const $str_nocasesense = 0
- Global Const $str_casesense = 1
- Global Const $str_nocasesensebasic = 2
- Global Const $str_stripleading = 1
- Global Const $str_striptrailing = 2
- Global Const $str_stripspaces = 4
- Global Const $str_stripall = 8
- Global Const $str_chrsplit = 0
- Global Const $str_entiresplit = 1
- Global Const $str_nocount = 2
- Global Const $str_regexpmatch = 0
- Global Const $str_regexparraymatch = 1
- Global Const $str_regexparrayfullmatch = 2
- Global Const $str_regexparrayglobalmatch = 3
- Global Const $str_regexparrayglobalfullmatch = 4
- Global Const $str_endisstart = 0
- Global Const $str_endnotstart = 1
- Global Const $sb_ansi = 1
- Global Const $sb_utf16le = 2
- Global Const $sb_utf16be = 3
- Global Const $sb_utf8 = 4
- Global Const $se_utf16 = 0
- Global Const $se_ansi = 1
- Global Const $se_utf8 = 2
- Global Const $str_utf16 = 0
- Global Const $str_ucs2 = 1
- Global Enum $arrayfill_force_default, $arrayfill_force_singleitem, $arrayfill_force_int, $arrayfill_force_number, $arrayfill_force_ptr, $arrayfill_force_hwnd, $arrayfill_force_string
- Global Enum $arrayunique_nocount, $arrayunique_count
- Global Enum $arrayunique_auto, $arrayunique_force32, $arrayunique_force64, $arrayunique_match, $arrayunique_distinct
- Func _arrayadd(ByRef $aarray, $vvalue, $istart = 0, $sdelim_item = "|", $sdelim_row = @CRLF, $iforce = $arrayfill_force_default)
- If $istart = Default Then $istart = 0
- If $sdelim_item = Default Then $sdelim_item = "|"
- If $sdelim_row = Default Then $sdelim_row = @CRLF
- If $iforce = Default Then $iforce = $arrayfill_force_default
- If NOT IsArray($aarray) Then Return SetError(1, 0, -1)
- Local $idim_1 = UBound($aarray, $ubound_rows)
- Local $hdatatype = 0
- Switch $iforce
- Case $arrayfill_force_int
- $hdatatype = Int
- Case $arrayfill_force_number
- $hdatatype = Number
- Case $arrayfill_force_ptr
- $hdatatype = Ptr
- Case $arrayfill_force_hwnd
- $hdatatype = HWnd
- Case $arrayfill_force_string
- $hdatatype = String
- EndSwitch
- Switch UBound($aarray, $ubound_dimensions)
- Case 1
- If $iforce = $arrayfill_force_singleitem Then
- ReDim $aarray[$idim_1 + 1]
- $aarray[$idim_1] = $vvalue
- Return $idim_1
- EndIf
- If IsArray($vvalue) Then
- If UBound($vvalue, $ubound_dimensions) <> 1 Then Return SetError(5, 0, -1)
- $hdatatype = 0
- Else
- Local $atmp = StringSplit($vvalue, $sdelim_item, $str_nocount + $str_entiresplit)
- If UBound($atmp, $ubound_rows) = 1 Then
- $atmp[0] = $vvalue
- EndIf
- $vvalue = $atmp
- EndIf
- Local $iadd = UBound($vvalue, $ubound_rows)
- ReDim $aarray[$idim_1 + $iadd]
- For $i = 0 To $iadd - 1
- If IsFunc($hdatatype) Then
- $aarray[$idim_1 + $i] = $hdatatype($vvalue[$i])
- Else
- $aarray[$idim_1 + $i] = $vvalue[$i]
- EndIf
- Next
- Return $idim_1 + $iadd - 1
- Case 2
- Local $idim_2 = UBound($aarray, $ubound_columns)
- If $istart < 0 OR $istart > $idim_2 - 1 Then Return SetError(4, 0, -1)
- Local $ivaldim_1, $ivaldim_2 = 0, $icolcount
- If IsArray($vvalue) Then
- If UBound($vvalue, $ubound_dimensions) <> 2 Then Return SetError(5, 0, -1)
- $ivaldim_1 = UBound($vvalue, $ubound_rows)
- $ivaldim_2 = UBound($vvalue, $ubound_columns)
- $hdatatype = 0
- Else
- Local $asplit_1 = StringSplit($vvalue, $sdelim_row, $str_nocount + $str_entiresplit)
- $ivaldim_1 = UBound($asplit_1, $ubound_rows)
- Local $atmp[$ivaldim_1][0], $asplit_2
- For $i = 0 To $ivaldim_1 - 1
- $asplit_2 = StringSplit($asplit_1[$i], $sdelim_item, $str_nocount + $str_entiresplit)
- $icolcount = UBound($asplit_2)
- If $icolcount > $ivaldim_2 Then
- $ivaldim_2 = $icolcount
- ReDim $atmp[$ivaldim_1][$ivaldim_2]
- EndIf
- For $j = 0 To $icolcount - 1
- $atmp[$i][$j] = $asplit_2[$j]
- Next
- Next
- $vvalue = $atmp
- EndIf
- If UBound($vvalue, $ubound_columns) + $istart > UBound($aarray, $ubound_columns) Then Return SetError(3, 0, -1)
- ReDim $aarray[$idim_1 + $ivaldim_1][$idim_2]
- For $iwriteto_index = 0 To $ivaldim_1 - 1
- For $j = 0 To $idim_2 - 1
- If $j < $istart Then
- $aarray[$iwriteto_index + $idim_1][$j] = ""
- ElseIf $j - $istart > $ivaldim_2 - 1 Then
- $aarray[$iwriteto_index + $idim_1][$j] = ""
- Else
- If IsFunc($hdatatype) Then
- $aarray[$iwriteto_index + $idim_1][$j] = $hdatatype($vvalue[$iwriteto_index][$j - $istart])
- Else
- $aarray[$iwriteto_index + $idim_1][$j] = $vvalue[$iwriteto_index][$j - $istart]
- EndIf
- EndIf
- Next
- Next
- Case Else
- Return SetError(2, 0, -1)
- EndSwitch
- Return UBound($aarray, $ubound_rows) - 1
- EndFunc
- Func _arraybinarysearch(Const ByRef $aarray, $vvalue, $istart = 0, $iend = 0, $icolumn = 0)
- If $istart = Default Then $istart = 0
- If $iend = Default Then $iend = 0
- If $icolumn = Default Then $icolumn = 0
- If NOT IsArray($aarray) Then Return SetError(1, 0, -1)
- Local $idim_1 = UBound($aarray, $ubound_rows)
- If $idim_1 = 0 Then Return SetError(6, 0, -1)
- If $iend < 1 OR $iend > $idim_1 - 1 Then $iend = $idim_1 - 1
- If $istart < 0 Then $istart = 0
- If $istart > $iend Then Return SetError(4, 0, -1)
- Local $imid = Int(($iend + $istart) / 2)
- Switch UBound($aarray, $ubound_dimensions)
- Case 1
- If $aarray[$istart] > $vvalue OR $aarray[$iend] < $vvalue Then Return SetError(2, 0, -1)
- While $istart <= $imid AND $vvalue <> $aarray[$imid]
- If $vvalue < $aarray[$imid] Then
- $iend = $imid - 1
- Else
- $istart = $imid + 1
- EndIf
- $imid = Int(($iend + $istart) / 2)
- WEnd
- If $istart > $iend Then Return SetError(3, 0, -1)
- Case 2
- Local $idim_2 = UBound($aarray, $ubound_columns) - 1
- If $icolumn < 0 OR $icolumn > $idim_2 Then Return SetError(7, 0, -1)
- If $aarray[$istart][$icolumn] > $vvalue OR $aarray[$iend][$icolumn] < $vvalue Then Return SetError(2, 0, -1)
- While $istart <= $imid AND $vvalue <> $aarray[$imid][$icolumn]
- If $vvalue < $aarray[$imid][$icolumn] Then
- $iend = $imid - 1
- Else
- $istart = $imid + 1
- EndIf
- $imid = Int(($iend + $istart) / 2)
- WEnd
- If $istart > $iend Then Return SetError(3, 0, -1)
- Case Else
- Return SetError(5, 0, -1)
- EndSwitch
- Return $imid
- EndFunc
- Func _arraycoldelete(ByRef $aarray, $icolumn, $bconvert = False)
- If $bconvert = Default Then $bconvert = False
- If NOT IsArray($aarray) Then Return SetError(1, 0, -1)
- Local $idim_1 = UBound($aarray, $ubound_rows)
- If UBound($aarray, $ubound_dimensions) <> 2 Then Return SetError(2, 0, -1)
- Local $idim_2 = UBound($aarray, $ubound_columns)
- Switch $idim_2
- Case 2
- If $icolumn < 0 OR $icolumn > 1 Then Return SetError(3, 0, -1)
- If $bconvert Then
- Local $atemparray[$idim_1]
- For $i = 0 To $idim_1 - 1
- $atemparray[$i] = $aarray[$i][(NOT $icolumn)]
- Next
- $aarray = $atemparray
- Else
- ContinueCase
- EndIf
- Case Else
- If $icolumn < 0 OR $icolumn > $idim_2 - 1 Then Return SetError(3, 0, -1)
- For $i = 0 To $idim_1 - 1
- For $j = $icolumn To $idim_2 - 2
- $aarray[$i][$j] = $aarray[$i][$j + 1]
- Next
- Next
- ReDim $aarray[$idim_1][$idim_2 - 1]
- EndSwitch
- Return UBound($aarray, $ubound_columns)
- EndFunc
- Func _arraycolinsert(ByRef $aarray, $icolumn)
- If NOT IsArray($aarray) Then Return SetError(1, 0, -1)
- Local $idim_1 = UBound($aarray, $ubound_rows)
- Switch UBound($aarray, $ubound_dimensions)
- Case 1
- Local $atemparray[$idim_1][2]
- Switch $icolumn
- Case 0, 1
- For $i = 0 To $idim_1 - 1
- $atemparray[$i][(NOT $icolumn)] = $aarray[$i]
- Next
- Case Else
- Return SetError(3, 0, -1)
- EndSwitch
- $aarray = $atemparray
- Case 2
- Local $idim_2 = UBound($aarray, $ubound_columns)
- If $icolumn < 0 OR $icolumn > $idim_2 Then Return SetError(3, 0, -1)
- ReDim $aarray[$idim_1][$idim_2 + 1]
- For $i = 0 To $idim_1 - 1
- For $j = $idim_2 To $icolumn + 1 Step -1
- $aarray[$i][$j] = $aarray[$i][$j - 1]
- Next
- $aarray[$i][$icolumn] = ""
- Next
- Case Else
- Return SetError(2, 0, -1)
- EndSwitch
- Return UBound($aarray, $ubound_columns)
- EndFunc
- Func _arraycombinations(Const ByRef $aarray, $iset, $sdelimiter = "")
- If $sdelimiter = Default Then $sdelimiter = ""
- If NOT IsArray($aarray) Then Return SetError(1, 0, 0)
- If UBound($aarray, $ubound_dimensions) <> 1 Then Return SetError(2, 0, 0)
- Local $in = UBound($aarray)
- Local $ir = $iset
- Local $aidx[$ir]
- For $i = 0 To $ir - 1
- $aidx[$i] = $i
- Next
- Local $itotal = __array_combinations($in, $ir)
- Local $ileft = $itotal
- Local $aresult[$itotal + 1]
- $aresult[0] = $itotal
- Local $icount = 1
- While $ileft > 0
- __array_getnext($in, $ir, $ileft, $itotal, $aidx)
- For $i = 0 To $iset - 1
- $aresult[$icount] &= $aarray[$aidx[$i]] & $sdelimiter
- Next
- If $sdelimiter <> "" Then $aresult[$icount] = StringTrimRight($aresult[$icount], 1)
- $icount += 1
- WEnd
- Return $aresult
- EndFunc
- Func _arrayconcatenate(ByRef $aarraytarget, Const ByRef $aarraysource, $istart = 0)
- If $istart = Default Then $istart = 0
- If NOT IsArray($aarraytarget) Then Return SetError(1, 0, -1)
- If NOT IsArray($aarraysource) Then Return SetError(2, 0, -1)
- Local $idim_total_tgt = UBound($aarraytarget, $ubound_dimensions)
- Local $idim_total_src = UBound($aarraysource, $ubound_dimensions)
- Local $idim_1_tgt = UBound($aarraytarget, $ubound_rows)
- Local $idim_1_src = UBound($aarraysource, $ubound_rows)
- If $istart < 0 OR $istart > $idim_1_src - 1 Then Return SetError(6, 0, -1)
- Switch $idim_total_tgt
- Case 1
- If $idim_total_src <> 1 Then Return SetError(4, 0, -1)
- ReDim $aarraytarget[$idim_1_tgt + $idim_1_src - $istart]
- For $i = $istart To $idim_1_src - 1
- $aarraytarget[$idim_1_tgt + $i - $istart] = $aarraysource[$i]
- Next
- Case 2
- If $idim_total_src <> 2 Then Return SetError(4, 0, -1)
- Local $idim_2_tgt = UBound($aarraytarget, $ubound_columns)
- If UBound($aarraysource, $ubound_columns) <> $idim_2_tgt Then Return SetError(5, 0, -1)
- ReDim $aarraytarget[$idim_1_tgt + $idim_1_src - $istart][$idim_2_tgt]
- For $i = $istart To $idim_1_src - 1
- For $j = 0 To $idim_2_tgt - 1
- $aarraytarget[$idim_1_tgt + $i - $istart][$j] = $aarraysource[$i][$j]
- Next
- Next
- Case Else
- Return SetError(3, 0, -1)
- EndSwitch
- Return UBound($aarraytarget, $ubound_rows)
- EndFunc
- Func _arraydelete(ByRef $aarray, $vrange)
- If NOT IsArray($aarray) Then Return SetError(1, 0, -1)
- Local $idim_1 = UBound($aarray, $ubound_rows) - 1
- If IsArray($vrange) Then
- If UBound($vrange, $ubound_dimensions) <> 1 OR UBound($vrange, $ubound_rows) < 2 Then Return SetError(4, 0, -1)
- Else
- Local $inumber, $asplit_1, $asplit_2
- $vrange = StringStripWS($vrange, 8)
- $asplit_1 = StringSplit($vrange, ";")
- $vrange = ""
- For $i = 1 To $asplit_1[0]
- If NOT StringRegExp($asplit_1[$i], "^\d+(-\d+)?$") Then Return SetError(3, 0, -1)
- $asplit_2 = StringSplit($asplit_1[$i], "-")
- Switch $asplit_2[0]
- Case 1
- $vrange &= $asplit_2[1] & ";"
- Case 2
- If Number($asplit_2[2]) >= Number($asplit_2[1]) Then
- $inumber = $asplit_2[1] - 1
- Do
- $inumber += 1
- $vrange &= $inumber & ";"
- Until $inumber = $asplit_2[2]
- EndIf
- EndSwitch
- Next
- $vrange = StringSplit(StringTrimRight($vrange, 1), ";")
- EndIf
- If $vrange[1] < 0 OR $vrange[$vrange[0]] > $idim_1 Then Return SetError(5, 0, -1)
- Local $icopyto_index = 0
- Switch UBound($aarray, $ubound_dimensions)
- Case 1
- For $i = 1 To $vrange[0]
- $aarray[$vrange[$i]] = ChrW(64177)
- Next
- For $ireadfrom_index = 0 To $idim_1
- If $aarray[$ireadfrom_index] == ChrW(64177) Then
- ContinueLoop
- Else
- If $ireadfrom_index <> $icopyto_index Then
- $aarray[$icopyto_index] = $aarray[$ireadfrom_index]
- EndIf
- $icopyto_index += 1
- EndIf
- Next
- ReDim $aarray[$idim_1 - $vrange[0] + 1]
- Case 2
- Local $idim_2 = UBound($aarray, $ubound_columns) - 1
- For $i = 1 To $vrange[0]
- $aarray[$vrange[$i]][0] = ChrW(64177)
- Next
- For $ireadfrom_index = 0 To $idim_1
- If $aarray[$ireadfrom_index][0] == ChrW(64177) Then
- ContinueLoop
- Else
- If $ireadfrom_index <> $icopyto_index Then
- For $j = 0 To $idim_2
- $aarray[$icopyto_index][$j] = $aarray[$ireadfrom_index][$j]
- Next
- EndIf
- $icopyto_index += 1
- EndIf
- Next
- ReDim $aarray[$idim_1 - $vrange[0] + 1][$idim_2 + 1]
- Case Else
- Return SetError(2, 0, False)
- EndSwitch
- Return UBound($aarray, $ubound_rows)
- EndFunc
- 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)
- If $stitle = Default Then $stitle = "ArrayDisplay"
- If $sarrayrange = Default Then $sarrayrange = ""
- If $iflags = Default Then $iflags = 0
- If $vuser_separator = Default Then $vuser_separator = ""
- If $sheader = Default Then $sheader = ""
- If $imax_colwidth = Default Then $imax_colwidth = 350
- If $ialt_color = Default Then $ialt_color = 0
- If $huser_function = Default Then $huser_function = 0
- Local $itranspose = BitAND($iflags, 1)
- Local $icolalign = BitAND($iflags, 6)
- Local $iverbose = BitAND($iflags, 8)
- Local $ibuttonmargin = ((BitAND($iflags, 32)) ? (0) : ((BitAND($iflags, 16)) ? (20) : (40)))
- Local $inorow = BitAND($iflags, 64)
- Local $smsg = "", $iret = 1
- If IsArray($aarray) Then
- Local $idimension = UBound($aarray, $ubound_dimensions), $irowcount = UBound($aarray, $ubound_rows), $icolcount = UBound($aarray, $ubound_columns)
- If $idimension > 2 Then
- $smsg = "Larger than 2D array passed to function"
- $iret = 2
- EndIf
- Else
- $smsg = "No array variable passed to function"
- EndIf
- If $smsg Then
- If $iverbose AND MsgBox($mb_systemmodal + $mb_iconerror + $mb_yesno, "ArrayDisplay Error: " & $stitle, $smsg & @CRLF & @CRLF & "Exit the script?") = $idyes Then
- Exit
- Else
- Return SetError($iret, 0, "")
- EndIf
- EndIf
- Local $icw_colwidth = Number($vuser_separator)
- Local $sad_separator = ChrW(64177)
- Local $scurr_separator = Opt("GUIDataSeparatorChar", $sad_separator)
- If $vuser_separator = "" Then $vuser_separator = $scurr_separator
- Local $vtmp, $irowlimit = 65525, $icollimit = 250
- Local $idatarow = $irowcount
- Local $idatacol = $icolcount
- Local $iitem_start = 0, $iitem_end = $irowcount - 1, $isubitem_start = 0, $isubitem_end = (($idimension = 2) ? ($icolcount - 1) : (0))
- Local $brange_flag = False, $avrangesplit
- If $sarrayrange Then
- Local $aarray_range = StringRegExp($sarrayrange & "||", "(?U)(.*)\|", 3)
- If $aarray_range[0] Then
- $avrangesplit = StringSplit($aarray_range[0], ":")
- If @error Then
- $iitem_end = Number($avrangesplit[1])
- Else
- $iitem_start = Number($avrangesplit[1])
- $iitem_end = Number($avrangesplit[2])
- EndIf
- EndIf
- If $iitem_start > $iitem_end Then
- $vtmp = $iitem_start
- $iitem_start = $iitem_end
- $iitem_end = $vtmp
- EndIf
- If $iitem_start < 0 Then $iitem_start = 0
- If $iitem_end > $irowcount - 1 Then $iitem_end = $irowcount - 1
- If $iitem_start <> 0 OR $iitem_end <> $irowcount - 1 Then $brange_flag = True
- If $idimension = 2 AND $aarray_range[1] Then
- $avrangesplit = StringSplit($aarray_range[1], ":")
- If @error Then
- $isubitem_end = Number($avrangesplit[1])
- Else
- $isubitem_start = Number($avrangesplit[1])
- $isubitem_end = Number($avrangesplit[2])
- EndIf
- If $isubitem_start > $isubitem_end Then
- $vtmp = $isubitem_start
- $isubitem_start = $isubitem_end
- $isubitem_end = $vtmp
- EndIf
- If $isubitem_start < 0 Then $isubitem_start = 0
- If $isubitem_end > $icolcount - 1 Then $isubitem_end = $icolcount - 1
- If $isubitem_start <> 0 OR $isubitem_end <> $icolcount - 1 Then $brange_flag = True
- EndIf
- EndIf
- Local $sdisplaydata = "[" & $idatarow
- Local $btruncated = False
- If $itranspose Then
- If $iitem_end - $iitem_start > $icollimit Then
- $btruncated = True
- $iitem_end = $iitem_start + $icollimit - 1
- EndIf
- Else
- If $iitem_end - $iitem_start > $irowlimit Then
- $btruncated = True
- $iitem_end = $iitem_start + $irowlimit - 1
- EndIf
- EndIf
- If $btruncated Then
- $sdisplaydata &= "*]"
- Else
- $sdisplaydata &= "]"
- EndIf
- If $idimension = 2 Then
- $sdisplaydata &= " [" & $idatacol
- If $itranspose Then
- If $isubitem_end - $isubitem_start > $irowlimit Then
- $btruncated = True
- $isubitem_end = $isubitem_start + $irowlimit - 1
- EndIf
- Else
- If $isubitem_end - $isubitem_start > $icollimit Then
- $btruncated = True
- $isubitem_end = $isubitem_start + $icollimit - 1
- EndIf
- EndIf
- If $btruncated Then
- $sdisplaydata &= "*]"
- Else
- $sdisplaydata &= "]"
- EndIf
- EndIf
- Local $stipdata = ""
- If $btruncated Then $stipdata &= "Truncated"
- If $brange_flag Then
- If $stipdata Then $stipdata &= " - "
- $stipdata &= "Range set"
- EndIf
- If $itranspose Then
- If $stipdata Then $stipdata &= " - "
- $stipdata &= "Transposed"
- EndIf
- Local $asheader = StringSplit($sheader, $scurr_separator, $str_nocount)
- If UBound($asheader) = 0 Then Local $asheader[1] = [""]
- $sheader = "Row"
- Local $iindex = $isubitem_start
- If $itranspose Then
- For $j = $iitem_start To $iitem_end
- $sheader &= $sad_separator & "Col " & $j
- Next
- Else
- If $asheader[0] Then
- For $iindex = $isubitem_start To $isubitem_end
- If $iindex >= UBound($asheader) Then ExitLoop
- $sheader &= $sad_separator & $asheader[$iindex]
- Next
- EndIf
- For $j = $iindex To $isubitem_end
- $sheader &= $sad_separator & "Col " & $j
- Next
- EndIf
- If $inorow Then $sheader = StringTrimLeft($sheader, 4)
- If $iverbose AND ($iitem_end - $iitem_start + 1) * ($isubitem_end - $isubitem_start + 1) > 10000 Then
- SplashTextOn("ArrayDisplay", "Preparing display" & @CRLF & @CRLF & "Please be patient", 300, 100)
- EndIf
- Local $ibuffer = 4094
- If $itranspose Then
- $vtmp = $iitem_start
- $iitem_start = $isubitem_start
- $isubitem_start = $vtmp
- $vtmp = $iitem_end
- $iitem_end = $isubitem_end
- $isubitem_end = $vtmp
- EndIf
- Local $avarraytext[$iitem_end - $iitem_start + 1]
- For $i = $iitem_start To $iitem_end
- If NOT $inorow Then $avarraytext[$i - $iitem_start] = "[" & $i & "]"
- For $j = $isubitem_start To $isubitem_end
- If $idimension = 1 Then
- If $itranspose Then
- Switch VarGetType($aarray[$j])
- Case "Array"
- $vtmp = "{Array}"
- Case Else
- $vtmp = $aarray[$j]
- EndSwitch
- Else
- Switch VarGetType($aarray[$i])
- Case "Array"
- $vtmp = "{Array}"
- Case Else
- $vtmp = $aarray[$i]
- EndSwitch
- EndIf
- Else
- If $itranspose Then
- Switch VarGetType($aarray[$j][$i])
- Case "Array"
- $vtmp = "{Array}"
- Case Else
- $vtmp = $aarray[$j][$i]
- EndSwitch
- Else
- Switch VarGetType($aarray[$i][$j])
- Case "Array"
- $vtmp = "{Array}"
- Case Else
- $vtmp = $aarray[$i][$j]
- EndSwitch
- EndIf
- EndIf
- If StringLen($vtmp) > $ibuffer Then $vtmp = StringLeft($vtmp, $ibuffer)
- $avarraytext[$i - $iitem_start] &= $sad_separator & $vtmp
- Next
- If $inorow Then $avarraytext[$i - $iitem_start] = StringTrimLeft($avarraytext[$i - $iitem_start], 1)
- Next
- Local Const $_arrayconstant_gui_dockbottom = 64
- Local Const $_arrayconstant_gui_dockborders = 102
- Local Const $_arrayconstant_gui_dockheight = 512
- Local Const $_arrayconstant_gui_dockleft = 2
- Local Const $_arrayconstant_gui_dockright = 4
- Local Const $_arrayconstant_gui_dockhcenter = 8
- Local Const $_arrayconstant_gui_event_close = -3
- Local Const $_arrayconstant_gui_focus = 256
- Local Const $_arrayconstant_gui_bkcolor_lv_alternate = -33554432
- Local Const $_arrayconstant_ss_center = 1
- Local Const $_arrayconstant_ss_centerimage = 512
- Local Const $_arrayconstant_lvm_getitemcount = (4096 + 4)
- Local Const $_arrayconstant_lvm_getitemrect = (4096 + 14)
- Local Const $_arrayconstant_lvm_getcolumnwidth = (4096 + 29)
- Local Const $_arrayconstant_lvm_setcolumnwidth = (4096 + 30)
- Local Const $_arrayconstant_lvm_getitemstate = (4096 + 44)
- Local Const $_arrayconstant_lvm_getselectedcount = (4096 + 50)
- Local Const $_arrayconstant_lvm_setextendedlistviewstyle = (4096 + 54)
- Local Const $_arrayconstant_lvs_ex_gridlines = 1
- Local Const $_arrayconstant_lvis_selected = 2
- Local Const $_arrayconstant_lvs_showselalways = 8
- Local Const $_arrayconstant_lvs_ex_fullrowselect = 32
- Local Const $_arrayconstant_ws_ex_clientedge = 512
- Local Const $_arrayconstant_ws_maximizebox = 65536
- Local Const $_arrayconstant_ws_minimizebox = 131072
- Local Const $_arrayconstant_ws_sizebox = 262144
- Local Const $_arrayconstant_wm_setredraw = 11
- Local Const $_arrayconstant_lvscw_autosize = -1
- Local $icoordmode = Opt("GUICoordMode", 1)
- Local $iorgwidth = 210, $iheight = 200, $iminsize = 250
- Local $hgui = GUICreate($stitle, $iorgwidth, $iheight, Default, Default, BitOR($_arrayconstant_ws_sizebox, $_arrayconstant_ws_minimizebox, $_arrayconstant_ws_maximizebox))
- Local $aiguisize = WinGetClientSize($hgui)
- Local $ibuttonwidth_2 = $aiguisize[0] / 2
- Local $ibuttonwidth_3 = $aiguisize[0] / 3
- Local $idlistview = GUICtrlCreateListView($sheader, 0, 0, $aiguisize[0], $aiguisize[1] - $ibuttonmargin, $_arrayconstant_lvs_showselalways)
- GUICtrlSetBkColor($idlistview, $_arrayconstant_gui_bkcolor_lv_alternate)
- GUICtrlSendMsg($idlistview, $_arrayconstant_lvm_setextendedlistviewstyle, $_arrayconstant_lvs_ex_gridlines, $_arrayconstant_lvs_ex_gridlines)
- GUICtrlSendMsg($idlistview, $_arrayconstant_lvm_setextendedlistviewstyle, $_arrayconstant_lvs_ex_fullrowselect, $_arrayconstant_lvs_ex_fullrowselect)
- GUICtrlSendMsg($idlistview, $_arrayconstant_lvm_setextendedlistviewstyle, $_arrayconstant_ws_ex_clientedge, $_arrayconstant_ws_ex_clientedge)
- Local $idcopy_id = 9999, $idcopy_data = 99999, $iddata_label = 99999, $iduser_func = 99999, $idexit_script = 99999
- If $ibuttonmargin Then
- $idcopy_id = GUICtrlCreateButton("Copy Data && Hdr/Row", 0, $aiguisize[1] - $ibuttonmargin, $ibuttonwidth_2, 20)
- $idcopy_data = GUICtrlCreateButton("Copy Data Only", $ibuttonwidth_2, $aiguisize[1] - $ibuttonmargin, $ibuttonwidth_2, 20)
- If $ibuttonmargin = 40 Then
- Local $ibuttonwidth_var = $ibuttonwidth_2
- Local $ioffset = $ibuttonwidth_2
- If IsFunc($huser_function) Then
- $iduser_func = GUICtrlCreateButton("Run User Func", $ibuttonwidth_3, $aiguisize[1] - 20, $ibuttonwidth_3, 20)
- $ibuttonwidth_var = $ibuttonwidth_3
- $ioffset = $ibuttonwidth_3 * 2
- EndIf
- $idexit_script = GUICtrlCreateButton("Exit Script", $ioffset, $aiguisize[1] - 20, $ibuttonwidth_var, 20)
- $iddata_label = GUICtrlCreateLabel($sdisplaydata, 0, $aiguisize[1] - 20, $ibuttonwidth_var, 18, BitOR($_arrayconstant_ss_center, $_arrayconstant_ss_centerimage))
- Select
- Case $btruncated OR $itranspose OR $brange_flag
- GUICtrlSetColor($iddata_label, 16711680)
- GUICtrlSetTip($iddata_label, $stipdata)
- EndSelect
- EndIf
- EndIf
- GUICtrlSetResizing($idlistview, $_arrayconstant_gui_dockborders)
- GUICtrlSetResizing($idcopy_id, $_arrayconstant_gui_dockleft + $_arrayconstant_gui_dockbottom + $_arrayconstant_gui_dockheight)
- GUICtrlSetResizing($idcopy_data, $_arrayconstant_gui_dockright + $_arrayconstant_gui_dockbottom + $_arrayconstant_gui_dockheight)
- GUICtrlSetResizing($iddata_label, $_arrayconstant_gui_dockleft + $_arrayconstant_gui_dockbottom + $_arrayconstant_gui_dockheight)
- GUICtrlSetResizing($iduser_func, $_arrayconstant_gui_dockhcenter + $_arrayconstant_gui_dockbottom + $_arrayconstant_gui_dockheight)
- GUICtrlSetResizing($idexit_script, $_arrayconstant_gui_dockright + $_arrayconstant_gui_dockbottom + $_arrayconstant_gui_dockheight)
- GUICtrlSendMsg($idlistview, $_arrayconstant_wm_setredraw, 0, 0)
- Local $iditem
- For $i = 0 To UBound($avarraytext) - 1
- $iditem = GUICtrlCreateListViewItem($avarraytext[$i], $idlistview)
- If $ialt_color Then
- GUICtrlSetBkColor($iditem, $ialt_color)
- EndIf
- Next
- If $icolalign Then
- Local Const $_arrayconstant_lvcf_fmt = 1
- Local Const $_arrayconstant_lvm_setcolumnw = (4096 + 96)
- 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")
- DllStructSetData($tcolumn, "Mask", $_arrayconstant_lvcf_fmt)
- DllStructSetData($tcolumn, "Fmt", $icolalign / 2)
- Local $pcolumn = DllStructGetPtr($tcolumn)
- For $i = 1 To $isubitem_end - $isubitem_start + 1
- GUICtrlSendMsg($idlistview, $_arrayconstant_lvm_setcolumnw, $i, $pcolumn)
- Next
- EndIf
- GUICtrlSendMsg($idlistview, $_arrayconstant_wm_setredraw, 1, 0)
- Local $iborder = 45
- If UBound($avarraytext) > 20 Then
- $iborder += 20
- EndIf
- Local $iwidth = $iborder, $icolwidth = 0, $aicolwidth[$isubitem_end - $isubitem_start + 2], $imin_colwidth = 55
- For $i = 0 To $isubitem_end - $isubitem_start + 1
- GUICtrlSendMsg($idlistview, $_arrayconstant_lvm_setcolumnwidth, $i, $_arrayconstant_lvscw_autosize)
- $icolwidth = GUICtrlSendMsg($idlistview, $_arrayconstant_lvm_getcolumnwidth, $i, 0)
- If $icolwidth < $imin_colwidth Then
- GUICtrlSendMsg($idlistview, $_arrayconstant_lvm_setcolumnwidth, $i, $imin_colwidth)
- $icolwidth = $imin_colwidth
- EndIf
- $iwidth += $icolwidth
- $aicolwidth[$i] = $icolwidth
- Next
- If $inorow Then $iwidth -= 55
- If $iwidth > @DesktopWidth - 100 Then
- $iwidth = $iborder
- For $i = 0 To $isubitem_end - $isubitem_start + 1
- If $aicolwidth[$i] > $imax_colwidth Then
- GUICtrlSendMsg($idlistview, $_arrayconstant_lvm_setcolumnwidth, $i, $imax_colwidth)
- $iwidth += $imax_colwidth
- Else
- $iwidth += $aicolwidth[$i]
- EndIf
- Next
- EndIf
- If $iwidth > @DesktopWidth - 100 Then
- $iwidth = @DesktopWidth - 100
- ElseIf $iwidth < $iminsize Then
- $iwidth = $iminsize
- EndIf
- Local $trect = DllStructCreate("struct; long Left;long Top;long Right;long Bottom; endstruct")
- DllCall("user32.dll", "struct*", "SendMessageW", "hwnd", GUICtrlGetHandle($idlistview), "uint", $_arrayconstant_lvm_getitemrect, "wparam", 0, "struct*", $trect)
- Local $aiwin_pos = WinGetPos($hgui)
- Local $ailv_pos = ControlGetPos($hgui, "", $idlistview)
- $iheight = ((UBound($avarraytext) + 2) * (DllStructGetData($trect, "Bottom") - DllStructGetData($trect, "Top"))) + $aiwin_pos[3] - $ailv_pos[3]
- If $iheight > @DesktopHeight - 100 Then
- $iheight = @DesktopHeight - 100
- ElseIf $iheight < $iminsize Then
- $iheight = $iminsize
- EndIf
- If $iverbose Then SplashOff()
- GUISetState(@SW_HIDE, $hgui)
- WinMove($hgui, "", (@DesktopWidth - $iwidth) / 2, (@DesktopHeight - $iheight) / 2, $iwidth, $iheight)
- GUISetState(@SW_SHOW, $hgui)
- Local $ioneventmode = Opt("GUIOnEventMode", 0), $imsg
- While 1
- $imsg = GUIGetMsg()
- Switch $imsg
- Case $_arrayconstant_gui_event_close
- ExitLoop
- Case $idcopy_id, $idcopy_data
- Local $isel_count = GUICtrlSendMsg($idlistview, $_arrayconstant_lvm_getselectedcount, 0, 0)
- If $iverbose AND (NOT $isel_count) AND ($iitem_end - $iitem_start) * ($isubitem_end - $isubitem_start) > 10000 Then
- SplashTextOn("ArrayDisplay", "Copying data" & @CRLF & @CRLF & "Please be patient", 300, 100)
- EndIf
- Local $sclip = "", $sitem, $asplit
- For $i = 0 To $iitem_end - $iitem_start
- If $isel_count AND NOT (GUICtrlSendMsg($idlistview, $_arrayconstant_lvm_getitemstate, $i, $_arrayconstant_lvis_selected)) Then
- ContinueLoop
- EndIf
- $sitem = $avarraytext[$i]
- If $imsg = $idcopy_data Then
- $sitem = StringRegExpReplace($sitem, "^\[\d+\].(.*)$", "$1")
- EndIf
- If $icw_colwidth Then
- $asplit = StringSplit($sitem, $sad_separator)
- $sitem = ""
- For $j = 1 To $asplit[0]
- $sitem &= StringFormat("%-" & $icw_colwidth + 1 & "s", StringLeft($asplit[$j], $icw_colwidth))
- Next
- Else
- $sitem = StringReplace($sitem, $sad_separator, $vuser_separator)
- EndIf
- $sclip &= $sitem & @CRLF
- Next
- If $imsg = $idcopy_id Then
- If $icw_colwidth Then
- $asplit = StringSplit($sheader, $sad_separator)
- $sitem = ""
- For $j = 1 To $asplit[0]
- $sitem &= StringFormat("%-" & $icw_colwidth + 1 & "s", StringLeft($asplit[$j], $icw_colwidth))
- Next
- Else
- $sitem = StringReplace($sheader, $sad_separator, $vuser_separator)
- EndIf
- $sclip = $sitem & @CRLF & $sclip
- EndIf
- ClipPut($sclip)
- SplashOff()
- GUICtrlSetState($idlistview, $_arrayconstant_gui_focus)
- Case $iduser_func
- Local $aiselitems[$irowlimit] = [0]
- For $i = 0 To GUICtrlSendMsg($idlistview, $_arrayconstant_lvm_getitemcount, 0, 0)
- If GUICtrlSendMsg($idlistview, $_arrayconstant_lvm_getitemstate, $i, $_arrayconstant_lvis_selected) Then
- $aiselitems[0] += 1
- $aiselitems[$aiselitems[0]] = $i + $iitem_start
- EndIf
- Next
- ReDim $aiselitems[$aiselitems[0] + 1]
- $huser_function($aarray, $aiselitems)
- GUICtrlSetState($idlistview, $_arrayconstant_gui_focus)
- Case $idexit_script
- GUIDelete($hgui)
- Exit
- EndSwitch
- WEnd
- GUIDelete($hgui)
- Opt("GUICoordMode", $icoordmode)
- Opt("GUIOnEventMode", $ioneventmode)
- Opt("GUIDataSeparatorChar", $scurr_separator)
- Return 1
- EndFunc
- Func _arrayextract(Const ByRef $aarray, $istart_row = -1, $iend_row = -1, $istart_col = -1, $iend_col = -1)
- If $istart_row = Default Then $istart_row = -1
- If $iend_row = Default Then $iend_row = -1
- If $istart_col = Default Then $istart_col = -1
- If $iend_col = Default Then $iend_col = -1
- If NOT IsArray($aarray) Then Return SetError(1, 0, -1)
- Local $idim_1 = UBound($aarray, $ubound_rows) - 1
- If $iend_row = -1 Then $iend_row = $idim_1
- If $istart_row = -1 Then $istart_row = 0
- If $istart_row < -1 OR $iend_row < -1 Then Return SetError(3, 0, -1)
- If $istart_row > $idim_1 OR $iend_row > $idim_1 Then Return SetError(3, 0, -1)
- If $istart_row > $iend_row Then Return SetError(4, 0, -1)
- Switch UBound($aarray, $ubound_dimensions)
- Case 1
- Local $aretarray[$iend_row - $istart_row + 1]
- For $i = 0 To $iend_row - $istart_row
- $aretarray[$i] = $aarray[$i + $istart_row]
- Next
- Return $aretarray
- Case 2
- Local $idim_2 = UBound($aarray, $ubound_columns) - 1
- If $iend_col = -1 Then $iend_col = $idim_2
- If $istart_col = -1 Then $istart_col = 0
- If $istart_col < -1 OR $iend_col < -1 Then Return SetError(5, 0, -1)
- If $istart_col > $idim_2 OR $iend_col > $idim_2 Then Return SetError(5, 0, -1)
- If $istart_col > $iend_col Then Return SetError(6, 0, -1)
- If $istart_col = $iend_col Then
- Local $aretarray[$iend_row - $istart_row + 1]
- Else
- Local $aretarray[$iend_row - $istart_row + 1][$iend_col - $istart_col + 1]
- EndIf
- For $i = 0 To $iend_row - $istart_row
- For $j = 0 To $iend_col - $istart_col
- If $istart_col = $iend_col Then
- $aretarray[$i] = $aarray[$i + $istart_row][$j + $istart_col]
- Else
- $aretarray[$i][$j] = $aarray[$i + $istart_row][$j + $istart_col]
- EndIf
- Next
- Next
- Return $aretarray
- Case Else
- Return SetError(2, 0, -1)
- EndSwitch
- Return 1
- EndFunc
- Func _arrayfindall(Const ByRef $aarray, $vvalue, $istart = 0, $iend = 0, $icase = 0, $icompare = 0, $isubitem = 0, $brow = False)
- If $istart = Default Then $istart = 0
- If $iend = Default Then $iend = 0
- If $icase = Default Then $icase = 0
- If $icompare = Default Then $icompare = 0
- If $isubitem = Default Then $isubitem = 0
- If $brow = Default Then $brow = False
- $istart = _arraysearch($aarray, $vvalue, $istart, $iend, $icase, $icompare, 1, $isubitem, $brow)
- If @error Then Return SetError(@error, 0, -1)
- Local $iindex = 0, $avresult[UBound($aarray, ($brow ? $ubound_columns : $ubound_rows))]
- Do
- $avresult[$iindex] = $istart
- $iindex += 1
- $istart = _arraysearch($aarray, $vvalue, $istart + 1, $iend, $icase, $icompare, 1, $isubitem, $brow)
- Until @error
- ReDim $avresult[$iindex]
- Return $avresult
- EndFunc
- Func _arrayinsert(ByRef $aarray, $vrange, $vvalue = "", $istart = 0, $sdelim_item = "|", $sdelim_row = @CRLF, $iforce = $arrayfill_force_default)
- If $vvalue = Default Then $vvalue = ""
- If $istart = Default Then $istart = 0
- If $sdelim_item = Default Then $sdelim_item = "|"
- If $sdelim_row = Default Then $sdelim_row = @CRLF
- If $iforce = Default Then $iforce = $arrayfill_force_default
- If NOT IsArray($aarray) Then Return SetError(1, 0, -1)
- Local $idim_1 = UBound($aarray, $ubound_rows) - 1
- Local $hdatatype = 0
- Switch $iforce
- Case $arrayfill_force_int
- $hdatatype = Int
- Case $arrayfill_force_number
- $hdatatype = Number
- Case $arrayfill_force_ptr
- $hdatatype = Ptr
- Case $arrayfill_force_hwnd
- $hdatatype = HWnd
- Case $arrayfill_force_string
- $hdatatype = String
- EndSwitch
- Local $asplit_1, $asplit_2
- If IsArray($vrange) Then
- If UBound($vrange, $ubound_dimensions) <> 1 OR UBound($vrange, $ubound_rows) < 2 Then Return SetError(4, 0, -1)
- Else
- Local $inumber
- $vrange = StringStripWS($vrange, 8)
- $asplit_1 = StringSplit($vrange, ";")
- $vrange = ""
- For $i = 1 To $asplit_1[0]
- If NOT StringRegExp($asplit_1[$i], "^\d+(-\d+)?$") Then Return SetError(3, 0, -1)
- $asplit_2 = StringSplit($asplit_1[$i], "-")
- Switch $asplit_2[0]
- Case 1
- $vrange &= $asplit_2[1] & ";"
- Case 2
- If Number($asplit_2[2]) >= Number($asplit_2[1]) Then
- $inumber = $asplit_2[1] - 1
- Do
- $inumber += 1
- $vrange &= $inumber & ";"
- Until $inumber = $asplit_2[2]
- EndIf
- EndSwitch
- Next
- $vrange = StringSplit(StringTrimRight($vrange, 1), ";")
- EndIf
- If $vrange[1] < 0 OR $vrange[$vrange[0]] > $idim_1 Then Return SetError(5, 0, -1)
- For $i = 2 To $vrange[0]
- If $vrange[$i] < $vrange[$i - 1] Then Return SetError(3, 0, -1)
- Next
- Local $icopyto_index = $idim_1 + $vrange[0]
- Local $iinsertpoint_index = $vrange[0]
- Local $iinsert_index = $vrange[$iinsertpoint_index]
- Switch UBound($aarray, $ubound_dimensions)
- Case 1
- If $iforce = $arrayfill_force_singleitem Then
- ReDim $aarray[$idim_1 + $vrange[0] + 1]
- For $ireadfromindex = $idim_1 To 0 Step -1
- $aarray[$icopyto_index] = $aarray[$ireadfromindex]
- $icopyto_index -= 1
- $iinsert_index = $vrange[$iinsertpoint_index]
- While $ireadfromindex = $iinsert_index
- $aarray[$icopyto_index] = $vvalue
- $icopyto_index -= 1
- $iinsertpoint_index -= 1
- If $iinsertpoint_index < 1 Then ExitLoop 2
- $iinsert_index = $vrange[$iinsertpoint_index]
- WEnd
- Next
- Return $idim_1 + $vrange[0] + 1
- EndIf
- ReDim $aarray[$idim_1 + $vrange[0] + 1]
- If IsArray($vvalue) Then
- If UBound($vvalue, $ubound_dimensions) <> 1 Then Return SetError(5, 0, -1)
- $hdatatype = 0
- Else
- Local $atmp = StringSplit($vvalue, $sdelim_item, $str_nocount + $str_entiresplit)
- If UBound($atmp, $ubound_rows) = 1 Then
- $atmp[0] = $vvalue
- $hdatatype = 0
- EndIf
- $vvalue = $atmp
- EndIf
- For $ireadfromindex = $idim_1 To 0 Step -1
- $aarray[$icopyto_index] = $aarray[$ireadfromindex]
- $icopyto_index -= 1
- $iinsert_index = $vrange[$iinsertpoint_index]
- While $ireadfromindex = $iinsert_index
- If $iinsertpoint_index <= UBound($vvalue, $ubound_rows) Then
- If IsFunc($hdatatype) Then
- $aarray[$icopyto_index] = $hdatatype($vvalue[$iinsertpoint_index - 1])
- Else
- $aarray[$icopyto_index] = $vvalue[$iinsertpoint_index - 1]
- EndIf
- Else
- $aarray[$icopyto_index] = ""
- EndIf
- $icopyto_index -= 1
- $iinsertpoint_index -= 1
- If $iinsertpoint_index = 0 Then ExitLoop 2
- $iinsert_index = $vrange[$iinsertpoint_index]
- WEnd
- Next
- Case 2
- Local $idim_2 = UBound($aarray, $ubound_columns)
- If $istart < 0 OR $istart > $idim_2 - 1 Then Return SetError(6, 0, -1)
- Local $ivaldim_1, $ivaldim_2
- If IsArray($vvalue) Then
- If UBound($vvalue, $ubound_dimensions) <> 2 Then Return SetError(7, 0, -1)
- $ivaldim_1 = UBound($vvalue, $ubound_rows)
- $ivaldim_2 = UBound($vvalue, $ubound_columns)
- $hdatatype = 0
- Else
- $asplit_1 = StringSplit($vvalue, $sdelim_row, $str_nocount + $str_entiresplit)
- $ivaldim_1 = UBound($asplit_1, $ubound_rows)
- StringReplace($asplit_1[0], $sdelim_item, "")
- $ivaldim_2 = @extended + 1
- Local $atmp[$ivaldim_1][$ivaldim_2]
- For $i = 0 To $ivaldim_1 - 1
- $asplit_2 = StringSplit($asplit_1[$i], $sdelim_item, $str_nocount + $str_entiresplit)
- For $j = 0 To $ivaldim_2 - 1
- $atmp[$i][$j] = $asplit_2[$j]
- Next
- Next
- $vvalue = $atmp
- EndIf
- If UBound($vvalue, $ubound_columns) + $istart > UBound($aarray, $ubound_columns) Then Return SetError(8, 0, -1)
- ReDim $aarray[$idim_1 + $vrange[0] + 1][$idim_2]
- For $ireadfromindex = $idim_1 To 0 Step -1
- For $j = 0 To $idim_2 - 1
- $aarray[$icopyto_index][$j] = $aarray[$ireadfromindex][$j]
- Next
- $icopyto_index -= 1
- $iinsert_index = $vrange[$iinsertpoint_index]
- While $ireadfromindex = $iinsert_index
- For $j = 0 To $idim_2 - 1
- If $j < $istart Then
- $aarray[$icopyto_index][$j] = ""
- ElseIf $j - $istart > $ivaldim_2 - 1 Then
- $aarray[$icopyto_index][$j] = ""
- Else
- If $iinsertpoint_index - 1 < $ivaldim_1 Then
- If IsFunc($hdatatype) Then
- $aarray[$icopyto_index][$j] = $hdatatype($vvalue[$iinsertpoint_index - 1][$j - $istart])
- Else
- $aarray[$icopyto_index][$j] = $vvalue[$iinsertpoint_index - 1][$j - $istart]
- EndIf
- Else
- $aarray[$icopyto_index][$j] = ""
- EndIf
- EndIf
- Next
- $icopyto_index -= 1
- $iinsertpoint_index -= 1
- If $iinsertpoint_index = 0 Then ExitLoop 2
- $iinsert_index = $vrange[$iinsertpoint_index]
- WEnd
- Next
- Case Else
- Return SetError(2, 0, -1)
- EndSwitch
- Return UBound($aarray, $ubound_rows)
- EndFunc
- Func _arraymax(Const ByRef $aarray, $icompnumeric = 0, $istart = -1, $iend = -1, $isubitem = 0)
- Local $iresult = _arraymaxindex($aarray, $icompnumeric, $istart, $iend, $isubitem)
- If @error Then Return SetError(@error, 0, "")
- If UBound($aarray, $ubound_dimensions) = 1 Then
- Return $aarray[$iresult]
- Else
- Return $aarray[$iresult][$isubitem]
- EndIf
- EndFunc
- Func _arraymaxindex(Const ByRef $aarray, $icompnumeric = 0, $istart = -1, $iend = -1, $isubitem = 0)
- If $icompnumeric = Default Then $icompnumeric = 0
- If $istart = Default Then $istart = -1
- If $iend = Default Then $iend = -1
- If $isubitem = Default Then $isubitem = 0
- Local $iret = __array_minmaxindex($aarray, $icompnumeric, $istart, $iend, $isubitem, __array_greaterthan)
- Return SetError(@error, 0, $iret)
- EndFunc
- Func _arraymin(Const ByRef $aarray, $icompnumeric = 0, $istart = -1, $iend = -1, $isubitem = 0)
- Local $iresult = _arrayminindex($aarray, $icompnumeric, $istart, $iend, $isubitem)
- If @error Then Return SetError(@error, 0, "")
- If UBound($aarray, $ubound_dimensions) = 1 Then
- Return $aarray[$iresult]
- Else
- Return $aarray[$iresult][$isubitem]
- EndIf
- EndFunc
- Func _arrayminindex(Const ByRef $aarray, $icompnumeric = 0, $istart = -1, $iend = -1, $isubitem = 0)
- If $icompnumeric = Default Then $icompnumeric = 0
- If $istart = Default Then $istart = -1
- If $iend = Default Then $iend = -1
- If $isubitem = Default Then $isubitem = 0
- Local $iret = __array_minmaxindex($aarray, $icompnumeric, $istart, $iend, $isubitem, __array_lessthan)
- Return SetError(@error, 0, $iret)
- EndFunc
- Func _arraypermute(ByRef $aarray, $sdelimiter = "")
- If $sdelimiter = Default Then $sdelimiter = ""
- If NOT IsArray($aarray) Then Return SetError(1, 0, 0)
- If UBound($aarray, $ubound_dimensions) <> 1 Then Return SetError(2, 0, 0)
- Local $isize = UBound($aarray), $ifactorial = 1, $aidx[$isize], $aresult[1], $icount = 1
- If UBound($aarray) Then
- For $i = 0 To $isize - 1
- $aidx[$i] = $i
- Next
- For $i = $isize To 1 Step -1
- $ifactorial *= $i
- Next
- ReDim $aresult[$ifactorial + 1]
- $aresult[0] = $ifactorial
- __array_exeterinternal($aarray, 0, $isize, $sdelimiter, $aidx, $aresult, $icount)
- Else
- $aresult[0] = 0
- EndIf
- Return $aresult
- EndFunc
- Func _arraypop(ByRef $aarray)
- If (NOT IsArray($aarray)) Then Return SetError(1, 0, "")
- If UBound($aarray, $ubound_dimensions) <> 1 Then Return SetError(2, 0, "")
- Local $iubound = UBound($aarray) - 1
- If $iubound = -1 Then Return SetError(3, 0, "")
- Local $slastval = $aarray[$iubound]
- If $iubound > -1 Then
- ReDim $aarray[$iubound]
- EndIf
- Return $slastval
- EndFunc
- Func _arraypush(ByRef $aarray, $vvalue, $idirection = 0)
- If $idirection = Default Then $idirection = 0
- If (NOT IsArray($aarray)) Then Return SetError(1, 0, 0)
- If UBound($aarray, $ubound_dimensions) <> 1 Then Return SetError(3, 0, 0)
- Local $iubound = UBound($aarray) - 1
- If IsArray($vvalue) Then
- Local $iubounds = UBound($vvalue)
- If ($iubounds - 1) > $iubound Then Return SetError(2, 0, 0)
- If $idirection Then
- For $i = $iubound To $iubounds Step -1
- $aarray[$i] = $aarray[$i - $iubounds]
- Next
- For $i = 0 To $iubounds - 1
- $aarray[$i] = $vvalue[$i]
- Next
- Else
- For $i = 0 To $iubound - $iubounds
- $aarray[$i] = $aarray[$i + $iubounds]
- Next
- For $i = 0 To $iubounds - 1
- $aarray[$i + $iubound - $iubounds + 1] = $vvalue[$i]
- Next
- EndIf
- Else
- If $iubound > -1 Then
- If $idirection Then
- For $i = $iubound To 1 Step -1
- $aarray[$i] = $aarray[$i - 1]
- Next
- $aarray[0] = $vvalue
- Else
- For $i = 0 To $iubound - 1
- $aarray[$i] = $aarray[$i + 1]
- Next
- $aarray[$iubound] = $vvalue
- EndIf
- EndIf
- EndIf
- Return 1
- EndFunc
- Func _arrayreverse(ByRef $aarray, $istart = 0, $iend = 0)
- If $istart = Default Then $istart = 0
- If $iend = Default Then $iend = 0
- If NOT IsArray($aarray) Then Return SetError(1, 0, 0)
- If UBound($aarray, $ubound_dimensions) <> 1 Then Return SetError(3, 0, 0)
- If NOT UBound($aarray) Then Return SetError(4, 0, 0)
- Local $vtmp, $iubound = UBound($aarray) - 1
- If $iend < 1 OR $iend > $iubound Then $iend = $iubound
- If $istart < 0 Then $istart = 0
- If $istart > $iend Then Return SetError(2, 0, 0)
- For $i = $istart To Int(($istart + $iend - 1) / 2)
- $vtmp = $aarray[$i]
- $aarray[$i] = $aarray[$iend]
- $aarray[$iend] = $vtmp
- $iend -= 1
- Next
- Return 1
- EndFunc
- Func _arraysearch(Const ByRef $aarray, $vvalue, $istart = 0, $iend = 0, $icase = 0, $icompare = 0, $iforward = 1, $isubitem = -1, $brow = False)
- If $istart = Default Then $istart = 0
- If $iend = Default Then $iend = 0
- If $icase = Default Then $icase = 0
- If $icompare = Default Then $icompare = 0
- If $iforward = Default Then $iforward = 1
- If $isubitem = Default Then $isubitem = -1
- If $brow = Default Then $brow = False
- If NOT IsArray($aarray) Then Return SetError(1, 0, -1)
- Local $idim_1 = UBound($aarray) - 1
- If $idim_1 = -1 Then Return SetError(3, 0, -1)
- Local $idim_2 = UBound($aarray, $ubound_columns) - 1
- Local $bcomptype = False
- If $icompare = 2 Then
- $icompare = 0
- $bcomptype = True
- EndIf
- If $brow Then
- If UBound($aarray, $ubound_dimensions) = 1 Then Return SetError(5, 0, -1)
- If $iend < 1 OR $iend > $idim_2 Then $iend = $idim_2
- If $istart < 0 Then $istart = 0
- If $istart > $iend Then Return SetError(4, 0, -1)
- Else
- If $iend < 1 OR $iend > $idim_1 Then $iend = $idim_1
- If $istart < 0 Then $istart = 0
- If $istart > $iend Then Return SetError(4, 0, -1)
- EndIf
- Local $istep = 1
- If NOT $iforward Then
- Local $itmp = $istart
- $istart = $iend
- $iend = $itmp
- $istep = -1
- EndIf
- Switch UBound($aarray, $ubound_dimensions)
- Case 1
- If NOT $icompare Then
- If NOT $icase Then
- For $i = $istart To $iend Step $istep
- If $bcomptype AND VarGetType($aarray[$i]) <> VarGetType($vvalue) Then ContinueLoop
- If $aarray[$i] = $vvalue Then Return $i
- Next
- Else
- For $i = $istart To $iend Step $istep
- If $bcomptype AND VarGetType($aarray[$i]) <> VarGetType($vvalue) Then ContinueLoop
- If $aarray[$i] == $vvalue Then Return $i
- Next
- EndIf
- Else
- For $i = $istart To $iend Step $istep
- If $icompare = 3 Then
- If StringRegExp($aarray[$i], $vvalue) Then Return $i
- Else
- If StringInStr($aarray[$i], $vvalue, $icase) > 0 Then Return $i
- EndIf
- Next
- EndIf
- Case 2
- Local $idim_sub
- If $brow Then
- $idim_sub = $idim_1
- If $isubitem > $idim_sub Then $isubitem = $idim_sub
- If $isubitem < 0 Then
- $isubitem = 0
- Else
- $idim_sub = $isubitem
- EndIf
- Else
- $idim_sub = $idim_2
- If $isubitem > $idim_sub Then $isubitem = $idim_sub
- If $isubitem < 0 Then
- $isubitem = 0
- Else
- $idim_sub = $isubitem
- EndIf
- EndIf
- For $j = $isubitem To $idim_sub
- If NOT $icompare Then
- If NOT $icase Then
- For $i = $istart To $iend Step $istep
- If $brow Then
- If $bcomptype AND VarGetType($aarray[$j][$j]) <> VarGetType($vvalue) Then ContinueLoop
- If $aarray[$j][$i] = $vvalue Then Return $i
- Else
- If $bcomptype AND VarGetType($aarray[$i][$j]) <> VarGetType($vvalue) Then ContinueLoop
- If $aarray[$i][$j] = $vvalue Then Return $i
- EndIf
- Next
- Else
- For $i = $istart To $iend Step $istep
- If $brow Then
- If $bcomptype AND VarGetType($aarray[$j][$i]) <> VarGetType($vvalue) Then ContinueLoop
- If $aarray[$j][$i] == $vvalue Then Return $i
- Else
- If $bcomptype AND VarGetType($aarray[$i][$j]) <> VarGetType($vvalue) Then ContinueLoop
- If $aarray[$i][$j] == $vvalue Then Return $i
- EndIf
- Next
- EndIf
- Else
- For $i = $istart To $iend Step $istep
- If $icompare = 3 Then
- If $brow Then
- If StringRegExp($aarray[$j][$i], $vvalue) Then Return $i
- Else
- If StringRegExp($aarray[$i][$j], $vvalue) Then Return $i
- EndIf
- Else
- If $brow Then
- If StringInStr($aarray[$j][$i], $vvalue, $icase) > 0 Then Return $i
- Else
- If StringInStr($aarray[$i][$j], $vvalue, $icase) > 0 Then Return $i
- EndIf
- EndIf
- Next
- EndIf
- Next
- Case Else
- Return SetError(2, 0, -1)
- EndSwitch
- Return SetError(6, 0, -1)
- EndFunc
- Func _arrayshuffle(ByRef $aarray, $istart_row = 0, $iend_row = 0, $icol = -1)
- If $istart_row = Default Then $istart_row = 0
- If $iend_row = Default Then $iend_row = 0
- If $icol = Default Then $icol = -1
- If NOT IsArray($aarray) Then Return SetError(1, 0, -1)
- Local $idim_1 = UBound($aarray, $ubound_rows)
- If $iend_row = 0 Then $iend_row = $idim_1 - 1
- If $istart_row < 0 OR $istart_row > $idim_1 - 1 Then Return SetError(3, 0, -1)
- If $iend_row < 1 OR $iend_row > $idim_1 - 1 Then Return SetError(3, 0, -1)
- If $istart_row > $iend_row Then Return SetError(4, 0, -1)
- Local $vtmp, $irand
- Switch UBound($aarray, $ubound_dimensions)
- Case 1
- For $i = $iend_row To $istart_row + 1 Step -1
- $irand = Random($istart_row, $i, 1)
- $vtmp = $aarray[$i]
- $aarray[$i] = $aarray[$irand]
- $aarray[$irand] = $vtmp
- Next
- Return 1
- Case 2
- Local $idim_2 = UBound($aarray, $ubound_columns)
- If $icol < -1 OR $icol > $idim_2 - 1 Then Return SetError(5, 0, -1)
- Local $icol_start, $icol_end
- If $icol = -1 Then
- $icol_start = 0
- $icol_end = $idim_2 - 1
- Else
- $icol_start = $icol
- $icol_end = $icol
- EndIf
- For $i = $iend_row To $istart_row + 1 Step -1
- $irand = Random($istart_row, $i, 1)
- For $j = $icol_start To $icol_end
- $vtmp = $aarray[$i][$j]
- $aarray[$i][$j] = $aarray[$irand][$j]
- $aarray[$irand][$j] = $vtmp
- Next
- Next
- Return 1
- Case Else
- Return SetError(2, 0, -1)
- EndSwitch
- EndFunc
- Func _arraysort(ByRef $aarray, $idescending = 0, $istart = 0, $iend = 0, $isubitem = 0, $ipivot = 0)
- If $idescending = Default Then $idescending = 0
- If $istart = Default Then $istart = 0
- If $iend = Default Then $iend = 0
- If $isubitem = Default Then $isubitem = 0
- If $ipivot = Default Then $ipivot = 0
- If NOT IsArray($aarray) Then Return SetError(1, 0, 0)
- Local $iubound = UBound($aarray) - 1
- If $iubound = -1 Then Return SetError(5, 0, 0)
- If $iend = Default Then $iend = 0
- If $iend < 1 OR $iend > $iubound OR $iend = Default Then $iend = $iubound
- If $istart < 0 OR $istart = Default Then $istart = 0
- If $istart > $iend Then Return SetError(2, 0, 0)
- If $idescending = Default Then $idescending = 0
- If $ipivot = Default Then $ipivot = 0
- If $isubitem = Default Then $isubitem = 0
- Switch UBound($aarray, $ubound_dimensions)
- Case 1
- If $ipivot Then
- __arraydualpivotsort($aarray, $istart, $iend)
- Else
- __arrayquicksort1d($aarray, $istart, $iend)
- EndIf
- If $idescending Then _arrayreverse($aarray, $istart, $iend)
- Case 2
- If $ipivot Then Return SetError(6, 0, 0)
- Local $isubmax = UBound($aarray, $ubound_columns) - 1
- If $isubitem > $isubmax Then Return SetError(3, 0, 0)
- If $idescending Then
- $idescending = -1
- Else
- $idescending = 1
- EndIf
- __arrayquicksort2d($aarray, $idescending, $istart, $iend, $isubitem, $isubmax)
- Case Else
- Return SetError(4, 0, 0)
- EndSwitch
- Return 1
- EndFunc
- Func __arrayquicksort1d(ByRef $aarray, Const ByRef $istart, Const ByRef $iend)
- If $iend <= $istart Then Return
- Local $vtmp
- If ($iend - $istart) < 15 Then
- Local $vcur
- For $i = $istart + 1 To $iend
- $vtmp = $aarray[$i]
- If IsNumber($vtmp) Then
- For $j = $i - 1 To $istart Step -1
- $vcur = $aarray[$j]
- If ($vtmp >= $vcur AND IsNumber($vcur)) OR (NOT IsNumber($vcur) AND StringCompare($vtmp, $vcur) >= 0) Then ExitLoop
- $aarray[$j + 1] = $vcur
- Next
- Else
- For $j = $i - 1 To $istart Step -1
- If (StringCompare($vtmp, $aarray[$j]) >= 0) Then ExitLoop
- $aarray[$j + 1] = $aarray[$j]
- Next
- EndIf
- $aarray[$j + 1] = $vtmp
- Next
- Return
- EndIf
- Local $l = $istart, $r = $iend, $vpivot = $aarray[Int(($istart + $iend) / 2)], $bnum = IsNumber($vpivot)
- Do
- If $bnum Then
- While ($aarray[$l] < $vpivot AND IsNumber($aarray[$l])) OR (NOT IsNumber($aarray[$l]) AND StringCompare($aarray[$l], $vpivot) < 0)
- $l += 1
- WEnd
- While ($aarray[$r] > $vpivot AND IsNumber($aarray[$r])) OR (NOT IsNumber($aarray[$r]) AND StringCompare($aarray[$r], $vpivot) > 0)
- $r -= 1
- WEnd
- Else
- While (StringCompare($aarray[$l], $vpivot) < 0)
- $l += 1
- WEnd
- While (StringCompare($aarray[$r], $vpivot) > 0)
- $r -= 1
- WEnd
- EndIf
- If $l <= $r Then
- $vtmp = $aarray[$l]
- $aarray[$l] = $aarray[$r]
- $aarray[$r] = $vtmp
- $l += 1
- $r -= 1
- EndIf
- Until $l > $r
- __arrayquicksort1d($aarray, $istart, $r)
- __arrayquicksort1d($aarray, $l, $iend)
- EndFunc
- Func __arrayquicksort2d(ByRef $aarray, Const ByRef $istep, Const ByRef $istart, Const ByRef $iend, Const ByRef $isubitem, Const ByRef $isubmax)
- If $iend <= $istart Then Return
- Local $vtmp, $l = $istart, $r = $iend, $vpivot = $aarray[Int(($istart + $iend) / 2)][$isubitem], $bnum = IsNumber($vpivot)
- Do
- If $bnum Then
- 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)
- $l += 1
- WEnd
- 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)
- $r -= 1
- WEnd
- Else
- While ($istep * StringCompare($aarray[$l][$isubitem], $vpivot) < 0)
- $l += 1
- WEnd
- While ($istep * StringCompare($aarray[$r][$isubitem], $vpivot) > 0)
- $r -= 1
- WEnd
- EndIf
- If $l <= $r Then
- For $i = 0 To $isubmax
- $vtmp = $aarray[$l][$i]
- $aarray[$l][$i] = $aarray[$r][$i]
- $aarray[$r][$i] = $vtmp
- Next
- $l += 1
- $r -= 1
- EndIf
- Until $l > $r
- __arrayquicksort2d($aarray, $istep, $istart, $r, $isubitem, $isubmax)
- __arrayquicksort2d($aarray, $istep, $l, $iend, $isubitem, $isubmax)
- EndFunc
- Func __arraydualpivotsort(ByRef $aarray, $ipivot_left, $ipivot_right, $bleftmost = True)
- If $ipivot_left > $ipivot_right Then Return
- Local $ilength = $ipivot_right - $ipivot_left + 1
- Local $i, $j, $k, $iai, $iak, $ia1, $ia2, $ilast
- If $ilength < 45 Then
- If $bleftmost Then
- $i = $ipivot_left
- While $i < $ipivot_right
- $j = $i
- $iai = $aarray[$i + 1]
- While $iai < $aarray[$j]
- $aarray[$j + 1] = $aarray[$j]
- $j -= 1
- If $j + 1 = $ipivot_left Then ExitLoop
- WEnd
- $aarray[$j + 1] = $iai
- $i += 1
- WEnd
- Else
- While 1
- If $ipivot_left >= $ipivot_right Then Return 1
- $ipivot_left += 1
- If $aarray[$ipivot_left] < $aarray[$ipivot_left - 1] Then ExitLoop
- WEnd
- While 1
- $k = $ipivot_left
- $ipivot_left += 1
- If $ipivot_left > $ipivot_right Then ExitLoop
- $ia1 = $aarray[$k]
- $ia2 = $aarray[$ipivot_left]
- If $ia1 < $ia2 Then
- $ia2 = $ia1
- $ia1 = $aarray[$ipivot_left]
- EndIf
- $k -= 1
- While $ia1 < $aarray[$k]
- $aarray[$k + 2] = $aarray[$k]
- $k -= 1
- WEnd
- $aarray[$k + 2] = $ia1
- While $ia2 < $aarray[$k]
- $aarray[$k + 1] = $aarray[$k]
- $k -= 1
- WEnd
- $aarray[$k + 1] = $ia2
- $ipivot_left += 1
- WEnd
- $ilast = $aarray[$ipivot_right]
- $ipivot_right -= 1
- While $ilast < $aarray[$ipivot_right]
- $aarray[$ipivot_right + 1] = $aarray[$ipivot_right]
- $ipivot_right -= 1
- WEnd
- $aarray[$ipivot_right + 1] = $ilast
- EndIf
- Return 1
- EndIf
- Local $iseventh = BitShift($ilength, 3) + BitShift($ilength, 6) + 1
- Local $ie1, $ie2, $ie3, $ie4, $ie5, $t
- $ie3 = Ceiling(($ipivot_left + $ipivot_right) / 2)
- $ie2 = $ie3 - $iseventh
- $ie1 = $ie2 - $iseventh
- $ie4 = $ie3 + $iseventh
- $ie5 = $ie4 + $iseventh
- If $aarray[$ie2] < $aarray[$ie1] Then
- $t = $aarray[$ie2]
- $aarray[$ie2] = $aarray[$ie1]
- $aarray[$ie1] = $t
- EndIf
- If $aarray[$ie3] < $aarray[$ie2] Then
- $t = $aarray[$ie3]
- $aarray[$ie3] = $aarray[$ie2]
- $aarray[$ie2] = $t
- If $t < $aarray[$ie1] Then
- $aarray[$ie2] = $aarray[$ie1]
- $aarray[$ie1] = $t
- EndIf
- EndIf
- If $aarray[$ie4] < $aarray[$ie3] Then
- $t = $aarray[$ie4]
- $aarray[$ie4] = $aarray[$ie3]
- $aarray[$ie3] = $t
- If $t < $aarray[$ie2] Then
- $aarray[$ie3] = $aarray[$ie2]
- $aarray[$ie2] = $t
- If $t < $aarray[$ie1] Then
- $aarray[$ie2] = $aarray[$ie1]
- $aarray[$ie1] = $t
- EndIf
- EndIf
- EndIf
- If $aarray[$ie5] < $aarray[$ie4] Then
- $t = $aarray[$ie5]
- $aarray[$ie5] = $aarray[$ie4]
- $aarray[$ie4] = $t
- If $t < $aarray[$ie3] Then
- $aarray[$ie4] = $aarray[$ie3]
- $aarray[$ie3] = $t
- If $t < $aarray[$ie2] Then
- $aarray[$ie3] = $aarray[$ie2]
- $aarray[$ie2] = $t
- If $t < $aarray[$ie1] Then
- $aarray[$ie2] = $aarray[$ie1]
- $aarray[$ie1] = $t
- EndIf
- EndIf
- EndIf
- EndIf
- Local $iless = $ipivot_left
- Local $igreater = $ipivot_right
- If (($aarray[$ie1] <> $aarray[$ie2]) AND ($aarray[$ie2] <> $aarray[$ie3]) AND ($aarray[$ie3] <> $aarray[$ie4]) AND ($aarray[$ie4] <> $aarray[$ie5])) Then
- Local $ipivot_1 = $aarray[$ie2]
- Local $ipivot_2 = $aarray[$ie4]
- $aarray[$ie2] = $aarray[$ipivot_left]
- $aarray[$ie4] = $aarray[$ipivot_right]
- Do
- $iless += 1
- Until $aarray[$iless] >= $ipivot_1
- Do
- $igreater -= 1
- Until $aarray[$igreater] <= $ipivot_2
- $k = $iless
- While $k <= $igreater
- $iak = $aarray[$k]
- If $iak < $ipivot_1 Then
- $aarray[$k] = $aarray[$iless]
- $aarray[$iless] = $iak
- $iless += 1
- ElseIf $iak > $ipivot_2 Then
- While $aarray[$igreater] > $ipivot_2
- $igreater -= 1
- If $igreater + 1 = $k Then ExitLoop 2
- WEnd
- If $aarray[$igreater] < $ipivot_1 Then
- $aarray[$k] = $aarray[$iless]
- $aarray[$iless] = $aarray[$igreater]
- $iless += 1
- Else
- $aarray[$k] = $aarray[$igreater]
- EndIf
- $aarray[$igreater] = $iak
- $igreater -= 1
- EndIf
- $k += 1
- WEnd
- $aarray[$ipivot_left] = $aarray[$iless - 1]
- $aarray[$iless - 1] = $ipivot_1
- $aarray[$ipivot_right] = $aarray[$igreater + 1]
- $aarray[$igreater + 1] = $ipivot_2
- __arraydualpivotsort($aarray, $ipivot_left, $iless - 2, True)
- __arraydualpivotsort($aarray, $igreater + 2, $ipivot_right, False)
- If ($iless < $ie1) AND ($ie5 < $igreater) Then
- While $aarray[$iless] = $ipivot_1
- $iless += 1
- WEnd
- While $aarray[$igreater] = $ipivot_2
- $igreater -= 1
- WEnd
- $k = $iless
- While $k <= $igreater
- $iak = $aarray[$k]
- If $iak = $ipivot_1 Then
- $aarray[$k] = $aarray[$iless]
- $aarray[$iless] = $iak
- $iless += 1
- ElseIf $iak = $ipivot_2 Then
- While $aarray[$igreater] = $ipivot_2
- $igreater -= 1
- If $igreater + 1 = $k Then ExitLoop 2
- WEnd
- If $aarray[$igreater] = $ipivot_1 Then
- $aarray[$k] = $aarray[$iless]
- $aarray[$iless] = $ipivot_1
- $iless += 1
- Else
- $aarray[$k] = $aarray[$igreater]
- EndIf
- $aarray[$igreater] = $iak
- $igreater -= 1
- EndIf
- $k += 1
- WEnd
- EndIf
- __arraydualpivotsort($aarray, $iless, $igreater, False)
- Else
- Local $ipivot = $aarray[$ie3]
- $k = $iless
- While $k <= $igreater
- If $aarray[$k] = $ipivot Then
- $k += 1
- ContinueLoop
- EndIf
- $iak = $aarray[$k]
- If $iak < $ipivot Then
- $aarray[$k] = $aarray[$iless]
- $aarray[$iless] = $iak
- $iless += 1
- Else
- While $aarray[$igreater] > $ipivot
- $igreater -= 1
- WEnd
- If $aarray[$igreater] < $ipivot Then
- $aarray[$k] = $aarray[$iless]
- $aarray[$iless] = $aarray[$igreater]
- $iless += 1
- Else
- $aarray[$k] = $ipivot
- EndIf
- $aarray[$igreater] = $iak
- $igreater -= 1
- EndIf
- $k += 1
- WEnd
- __arraydualpivotsort($aarray, $ipivot_left, $iless - 1, True)
- __arraydualpivotsort($aarray, $igreater + 1, $ipivot_right, False)
- EndIf
- EndFunc
- Func _arrayswap(ByRef $aarray, $iindex_1, $iindex_2, $bcol = False, $istart = -1, $iend = -1)
- If $bcol = Default Then $bcol = False
- If $istart = Default Then $istart = -1
- If $iend = Default Then $iend = -1
- If NOT IsArray($aarray) Then Return SetError(1, 0, -1)
- Local $idim_1 = UBound($aarray, $ubound_rows) - 1
- Local $idim_2 = UBound($aarray, $ubound_columns) - 1
- If $idim_2 = -1 Then
- $bcol = False
- $istart = -1
- $iend = -1
- EndIf
- If $istart > $iend Then Return SetError(5, 0, -1)
- If $bcol Then
- If $iindex_1 < 0 OR $iindex_2 > $idim_2 Then Return SetError(3, 0, -1)
- If $istart = -1 Then $istart = 0
- If $iend = -1 Then $iend = $idim_1
- Else
- If $iindex_1 < 0 OR $iindex_2 > $idim_1 Then Return SetError(3, 0, -1)
- If $istart = -1 Then $istart = 0
- If $iend = -1 Then $iend = $idim_2
- EndIf
- Local $vtmp
- Switch UBound($aarray, $ubound_dimensions)
- Case 1
- $vtmp = $aarray[$iindex_1]
- $aarray[$iindex_1] = $aarray[$iindex_2]
- $aarray[$iindex_2] = $vtmp
- Case 2
- If $istart < -1 OR $iend < -1 Then Return SetError(4, 0, -1)
- If $bcol Then
- If $istart > $idim_1 OR $iend > $idim_1 Then Return SetError(4, 0, -1)
- For $j = $istart To $iend
- $vtmp = $aarray[$j][$iindex_1]
- $aarray[$j][$iindex_1] = $aarray[$j][$iindex_2]
- $aarray[$j][$iindex_2] = $vtmp
- Next
- Else
- If $istart > $idim_2 OR $iend > $idim_2 Then Return SetError(4, 0, -1)
- For $j = $istart To $iend
- $vtmp = $aarray[$iindex_1][$j]
- $aarray[$iindex_1][$j] = $aarray[$iindex_2][$j]
- $aarray[$iindex_2][$j] = $vtmp
- Next
- EndIf
- Case Else
- Return SetError(2, 0, -1)
- EndSwitch
- Return 1
- EndFunc
- Func _arraytoclip(Const ByRef $aarray, $sdelim_col = "|", $istart_row = -1, $iend_row = -1, $sdelim_row = @CRLF, $istart_col = -1, $iend_col = -1)
- Local $sresult = _arraytostring($aarray, $sdelim_col, $istart_row, $iend_row, $sdelim_row, $istart_col, $iend_col)
- If @error Then Return SetError(@error, 0, 0)
- If ClipPut($sresult) Then Return 1
- Return SetError(-1, 0, 0)
- EndFunc
- Func _arraytostring(Const ByRef $aarray, $sdelim_col = "|", $istart_row = -1, $iend_row = -1, $sdelim_row = @CRLF, $istart_col = -1, $iend_col = -1)
- If $sdelim_col = Default Then $sdelim_col = "|"
- If $sdelim_row = Default Then $sdelim_row = @CRLF
- If $istart_row = Default Then $istart_row = -1
- If $iend_row = Default Then $iend_row = -1
- If $istart_col = Default Then $istart_col = -1
- If $iend_col = Default Then $iend_col = -1
- If NOT IsArray($aarray) Then Return SetError(1, 0, -1)
- Local $idim_1 = UBound($aarray, $ubound_rows) - 1
- If $istart_row = -1 Then $istart_row = 0
- If $iend_row = -1 Then $iend_row = $idim_1
- If $istart_row < -1 OR $iend_row < -1 Then Return SetError(3, 0, -1)
- If $istart_row > $idim_1 OR $iend_row > $idim_1 Then Return SetError(3, 0, "")
- If $istart_row > $iend_row Then Return SetError(4, 0, -1)
- Local $sret = ""
- Switch UBound($aarray, $ubound_dimensions)
- Case 1
- For $i = $istart_row To $iend_row
- $sret &= $aarray[$i] & $sdelim_col
- Next
- Return StringTrimRight($sret, StringLen($sdelim_col))
- Case 2
- Local $idim_2 = UBound($aarray, $ubound_columns) - 1
- If $istart_col = -1 Then $istart_col = 0
- If $iend_col = -1 Then $iend_col = $idim_2
- If $istart_col < -1 OR $iend_col < -1 Then Return SetError(5, 0, -1)
- If $istart_col > $idim_2 OR $iend_col > $idim_2 Then Return SetError(5, 0, -1)
- If $istart_col > $iend_col Then Return SetError(6, 0, -1)
- For $i = $istart_row To $iend_row
- For $j = $istart_col To $iend_col
- $sret &= $aarray[$i][$j] & $sdelim_col
- Next
- $sret = StringTrimRight($sret, StringLen($sdelim_col)) & $sdelim_row
- Next
- Return StringTrimRight($sret, StringLen($sdelim_row))
- Case Else
- Return SetError(2, 0, -1)
- EndSwitch
- Return 1
- EndFunc
- Func _arraytranspose(ByRef $aarray)
- Switch UBound($aarray, 0)
- Case 0
- Return SetError(2, 0, 0)
- Case 1
- Local $atemp[1][UBound($aarray)]
- For $i = 0 To UBound($aarray) - 1
- $atemp[0][$i] = $aarray[$i]
- Next
- $aarray = $atemp
- Case 2
- Local $idim_1 = UBound($aarray, 1), $idim_2 = UBound($aarray, 2)
- If $idim_1 <> $idim_2 Then
- Local $atemp[$idim_2][$idim_1]
- For $i = 0 To $idim_1 - 1
- For $j = 0 To $idim_2 - 1
- $atemp[$j][$i] = $aarray[$i][$j]
- Next
- Next
- $aarray = $atemp
- Else
- Local $velement
- For $i = 0 To $idim_1 - 1
- For $j = $i + 1 To $idim_2 - 1
- $velement = $aarray[$i][$j]
- $aarray[$i][$j] = $aarray[$j][$i]
- $aarray[$j][$i] = $velement
- Next
- Next
- EndIf
- Case Else
- Return SetError(1, 0, 0)
- EndSwitch
- Return 1
- EndFunc
- Func _arraytrim(ByRef $aarray, $itrimnum, $idirection = 0, $istart = 0, $iend = 0, $isubitem = 0)
- If $idirection = Default Then $idirection = 0
- If $istart = Default Then $istart = 0
- If $iend = Default Then $iend = 0
- If $isubitem = Default Then $isubitem = 0
- If NOT IsArray($aarray) Then Return SetError(1, 0, 0)
- Local $idim_1 = UBound($aarray, $ubound_rows) - 1
- If $iend = 0 Then $iend = $idim_1
- If $istart > $iend Then Return SetError(3, 0, -1)
- If $istart < 0 OR $iend < 0 Then Return SetError(3, 0, -1)
- If $istart > $idim_1 OR $iend > $idim_1 Then Return SetError(3, 0, -1)
- If $istart > $iend Then Return SetError(4, 0, -1)
- Switch UBound($aarray, $ubound_dimensions)
- Case 1
- If $idirection Then
- For $i = $istart To $iend
- $aarray[$i] = StringTrimRight($aarray[$i], $itrimnum)
- Next
- Else
- For $i = $istart To $iend
- $aarray[$i] = StringTrimLeft($aarray[$i], $itrimnum)
- Next
- EndIf
- Case 2
- Local $idim_2 = UBound($aarray, $ubound_columns) - 1
- If $isubitem < 0 OR $isubitem > $idim_2 Then Return SetError(5, 0, -1)
- If $idirection Then
- For $i = $istart To $iend
- $aarray[$i][$isubitem] = StringTrimRight($aarray[$i][$isubitem], $itrimnum)
- Next
- Else
- For $i = $istart To $iend
- $aarray[$i][$isubitem] = StringTrimLeft($aarray[$i][$isubitem], $itrimnum)
- Next
- EndIf
- Case Else
- Return SetError(2, 0, 0)
- EndSwitch
- Return 1
- EndFunc
- Func _arrayunique(Const ByRef $aarray, $icolumn = 0, $ibase = 0, $icase = 0, $icount = $arrayunique_count, $iinttype = $arrayunique_auto)
- If $icolumn = Default Then $icolumn = 0
- If $ibase = Default Then $ibase = 0
- If $icase = Default Then $icase = 0
- If $icount = Default Then $icount = $arrayunique_count
- If UBound($aarray, $ubound_rows) = 0 Then Return SetError(1, 0, 0)
- Local $idims = UBound($aarray, $ubound_dimensions), $inumcolumns = UBound($aarray, $ubound_columns)
- If $idims > 2 Then Return SetError(2, 0, 0)
- If $ibase < 0 OR $ibase > 1 OR (NOT IsInt($ibase)) Then Return SetError(3, 0, 0)
- If $icase < 0 OR $icase > 1 OR (NOT IsInt($icase)) Then Return SetError(3, 0, 0)
- If $icount < 0 OR $icount > 1 OR (NOT IsInt($icount)) Then Return SetError(4, 0, 0)
- If $iinttype < 0 OR $iinttype > 4 OR (NOT IsInt($iinttype)) Then Return SetError(5, 0, 0)
- If $icolumn < 0 OR ($inumcolumns = 0 AND $icolumn > 0) OR ($inumcolumns > 0 AND $icolumn >= $inumcolumns) Then Return SetError(6, 0, 0)
- If $iinttype = $arrayunique_auto Then
- Local $vfirstelem = (($idims = 1) ? ($aarray[$ibase]) : ($aarray[$icolumn][$ibase]))
- If IsInt($vfirstelem) Then
- Switch VarGetType($vfirstelem)
- Case "Int32"
- $iinttype = $arrayunique_force32
- Case "Int64"
- $iinttype = $arrayunique_force64
- EndSwitch
- Else
- $iinttype = $arrayunique_force32
- EndIf
- EndIf
- ObjEvent("AutoIt.Error", "__ArrayUnique_AutoErrFunc")
- Local $odictionary = ObjCreate("Scripting.Dictionary")
- $odictionary.comparemode = Number(NOT $icase)
- Local $velem, $stype, $vkey, $bcomerror = False
- For $i = $ibase To UBound($aarray) - 1
- If $idims = 1 Then
- $velem = $aarray[$i]
- Else
- $velem = $aarray[$i][$icolumn]
- EndIf
- Switch $iinttype
- Case $arrayunique_force32
- $odictionary.item($velem)
- If @error Then
- $bcomerror = True
- ExitLoop
- EndIf
- Case $arrayunique_force64
- $stype = VarGetType($velem)
- If $stype = "Int32" Then
- $bcomerror = True
- ExitLoop
- EndIf
- $vkey = "#" & $stype & "#" & String($velem)
- If NOT $odictionary.item($vkey) Then
- $odictionary($vkey) = $velem
- EndIf
- Case $arrayunique_match
- $stype = VarGetType($velem)
- If StringLeft($stype, 3) = "Int" Then
- $vkey = "#Int#" & String($velem)
- Else
- $vkey = "#" & $stype & "#" & String($velem)
- EndIf
- If NOT $odictionary.item($vkey) Then
- $odictionary($vkey) = $velem
- EndIf
- Case $arrayunique_distinct
- $vkey = "#" & VarGetType($velem) & "#" & String($velem)
- If NOT $odictionary.item($vkey) Then
- $odictionary($vkey) = $velem
- EndIf
- EndSwitch
- Next
- Local $avalues, $j = 0
- If $bcomerror Then
- Return SetError(7, 0, 0)
- ElseIf $iinttype <> $arrayunique_force32 Then
- Local $avalues[$odictionary.count]
- For $vkey In $odictionary.keys()
- $avalues[$j] = $odictionary($vkey)
- If StringLeft($vkey, 5) = "#Ptr#" Then
- $avalues[$j] = Ptr($avalues[$j])
- EndIf
- $j += 1
- Next
- Else
- $avalues = $odictionary.keys()
- EndIf
- If $icount Then
- _arrayinsert($avalues, 0, $odictionary.count)
- EndIf
- Return $avalues
- EndFunc
- Func _array1dtohistogram($aarray, $isizing = 100)
- If UBound($aarray, 0) > 1 Then Return SetError(1, 0, "")
- $isizing = $isizing * 8
- Local $t, $n, $imin = 0, $imax = 0, $ioffset = 0
- For $i = 0 To UBound($aarray) - 1
- $t = $aarray[$i]
- $t = IsNumber($t) ? Round($t) : 0
- If $t < $imin Then $imin = $t
- If $t > $imax Then $imax = $t
- Next
- Local $irange = Int(Round(($imax - $imin) / 8)) * 8
- Local $ispaceratio = 4
- For $i = 0 To UBound($aarray) - 1
- $t = $aarray[$i]
- If $t Then
- $n = Abs(Round(($isizing * $t) / $irange) / 8)
- $aarray[$i] = ""
- If $t > 0 Then
- If $imin Then
- $ioffset = Int(Abs(Round(($isizing * $imin) / $irange) / 8) / 8 * $ispaceratio)
- $aarray[$i] = __array_stringrepeat(ChrW(32), $ioffset)
- EndIf
- Else
- If $imin <> $t Then
- $ioffset = Int(Abs(Round(($isizing * ($t - $imin)) / $irange) / 8) / 8 * $ispaceratio)
- $aarray[$i] = __array_stringrepeat(ChrW(32), $ioffset)
- EndIf
- EndIf
- $aarray[$i] &= __array_stringrepeat(ChrW(9608), Int($n / 8))
- $n = Mod($n, 8)
- If $n > 0 Then $aarray[$i] &= ChrW(9608 + 8 - $n)
- $aarray[$i] &= " " & $t
- Else
- $aarray[$i] = ""
- EndIf
- Next
- Return $aarray
- EndFunc
- Func __array_stringrepeat($sstring, $irepeatcount)
- $irepeatcount = Int($irepeatcount)
- If StringLen($sstring) < 1 OR $irepeatcount <= 0 Then Return SetError(1, 0, "")
- Local $sresult = ""
- While $irepeatcount > 1
- If BitAND($irepeatcount, 1) Then $sresult &= $sstring
- $sstring &= $sstring
- $irepeatcount = BitShift($irepeatcount, 1)
- WEnd
- Return $sstring & $sresult
- EndFunc
- Func __array_exeterinternal(ByRef $aarray, $istart, $isize, $sdelimiter, ByRef $aidx, ByRef $aresult, ByRef $icount)
- If $istart == $isize - 1 Then
- For $i = 0 To $isize - 1
- $aresult[$icount] &= $aarray[$aidx[$i]] & $sdelimiter
- Next
- If $sdelimiter <> "" Then $aresult[$icount] = StringTrimRight($aresult[$icount], StringLen($sdelimiter))
- $icount += 1
- Else
- Local $itemp
- For $i = $istart To $isize - 1
- $itemp = $aidx[$i]
- $aidx[$i] = $aidx[$istart]
- $aidx[$istart] = $itemp
- __array_exeterinternal($aarray, $istart + 1, $isize, $sdelimiter, $aidx, $aresult, $icount)
- $aidx[$istart] = $aidx[$i]
- $aidx[$i] = $itemp
- Next
- EndIf
- EndFunc
- Func __array_combinations($in, $ir)
- Local $i_total = 1
- For $i = $ir To 1 Step -1
- $i_total *= ($in / $i)
- $in -= 1
- Next
- Return Round($i_total)
- EndFunc
- Func __array_getnext($in, $ir, ByRef $ileft, $itotal, ByRef $aidx)
- If $ileft == $itotal Then
- $ileft -= 1
- Return
- EndIf
- Local $i = $ir - 1
- While $aidx[$i] == $in - $ir + $i
- $i -= 1
- WEnd
- $aidx[$i] += 1
- For $j = $i + 1 To $ir - 1
- $aidx[$j] = $aidx[$i] + $j - $i
- Next
- $ileft -= 1
- EndFunc
- Func __array_minmaxindex(Const ByRef $aarray, $icompnumeric, $istart, $iend, $isubitem, $fucomparison)
- If $icompnumeric = Default Then $icompnumeric = 0
- If $icompnumeric <> 1 Then $icompnumeric = 0
- If $istart = Default Then $istart = 0
- If $iend = Default Then $iend = 0
- If $isubitem = Default Then $isubitem = 0
- If NOT IsArray($aarray) Then Return SetError(1, 0, -1)
- Local $idim_1 = UBound($aarray, $ubound_rows) - 1
- If $idim_1 < 0 Then Return SetError(1, 0, -1)
- If $iend = -1 Then $iend = $idim_1
- If $istart = -1 Then $istart = 0
- If $istart < -1 OR $iend < -1 Then Return SetError(3, 0, -1)
- If $istart > $idim_1 OR $iend > $idim_1 Then Return SetError(3, 0, -1)
- If $istart > $iend Then Return SetError(4, 0, -1)
- If $idim_1 < 0 Then Return SetError(5, 0, -1)
- Local $imaxminindex = $istart
- Switch UBound($aarray, $ubound_dimensions)
- Case 1
- If $icompnumeric Then
- For $i = $istart To $iend
- If $fucomparison(Number($aarray[$i]), Number($aarray[$imaxminindex])) Then $imaxminindex = $i
- Next
- Else
- For $i = $istart To $iend
- If $fucomparison($aarray[$i], $aarray[$imaxminindex]) Then $imaxminindex = $i
- Next
- EndIf
- Case 2
- If $isubitem < 0 OR $isubitem > UBound($aarray, $ubound_columns) - 1 Then Return SetError(6, 0, -1)
- If $icompnumeric Then
- For $i = $istart To $iend
- If $fucomparison(Number($aarray[$i][$isubitem]), Number($aarray[$imaxminindex][$isubitem])) Then $imaxminindex = $i
- Next
- Else
- For $i = $istart To $iend
- If $fucomparison($aarray[$i][$isubitem], $aarray[$imaxminindex][$isubitem]) Then $imaxminindex = $i
- Next
- EndIf
- Case Else
- Return SetError(2, 0, -1)
- EndSwitch
- Return $imaxminindex
- EndFunc
- Func __array_greaterthan($vvalue1, $vvalue2)
- Return $vvalue1 > $vvalue2
- EndFunc
- Func __array_lessthan($vvalue1, $vvalue2)
- Return $vvalue1 < $vvalue2
- EndFunc
- Func __arrayunique_autoerrfunc()
- EndFunc
- Global Const $fc_nooverwrite = 0
- Global Const $fc_overwrite = 1
- Global Const $fc_createpath = 8
- Global Const $ft_modified = 0
- Global Const $ft_created = 1
- Global Const $ft_accessed = 2
- Global Const $ft_array = 0
- Global Const $ft_string = 1
- Global Const $fsf_createbutton = 1
- Global Const $fsf_newdialog = 2
- Global Const $fsf_editcontrol = 4
- Global Const $ft_nonrecursive = 0
- Global Const $ft_recursive = 1
- Global Const $fo_read = 0
- Global Const $fo_append = 1
- Global Const $fo_overwrite = 2
- Global Const $fo_createpath = 8
- Global Const $fo_binary = 16
- Global Const $fo_unicode = 32
- Global Const $fo_utf16_le = 32
- Global Const $fo_utf16_be = 64
- Global Const $fo_utf8 = 128
- Global Const $fo_utf8_nobom = 256
- Global Const $fo_ansi = 512
- Global Const $fo_utf16_le_nobom = 1024
- Global Const $fo_utf16_be_nobom = 2048
- Global Const $fo_utf8_full = 16384
- Global Const $fo_fullfile_detect = 16384
- Global Const $eof = -1
- Global Const $fd_filemustexist = 1
- Global Const $fd_pathmustexist = 2
- Global Const $fd_multiselect = 4
- Global Const $fd_promptcreatenew = 8
- Global Const $fd_promptoverwrite = 16
- Global Const $create_new = 1
- Global Const $create_always = 2
- Global Const $open_existing = 3
- Global Const $open_always = 4
- Global Const $truncate_existing = 5
- Global Const $invalid_set_file_pointer = -1
- Global Const $file_begin = 0
- Global Const $file_current = 1
- Global Const $file_end = 2
- Global Const $file_attribute_readonly = 1
- Global Const $file_attribute_hidden = 2
- Global Const $file_attribute_system = 4
- Global Const $file_attribute_directory = 16
- Global Const $file_attribute_archive = 32
- Global Const $file_attribute_device = 64
- Global Const $file_attribute_normal = 128
- Global Const $file_attribute_temporary = 256
- Global Const $file_attribute_sparse_file = 512
- Global Const $file_attribute_reparse_point = 1024
- Global Const $file_attribute_compressed = 2048
- Global Const $file_attribute_offline = 4096
- Global Const $file_attribute_not_content_indexed = 8192
- Global Const $file_attribute_encrypted = 16384
- Global Const $file_share_read = 1
- Global Const $file_share_write = 2
- Global Const $file_share_delete = 4
- Global Const $file_share_readwrite = BitOR($file_share_read, $file_share_write)
- Global Const $file_share_any = BitOR($file_share_read, $file_share_write, $file_share_delete)
- Global Const $generic_all = 268435456
- Global Const $generic_execute = 536870912
- Global Const $generic_write = 1073741824
- Global Const $generic_read = -2147483648
- Global Const $generic_readwrite = BitOR($generic_read, $generic_write)
- Global Const $file_encoding_utf16le = 32
- Global Const $fe_entire_utf8 = 1
- Global Const $fe_partialfirst_utf8 = 2
- Global Const $fn_fullpath = 0
- Global Const $fn_relativepath = 1
- Global Const $fv_comments = "Comments"
- Global Const $fv_companyname = "CompanyName"
- Global Const $fv_filedescription = "FileDescription"
- Global Const $fv_fileversion = "FileVersion"
- Global Const $fv_internalname = "InternalName"
- Global Const $fv_legalcopyright = "LegalCopyright"
- Global Const $fv_legaltrademarks = "LegalTrademarks"
- Global Const $fv_originalfilename = "OriginalFilename"
- Global Const $fv_productname = "ProductName"
- Global Const $fv_productversion = "ProductVersion"
- Global Const $fv_privatebuild = "PrivateBuild"
- Global Const $fv_specialbuild = "SpecialBuild"
- Global Const $frta_nocount = 0
- Global Const $frta_count = 1
- Global Const $frta_intarrays = 2
- Global Const $frta_entiresplit = 4
- Global Const $flta_filesfolders = 0
- Global Const $flta_files = 1
- Global Const $flta_folders = 2
- Global Const $fltar_filesfolders = 0
- Global Const $fltar_files = 1
- Global Const $fltar_folders = 2
- Global Const $fltar_nohidden = 4
- Global Const $fltar_nosystem = 8
- Global Const $fltar_nolink = 16
- Global Const $fltar_norecur = 0
- Global Const $fltar_recur = 1
- Global Const $fltar_nosort = 0
- Global Const $fltar_sort = 1
- Global Const $fltar_fastsort = 2
- Global Const $fltar_nopath = 0
- Global Const $fltar_relpath = 1
- Global Const $fltar_fullpath = 2
- Func _filecountlines($sfilepath)
- Local $hfileopen = FileOpen($sfilepath, $fo_read)
- If $hfileopen = -1 Then Return SetError(1, 0, 0)
- Local $sfileread = StringStripWS(FileRead($hfileopen), $str_striptrailing)
- FileClose($hfileopen)
- Return UBound(StringRegExp($sfileread, "\R", $str_regexparrayglobalmatch)) + 1 - Int($sfileread = "")
- EndFunc
- Func _filecreate($sfilepath)
- Local $hfileopen = FileOpen($sfilepath, BitOR($fo_overwrite, $fo_createpath))
- If $hfileopen = -1 Then Return SetError(1, 0, 0)
- Local $ifilewrite = FileWrite($hfileopen, "")
- FileClose($hfileopen)
- If NOT $ifilewrite Then Return SetError(2, 0, 0)
- Return 1
- EndFunc
- Func _filelisttoarray($sfilepath, $sfilter = "*", $iflag = $flta_filesfolders, $breturnpath = False)
- Local $sdelimiter = "|", $sfilelist = "", $sfilename = "", $sfullpath = ""
- $sfilepath = StringRegExpReplace($sfilepath, "[\\/]+$", "") & "\"
- If $iflag = Default Then $iflag = $flta_filesfolders
- If $breturnpath Then $sfullpath = $sfilepath
- If $sfilter = Default Then $sfilter = "*"
- If NOT FileExists($sfilepath) Then Return SetError(1, 0, 0)
- If StringRegExp($sfilter, "[\\/:><\|]|(?s)^\s*$") Then Return SetError(2, 0, 0)
- If NOT ($iflag = 0 OR $iflag = 1 OR $iflag = 2) Then Return SetError(3, 0, 0)
- Local $hsearch = FileFindFirstFile($sfilepath & $sfilter)
- If @error Then Return SetError(4, 0, 0)
- While 1
- $sfilename = FileFindNextFile($hsearch)
- If @error Then ExitLoop
- If ($iflag + @extended = 2) Then ContinueLoop
- $sfilelist &= $sdelimiter & $sfullpath & $sfilename
- WEnd
- FileClose($hsearch)
- If $sfilelist = "" Then Return SetError(4, 0, 0)
- Return StringSplit(StringTrimLeft($sfilelist, 1), $sdelimiter)
- EndFunc
- Func _filelisttoarrayrec($sfilepath, $smask = "*", $ireturn = $fltar_filesfolders, $irecur = $fltar_norecur, $isort = $fltar_nosort, $ireturnpath = $fltar_relpath)
- If NOT FileExists($sfilepath) Then Return SetError(1, 1, "")
- If $smask = Default Then $smask = "*"
- If $ireturn = Default Then $ireturn = $fltar_filesfolders
- If $irecur = Default Then $irecur = $fltar_norecur
- If $isort = Default Then $isort = $fltar_nosort
- If $ireturnpath = Default Then $ireturnpath = $fltar_relpath
- If $irecur > 1 OR NOT IsInt($irecur) Then Return SetError(1, 6, "")
- Local $blongpath = False
- If StringLeft($sfilepath, 4) == "\\?\" Then
- $blongpath = True
- EndIf
- Local $sfolderslash = ""
- If StringRight($sfilepath, 1) = "\" Then
- $sfolderslash = "\"
- Else
- $sfilepath = $sfilepath & "\"
- EndIf
- Local $asfoldersearchlist[100] = [1]
- $asfoldersearchlist[1] = $sfilepath
- Local $ihide_hs = 0, $shide_hs = ""
- If BitAND($ireturn, 4) Then
- $ihide_hs += 2
- $shide_hs &= "H"
- $ireturn -= 4
- EndIf
- If BitAND($ireturn, 8) Then
- $ihide_hs += 4
- $shide_hs &= "S"
- $ireturn -= 8
- EndIf
- Local $ihide_link = 0
- If BitAND($ireturn, 16) Then
- $ihide_link = 1024
- $ireturn -= 16
- EndIf
- Local $imaxlevel = 0
- If $irecur < 0 Then
- StringReplace($sfilepath, "\", "", 0, $str_nocasesensebasic)
- $imaxlevel = @extended - $irecur
- EndIf
- Local $sexclude_list = "", $sexclude_list_folder = "", $sinclude_list = "*"
- Local $amasksplit = StringSplit($smask, "|")
- Switch $amasksplit[0]
- Case 3
- $sexclude_list_folder = $amasksplit[3]
- ContinueCase
- Case 2
- $sexclude_list = $amasksplit[2]
- ContinueCase
- Case 1
- $sinclude_list = $amasksplit[1]
- EndSwitch
- Local $sinclude_file_mask = ".+"
- If $sinclude_list <> "*" Then
- If NOT __fltar_listtomask($sinclude_file_mask, $sinclude_list) Then Return SetError(1, 2, "")
- EndIf
- Local $sinclude_folder_mask = ".+"
- Switch $ireturn
- Case 0
- Switch $irecur
- Case 0
- $sinclude_folder_mask = $sinclude_file_mask
- EndSwitch
- Case 2
- $sinclude_folder_mask = $sinclude_file_mask
- EndSwitch
- Local $sexclude_file_mask = ":"
- If $sexclude_list <> "" Then
- If NOT __fltar_listtomask($sexclude_file_mask, $sexclude_list) Then Return SetError(1, 3, "")
- EndIf
- Local $sexclude_folder_mask = ":"
- If $irecur Then
- If $sexclude_list_folder Then
- If NOT __fltar_listtomask($sexclude_folder_mask, $sexclude_list_folder) Then Return SetError(1, 4, "")
- EndIf
- If $ireturn = 2 Then
- $sexclude_folder_mask = $sexclude_file_mask
- EndIf
- Else
- $sexclude_folder_mask = $sexclude_file_mask
- EndIf
- If NOT ($ireturn = 0 OR $ireturn = 1 OR $ireturn = 2) Then Return SetError(1, 5, "")
- If NOT ($isort = 0 OR $isort = 1 OR $isort = 2) Then Return SetError(1, 7, "")
- If NOT ($ireturnpath = 0 OR $ireturnpath = 1 OR $ireturnpath = 2) Then Return SetError(1, 8, "")
- If $ihide_link Then
- 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")
- Local $hdll = DllOpen("kernel32.dll"), $adll_ret
- EndIf
- Local $asreturnlist[100] = [0]
- Local $asfilematchlist = $asreturnlist, $asrootfilematchlist = $asreturnlist, $asfoldermatchlist = $asreturnlist
- Local $bfolder = False, $hsearch = 0, $scurrentpath = "", $sname = "", $sretpath = ""
- Local $iattribs = 0, $sattribs = ""
- Local $asfolderfilesectionlist[100][2] = [[0, 0]]
- While $asfoldersearchlist[0] > 0
- $scurrentpath = $asfoldersearchlist[$asfoldersearchlist[0]]
- $asfoldersearchlist[0] -= 1
- Switch $ireturnpath
- Case 1
- $sretpath = StringReplace($scurrentpath, $sfilepath, "")
- Case 2
- If $blongpath Then
- $sretpath = StringTrimLeft($scurrentpath, 4)
- Else
- $sretpath = $scurrentpath
- EndIf
- EndSwitch
- If $ihide_link Then
- $adll_ret = DllCall($hdll, "handle", "FindFirstFileW", "wstr", $scurrentpath & "*", "struct*", $tfile_data)
- If @error OR NOT $adll_ret[0] Then
- ContinueLoop
- EndIf
- $hsearch = $adll_ret[0]
- Else
- $hsearch = FileFindFirstFile($scurrentpath & "*")
- If $hsearch = -1 Then
- ContinueLoop
- EndIf
- EndIf
- If $ireturn = 0 AND $isort AND $ireturnpath Then
- __fltar_addtolist($asfolderfilesectionlist, $sretpath, $asfilematchlist[0] + 1)
- EndIf
- $sattribs = ""
- While 1
- If $ihide_link Then
- $adll_ret = DllCall($hdll, "int", "FindNextFileW", "handle", $hsearch, "struct*", $tfile_data)
- If @error OR NOT $adll_ret[0] Then
- ExitLoop
- EndIf
- $sname = DllStructGetData($tfile_data, "FileName")
- If $sname = ".." Then
- ContinueLoop
- EndIf
- $iattribs = DllStructGetData($tfile_data, "FileAttributes")
- If $ihide_hs AND BitAND($iattribs, $ihide_hs) Then
- ContinueLoop
- EndIf
- If BitAND($iattribs, $ihide_link) Then
- ContinueLoop
- EndIf
- $bfolder = False
- If BitAND($iattribs, 16) Then
- $bfolder = True
- EndIf
- Else
- $bfolder = False
- $sname = FileFindNextFile($hsearch, 1)
- If @error Then
- ExitLoop
- EndIf
- $sattribs = @extended
- If StringInStr($sattribs, "D") Then
- $bfolder = True
- EndIf
- If StringRegExp($sattribs, "[" & $shide_hs & "]") Then
- ContinueLoop
- EndIf
- EndIf
- If $bfolder Then
- Select
- Case $irecur < 0
- StringReplace($scurrentpath, "\", "", 0, $str_nocasesensebasic)
- If @extended < $imaxlevel Then
- ContinueCase
- EndIf
- Case $irecur = 1
- If NOT StringRegExp($sname, $sexclude_folder_mask) Then
- __fltar_addtolist($asfoldersearchlist, $scurrentpath & $sname & "\")
- EndIf
- EndSelect
- EndIf
- If $isort Then
- If $bfolder Then
- If StringRegExp($sname, $sinclude_folder_mask) AND NOT StringRegExp($sname, $sexclude_folder_mask) Then
- __fltar_addtolist($asfoldermatchlist, $sretpath & $sname & $sfolderslash)
- EndIf
- Else
- If StringRegExp($sname, $sinclude_file_mask) AND NOT StringRegExp($sname, $sexclude_file_mask) Then
- If $scurrentpath = $sfilepath Then
- __fltar_addtolist($asrootfilematchlist, $sretpath & $sname)
- Else
- __fltar_addtolist($asfilematchlist, $sretpath & $sname)
- EndIf
- EndIf
- EndIf
- Else
- If $bfolder Then
- If $ireturn <> 1 AND StringRegExp($sname, $sinclude_folder_mask) AND NOT StringRegExp($sname, $sexclude_folder_mask) Then
- __fltar_addtolist($asreturnlist, $sretpath & $sname & $sfolderslash)
- EndIf
- Else
- If $ireturn <> 2 AND StringRegExp($sname, $sinclude_file_mask) AND NOT StringRegExp($sname, $sexclude_file_mask) Then
- __fltar_addtolist($asreturnlist, $sretpath & $sname)
- EndIf
- EndIf
- EndIf
- WEnd
- If $ihide_link Then
- DllCall($hdll, "int", "FindClose", "ptr", $hsearch)
- Else
- FileClose($hsearch)
- EndIf
- WEnd
- If $ihide_link Then
- DllClose($hdll)
- EndIf
- If $isort Then
- Switch $ireturn
- Case 2
- If $asfoldermatchlist[0] = 0 Then Return SetError(1, 9, "")
- ReDim $asfoldermatchlist[$asfoldermatchlist[0] + 1]
- $asreturnlist = $asfoldermatchlist
- __arraydualpivotsort($asreturnlist, 1, $asreturnlist[0])
- Case 1
- If $asrootfilematchlist[0] = 0 AND $asfilematchlist[0] = 0 Then Return SetError(1, 9, "")
- If $ireturnpath = 0 Then
- __fltar_addfilelists($asreturnlist, $asrootfilematchlist, $asfilematchlist)
- __arraydualpivotsort($asreturnlist, 1, $asreturnlist[0])
- Else
- __fltar_addfilelists($asreturnlist, $asrootfilematchlist, $asfilematchlist, 1)
- EndIf
- Case 0
- If $asrootfilematchlist[0] = 0 AND $asfoldermatchlist[0] = 0 Then Return SetError(1, 9, "")
- If $ireturnpath = 0 Then
- __fltar_addfilelists($asreturnlist, $asrootfilematchlist, $asfilematchlist)
- $asreturnlist[0] += $asfoldermatchlist[0]
- ReDim $asfoldermatchlist[$asfoldermatchlist[0] + 1]
- _arrayconcatenate($asreturnlist, $asfoldermatchlist, 1)
- __arraydualpivotsort($asreturnlist, 1, $asreturnlist[0])
- Else
- Local $asreturnlist[$asfilematchlist[0] + $asrootfilematchlist[0] + $asfoldermatchlist[0] + 1]
- $asreturnlist[0] = $asfilematchlist[0] + $asrootfilematchlist[0] + $asfoldermatchlist[0]
- __arraydualpivotsort($asrootfilematchlist, 1, $asrootfilematchlist[0])
- For $i = 1 To $asrootfilematchlist[0]
- $asreturnlist[$i] = $asrootfilematchlist[$i]
- Next
- Local $inextinsertionindex = $asrootfilematchlist[0] + 1
- __arraydualpivotsort($asfoldermatchlist, 1, $asfoldermatchlist[0])
- Local $sfoldertofind = ""
- For $i = 1 To $asfoldermatchlist[0]
- $asreturnlist[$inextinsertionindex] = $asfoldermatchlist[$i]
- $inextinsertionindex += 1
- If $sfolderslash Then
- $sfoldertofind = $asfoldermatchlist[$i]
- Else
- $sfoldertofind = $asfoldermatchlist[$i] & "\"
- EndIf
- Local $ifilesectionendindex = 0, $ifilesectionstartindex = 0
- For $j = 1 To $asfolderfilesectionlist[0][0]
- If $sfoldertofind = $asfolderfilesectionlist[$j][0] Then
- $ifilesectionstartindex = $asfolderfilesectionlist[$j][1]
- If $j = $asfolderfilesectionlist[0][0] Then
- $ifilesectionendindex = $asfilematchlist[0]
- Else
- $ifilesectionendindex = $asfolderfilesectionlist[$j + 1][1] - 1
- EndIf
- If $isort = 1 Then
- __arraydualpivotsort($asfilematchlist, $ifilesectionstartindex, $ifilesectionendindex)
- EndIf
- For $k = $ifilesectionstartindex To $ifilesectionendindex
- $asreturnlist[$inextinsertionindex] = $asfilematchlist[$k]
- $inextinsertionindex += 1
- Next
- ExitLoop
- EndIf
- Next
- Next
- EndIf
- EndSwitch
- Else
- If $asreturnlist[0] = 0 Then Return SetError(1, 9, "")
- ReDim $asreturnlist[$asreturnlist[0] + 1]
- EndIf
- Return $asreturnlist
- EndFunc
- Func __fltar_addfilelists(ByRef $astarget, $assource_1, $assource_2, $isort = 0)
- ReDim $assource_1[$assource_1[0] + 1]
- If $isort = 1 Then __arraydualpivotsort($assource_1, 1, $assource_1[0])
- $astarget = $assource_1
- $astarget[0] += $assource_2[0]
- ReDim $assource_2[$assource_2[0] + 1]
- If $isort = 1 Then __arraydualpivotsort($assource_2, 1, $assource_2[0])
- _arrayconcatenate($astarget, $assource_2, 1)
- EndFunc
- Func __fltar_addtolist(ByRef $alist, $vvalue_0, $vvalue_1 = -1)
- If $vvalue_1 = -1 Then
- $alist[0] += 1
- If UBound($alist) <= $alist[0] Then ReDim $alist[UBound($alist) * 2]
- $alist[$alist[0]] = $vvalue_0
- Else
- $alist[0][0] += 1
- If UBound($alist) <= $alist[0][0] Then ReDim $alist[UBound($alist) * 2][2]
- $alist[$alist[0][0]][0] = $vvalue_0
- $alist[$alist[0][0]][1] = $vvalue_1
- EndIf
- EndFunc
- Func __fltar_listtomask(ByRef $smask, $slist)
- If StringRegExp($slist, "\\|/|:|\<|\>|\|") Then Return 0
- $slist = StringReplace(StringStripWS(StringRegExpReplace($slist, "\s*;\s*", ";"), $str_stripleading + $str_striptrailing), ";", "|")
- $slist = StringReplace(StringReplace(StringRegExpReplace($slist, "[][$^.{}()+\-]", "\\$0"), "?", "."), "*", ".*?")
- $smask = "(?i)^(" & $slist & ")\z"
- Return 1
- EndFunc
- Func _fileprint($sfilepath, $ishow = @SW_HIDE)
- If $ishow = Default Then $ishow = @SW_HIDE
- Return ShellExecute($sfilepath, "", @WorkingDir, "print", $ishow)
- EndFunc
- Func _filereadtoarray($sfilepath, ByRef $vreturn, $iflags = $frta_count, $sdelimiter = "")
- $vreturn = 0
- If $iflags = Default Then $iflags = $frta_count
- If $sdelimiter = Default Then $sdelimiter = ""
- Local $bexpand = True
- If BitAND($iflags, $frta_intarrays) Then
- $bexpand = False
- $iflags -= $frta_intarrays
- EndIf
- Local $ientire = $str_chrsplit
- If BitAND($iflags, $frta_entiresplit) Then
- $ientire = $str_entiresplit
- $iflags -= $frta_entiresplit
- EndIf
- Local $inocount = 0
- If $iflags <> $frta_count Then
- $iflags = $frta_nocount
- $inocount = $str_nocount
- EndIf
- If $sdelimiter Then
- Local $alines = FILEREADTOARRAY($sfilepath)
- If @error Then Return SetError(@error, 0, 0)
- Local $idim_1 = UBound($alines) + $iflags
- If $bexpand Then
- Local $idim_2 = UBound(StringSplit($alines[0], $sdelimiter, $ientire + $str_nocount))
- Local $atemp_array[$idim_1][$idim_2]
- Local $ifields, $asplit
- For $i = 0 To $idim_1 - $iflags - 1
- $asplit = StringSplit($alines[$i], $sdelimiter, $ientire + $str_nocount)
- $ifields = UBound($asplit)
- If $ifields <> $idim_2 Then
- Return SetError(3, 0, 0)
- EndIf
- For $j = 0 To $ifields - 1
- $atemp_array[$i + $iflags][$j] = $asplit[$j]
- Next
- Next
- If $idim_2 < 2 Then Return SetError(4, 0, 0)
- If $iflags Then
- $atemp_array[0][0] = $idim_1 - $iflags
- $atemp_array[0][1] = $idim_2
- EndIf
- Else
- Local $atemp_array[$idim_1]
- For $i = 0 To $idim_1 - $iflags - 1
- $atemp_array[$i + $iflags] = StringSplit($alines[$i], $sdelimiter, $ientire + $inocount)
- Next
- If $iflags Then
- $atemp_array[0] = $idim_1 - $iflags
- EndIf
- EndIf
- $vreturn = $atemp_array
- Else
- If $iflags Then
- Local $hfileopen = FileOpen($sfilepath, $fo_read)
- If $hfileopen = -1 Then Return SetError(1, 0, 0)
- Local $sfileread = FileRead($hfileopen)
- FileClose($hfileopen)
- If StringLen($sfileread) Then
- $vreturn = StringRegExp(@LF & $sfileread, "(?|(\N+)\z|(\N*)(?:\R))", 3)
- $vreturn[0] = UBound($vreturn) - 1
- Else
- Return SetError(2, 0, 0)
- EndIf
- Else
- $vreturn = FILEREADTOARRAY($sfilepath)
- If @error Then
- $vreturn = 0
- Return SetError(@error, 0, 0)
- EndIf
- EndIf
- EndIf
- Return 1
- EndFunc
- Func _filewritefromarray($sfilepath, Const ByRef $aarray, $ibase = Default, $iubound = Default, $sdelimiter = "|")
- Local $ireturn = 0
- If NOT IsArray($aarray) Then Return SetError(2, 0, $ireturn)
- Local $idims = UBound($aarray, $ubound_dimensions)
- If $idims > 2 Then Return SetError(4, 0, 0)
- Local $ilast = UBound($aarray) - 1
- If $iubound = Default OR $iubound > $ilast Then $iubound = $ilast
- If $ibase < 0 OR $ibase = Default Then $ibase = 0
- If $ibase > $iubound Then Return SetError(5, 0, $ireturn)
- If $sdelimiter = Default Then $sdelimiter = "|"
- Local $hfileopen = $sfilepath
- If IsString($sfilepath) Then
- $hfileopen = FileOpen($sfilepath, $fo_overwrite)
- If $hfileopen = -1 Then Return SetError(1, 0, $ireturn)
- EndIf
- Local $ierror = 0
- $ireturn = 1
- Switch $idims
- Case 1
- For $i = $ibase To $iubound
- If NOT FileWrite($hfileopen, $aarray[$i] & @CRLF) Then
- $ierror = 3
- $ireturn = 0
- ExitLoop
- EndIf
- Next
- Case 2
- Local $stemp = ""
- For $i = $ibase To $iubound
- $stemp = $aarray[$i][0]
- For $j = 1 To UBound($aarray, $ubound_columns) - 1
- $stemp &= $sdelimiter & $aarray[$i][$j]
- Next
- If NOT FileWrite($hfileopen, $stemp & @CRLF) Then
- $ierror = 3
- $ireturn = 0
- ExitLoop
- EndIf
- Next
- EndSwitch
- If IsString($sfilepath) Then FileClose($hfileopen)
- Return SetError($ierror, 0, $ireturn)
- EndFunc
- Func _filewritelog($slogpath, $slogmsg, $iflag = -1)
- Local $iopenmode = $fo_append
- Local $sdatenow = @YEAR & "-" & @MON & "-" & @MDAY
- Local $stimenow = @HOUR & ":" & @MIN & ":" & @SEC
- Local $smsg = $sdatenow & " " & $stimenow & " : " & $slogmsg
- If $iflag = Default Then $iflag = -1
- If $iflag <> -1 Then
- $iopenmode = $fo_overwrite
- $smsg &= @CRLF & FileRead($slogpath)
- EndIf
- Local $hfileopen = $slogpath
- If IsString($slogpath) Then
- $hfileopen = FileOpen($slogpath, $iopenmode)
- EndIf
- If $hfileopen = -1 Then Return SetError(1, 0, 0)
- Local $ireturn = FileWriteLine($hfileopen, $smsg)
- If IsString($slogpath) Then $ireturn = FileClose($hfileopen)
- If $ireturn <= 0 Then Return SetError(2, $ireturn, 0)
- Return $ireturn
- EndFunc
- Func _filewritetoline($sfilepath, $iline, $stext, $boverwrite = False)
- If $iline <= 0 Then Return SetError(4, 0, 0)
- If NOT IsString($stext) Then
- $stext = String($stext)
- If $stext = "" Then Return SetError(6, 0, 0)
- EndIf
- If $boverwrite = Default Then $boverwrite = False
- If NOT (IsBool($boverwrite) OR $boverwrite = 0 OR $boverwrite = 1) Then Return SetError(5, 0, 0)
- If NOT FileExists($sfilepath) Then Return SetError(2, 0, 0)
- Local $aarray = FILEREADTOARRAY($sfilepath)
- Local $iubound = UBound($aarray) - 1
- If ($iubound + 1) < $iline Then Return SetError(1, 0, 0)
- Local $hfileopen = FileOpen($sfilepath, FileGetEncoding($sfilepath) + $fo_overwrite)
- If $hfileopen = -1 Then Return SetError(3, 0, 0)
- Local $sdata = ""
- $iline -= 1
- For $i = 0 To $iubound
- If $i = $iline Then
- If $boverwrite Then
- If $stext Then $sdata &= $stext & @CRLF
- Else
- $sdata &= $stext & @CRLF & $aarray[$i] & @CRLF
- EndIf
- ElseIf $i < $iubound Then
- $sdata &= $aarray[$i] & @CRLF
- ElseIf $i = $iubound Then
- $sdata &= $aarray[$i]
- EndIf
- Next
- FileWrite($hfileopen, $sdata)
- FileClose($hfileopen)
- Return 1
- EndFunc
- Func _pathfull($srelativepath, $sbasepath = @WorkingDir)
- If NOT $srelativepath OR $srelativepath = "." Then Return $sbasepath
- Local $sfullpath = StringReplace($srelativepath, "/", "\")
- Local Const $sfullpathconst = $sfullpath
- Local $spath
- Local $brootonly = StringLeft($sfullpath, 1) = "\" AND StringMid($sfullpath, 2, 1) <> "\"
- If $sbasepath = Default Then $sbasepath = @WorkingDir
- For $i = 1 To 2
- $spath = StringLeft($sfullpath, 2)
- If $spath = "\\" Then
- $sfullpath = StringTrimLeft($sfullpath, 2)
- Local $nserverlen = StringInStr($sfullpath, "\") - 1
- $spath = "\\" & StringLeft($sfullpath, $nserverlen)
- $sfullpath = StringTrimLeft($sfullpath, $nserverlen)
- ExitLoop
- ElseIf StringRight($spath, 1) = ":" Then
- $sfullpath = StringTrimLeft($sfullpath, 2)
- ExitLoop
- Else
- $sfullpath = $sbasepath & "\" & $sfullpath
- EndIf
- Next
- If StringLeft($sfullpath, 1) <> "\" Then
- If StringLeft($sfullpathconst, 2) = StringLeft($sbasepath, 2) Then
- $sfullpath = $sbasepath & "\" & $sfullpath
- Else
- $sfullpath = "\" & $sfullpath
- EndIf
- EndIf
- Local $atemp = StringSplit($sfullpath, "\")
- Local $apathparts[$atemp[0]], $j = 0
- For $i = 2 To $atemp[0]
- If $atemp[$i] = ".." Then
- If $j Then $j -= 1
- ElseIf NOT ($atemp[$i] = "" AND $i <> $atemp[0]) AND $atemp[$i] <> "." Then
- $apathparts[$j] = $atemp[$i]
- $j += 1
- EndIf
- Next
- $sfullpath = $spath
- If NOT $brootonly Then
- For $i = 0 To $j - 1
- $sfullpath &= "\" & $apathparts[$i]
- Next
- Else
- $sfullpath &= $sfullpathconst
- If StringInStr($sfullpath, "..") Then $sfullpath = _pathfull($sfullpath)
- EndIf
- Do
- $sfullpath = StringReplace($sfullpath, ".\", "\")
- Until @extended = 0
- Return $sfullpath
- EndFunc
- Func _pathgetrelative($sfrom, $sto)
- If StringRight($sfrom, 1) <> "\" Then $sfrom &= "\"
- If StringRight($sto, 1) <> "\" Then $sto &= "\"
- If $sfrom = $sto Then Return SetError(1, 0, StringTrimRight($sto, 1))
- Local $asfrom = StringSplit($sfrom, "\")
- Local $asto = StringSplit($sto, "\")
- If $asfrom[1] <> $asto[1] Then Return SetError(2, 0, StringTrimRight($sto, 1))
- Local $i = 2
- Local $idiff = 1
- While 1
- If $asfrom[$i] <> $asto[$i] Then
- $idiff = $i
- ExitLoop
- EndIf
- $i += 1
- WEnd
- $i = 1
- Local $srelpath = ""
- For $j = 1 To $asto[0]
- If $i >= $idiff Then
- $srelpath &= "\" & $asto[$i]
- EndIf
- $i += 1
- Next
- $srelpath = StringTrimLeft($srelpath, 1)
- $i = 1
- For $j = 1 To $asfrom[0]
- If $i > $idiff Then
- $srelpath = "..\" & $srelpath
- EndIf
- $i += 1
- Next
- If StringRight($srelpath, 1) == "\" Then $srelpath = StringTrimRight($srelpath, 1)
- Return $srelpath
- EndFunc
- Func _pathmake($sdrive, $sdir, $sfilename, $sextension)
- If StringLen($sdrive) Then
- If NOT (StringLeft($sdrive, 2) = "\\") Then $sdrive = StringLeft($sdrive, 1) & ":"
- EndIf
- If StringLen($sdir) Then
- If NOT (StringRight($sdir, 1) = "\") AND NOT (StringRight($sdir, 1) = "/") Then $sdir = $sdir & "\"
- Else
- $sdir = "\"
- EndIf
- If StringLen($sdir) Then
- If NOT (StringLeft($sdir, 1) = "\") AND NOT (StringLeft($sdir, 1) = "/") Then $sdir = "\" & $sdir
- EndIf
- If StringLen($sextension) Then
- If NOT (StringLeft($sextension, 1) = ".") Then $sextension = "." & $sextension
- EndIf
- Return $sdrive & $sdir & $sfilename & $sextension
- EndFunc
- Func _pathsplit($sfilepath, ByRef $sdrive, ByRef $sdir, ByRef $sfilename, ByRef $sextension)
- Local $aarray = StringRegExp($sfilepath, "^\h*((?:\\\\\?\\)*(\\\\[^\?\/\\]+|[A-Za-z]:)?(.*[\/\\]\h*)?((?:[^\.\/\\]|(?(?=\.[^\/\\]*\.)\.))*)?([^\/\\]*))$", $str_regexparraymatch)
- If @error Then
- ReDim $aarray[5]
- $aarray[0] = $sfilepath
- EndIf
- $sdrive = $aarray[1]
- If StringLeft($aarray[2], 1) == "/" Then
- $sdir = StringRegExpReplace($aarray[2], "\h*[\/\\]+\h*", "\/")
- Else
- $sdir = StringRegExpReplace($aarray[2], "\h*[\/\\]+\h*", "\\")
- EndIf
- $aarray[2] = $sdir
- $sfilename = $aarray[3]
- $sextension = $aarray[4]
- Return $aarray
- EndFunc
- Func _replacestringinfile($sfilepath, $ssearchstring, $sreplacestring, $icasesensitive = 0, $ioccurance = 1)
- If StringInStr(FileGetAttrib($sfilepath), "R") Then Return SetError(1, 0, -1)
- Local $hfileopen = FileOpen($sfilepath, $fo_read)
- If $hfileopen = -1 Then Return SetError(2, 0, -1)
- Local $sfileread = FileRead($hfileopen)
- FileClose($hfileopen)
- If $icasesensitive = Default Then $icasesensitive = 0
- If $ioccurance = Default Then $ioccurance = 1
- $sfileread = StringReplace($sfileread, $ssearchstring, $sreplacestring, 1 - $ioccurance, $icasesensitive)
- Local $ireturn = @extended
- If $ireturn Then
- Local $ifileencoding = FileGetEncoding($sfilepath)
- $hfileopen = FileOpen($sfilepath, $ifileencoding + $fo_overwrite)
- If $hfileopen = -1 Then Return SetError(3, 0, -1)
- FileWrite($hfileopen, $sfileread)
- FileClose($hfileopen)
- EndIf
- Return $ireturn
- EndFunc
- Func _tempfile($sdirectoryname = @TempDir, $sfileprefix = "~", $sfileextension = ".tmp", $irandomlength = 7)
- If $irandomlength = Default OR $irandomlength <= 0 Then $irandomlength = 7
- If $sdirectoryname = Default OR (NOT FileExists($sdirectoryname)) Then $sdirectoryname = @TempDir
- If $sfileextension = Default Then $sfileextension = ".tmp"
- If $sfileprefix = Default Then $sfileprefix = "~"
- If NOT FileExists($sdirectoryname) Then $sdirectoryname = @ScriptDir
- $sdirectoryname = StringRegExpReplace($sdirectoryname, "[\\/]+$", "")
- $sfileextension = StringRegExpReplace($sfileextension, "^\.+", "")
- $sfileprefix = StringRegExpReplace($sfileprefix, '[\\/:*?"<>|]', "")
- Local $stempname = ""
- Do
- $stempname = ""
- While StringLen($stempname) < $irandomlength
- $stempname &= Chr(Random(97, 122, 1))
- WEnd
- $stempname = $sdirectoryname & "\" & $sfileprefix & $stempname & "." & $sfileextension
- Until NOT FileExists($stempname)
- Return $stempname
- EndFunc
- Global Const $dllver_platform_windows = 1
- Global Const $dllver_platform_nt = 2
- Global Const $shcne_allevents = 2147483647
- Global Const $shcne_assocchanged = 134217728
- Global Const $shcne_attributes = 2048
- Global Const $shcne_create = 2
- Global Const $shcne_delete = 4
- Global Const $shcne_driveadd = 256
- Global Const $shcne_driveaddgui = 65536
- Global Const $shcne_driveremoved = 128
- Global Const $shcne_extended_event = 67108864
- Global Const $shcne_freespace = 262144
- Global Const $shcne_mediainserted = 32
- Global Const $shcne_mediaremoved = 64
- Global Const $shcne_mkdir = 8
- Global Const $shcne_netshare = 512
- Global Const $shcne_netunshare = 1024
- Global Const $shcne_renamefolder = 131072
- Global Const $shcne_renameitem = 1
- Global Const $shcne_rmdir = 16
- Global Const $shcne_serverdisconnect = 16384
- Global Const $shcne_updatedir = 4096
- Global Const $shcne_updateimage = 32768
- Global Const $shcne_updateitem = 8192
- Global Const $shcne_diskevents = 145439
- Global Const $shcne_globalevents = 201687520
- Global Const $shcne_interrupt = -2147483648
- Global Const $shcnf_dword = 3
- Global Const $shcnf_idlist = 0
- Global Const $shcnf_path = 1
- Global Const $shcnf_printer = 2
- Global Const $shcnf_flush = 4096
- Global Const $shcnf_flushnowait = 8192
- Global Const $shcnf_notifyrecursive = 65536
- Global Const $shcnrf_interruptlevel = 1
- Global Const $shcnrf_shelllevel = 2
- Global Const $shcnrf_recursiveinterrupt = 4096
- Global Const $shcnrf_newdelivery = 32768
- Global Const $sherb_noconfirmation = 1
- Global Const $sherb_noprogressui = 2
- Global Const $sherb_nosound = 4
- Global Const $sherb_no_ui = BitOR($sherb_noconfirmation, $sherb_noprogressui, $sherb_nosound)
- Global Const $see_mask_default = 0
- Global Const $see_mask_classname = 1
- Global Const $see_mask_classkey = 3
- Global Const $see_mask_idlist = 4
- Global Const $see_mask_invokeidlist = 12
- Global Const $see_mask_icon = 16
- Global Const $see_mask_hotkey = 32
- Global Const $see_mask_nocloseprocess = 64
- Global Const $see_mask_connectnetdrv = 128
- Global Const $see_mask_noasync = 256
- Global Const $see_mask_flag_ddewait = $see_mask_noasync
- Global Const $see_mask_doenvsubst = 512
- Global Const $see_mask_flag_no_ui = 1024
- Global Const $see_mask_unicode = 16384
- Global Const $see_mask_no_console = 32768
- Global Const $see_mask_asyncok = 1048576
- Global Const $see_mask_noqueryclassstore = 16777216
- Global Const $see_mask_hmonitor = 2097152
- Global Const $see_mask_nozonechecks = 8388608
- Global Const $see_mask_waitforinputidle = 33554432
- Global Const $see_mask_flag_log_usage = 67108864
- Global Const $se_err_accessdenied = 5
- Global Const $se_err_associncomplete = 27
- Global Const $se_err_ddebusy = 30
- Global Const $se_err_ddefail = 29
- Global Const $se_err_ddetimeout = 28
- Global Const $se_err_dllnotfound = 32
- Global Const $se_err_fnf = 2
- Global Const $se_err_noassoc = 31
- Global Const $se_err_oom = 8
- Global Const $se_err_pnf = 3
- Global Const $se_err_share = 26
- Global Const $fo_copy = 2
- Global Const $fo_delete = 3
- Global Const $fo_move = 1
- Global Const $fo_rename = 4
- Global Const $fof_allowundo = 64
- Global Const $fof_confirmmouse = 2
- Global Const $fof_filesonly = 128
- Global Const $fof_multidestfiles = 1
- Global Const $fof_noconfirmation = 16
- Global Const $fof_noconfirmmkdir = 512
- Global Const $fof_no_connected_elements = 8192
- Global Const $fof_nocopysecurityattribs = 2048
- Global Const $fof_noerrorui = 1024
- Global Const $fof_norecursereparse = 32768
- Global Const $fof_norecursion = 4096
- Global Const $fof_renameoncollision = 8
- Global Const $fof_silent = 4
- Global Const $fof_simpleprogress = 256
- Global Const $fof_wantmappinghandle = 32
- Global Const $fof_wantnukewarning = 16384
- Global Const $fof_no_ui = BitOR($fof_noconfirmation, $fof_noconfirmmkdir, $fof_noerrorui, $fof_silent)
- Global Const $shgfi_addoverlays = 32
- Global Const $shgfi_attr_specified = 131072
- Global Const $shgfi_attributes = 2048
- Global Const $shgfi_displayname = 512
- Global Const $shgfi_exetype = 8192
- Global Const $shgfi_icon = 256
- Global Const $shgfi_iconlocation = 4096
- Global Const $shgfi_largeicon = 0
- Global Const $shgfi_linkoverlay = 32768
- Global Const $shgfi_openicon = 2
- Global Const $shgfi_overlayindex = 64
- Global Const $shgfi_pidl = 8
- Global Const $shgfi_selected = 65536
- Global Const $shgfi_shelliconsize = 4
- Global Const $shgfi_smallicon = 1
- Global Const $shgfi_sysiconindex = 16384
- Global Const $shgfi_typename = 1024
- Global Const $shgfi_usefileattributes = 16
- Global Const $sfgao_cancopy = 1
- Global Const $sfgao_canmove = 2
- Global Const $sfgao_canlink = 4
- Global Const $sfgao_storage = 8
- Global Const $sfgao_canrename = 16
- Global Const $sfgao_candelete = 32
- Global Const $sfgao_haspropsheet = 64
- Global Const $sfgao_droptarget = 256
- Global Const $sfgao_capabilitymask = BitOR($sfgao_cancopy, $sfgao_canmove, $sfgao_canlink, $sfgao_canrename, $sfgao_candelete, $sfgao_haspropsheet, $sfgao_droptarget)
- Global Const $sfgao_system = 4096
- Global Const $sfgao_encrypted = 8192
- Global Const $sfgao_isslow = 16384
- Global Const $sfgao_ghosted = 32768
- Global Const $sfgao_link = 65536
- Global Const $sfgao_share = 131072
- Global Const $sfgao_readonly = 262144
- Global Const $sfgao_hidden = 524288
- Global Const $sfgao_displayattrmask = BitOR($sfgao_isslow, $sfgao_ghosted, $sfgao_link, $sfgao_share, $sfgao_readonly, $sfgao_hidden)
- Global Const $sfgao_nonenumerated = 1048576
- Global Const $sfgao_newcontent = 2097152
- Global Const $sfgao_stream = 4194304
- Global Const $sfgao_storageancestor = 8388608
- Global Const $sfgao_validate = 16777216
- Global Const $sfgao_removable = 33554432
- Global Const $sfgao_compressed = 67108864
- Global Const $sfgao_browsable = 134217728
- Global Const $sfgao_filesysancestor = 268435456
- Global Const $sfgao_folder = 536870912
- Global Const $sfgao_filesystem = 1073741824
- Global Const $sfgao_storagecapmask = BitOR($sfgao_storage, $sfgao_link, $sfgao_readonly, $sfgao_stream, $sfgao_storageancestor, $sfgao_filesysancestor, $sfgao_folder, $sfgao_filesystem)
- Global Const $sfgao_hassubfolder = -2147483648
- Global Const $sfgao_contentsmask = $sfgao_hassubfolder
- Global Const $sfgao_pkeysfgaomask = BitOR($sfgao_isslow, $sfgao_readonly, $sfgao_hassubfolder, $sfgao_validate)
- Global Const $ido_shgioi_default = 268435452
- Global Const $ido_shgioi_link = 268435454
- Global Const $ido_shgioi_share = 268435455
- Global Const $ido_shgioi_slowfile = 268435453
- Global Const $fcsm_viewid = 1
- Global Const $fcsm_webviewtemplate = 2
- Global Const $fcsm_infotip = 4
- Global Const $fcsm_clsid = 8
- Global Const $fcsm_iconfile = 16
- Global Const $fcsm_logo = 32
- Global Const $fcsm_flags = 64
- Global Const $fcs_read = 1
- Global Const $fcs_forcewrite = 2
- Global Const $fcs_write = BitOR($fcs_read, $fcs_forcewrite)
- Global Const $ssf_autocheckselect = 8388608
- Global Const $ssf_desktophtml = 512
- Global Const $ssf_dontprettypath = 2048
- Global Const $ssf_doubleclickinwebview = 128
- Global Const $ssf_hideicons = 16384
- Global Const $ssf_iconsonly = 16777216
- Global Const $ssf_mapnetdrvbutton = 4096
- Global Const $ssf_noconfirmrecycle = 32768
- Global Const $ssf_nonetcrawling = 1048576
- Global Const $ssf_sepprocess = 524288
- Global Const $ssf_showallobjects = 1
- Global Const $ssf_showcompcolor = 8
- Global Const $ssf_showextensions = 2
- Global Const $ssf_showinfotip = 8192
- Global Const $ssf_showsuperhidden = 262144
- Global Const $ssf_showsysfiles = 32
- Global Const $ssf_showtypeoverlay = 33554432
- Global Const $ssf_startpanelon = 2097152
- Global Const $ssf_win95classic = 1024
- Global Const $ssf_webview = 131072
- Global Const $csidl_admintools = 48
- Global Const $csidl_altstartup = 29
- Global Const $csidl_appdata = 26
- Global Const $csidl_bitbucket = 10
- Global Const $csidl_cdburn_area = 59
- Global Const $csidl_common_admintools = 47
- Global Const $csidl_common_altstartup = 30
- Global Const $csidl_common_appdata = 35
- Global Const $csidl_common_desktopdirectory = 25
- Global Const $csidl_common_documents = 46
- Global Const $csidl_common_favorites = 31
- Global Const $csidl_common_music = 53
- Global Const $csidl_common_pictures = 54
- Global Const $csidl_common_programs = 23
- Global Const $csidl_common_startmenu = 22
- Global Const $csidl_common_startup = 24
- Global Const $csidl_common_templates = 45
- Global Const $csidl_common_video = 55
- Global Const $csidl_computersnearme = 61
- Global Const $csidl_connections = 49
- Global Const $csidl_controls = 3
- Global Const $csidl_cookies = 33
- Global Const $csidl_desktop = 0
- Global Const $csidl_desktopdirectory = 16
- Global Const $csidl_drives = 17
- Global Const $csidl_favorites = 6
- Global Const $csidl_fonts = 20
- Global Const $csidl_internet_cache = 32
- Global Const $csidl_history = 34
- Global Const $csidl_local_appdata = 28
- Global Const $csidl_mymusic = 13
- Global Const $csidl_mypictures = 39
- Global Const $csidl_myvideo = 14
- Global Const $csidl_nethood = 19
- Global Const $csidl_personal = 5
- Global Const $csidl_printers = 4
- Global Const $csidl_printhood = 27
- Global Const $csidl_profile = 40
- Global Const $csidl_program_files = 38
- Global Const $csidl_program_files_common = 43
- Global Const $csidl_program_files_commonx86 = 44
- Global Const $csidl_program_filesx86 = 42
- Global Const $csidl_programs = 2
- Global Const $csidl_recent = 8
- Global Const $csidl_sendto = 9
- Global Const $csidl_startmenu = 11
- Global Const $csidl_startup = 7
- Global Const $csidl_system = 37
- Global Const $csidl_systemx86 = 41
- Global Const $csidl_templates = 21
- Global Const $csidl_windows = 36
- Global Const $siid_docnoassoc = 0
- Global Const $siid_docassoc = 1
- Global Const $siid_application = 2
- Global Const $siid_folder = 3
- Global Const $siid_folderopen = 4
- Global Const $siid_drive525 = 5
- Global Const $siid_drive35 = 6
- Global Const $siid_driveremove = 7
- Global Const $siid_drivefixed = 8
- Global Const $siid_drivenet = 9
- Global Const $siid_drivenetdisabled = 10
- Global Const $siid_drivecd = 11
- Global Const $siid_driveram = 12
- Global Const $siid_world = 13
- Global Const $siid_server = 15
- Global Const $siid_printer = 16
- Global Const $siid_mynetwork = 17
- Global Const $siid_find = 22
- Global Const $siid_help = 23
- Global Const $siid_share = 28
- Global Const $siid_link = 29
- Global Const $siid_slowfile = 30
- Global Const $siid_recycler = 31
- Global Const $siid_recyclerfull = 32
- Global Const $siid_mediacdaudio = 40
- Global Const $siid_lock = 47
- Global Const $siid_autolist = 49
- Global Const $siid_printernet = 50
- Global Const $siid_servershare = 51
- Global Const $siid_printerfax = 52
- Global Const $siid_printerfaxnet = 53
- Global Const $siid_printerfile = 54
- Global Const $siid_stack = 55
- Global Const $siid_mediasvcd = 56
- Global Const $siid_stuffedfolder = 57
- Global Const $siid_driveunknown = 58
- Global Const $siid_drivedvd = 59
- Global Const $siid_mediadvd = 60
- Global Const $siid_mediadvdram = 61
- Global Const $siid_mediadvdrw = 62
- Global Const $siid_mediadvdr = 63
- Global Const $siid_mediadvdrom = 64
- Global Const $siid_mediacdaudioplus = 65
- Global Const $siid_mediacdrw = 66
- Global Const $siid_mediacdr = 67
- Global Const $siid_mediacdburn = 68
- Global Const $siid_mediablankcd = 69
- Global Const $siid_mediacdrom = 70
- Global Const $siid_audiofiles = 71
- Global Const $siid_imagefiles = 72
- Global Const $siid_videofiles = 73
- Global Const $siid_mixedfiles = 74
- Global Const $siid_folderback = 75
- Global Const $siid_folderfront = 76
- Global Const $siid_shield = 77
- Global Const $siid_warning = 78
- Global Const $siid_info = 79
- Global Const $siid_error = 80
- Global Const $siid_key = 81
- Global Const $siid_software = 82
- Global Const $siid_rename = 83
- Global Const $siid_delete = 84
- Global Const $siid_mediaaudiodvd = 85
- Global Const $siid_mediamoviedvd = 86
- Global Const $siid_mediaenhancedcd = 87
- Global Const $siid_mediaenhanceddvd = 88
- Global Const $siid_mediahddvd = 89
- Global Const $siid_mediabluray = 90
- Global Const $siid_mediavcd = 91
- Global Const $siid_mediadvdplusr = 92
- Global Const $siid_mediadvdplusrw = 93
- Global Const $siid_desktoppc = 94
- Global Const $siid_mobilepc = 95
- Global Const $siid_users = 96
- Global Const $siid_mediasmartmedia = 97
- Global Const $siid_mediacompactflash = 98
- Global Const $siid_devicecellphone = 99
- Global Const $siid_devicecamera = 100
- Global Const $siid_devicevideocamera = 101
- Global Const $siid_deviceaudioplayer = 102
- Global Const $siid_networkconnect = 103
- Global Const $siid_internet = 104
- Global Const $siid_zipfile = 105
- Global Const $siid_settings = 106
- Global Const $siid_drivehddvd = 132
- Global Const $siid_drivebd = 133
- Global Const $siid_mediahddvdrom = 134
- Global Const $siid_mediahddvdr = 135
- Global Const $siid_mediahddvdram = 136
- Global Const $siid_mediabdrom = 137
- Global Const $siid_mediabdr = 138
- Global Const $siid_mediabdre = 139
- Global Const $siid_clustereddrive = 140
- Global Const $siid_max_icons = 174
- Global Const $shgsi_iconlocation = 0
- Global Const $shgsi_icon = $shgfi_icon
- Global Const $shgsi_sysiconindex = $shgfi_sysiconindex
- Global Const $shgsi_linkoverlay = $shgfi_linkoverlay
- Global Const $shgsi_selected = $shgfi_selected
- Global Const $shgsi_largeicon = $shgfi_largeicon
- Global Const $shgsi_smallicon = $shgfi_smallicon
- Global Const $shgsi_shelliconsize = $shgfi_shelliconsize
- Global Const $nim_add = 0
- Global Const $nim_modify = 1
- Global Const $nim_delete = 2
- Global Const $nim_setfocus = 3
- Global Const $nim_setversion = 4
- Global Const $nif_message = 1
- Global Const $nif_icon = 2
- Global Const $nif_tip = 4
- Global Const $nif_state = 8
- Global Const $nif_info = 16
- Global Const $nif_guid = 32
- Global Const $nif_realtime = 64
- Global Const $nif_showtip = 128
- Global Const $nis_hidden = 1
- Global Const $nis_sharedicon = 2
- Global Const $niif_none = 0
- Global Const $niif_info = 1
- Global Const $niif_warning = 2
- Global Const $niif_error = 3
- Global Const $niif_user = 4
- Global Const $niif_nosound = 16
- Global Const $niif_large_icon = 16
- Global Const $niif_respect_quiet_time = 128
- Global Const $niif_icon_mask = 15
- Global Const $shop_printername = 1
- Global Const $shop_filepath = 2
- Global Const $shop_volumeguid = 4
- Global Const $ofasi_edit = 1
- Global Const $ofasi_opendesktop = 2
- Global Const $quns_not_present = 1
- Global Const $quns_busy = 2
- Global Const $quns_running_d3d_full_screen = 3
- Global Const $quns_presentation_mode = 4
- Global Const $quns_accepts_notifications = 5
- Global Const $quns_quiet_time = 6
- Global Const $rest_norun = 1
- Global Const $rest_noclose = 2
- Global Const $rest_nosaveset = 3
- Global Const $rest_nofilemenu = 4
- Global Const $rest_nosetfolders = 5
- Global Const $rest_nosettaskbar = 6
- Global Const $rest_nodesktop = 7
- Global Const $rest_nofind = 8
- Global Const $rest_nodrives = 9
- Global Const $rest_nodriveautorun = 10
- Global Const $rest_nodrivetypeautorun = 11
- Global Const $rest_nonethood = 12
- Global Const $rest_startbanner = 13
- Global Const $rest_restrictrun = 14
- Global Const $rest_noprintertabs = 15
- Global Const $rest_noprinterdelete = 16
- Global Const $rest_noprinteradd = 17
- Global Const $rest_nostartmenusubfolders = 18
- Global Const $rest_mydocsonnet = 19
- Global Const $rest_noexittodos = 20
- Global Const $rest_enforceshellextsecurity = 21
- Global Const $rest_linkresolveignorelinkinfo = 22
- Global Const $rest_nocommongroups = 23
- Global Const $rest_separatedesktopprocess = 24
- Global Const $rest_noweb = 25
- Global Const $rest_notraycontextmenu = 26
- Global Const $rest_noviewcontextmenu = 27
- Global Const $rest_nonetconnectdisconnect = 28
- Global Const $rest_startmenulogoff = 29
- Global Const $rest_nosettingsassist = 30
- Global Const $rest_nointerneticon = 31
- Global Const $rest_norecentdocshistory = 32
- Global Const $rest_norecentdocsmenu = 33
- Global Const $rest_noactivedesktop = 34
- Global Const $rest_noactivedesktopchanges = 35
- Global Const $rest_nofavoritesmenu = 36
- Global Const $rest_clearrecentdocsonexit = 37
- Global Const $rest_classicshell = 38
- Global Const $rest_nocustomizewebview = 39
- Global Const $rest_nohtmlwallpaper = 40
- Global Const $rest_nochangingwallpaper = 41
- Global Const $rest_nodeskcomp = 42
- Global Const $rest_noadddeskcomp = 43
- Global Const $rest_nodeldeskcomp = 44
- Global Const $rest_noclosedeskcomp = 45
- Global Const $rest_noclose_dragdropband = 46
- Global Const $rest_nomovingband = 47
- Global Const $rest_noeditdeskcomp = 48
- Global Const $rest_noresolvesearch = 49
- Global Const $rest_noresolvetrack = 50
- Global Const $rest_forcecopyaclwithfile = 51
- Global Const $rest_nologo3channelnotify = 52
- Global Const $rest_noforgetsoftwareupdate = 53
- Global Const $rest_nosetactivedesktop = 54
- Global Const $rest_noupdatewindows = 55
- Global Const $rest_nochangestarmenu = 56
- Global Const $rest_nofolderoptions = 57
- Global Const $rest_hasfindcomputers = 58
- Global Const $rest_intellimenus = 59
- Global Const $rest_rundlgmemcheckbox = 60
- Global Const $rest_arp_showpostsetup = 61
- Global Const $rest_nocsc = 62
- Global Const $rest_nocontrolpanel = 63
- Global Const $rest_enumworkgroup = 64
- Global Const $rest_arp_noarp = 65
- Global Const $rest_arp_noremovepage = 66
- Global Const $rest_arp_noaddpage = 67
- Global Const $rest_arp_nowinsetuppage = 68
- Global Const $rest_greymsiads = 69
- Global Const $rest_nochangemappeddrivelabel = 70
- Global Const $rest_nochangemappeddrivecomment = 71
- Global Const $rest_maxrecentdocs = 72
- Global Const $rest_nonetworkconnections = 73
- Global Const $rest_forcestartmenulogoff = 74
- Global Const $rest_nowebview = 75
- Global Const $rest_nocustomizethisfolder = 76
- Global Const $rest_noencryption = 77
- Global Const $rest_dontshowsuperhidden = 78
- Global Const $rest_noshellsearchbutton = 79
- Global Const $rest_nohardwaretab = 80
- Global Const $rest_norunasinstallprompt = 81
- Global Const $rest_promptrunasinstallnetpath = 82
- Global Const $rest_nomanagemycomputerverb = 83
- Global Const $rest_norecentdocsnethood = 84
- Global Const $rest_disallowrun = 85
- Global Const $rest_nowelcomescreen = 86
- Global Const $rest_restrictcpl = 87
- Global Const $rest_disallowcpl = 88
- Global Const $rest_nosmballoontip = 89
- Global Const $rest_nosmhelp = 90
- Global Const $rest_nowinkeys = 91
- Global Const $rest_noencryptonmove = 92
- Global Const $rest_nolocalmachinerun = 93
- Global Const $rest_nocurrentuserrun = 94
- Global Const $rest_nolocalmachinerunonce = 95
- Global Const $rest_nocurrentuserrunonce = 96
- Global Const $rest_forceactivedesktopon = 97
- Global Const $rest_nocomputersnearme = 98
- Global Const $rest_noviewondrive = 99
- Global Const $rest_nonetcrawl = 100
- Global Const $rest_noshareddocuments = 101
- Global Const $rest_nosmmydocs = 102
- Global Const $rest_nosmmypics = 103
- Global Const $rest_allowbitbuckdrives = 104
- Global Const $rest_nonlegacyshellmode = 105
- Global Const $rest_nocontrolpanelbarricade = 106
- Global Const $rest_nostartpage = 107
- Global Const $rest_noautotraynotify = 108
- Global Const $rest_notaskgrouping = 109
- Global Const $rest_nocdburning = 110
- Global Const $rest_mycompnoprop = 111
- Global Const $rest_mydocsnoprop = 112
- Global Const $rest_nostartpanel = 113
- Global Const $rest_nodisplayappearancepage = 114
- Global Const $rest_nothemestab = 115
- Global Const $rest_novisualstylechoice = 116
- Global Const $rest_nosizechoice = 117
- Global Const $rest_nocolorchoice = 118
- Global Const $rest_setvisualstyle = 119
- Global Const $rest_startrunnohomepath = 120
- Global Const $rest_nousernameinstartpanel = 121
- Global Const $rest_nomycomputericon = 122
- Global Const $rest_nosmnetworkplaces = 123
- Global Const $rest_nosmpinnedlist = 124
- Global Const $rest_nosmmymusic = 125
- Global Const $rest_nosmejectpc = 126
- Global Const $rest_nosmmoreprograms = 127
- Global Const $rest_nosmmfuprograms = 128
- Global Const $rest_notrayitemsdisplay = 129
- Global Const $rest_notoolbarsontaskbar = 130
- Global Const $rest_nosmconfigureprograms = 131
- Global Const $rest_hideclock = 132
- Global Const $rest_nolowdiskspacechecks = 133
- Global Const $rest_noentirenetwork = 134
- Global Const $rest_nodesktopcleanup = 135
- Global Const $rest_bitbucknukeondelete = 136
- Global Const $rest_bitbuckconfirmdelete = 137
- Global Const $rest_bitbucknoprop = 138
- Global Const $rest_nodispbackground = 139
- Global Const $rest_nodispscreensavepg = 140
- Global Const $rest_nodispsettingspg = 141
- Global Const $rest_nodispscreensavepreview = 142
- Global Const $rest_nodisplaycpl = 143
- Global Const $rest_hiderunasverb = 144
- Global Const $rest_nothumbnailcache = 145
- Global Const $rest_nostrcmplogical = 146
- Global Const $rest_nopublishwizard = 147
- Global Const $rest_noonlineprintswizard = 148
- Global Const $rest_nowebservices = 149
- Global Const $rest_allowunhashedwebview = 150
- Global Const $rest_allowlegacywebview = 151
- Global Const $rest_revertwebviewsecurity = 152
- Global Const $rest_inheritconsolehandles = 153
- Global Const $rest_sortmaxitemcount = 154
- Global Const $rest_noremoterecursiveevents = 155
- Global Const $rest_noremotechangenotify = 156
- Global Const $rest_nosimplenetidlist = 157
- Global Const $rest_noenumentirenetwork = 158
- Global Const $rest_nodetailsthumbnailonnetwork = 159
- Global Const $rest_nointernetopenwith = 160
- Global Const $rest_allowlegacylmzbehavior = 161
- Global Const $rest_dontretrybadnetname = 162
- Global Const $rest_allowfileclsidjunctions = 163
- Global Const $rest_noupnpinstall = 164
- Global Const $rest_arp_dontgrouppatches = 165
- Global Const $rest_arp_nochooseprogramspage = 166
- Global Const $rest_nodisconnect = 167
- Global Const $rest_nosecurity = 168
- Global Const $rest_nofileassociate = 169
- Global Const $rest_allowcommenttoggle = 170
- Global Const $rest_usedesktopinicache = 171
- Global Const $gil_dontcache = 16
- Global Const $gil_notfilename = 8
- Global Const $gil_perclass = 4
- Global Const $gil_perinstance = 2
- Global Const $gil_simulatedoc = 1
- Global Const $gil_shield = 512
- Global Const $gil_forcenoshield = 1024
- Global Const $folderid_addnewprograms = "{DE61D971-5EBC-4F02-A3A9-6C82895E5C04}"
- Global Const $folderid_admintools = "{724EF170-A42D-4FEF-9F26-B60E846FBA4F}"
- Global Const $folderid_appupdates = "{A305CE99-F527-492B-8B1A-7E76FA98D6E4}"
- Global Const $folderid_cdburning = "{9E52AB10-F80D-49DF-ACB8-4330F5687855}"
- Global Const $folderid_changeremoveprograms = "{DF7266AC-9274-4867-8D55-3BD661DE872D}"
- Global Const $folderid_commonadmintools = "{D0384E7D-BAC3-4797-8F14-CBA229B392B5}"
- Global Const $folderid_commonoemlinks = "{C1BAE2D0-10DF-4334-BEDD-7AA20B227A9D}"
- Global Const $folderid_commonprograms = "{0139D44E-6AFE-49F2-8690-3DAFCAE6FFB8}"
- Global Const $folderid_commonstartmenu = "{A4115719-D62E-491D-AA7C-E74B8BE3B067}"
- Global Const $folderid_commonstartup = "{82A5EA35-D9CD-47C5-9629-E15D2F714E6E}"
- Global Const $folderid_commontemplates = "{B94237E7-57AC-4347-9151-B08C6C32D1F7}"
- Global Const $folderid_computerfolder = "{0AC0837C-BBF8-452A-850D-79D08E667CA7}"
- Global Const $folderid_conflictfolder = "{4BFEFB45-347D-4006-A5BE-AC0CB0567192}"
- Global Const $folderid_connectionsfolder = "{6F0CD92B-2E97-45D1-88FF-B0D186B8DEDD}"
- Global Const $folderid_contacts = "{56784854-C6CB-462B-8169-88E350ACB882}"
- Global Const $folderid_controlpanelfolder = "{82A74AEB-AEB4-465C-A014-D097EE346D63}"
- Global Const $folderid_cookies = "{2B0F765D-C0E9-4171-908E-08A611B84FF6}"
- Global Const $folderid_desktop = "{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}"
- Global Const $folderid_devicemetadatastore = "{5CE4A5E9-E4EB-479D-B89F-130C02886155}"
- Global Const $folderid_documentslibrary = "{7B0DB17D-9CD2-4A93-9733-46CC89022E7C}"
- Global Const $folderid_downloads = "{374DE290-123F-4565-9164-39C4925E467B}"
- Global Const $folderid_favorites = "{1777F761-68AD-4D8A-87BD-30B759FA33DD}"
- Global Const $folderid_fonts = "{FD228CB7-AE11-4AE3-864C-16F3910AB8FE}"
- Global Const $folderid_games = "{CAC52C1A-B53D-4EDC-92D7-6B2E8AC19434}"
- Global Const $folderid_gametasks = "{054FAE61-4DD8-4787-80B6-090220C4B700}"
- Global Const $folderid_history = "{D9DC8A3B-B784-432E-A781-5A1130A75963}"
- Global Const $folderid_homegroup = "{52528A6B-B9E3-4ADD-B60D-588C2DBA842D}"
- Global Const $folderid_implicitappshortcuts = "{BCB5256F-79F6-4CEE-B725-DC34E402FD46}"
- Global Const $folderid_internetcache = "{352481E8-33BE-4251-BA85-6007CAEDCF9D}"
- Global Const $folderid_internetfolder = "{4D9F7874-4E0C-4904-967B-40B0D20C3E4B}"
- Global Const $folderid_libraries = "{1B3EA5DC-B587-4786-B4EF-BD1DC332AEAE}"
- Global Const $folderid_links = "{BFB9D5E0-C6A9-404C-B2B2-AE6DB6AF4968}"
- Global Const $folderid_localappdata = "{F1B32785-6FBA-4FCF-9D55-7B8E7F157091}"
- Global Const $folderid_localappdatalow = "{A520A1A4-1780-4FF6-BD18-167343C5AF16}"
- Global Const $folderid_localizedresourcesdir = "{2A00375E-224C-49DE-B8D1-440DF7EF3DDC}"
- Global Const $folderid_music = "{4BD8D571-6D19-48D3-BE97-422220080E43}"
- Global Const $folderid_musiclibrary = "{2112AB0A-C86A-4FFE-A368-0DE96E47012E}"
- Global Const $folderid_nethood = "{C5ABBF53-E17F-4121-8900-86626FC2C973}"
- Global Const $folderid_networkfolder = "{D20BEEC4-5CA8-4905-AE3B-BF251EA09B53}"
- Global Const $folderid_originalimages = "{2C36C0AA-5812-4B87-BFD0-4CD0DFB19B39}"
- Global Const $folderid_photoalbums = "{69D2CF90-FC33-4FB7-9A0C-EBB0F0FCB43C}"
- Global Const $folderid_pictureslibrary = "{A990AE9F-A03B-4E80-94BC-9912D7504104}"
- Global Const $folderid_pictures = "{33E28130-4E1E-4676-835A-98395C3BC3BB}"
- Global Const $folderid_playlists = "{DE92C1C7-837F-4F69-A3BB-86E631204A23}"
- Global Const $folderid_printersfolder = "{76FC4E2D-D6AD-4519-A663-37BD56068185}"
- Global Const $folderid_printhood = "{9274BD8D-CFD1-41C3-B35E-B13F55A758F4}"
- Global Const $folderid_profile = "{5E6C858F-0E22-4760-9AFE-EA3317B67173}"
- Global Const $folderid_programdata = "{62AB5D82-FDC1-4DC3-A9DD-070D1D495D97}"
- Global Const $folderid_programfiles = "{905E63B6-C1BF-494E-B29C-65B732D3D21A}"
- Global Const $folderid_programfilesx64 = "{6D809377-6AF0-444B-8957-A3773F02200E}"
- Global Const $folderid_programfilesx86 = "{7C5A40EF-A0FB-4BFC-874A-C0F2E0B9FA8E}"
- Global Const $folderid_programfilescommon = "{F7F1ED05-9F6D-47A2-AAAE-29D317C6F066}"
- Global Const $folderid_programfilescommonx64 = "{6365D5A7-0F0D-45E5-87F6-0DA56B6A4F7D}"
- Global Const $folderid_programfilescommonx86 = "{DE974D24-D9C6-4D3E-BF91-F4455120B917}"
- Global Const $folderid_programs = "{A77F5D77-2E2B-44C3-A6A2-ABA601054A51}"
- Global Const $folderid_public = "{DFDF76A2-C82A-4D63-906A-5644AC457385}"
- Global Const $folderid_publicdesktop = "{C4AA340D-F20F-4863-AFEF-F87EF2E6BA25}"
- Global Const $folderid_publicdocuments = "{ED4824AF-DCE4-45A8-81E2-FC7965083634}"
- Global Const $folderid_publicdownloads = "{3D644C9B-1FB8-4F30-9B45-F670235F79C0}"
- Global Const $folderid_publicgametasks = "{DEBF2536-E1A8-4C59-B6A2-414586476AEA}"
- Global Const $folderid_publiclibraries = "{48DAF80B-E6CF-4F4E-B800-0E69D84EE384}"
- Global Const $folderid_publicmusic = "{3214FAB5-9757-4298-BB61-92A9DEAA44FF}"
- Global Const $folderid_publicpictures = "{B6EBFB86-6907-413C-9AF7-4FC2ABF07CC5}"
- Global Const $folderid_publicringtones = "{E555AB60-153B-4D17-9F04-A5FE99FC15EC}"
- Global Const $folderid_publicvideos = "{2400183A-6185-49FB-A2D8-4A392A602BA3}"
- Global Const $folderid_quicklaunch = "{52A4F021-7B75-48A9-9F6B-4B87A210BC8F}"
- Global Const $folderid_recent = "{AE50C081-EBD2-438A-8655-8A092E34987A}"
- Global Const $folderid_recordedtvlibrary = "{1A6FDBA2-F42D-4358-A798-B74D745926C5}"
- Global Const $folderid_recyclebinfolder = "{B7534046-3ECB-4C18-BE4E-64CD4CB7D6AC}"
- Global Const $folderid_resourcedir = "{8AD10C31-2ADB-4296-A8F7-E4701232C972}"
- Global Const $folderid_ringtones = "{C870044B-F49E-4126-A9C3-B52A1FF411E8}"
- Global Const $folderid_roamingappdata = "{3EB685DB-65F9-4CF6-A03A-E3EF65729F3D}"
- Global Const $folderid_samplemusic = "{B250C668-F57D-4EE1-A63C-290EE7D1AA1F}"
- Global Const $folderid_samplepictures = "{C4900540-2379-4C75-844B-64E6FAF8716B}"
- Global Const $folderid_sampleplaylists = "{15CA69B3-30EE-49C1-ACE1-6B5EC372AFB5}"
- Global Const $folderid_samplevideos = "{859EAD94-2E85-48AD-A71A-0969CB56A6CD}"
- Global Const $folderid_savedgames = "{4C5C32FF-BB9D-43B0-B5B4-2D72E54EAAA4}"
- Global Const $folderid_savedsearches = "{7D1D3A04-DEBB-4115-95CF-2F29DA2920DA}"
- Global Const $folderid_search_csc = "{EE32E446-31CA-4ABA-814F-A5EBD2FD6D5E}"
- Global Const $folderid_search_mapi = "{98EC0E18-2098-4D44-8644-66979315A281}"
- Global Const $folderid_searchhome = "{190337D1-B8CA-4121-A639-6D472D16972A}"
- Global Const $folderid_sendto = "{8983036C-27C0-404B-8F08-102D10DCFD74}"
- Global Const $folderid_sidebardefaultparts = "{7B396E54-9EC5-4300-BE0A-2482EBAE1A26}"
- Global Const $folderid_sidebarparts = "{A75D362E-50FC-4FB7-AC2C-A8BEAA314493}"
- Global Const $folderid_startmenu = "{625B53C3-AB48-4EC1-BA1F-A1EF4146FC19}"
- Global Const $folderid_startup = "{B97D20BB-F46A-4C97-BA10-5E3608430854}"
- Global Const $folderid_syncmanagerfolder = "{43668BF8-C14E-49B2-97C9-747784D784B7}"
- Global Const $folderid_syncresultsfolder = "{289A9A43-BE44-4057-A41B-587A76D7E7F9}"
- Global Const $folderid_syncsetupfolder = "{0F214138-B1D3-4A90-BBA9-27CBC0C5389A}"
- Global Const $folderid_system = "{1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}"
- Global Const $folderid_systemx86 = "{D65231B0-B2F1-4857-A4CE-A8E7C6EA7D27}"
- Global Const $folderid_templates = "{A63293E8-664E-48DB-A079-DF759E0509F7}"
- Global Const $folderid_userpinned = "{9E3995AB-1F9C-4F13-B827-48B24B6C7174}"
- Global Const $folderid_userprofiles = "{0762D272-C50A-4BB0-A382-697DCD729B80}"
- Global Const $folderid_userprogramfiles = "{5CD7AEE2-2219-4A67-B85D-6C9CE15660CB}"
- Global Const $folderid_userprogramfilescommon = "{BCBD3057-CA5C-4622-B42D-BC56DB0AE516}"
- Global Const $folderid_usersfiles = "{F3CE0F7C-4901-4ACC-8648-D5D44B04EF8F}"
- Global Const $folderid_userslibraries = "{A302545D-DEFF-464B-ABE8-61C8648D939B}"
- Global Const $folderid_videos = "{18989B1D-99B5-455B-841C-AB7C74E4DDFC}"
- Global Const $folderid_videoslibrary = "{491E922F-5643-4AF4-A7EB-4E7A138D8174}"
- Global Const $folderid_windows = "{F38BF404-1D43-42F2-9305-67DE0B28FC23}"
- Global Const $kf_flag_alias_only = -2147483648
- Global Const $kf_flag_create = 32768
- Global Const $kf_flag_dont_verify = 16384
- Global Const $kf_flag_dont_unexpand = 8192
- Global Const $kf_flag_no_alias = 4096
- Global Const $kf_flag_init = 2048
- Global Const $kf_flag_default_path = 1024
- Global Const $kf_flag_no_appcontainer_redirection = 65536
- Global Const $kf_flag_not_parent_relative = 512
- Global Const $kf_flag_simple_idlist = 256
- Global Const $coinit_apartmentthreaded = 2
- Global Const $coinit_disable_ole1dde = 4
- Global Const $coinit_multithreaded = 0
- Global Const $coinit_speed_over_memory = 8
- Global Const $tagpoint = "struct;long X;long Y;endstruct"
- Global Const $tagrect = "struct;long Left;long Top;long Right;long Bottom;endstruct"
- Global Const $tagsize = "struct;long X;long Y;endstruct"
- Global Const $tagmargins = "int cxLeftWidth;int cxRightWidth;int cyTopHeight;int cyBottomHeight"
- Global Const $tagfiletime = "struct;dword Lo;dword Hi;endstruct"
- Global Const $tagsystemtime = "struct;word Year;word Month;word Dow;word Day;word Hour;word Minute;word Second;word MSeconds;endstruct"
- 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"
- Global Const $tagnmhdr = "struct;hwnd hWndFrom;uint_ptr IDFrom;INT Code;endstruct"
- Global Const $tagcomboboxexitem = "uint Mask;int_ptr Item;ptr Text;int TextMax;int Image;int SelectedImage;int OverlayImage;" & "int Indent;lparam Param"
- Global Const $tagnmcbedragbegin = $tagnmhdr & ";int ItemID;wchar szText[260]"
- Global Const $tagnmcbeendedit = $tagnmhdr & ";bool fChanged;int NewSelection;wchar szText[260];int Why"
- Global Const $tagnmcomboboxex = $tagnmhdr & ";uint Mask;int_ptr Item;ptr Text;int TextMax;int Image;" & "int SelectedImage;int OverlayImage;int Indent;lparam Param"
- 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"
- Global Const $tagnmdatetimechange = $tagnmhdr & ";dword Flag;" & $tagsystemtime
- Global Const $tagnmdatetimeformat = $tagnmhdr & ";ptr Format;" & $tagsystemtime & ";ptr pDisplay;wchar Display[64]"
- Global Const $tagnmdatetimeformatquery = $tagnmhdr & ";ptr Format;struct;long SizeX;long SizeY;endstruct"
- Global Const $tagnmdatetimekeydown = $tagnmhdr & ";int VirtKey;ptr Format;" & $tagsystemtime
- Global Const $tagnmdatetimestring = $tagnmhdr & ";ptr UserString;" & $tagsystemtime & ";dword Flags"
- 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"
- Global Const $taggdip_effectparams_blur = "float Radius; bool ExpandEdge"
- Global Const $taggdip_effectparams_brightnesscontrast = "int BrightnessLevel; int ContrastLevel"
- Global Const $taggdip_effectparams_colorbalance = "int CyanRed; int MagentaGreen; int YellowBlue"
- Global Const $taggdip_effectparams_colorcurve = "int Adjustment; int Channel; int AdjustValue"
- Global Const $taggdip_effectparams_colorlut = "byte LutB[256]; byte LutG[256]; byte LutR[256]; byte LutA[256]"
- Global Const $taggdip_effectparams_huesaturationlightness = "int HueLevel; int SaturationLevel; int LightnessLevel"
- Global Const $taggdip_effectparams_levels = "int Highlight; int Midtone; int Shadow"
- Global Const $taggdip_effectparams_redeyecorrection = "uint NumberOfAreas; ptr Areas"
- Global Const $taggdip_effectparams_sharpen = "float Radius; float Amount"
- Global Const $taggdip_effectparams_tint = "int Hue; int Amount"
- Global Const $taggdipbitmapdata = "uint Width;uint Height;int Stride;int Format;ptr Scan0;uint_ptr Reserved"
- Global Const $taggdipcolormatrix = "float m[25]"
- Global Const $taggdipencoderparam = "struct;byte GUID[16];ulong NumberOfValues;ulong Type;ptr Values;endstruct"
- Global Const $taggdipencoderparams = "uint Count;" & $taggdipencoderparam
- Global Const $taggdiprectf = "struct;float X;float Y;float Width;float Height;endstruct"
- Global Const $taggdipstartupinput = "uint Version;ptr Callback;bool NoThread;bool NoCodecs"
- Global Const $taggdipstartupoutput = "ptr HookProc;ptr UnhookProc"
- 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"
- Global Const $taggdippencoderparams = "uint Count;byte Params[1]"
- 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"
- Global Const $tagnmhddispinfo = $tagnmhdr & ";int Item;uint Mask;ptr Text;int TextMax;int Image;lparam lParam"
- Global Const $tagnmhdfilterbtnclick = $tagnmhdr & ";int Item;" & $tagrect
- Global Const $tagnmheader = $tagnmhdr & ";int Item;int Button;ptr pItem"
- Global Const $taggetipaddress = "byte Field4;byte Field3;byte Field2;byte Field1"
- Global Const $tagnmipaddress = $tagnmhdr & ";int Field;int Value"
- Global Const $taglvfindinfo = "struct;uint Flags;ptr Text;lparam Param;" & $tagpoint & ";uint Direction;endstruct"
- Global Const $taglvhittestinfo = $tagpoint & ";uint Flags;int Item;int SubItem;int iGroup"
- 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"
- Global Const $tagnmlistview = $tagnmhdr & ";int Item;int SubItem;uint NewState;uint OldState;uint Changed;" & "struct;long ActionX;long ActionY;endstruct;lparam Param"
- 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"
- Global Const $tagnmlvdispinfo = $tagnmhdr & ";" & $taglvitem
- Global Const $tagnmlvfinditem = $tagnmhdr & ";int Start;" & $taglvfindinfo
- Global Const $tagnmlvgetinfotip = $tagnmhdr & ";dword Flags;ptr Text;int TextMax;int Item;int SubItem;lparam lParam"
- Global Const $tagnmitemactivate = $tagnmhdr & ";int Index;int SubItem;uint NewState;uint OldState;uint Changed;" & $tagpoint & ";lparam lParam;uint KeyFlags"
- Global Const $tagnmlvkeydown = "align 1;" & $tagnmhdr & ";word VKey;uint Flags"
- Global Const $tagnmlvscroll = $tagnmhdr & ";int DX;int DY"
- Global Const $tagmchittestinfo = "uint Size;" & $tagpoint & ";uint Hit;" & $tagsystemtime & ";" & $tagrect & ";int iOffset;int iRow;int iCol"
- 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"
- 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"
- 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"
- Global Const $tagnmdaystate = $tagnmhdr & ";" & $tagsystemtime & ";int DayState;ptr pDayState"
- 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"
- Global Const $tagnmobjectnotify = $tagnmhdr & ";int Item;ptr piid;ptr pObject;long Result;dword dwFlags"
- Global Const $tagnmtckeydown = "align 1;" & $tagnmhdr & ";word VKey;uint Flags"
- 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"
- Global Const $tagtvitemex = "struct;" & $tagtvitem & ";int Integral;uint uStateEx;hwnd hwnd;int iExpandedImage;int iReserved;endstruct"
- 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"
- Global Const $tagnmtvcustomdraw = "struct;" & $tagnmhdr & ";dword DrawStage;handle HDC;" & $tagrect & ";dword_ptr ItemSpec;uint ItemState;lparam ItemParam;endstruct" & ";dword ClrText;dword ClrTextBk;int Level"
- Global Const $tagnmtvdispinfo = $tagnmhdr & ";" & $tagtvitem
- Global Const $tagnmtvgetinfotip = $tagnmhdr & ";ptr Text;int TextMax;handle hItem;lparam lParam"
- Global Const $tagnmtvitemchange = $tagnmhdr & ";uint Changed;handle hItem;uint StateNew;uint StateOld;lparam lParam;"
- Global Const $tagtvhittestinfo = $tagpoint & ";uint Flags;handle Item"
- Global Const $tagnmtvkeydown = "align 1;" & $tagnmhdr & ";word VKey;uint Flags"
- Global Const $tagnmmouse = $tagnmhdr & ";dword_ptr ItemSpec;dword_ptr ItemData;" & $tagpoint & ";lparam HitInfo"
- Global Const $tagtoken_privileges = "dword Count;align 4;int64 LUID;dword Attributes"
- Global Const $tagimageinfo = "handle hBitmap;handle hMask;int Unused1;int Unused2;" & $tagrect
- Global Const $tagmenuinfo = "dword Size;INT Mask;dword Style;uint YMax;handle hBack;dword ContextHelpID;ulong_ptr MenuData"
- 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"
- 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")
- Global Const $tagnmrebarautobreak = $tagnmhdr & ";uint uBand;uint wID;lparam lParam;uint uMsg;uint fStyleCurrent;bool fAutoBreak"
- 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"
- Global Const $tagnmrebar = $tagnmhdr & ";dword dwMask;uint uBand;uint fStyle;uint wID;lparam lParam"
- Global Const $tagnmrebarchevron = $tagnmhdr & ";uint uBand;uint wID;lparam lParam;" & $tagrect & ";lparam lParamNM"
- 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"
- Global Const $tagcolorscheme = "dword Size;dword BtnHighlight;dword BtnShadow"
- 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
- Global Const $tagnmtbhotitem = $tagnmhdr & ";int idOld;int idNew;dword dwFlags"
- Global Const $tagtbbutton = "int Bitmap;int Command;byte State;byte Style;dword_ptr Param;int_ptr String"
- Global Const $tagtbbuttoninfo = "uint Size;dword Mask;int Command;int Image;byte State;byte Style;word CX;dword_ptr Param;ptr Text;int TextMax"
- Global Const $tagnetresource = "dword Scope;dword Type;dword DisplayType;dword Usage;ptr LocalName;ptr RemoteName;ptr Comment;ptr Provider"
- Global Const $tagoverlapped = "ulong_ptr Internal;ulong_ptr InternalHigh;struct;dword Offset;dword OffsetHigh;endstruct;handle hEvent"
- 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"
- 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"
- Global Const $tagbitmapinfo = $tagbitmapinfoheader & ";dword biRGBQuad[1]"
- Global Const $tagblendfunction = "byte Op;byte Flags;byte Alpha;byte Format"
- Global Const $tagguid = "struct;ulong Data1;ushort Data2;ushort Data3;byte Data4[8];endstruct"
- Global Const $tagwindowplacement = "uint length;uint flags;uint showCmd;long ptMinPosition[2];long ptMaxPosition[2];long rcNormalPosition[4]"
- Global Const $tagwindowpos = "hwnd hWnd;hwnd InsertAfter;int X;int Y;int CX;int CY;uint Flags"
- Global Const $tagscrollinfo = "uint cbSize;uint fMask;int nMin;int nMax;uint nPage;int nPos;int nTrackPos"
- Global Const $tagscrollbarinfo = "dword cbSize;" & $tagrect & ";int dxyLineButton;int xyThumbTop;" & "int xyThumbBottom;int reserved;dword rgstate[6]"
- 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"
- Global Const $tagkbdllhookstruct = "dword vkCode;dword scanCode;dword flags;dword time;ulong_ptr dwExtraInfo"
- Global Const $tagprocess_information = "handle hProcess;handle hThread;dword ProcessID;dword ThreadID"
- 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"
- Global Const $tagsecurity_attributes = "dword Length;ptr Descriptor;bool InheritHandle"
- 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]"
- 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"
- Func _winapi_getlasterror(Const $_icurrenterror = @error, Const $_icurrentextended = @extended)
- Local $aresult = DllCall("kernel32.dll", "dword", "GetLastError")
- Return SetError($_icurrenterror, $_icurrentextended, $aresult[0])
- EndFunc
- Func _winapi_setlasterror($ierrorcode, Const $_icurrenterror = @error, Const $_icurrentextended = @extended)
- DllCall("kernel32.dll", "none", "SetLastError", "dword", $ierrorcode)
- Return SetError($_icurrenterror, $_icurrentextended, NULL )
- EndFunc
- Func __comerrorformating($ocomerror, $sprefix = @TAB)
- Local Const $str_striptrailing = 2
- 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)
- Return $serror
- EndFunc
- #Region Global Variables and Constants
- Global $__g_venum, $__g_vext = 0
- Global $__g_hheap = 0, $__g_irgbmode = 1
- Global Const $tagosversioninfo = "struct;dword OSVersionInfoSize;dword MajorVersion;dword MinorVersion;dword BuildNumber;dword PlatformId;wchar CSDVersion[128];endstruct"
- Global Const $__winver = __winver()
- #EndRegion Global Variables and Constants
- #Region Functions list
- #EndRegion Functions list
- #Region Public Functions
- Func _winapi_arraytostruct(Const ByRef $adata, $istart = 0, $iend = -1)
- If __checkerrorarraybounds($adata, $istart, $iend) Then Return SetError(@error + 10, @extended, 0)
- Local $tagstruct = ""
- For $i = $istart To $iend
- $tagstruct &= "wchar[" & (StringLen($adata[$i]) + 1) & "];"
- Next
- Local $tdata = DllStructCreate($tagstruct & "wchar[1]")
- Local $icount = 1
- For $i = $istart To $iend
- DllStructSetData($tdata, $icount, $adata[$i])
- $icount += 1
- Next
- DllStructSetData($tdata, $icount, ChrW(0))
- Return $tdata
- EndFunc
- Func _winapi_createmargins($ileftwidth, $irightwidth, $itopheight, $ibottomheight)
- Local $tmargins = DllStructCreate($tagmargins)
- DllStructSetData($tmargins, 1, $ileftwidth)
- DllStructSetData($tmargins, 2, $irightwidth)
- DllStructSetData($tmargins, 3, $itopheight)
- DllStructSetData($tmargins, 4, $ibottomheight)
- Return $tmargins
- EndFunc
- Func _winapi_createpoint($ix, $iy)
- Local $tpoint = DllStructCreate($tagpoint)
- DllStructSetData($tpoint, 1, $ix)
- DllStructSetData($tpoint, 2, $iy)
- Return $tpoint
- EndFunc
- Func _winapi_createrect($ileft, $itop, $iright, $ibottom)
- Local $trect = DllStructCreate($tagrect)
- DllStructSetData($trect, 1, $ileft)
- DllStructSetData($trect, 2, $itop)
- DllStructSetData($trect, 3, $iright)
- DllStructSetData($trect, 4, $ibottom)
- Return $trect
- EndFunc
- Func _winapi_createrectex($ix, $iy, $iwidth, $iheight)
- Local $trect = DllStructCreate($tagrect)
- DllStructSetData($trect, 1, $ix)
- DllStructSetData($trect, 2, $iy)
- DllStructSetData($trect, 3, $ix + $iwidth)
- DllStructSetData($trect, 4, $iy + $iheight)
- Return $trect
- EndFunc
- Func _winapi_createsize($iwidth, $iheight)
- Local $tsize = DllStructCreate($tagsize)
- DllStructSetData($tsize, 1, $iwidth)
- DllStructSetData($tsize, 2, $iheight)
- Return $tsize
- EndFunc
- Func _winapi_fatalexit($icode)
- DllCall("kernel32.dll", "none", "FatalExit", "int", $icode)
- If @error Then Return SetError(@error, @extended)
- EndFunc
- Func _winapi_getbitmapdimension($hbitmap)
- Local Const $tagbitmap = "struct;long bmType;long bmWidth;long bmHeight;long bmWidthBytes;ushort bmPlanes;ushort bmBitsPixel;ptr bmBits;endstruct"
- Local $tobj = DllStructCreate($tagbitmap)
- Local $aret = DllCall("gdi32.dll", "int", "GetObject", "handle", $hbitmap, "int", DllStructGetSize($tobj), "struct*", $tobj)
- If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
- Return _winapi_createsize(DllStructGetData($tobj, "bmWidth"), DllStructGetData($tobj, "bmHeight"))
- EndFunc
- Func _winapi_getstring($pstring, $bunicode = True)
- Local $ilength = _winapi_strlen($pstring, $bunicode)
- If @error OR NOT $ilength Then Return SetError(@error + 10, @extended, "")
- Local $tstring = DllStructCreate(__iif($bunicode, "wchar", "char") & "[" & ($ilength + 1) & "]", $pstring)
- If @error Then Return SetError(@error, @extended, "")
- Return SetExtended($ilength, DllStructGetData($tstring, 1))
- EndFunc
- Func _winapi_isbadreadptr($paddress, $ilength)
- Local $aret = DllCall("kernel32.dll", "bool", "IsBadReadPtr", "struct*", $paddress, "uint_ptr", $ilength)
- If @error Then Return SetError(@error, @extended, False)
- Return $aret[0]
- EndFunc
- Func _winapi_isbadwriteptr($paddress, $ilength)
- Local $aret = DllCall("kernel32.dll", "bool", "IsBadWritePtr", "struct*", $paddress, "uint_ptr", $ilength)
- If @error Then Return SetError(@error, @extended, False)
- Return $aret[0]
- EndFunc
- Func _winapi_iswow64process($ipid = 0)
- If NOT $ipid Then $ipid = @AutoItPID
- Local $hprocess = DllCall("kernel32.dll", "handle", "OpenProcess", "dword", __iif($__winver < 1536, 1024, 4096), "bool", 0, "dword", $ipid)
- If @error OR NOT $hprocess[0] Then Return SetError(@error + 20, @extended, False)
- Local $aret = DllCall("kernel32.dll", "bool", "IsWow64Process", "handle", $hprocess[0], "bool*", 0)
- If __checkerrorclosehandle($aret, $hprocess[0]) Then Return SetError(@error, @extended, False)
- Return $aret[2]
- EndFunc
- Func _winapi_movememory($pdestination, $psource, $ilength)
- If _winapi_isbadreadptr($psource, $ilength) Then Return SetError(10, @extended, 0)
- If _winapi_isbadwriteptr($pdestination, $ilength) Then Return SetError(11, @extended, 0)
- DllCall("ntdll.dll", "none", "RtlMoveMemory", "struct*", $pdestination, "struct*", $psource, "ulong_ptr", $ilength)
- If @error Then Return SetError(@error, @extended, 0)
- Return 1
- EndFunc
- Func _winapi_pathisdirectory($sfilepath)
- Local $aret = DllCall("shlwapi.dll", "bool", "PathIsDirectoryW", "wstr", $sfilepath)
- If @error Then Return SetError(@error, @extended, False)
- Return $aret[0]
- EndFunc
- Func _winapi_strlen($pstring, $bunicode = True)
- Local $w = ""
- If $bunicode Then $w = "W"
- Local $aret = DllCall("kernel32.dll", "int", "lstrlen" & $w, "struct*", $pstring)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aret[0]
- EndFunc
- Func _winapi_structtoarray(ByRef $tstruct, $iitems = 0)
- Local $isize = 2 * Floor(DllStructGetSize($tstruct) / 2)
- Local $pstruct = DllStructGetPtr($tstruct)
- If NOT $isize OR NOT $pstruct Then Return SetError(1, 0, 0)
- Local $tdata, $ilength, $ioffset = 0
- Local $aresult[101] = [0]
- While 1
- $ilength = _winapi_strlen($pstruct + $ioffset)
- If NOT $ilength Then
- ExitLoop
- EndIf
- If 2 * (1 + $ilength) + $ioffset > $isize Then Return SetError(3, 0, 0)
- $tdata = DllStructCreate("wchar[" & (1 + $ilength) & "]", $pstruct + $ioffset)
- If @error Then Return SetError(@error + 10, 0, 0)
- __inc($aresult)
- $aresult[$aresult[0]] = DllStructGetData($tdata, 1)
- If $aresult[0] = $iitems Then
- ExitLoop
- EndIf
- $ioffset += 2 * (1 + $ilength)
- If $ioffset >= $isize Then Return SetError(3, 0, 0)
- WEnd
- If NOT $aresult[0] Then Return SetError(2, 0, 0)
- __inc($aresult, -1)
- Return $aresult
- EndFunc
- Func _winapi_swapdword($ivalue)
- Local $tstruct1 = DllStructCreate("dword;dword")
- Local $tstruct2 = DllStructCreate("byte[4];byte[4]", DllStructGetPtr($tstruct1))
- DllStructSetData($tstruct1, 1, $ivalue)
- For $i = 1 To 4
- DllStructSetData($tstruct2, 2, DllStructGetData($tstruct2, 1, 5 - $i), $i)
- Next
- Return DllStructGetData($tstruct1, 2)
- EndFunc
- Func _winapi_swapqword($ivalue)
- Local $tstruct1 = DllStructCreate("int64;int64")
- Local $tstruct2 = DllStructCreate("byte[8];byte[8]", DllStructGetPtr($tstruct1))
- DllStructSetData($tstruct1, 1, $ivalue)
- For $i = 1 To 8
- DllStructSetData($tstruct2, 2, DllStructGetData($tstruct2, 1, 9 - $i), $i)
- Next
- Return DllStructGetData($tstruct1, 2)
- EndFunc
- Func _winapi_swapword($ivalue)
- Local $tstruct1 = DllStructCreate("word;word")
- Local $tstruct2 = DllStructCreate("byte[2];byte[2]", DllStructGetPtr($tstruct1))
- DllStructSetData($tstruct1, 1, $ivalue)
- For $i = 1 To 2
- DllStructSetData($tstruct2, 2, DllStructGetData($tstruct2, 1, 3 - $i), $i)
- Next
- Return DllStructGetData($tstruct1, 2)
- EndFunc
- Func _winapi_switchcolor($icolor)
- If $icolor = -1 Then Return $icolor
- Return BitOR(BitAND($icolor, 65280), BitShift(BitAND($icolor, 255), -16), BitShift(BitAND($icolor, 16711680), 16))
- EndFunc
- Func _winapi_zeromemory($pmemory, $ilength)
- If _winapi_isbadwriteptr($pmemory, $ilength) Then Return SetError(11, @extended, 0)
- DllCall("ntdll.dll", "none", "RtlZeroMemory", "struct*", $pmemory, "ulong_ptr", $ilength)
- If @error Then Return SetError(@error, @extended, 0)
- Return 1
- EndFunc
- #EndRegion Public Functions
- #Region Internal Functions
- Func __checkerrorarraybounds(Const ByRef $adata, ByRef $istart, ByRef $iend, $ndim = 1, $idim = $ubound_dimensions)
- If NOT IsArray($adata) Then Return SetError(1, 0, 1)
- If UBound($adata, $idim) <> $ndim Then Return SetError(2, 0, 1)
- If $istart < 0 Then $istart = 0
- Local $iubound = UBound($adata) - 1
- If $iend < 1 OR $iend > $iubound Then $iend = $iubound
- If $istart > $iend Then Return SetError(4, 0, 1)
- Return 0
- EndFunc
- Func __checkerrorclosehandle($aret, $hfile, $blasterror = 0, $icurerr = @error, $icurext = @extended)
- If NOT $icurerr AND NOT $aret[0] Then $icurerr = 10
- Local $ilasterror = _winapi_getlasterror()
- DllCall("kernel32.dll", "bool", "CloseHandle", "handle", $hfile)
- If $icurerr Then _winapi_setlasterror($ilasterror)
- If $blasterror Then $icurext = $ilasterror
- Return SetError($icurerr, $icurext, $icurerr)
- EndFunc
- Func __dll($spath, $bpin = False)
- Local $aret = DllCall("kernel32.dll", "bool", "GetModuleHandleExW", "dword", __iif($bpin, 1, 2), "wstr", $spath, "ptr*", 0)
- If NOT $aret[3] Then
- Local $aresult = DllCall("kernel32.dll", "handle", "LoadLibraryW", "wstr", $spath)
- If NOT $aresult[0] Then Return 0
- EndIf
- Return 1
- EndFunc
- Func __enumwindowsproc($hwnd, $bvisible)
- Local $aresult
- If $bvisible Then
- $aresult = DllCall("user32.dll", "bool", "IsWindowVisible", "hwnd", $hwnd)
- If NOT $aresult[0] Then
- Return 1
- EndIf
- EndIf
- __inc($__g_venum)
- $__g_venum[$__g_venum[0][0]][0] = $hwnd
- $aresult = DllCall("user32.dll", "int", "GetClassNameW", "hwnd", $hwnd, "wstr", "", "int", 4096)
- $__g_venum[$__g_venum[0][0]][1] = $aresult[2]
- Return 1
- EndFunc
- Func __fatalexit($icode, $stext = "")
- If $stext Then MsgBox($mb_systemmodal, "AutoIt", $stext)
- _winapi_fatalexit($icode)
- EndFunc
- Func __heapalloc($isize, $babort = False)
- Local $aret
- If NOT $__g_hheap Then
- $aret = DllCall("kernel32.dll", "handle", "HeapCreate", "dword", 0, "ulong_ptr", 0, "ulong_ptr", 0)
- If @error OR NOT $aret[0] Then __fatalexit(1, "Error allocating memory.")
- $__g_hheap = $aret[0]
- EndIf
- $aret = DllCall("kernel32.dll", "ptr", "HeapAlloc", "handle", $__g_hheap, "dword", 8, "ulong_ptr", $isize)
- If @error OR NOT $aret[0] Then
- If $babort Then __fatalexit(1, "Error allocating memory.")
- Return SetError(@error + 30, @extended, 0)
- EndIf
- Return $aret[0]
- EndFunc
- Func __heapfree(ByRef $pmemory, $bcheck = False, $icurerr = @error, $icurext = @extended)
- If $bcheck AND (NOT __heapvalidate($pmemory)) Then Return SetError(@error, @extended, 0)
- Local $aret = DllCall("kernel32.dll", "int", "HeapFree", "handle", $__g_hheap, "dword", 0, "ptr", $pmemory)
- If @error OR NOT $aret[0] Then Return SetError(@error + 40, @extended, 0)
- $pmemory = 0
- Return SetError($icurerr, $icurext, 1)
- EndFunc
- Func __heaprealloc($pmemory, $isize, $bamount = False, $babort = False)
- Local $aret, $pret
- If __heapvalidate($pmemory) Then
- If $bamount AND (__heapsize($pmemory) >= $isize) Then Return SetExtended(1, Ptr($pmemory))
- $aret = DllCall("kernel32.dll", "ptr", "HeapReAlloc", "handle", $__g_hheap, "dword", 8, "ptr", $pmemory, "ulong_ptr", $isize)
- If @error OR NOT $aret[0] Then
- If $babort Then __fatalexit(1, "Error allocating memory.")
- Return SetError(@error + 20, @extended, Ptr($pmemory))
- EndIf
- $pret = $aret[0]
- Else
- $pret = __heapalloc($isize, $babort)
- If @error Then Return SetError(@error, @extended, 0)
- EndIf
- Return $pret
- EndFunc
- Func __heapsize($pmemory, $bcheck = False)
- If $bcheck AND (NOT __heapvalidate($pmemory)) Then Return SetError(@error, @extended, 0)
- Local $aret = DllCall("kernel32.dll", "ulong_ptr", "HeapSize", "handle", $__g_hheap, "dword", 0, "ptr", $pmemory)
- If @error OR ($aret[0] = Ptr(-1)) Then Return SetError(@error + 50, @extended, 0)
- Return $aret[0]
- EndFunc
- Func __heapvalidate($pmemory)
- If (NOT $__g_hheap) OR (NOT Ptr($pmemory)) Then Return SetError(9, 0, False)
- Local $aret = DllCall("kernel32.dll", "int", "HeapValidate", "handle", $__g_hheap, "dword", 0, "ptr", $pmemory)
- If @error Then Return SetError(@error, @extended, False)
- Return $aret[0]
- EndFunc
- Func __inc(ByRef $adata, $iincrement = 100)
- Select
- Case UBound($adata, $ubound_columns)
- If $iincrement < 0 Then
- ReDim $adata[$adata[0][0] + 1][UBound($adata, $ubound_columns)]
- Else
- $adata[0][0] += 1
- If $adata[0][0] > UBound($adata) - 1 Then
- ReDim $adata[$adata[0][0] + $iincrement][UBound($adata, $ubound_columns)]
- EndIf
- EndIf
- Case UBound($adata, $ubound_rows)
- If $iincrement < 0 Then
- ReDim $adata[$adata[0] + 1]
- Else
- $adata[0] += 1
- If $adata[0] > UBound($adata) - 1 Then
- ReDim $adata[$adata[0] + $iincrement]
- EndIf
- EndIf
- Case Else
- Return 0
- EndSelect
- Return 1
- EndFunc
- Func __iif($btest, $vtrue, $vfalse)
- Return $btest ? $vtrue : $vfalse
- EndFunc
- Func __init($ddata)
- Local $ilength = BinaryLen($ddata)
- Local $aret = DllCall("kernel32.dll", "ptr", "VirtualAlloc", "ptr", 0, "ulong_ptr", $ilength, "dword", 4096, "dword", 64)
- If @error OR NOT $aret[0] Then __fatalexit(1, "Error allocating memory.")
- Local $tdata = DllStructCreate("byte[" & $ilength & "]", $aret[0])
- DllStructSetData($tdata, 1, $ddata)
- Return $aret[0]
- EndFunc
- Func __rgb($icolor)
- If $__g_irgbmode Then
- $icolor = _winapi_switchcolor($icolor)
- EndIf
- Return $icolor
- EndFunc
- Func __winver()
- Local $tosvi = DllStructCreate($tagosversioninfo)
- DllStructSetData($tosvi, 1, DllStructGetSize($tosvi))
- Local $aret = DllCall("kernel32.dll", "bool", "GetVersionExW", "struct*", $tosvi)
- If @error OR NOT $aret[0] Then Return SetError(@error, @extended, 0)
- Return BitOR(BitShift(DllStructGetData($tosvi, 2), -8), DllStructGetData($tosvi, 3))
- EndFunc
- #EndRegion Internal Functions
- #Region Global Variables and Constants
- Global Const $__tagwinapicom_guid = "struct;ulong Data1;ushort Data2;ushort Data3;byte Data4[8];endstruct"
- #EndRegion Global Variables and Constants
- #Region Functions list
- #EndRegion Functions list
- #Region Public Functions
- Func _winapi_clsidfromprogid($sprogid)
- Local $tguid = DllStructCreate($__tagwinapicom_guid)
- Local $areturn = DllCall("ole32.dll", "long", "CLSIDFromProgID", "wstr", $sprogid, "struct*", $tguid)
- If @error Then Return SetError(@error, @extended, "")
- If $areturn[0] Then Return SetError(10, $areturn[0], "")
- $areturn = DllCall("ole32.dll", "int", "StringFromGUID2", "struct*", $tguid, "wstr", "", "int", 39)
- If @error OR NOT $areturn[0] Then Return SetError(@error + 20, @extended, "")
- Return $areturn[2]
- EndFunc
- Func _winapi_coinitialize($iflags = 0)
- Local $areturn = DllCall("ole32.dll", "long", "CoInitializeEx", "ptr", 0, "dword", $iflags)
- If @error Then Return SetError(@error, @extended, 0)
- If $areturn[0] Then Return SetError(10, $areturn[0], 0)
- Return 1
- EndFunc
- Func _winapi_cotaskmemalloc($isize)
- Local $areturn = DllCall("ole32.dll", "ptr", "CoTaskMemAlloc", "uint_ptr", $isize)
- If @error Then Return SetError(@error, @extended, 0)
- Return $areturn[0]
- EndFunc
- Func _winapi_cotaskmemfree($pmemory)
- DllCall("ole32.dll", "none", "CoTaskMemFree", "ptr", $pmemory)
- If @error Then Return SetError(@error, @extended, 0)
- Return 1
- EndFunc
- Func _winapi_cotaskmemrealloc($pmemory, $isize)
- Local $areturn = DllCall("ole32.dll", "ptr", "CoTaskMemRealloc", "ptr", $pmemory, "ulong_ptr", $isize)
- If @error Then Return SetError(@error, @extended, 0)
- Return $areturn[0]
- EndFunc
- Func _winapi_couninitialize()
- DllCall("ole32.dll", "none", "CoUninitialize")
- If @error Then Return SetError(@error, @extended, 0)
- Return 1
- EndFunc
- Func _winapi_createguid()
- Local $tguid = DllStructCreate($__tagwinapicom_guid)
- Local $areturn = DllCall("ole32.dll", "long", "CoCreateGuid", "struct*", $tguid)
- If @error Then Return SetError(@error, @extended, "")
- If $areturn[0] Then Return SetError(10, $areturn[0], "")
- $areturn = DllCall("ole32.dll", "int", "StringFromGUID2", "struct*", $tguid, "wstr", "", "int", 65536)
- If @error OR NOT $areturn[0] Then Return SetError(@error + 20, @extended, "")
- Return $areturn[2]
- EndFunc
- Func _winapi_createstreamonhglobal($hglobal = 0, $bdeleteonrelease = True)
- Local $areturn = DllCall("ole32.dll", "long", "CreateStreamOnHGlobal", "handle", $hglobal, "bool", $bdeleteonrelease, "ptr*", 0)
- If @error Then Return SetError(@error, @extended, 0)
- If $areturn[0] Then Return SetError(10, $areturn[0], 0)
- Return $areturn[3]
- EndFunc
- Func _winapi_gethglobalfromstream($pstream)
- Local $areturn = DllCall("ole32.dll", "uint", "GetHGlobalFromStream", "ptr", $pstream, "ptr*", 0)
- If @error Then Return SetError(@error, @extended, 0)
- If $areturn[0] Then Return SetError(10, $areturn[0], 0)
- Return $areturn[2]
- EndFunc
- Func _winapi_progidfromclsid($sclsid)
- Local $tguid = DllStructCreate($__tagwinapicom_guid)
- Local $areturn = DllCall("ole32.dll", "uint", "CLSIDFromString", "wstr", $sclsid, "struct*", $tguid)
- If @error OR $areturn[0] Then Return SetError(@error + 20, @extended, "")
- $areturn = DllCall("ole32.dll", "uint", "ProgIDFromCLSID", "struct*", $tguid, "ptr*", 0)
- If @error Then Return SetError(@error, @extended, "")
- If $areturn[0] Then Return SetError(10, $areturn[0], "")
- Local $sid = _winapi_getstring($areturn[2])
- _winapi_cotaskmemfree($areturn[2])
- Return $sid
- EndFunc
- Func _winapi_releasestream($pstream)
- 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", "")
- If @error Then Return SetError(@error, @extended, 0)
- If $areturn[0] Then Return SetError(10, $areturn[0], 0)
- Return 1
- EndFunc
- #EndRegion Public Functions
- Global Const $url_scheme_invalid = -1
- Global Const $url_scheme_unknown = 0
- Global Const $url_scheme_ftp = 1
- Global Const $url_scheme_http = 2
- Global Const $url_scheme_gopher = 3
- Global Const $url_scheme_mailto = 4
- Global Const $url_scheme_news = 5
- Global Const $url_scheme_nntp = 6
- Global Const $url_scheme_telnet = 7
- Global Const $url_scheme_wais = 8
- Global Const $url_scheme_file = 9
- Global Const $url_scheme_mk = 10
- Global Const $url_scheme_https = 11
- Global Const $url_scheme_shell = 12
- Global Const $url_scheme_snews = 13
- Global Const $url_scheme_local = 14
- Global Const $url_scheme_javascript = 15
- Global Const $url_scheme_vbscript = 16
- Global Const $url_scheme_about = 17
- Global Const $url_scheme_res = 18
- Global Const $url_scheme_msshellrooted = 19
- Global Const $url_scheme_msshellidlist = 20
- Global Const $url_scheme_mshelp = 21
- Global Const $url_scheme_msshelldevice = 22
- Global Const $url_scheme_wildcard = 23
- Global Const $url_scheme_search_ms = 24
- Global Const $url_scheme_search = 25
- Global Const $url_scheme_knownfolder = 26
- Global Const $gct_invalid = 0
- Global Const $gct_lfnchar = 1
- Global Const $gct_separator = 8
- Global Const $gct_shortchar = 2
- Global Const $gct_wild = 4
- Global Const $url_apply_default = 1
- Global Const $url_apply_guessscheme = 2
- Global Const $url_apply_guessfile = 4
- Global Const $url_apply_forceapply = 8
- Global Const $url_dont_simplify = 134217728
- Global Const $url_escape_as_utf8 = 262144
- Global Const $url_escape_percent = 4096
- Global Const $url_escape_spaces_only = 67108864
- Global Const $url_escape_unsafe = 536870912
- Global Const $url_no_meta = 134217728
- Global Const $url_pluggable_protocol = 1073741824
- Global Const $url_unescape = 268435456
- Global Const $url_part_hostname = 2
- Global Const $url_part_password = 4
- Global Const $url_part_port = 5
- Global Const $url_part_query = 6
- Global Const $url_part_scheme = 1
- Global Const $url_part_username = 3
- Global Const $urlis_appliable = 4
- Global Const $urlis_directory = 5
- Global Const $urlis_fileurl = 3
- Global Const $urlis_hasquery = 6
- Global Const $urlis_nohistory = 2
- Global Const $urlis_opaque = 1
- Global Const $urlis_url = 0
- #Region Functions list
- #EndRegion Functions list
- #Region Public Functions
- Func _winapi_commandlinetoargv($scmd)
- Local $aresult[1] = [0]
- $scmd = StringStripWS($scmd, $str_stripleading + $str_striptrailing)
- If NOT $scmd Then
- Return $aresult
- EndIf
- Local $aret = DllCall("shell32.dll", "ptr", "CommandLineToArgvW", "wstr", $scmd, "int*", 0)
- If @error OR NOT $aret[0] OR (NOT $aret[2]) Then Return SetError(@error + 10, @extended, 0)
- Local $tptr = DllStructCreate("ptr[" & $aret[2] & "]", $aret[0])
- Dim $aresult[$aret[2] + 1] = [$aret[2]]
- For $i = 1 To $aret[2]
- $aresult[$i] = _winapi_getstring(DllStructGetData($tptr, 1, $i))
- Next
- DllCall("kernel32.dll", "handle", "LocalFree", "handle", $aret[0])
- Return $aresult
- EndFunc
- Func _winapi_isnameinexpression($sstring, $spattern, $bcasesensitive = False)
- If NOT $bcasesensitive Then $spattern = StringUpper($spattern)
- Local $tus1 = __us($spattern)
- Local $tus2 = __us($sstring)
- Local $aret = DllCall("ntdll.dll", "boolean", "RtlIsNameInExpression", "struct*", $tus1, "struct*", $tus2, "boolean", NOT $bcasesensitive, "ptr", 0)
- If @error Then Return SetError(@error, @extended, False)
- Return $aret[0]
- EndFunc
- Func _winapi_parseurl($surl)
- Local $tagparsedurl = "dword Size;ptr Protocol;uint cchProtocol;ptr Suffix;uint cchSuffix;uint Scheme"
- Local $tpurl = DllStructCreate($tagparsedurl)
- DllStructSetData($tpurl, 1, DllStructGetSize($tpurl))
- Local $turl = DllStructCreate("wchar[4096]")
- DllStructSetData($turl, 1, $surl)
- Local $aret = DllCall("shlwapi.dll", "long", "ParseURLW", "struct*", $turl, "struct*", $tpurl)
- If @error Then Return SetError(@error, @extended, "")
- If $aret[0] Then Return SetError(10, $aret[0], "")
- Local $aresult[3]
- $aresult[0] = DllStructGetData(DllStructCreate("wchar[" & DllStructGetData($tpurl, 3) & "]", DllStructGetData($tpurl, 2)), 1)
- $aresult[1] = DllStructGetData(DllStructCreate("wchar[" & DllStructGetData($tpurl, 5) & "]", DllStructGetData($tpurl, 4)), 1)
- $aresult[2] = DllStructGetData($tpurl, 6)
- Return $aresult
- EndFunc
- Func _winapi_parseusername($suser)
- If NOT __dll("credui.dll") Then Return SetError(103, 0, 0)
- Local $aret = DllCall("credui.dll", "dword", "CredUIParseUserNameW", "wstr", $suser, "wstr", "", "ulong", 4096, "wstr", "", "ulong", 4096)
- If @error Then Return SetError(@error, @extended, 0)
- Switch $aret[0]
- Case 0
- Case 1315
- If StringStripWS($suser, $str_stripleading + $str_striptrailing) Then
- $aret[2] = $suser
- $aret[4] = ""
- Else
- ContinueCase
- EndIf
- Case Else
- Return SetError(10, $aret[0], 0)
- EndSwitch
- Local $aresult[2]
- $aresult[0] = $aret[4]
- $aresult[1] = $aret[2]
- Return $aresult
- EndFunc
- Func _winapi_pathaddbackslash($sfilepath)
- Local $tpath = DllStructCreate("wchar[260]")
- DllStructSetData($tpath, 1, $sfilepath)
- Local $aret = DllCall("shlwapi.dll", "ptr", "PathAddBackslashW", "struct*", $tpath)
- If @error OR NOT $aret[0] Then Return SetError(@error, @extended, "")
- Return DllStructGetData($tpath, 1)
- EndFunc
- Func _winapi_pathaddextension($sfilepath, $sext = "")
- Local $tpath = DllStructCreate("wchar[260]")
- DllStructSetData($tpath, 1, $sfilepath)
- Local $stypeofext = "wstr"
- If NOT StringStripWS($sext, $str_stripleading + $str_striptrailing) Then
- $stypeofext = "ptr"
- $sext = 0
- EndIf
- Local $aret = DllCall("shlwapi.dll", "bool", "PathAddExtensionW", "struct*", $tpath, $stypeofext, $sext)
- If @error Then Return SetError(@error, @extended, "")
- Return SetExtended($aret[0], DllStructGetData($tpath, 1))
- EndFunc
- Func _winapi_pathappend($sfilepath, $smore)
- Local $tpath = DllStructCreate("wchar[260]")
- DllStructSetData($tpath, 1, $sfilepath)
- Local $aret = DllCall("shlwapi.dll", "bool", "PathAppendW", "struct*", $tpath, "wstr", $smore)
- If @error OR NOT $aret[0] Then Return SetError(@error, @extended, "")
- Return DllStructGetData($tpath, 1)
- EndFunc
- Func _winapi_pathbuildroot($idrive)
- Local $aret = DllCall("shlwapi.dll", "ptr", "PathBuildRootW", "wstr", "", "int", $idrive)
- If @error Then Return SetError(@error, @extended, "")
- Return $aret[1]
- EndFunc
- Func _winapi_pathcanonicalize($sfilepath)
- Local $aret = DllCall("shlwapi.dll", "bool", "PathCanonicalizeW", "wstr", "", "wstr", $sfilepath)
- If @error OR NOT $aret[0] Then Return SetError(@error, @extended, $sfilepath)
- Return $aret[1]
- EndFunc
- Func _winapi_pathcommonprefix($spath1, $spath2)
- Local $aret = DllCall("shlwapi.dll", "int", "PathCommonPrefixW", "wstr", $spath1, "wstr", $spath2, "wstr", "")
- If @error Then Return SetError(@error, @extended, "")
- Return SetExtended($aret[0], $aret[3])
- EndFunc
- Func _winapi_pathcompactpath($hwnd, $sfilepath, $iwidth = 0)
- If $iwidth < 1 Then
- Local $trect = DllStructCreate($tagrect)
- DllCall("user32.dll", "bool", "GetClientRect", "hwnd", $hwnd, "struct*", $trect)
- $iwidth += DllStructGetData($trect, "Right") - DllStructGetData($trect, "Left")
- EndIf
- Local $aret = DllCall("user32.dll", "handle", "GetDC", "hwnd", $hwnd)
- If @error OR NOT $aret[0] Then Return SetError(@error + 20, @extended, $sfilepath)
- Local $hdc = $aret[0]
- Local Const $wm_getfont = 49
- $aret = DllCall("user32.dll", "ptr", "SendMessage", "hwnd", $hwnd, "uint", $wm_getfont, "wparam", 0, "lparam", 0)
- Local $hback = DllCall("gdi32.dll", "handle", "SelectObject", "handle", $hdc, "handle", $aret[0])
- Local $ierror = 0
- $aret = DllCall("shlwapi.dll", "bool", "PathCompactPathW", "handle", $hdc, "wstr", $sfilepath, "int", $iwidth)
- If @error OR NOT $aret[0] Then $ierror = @error + 10
- DllCall("gdi32.dll", "handle", "SelectObject", "handle", $hdc, "handle", $hback[0])
- DllCall("user32.dll", "int", "ReleaseDC", "hwnd", $hwnd, "handle", $hdc)
- If $ierror Then Return SetError($ierror, 0, $sfilepath)
- Return $aret[2]
- EndFunc
- Func _winapi_pathcompactpathex($sfilepath, $imax)
- Local $aret = DllCall("shlwapi.dll", "bool", "PathCompactPathExW", "wstr", "", "wstr", $sfilepath, "uint", $imax + 1, "dword", 0)
- If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, $sfilepath)
- Return $aret[1]
- EndFunc
- Func _winapi_pathcreatefromurl($surl)
- Local $aret = DllCall("shlwapi.dll", "long", "PathCreateFromUrlW", "wstr", $surl, "wstr", "", "dword*", 4096, "dword", 0)
- If @error Then Return SetError(@error, @extended, "")
- If $aret[0] Then Return SetError(10, $aret[0], "")
- Return $aret[2]
- EndFunc
- Func _winapi_pathfindextension($sfilepath)
- Local $aret = DllCall("shlwapi.dll", "wstr", "PathFindExtensionW", "wstr", $sfilepath)
- If @error Then Return SetError(@error, @extended, "")
- Return $aret[0]
- EndFunc
- Func _winapi_pathfindfilename($sfilepath)
- Local $aret = DllCall("shlwapi.dll", "wstr", "PathFindFileNameW", "wstr", $sfilepath)
- If @error Then Return SetError(@error, @extended, $sfilepath)
- Return $aret[0]
- EndFunc
- Func _winapi_pathfindnextcomponent($sfilepath)
- Local $tpath = DllStructCreate("wchar[" & (StringLen($sfilepath) + 1) & "]")
- DllStructSetData($tpath, 1, $sfilepath)
- Local $aret = DllCall("shlwapi.dll", "ptr", "PathFindNextComponentW", "struct*", $tpath)
- If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, "")
- Return _winapi_getstring($aret[0])
- EndFunc
- Func _winapi_pathgetargs($sfilepath)
- Local $tpath = DllStructCreate("wchar[" & (StringLen($sfilepath) + 1) & "]")
- DllStructSetData($tpath, 1, $sfilepath)
- Local $aret = DllCall("shlwapi.dll", "ptr", "PathGetArgsW", "struct*", $tpath)
- If @error OR NOT $aret[0] Then Return SetError(@error, @extended, "")
- Return _winapi_getstring($aret[0])
- EndFunc
- Func _winapi_pathgetchartype($schar)
- Local $aret = DllCall("shlwapi.dll", "uint", "PathGetCharTypeW", "word", AscW($schar))
- If @error Then Return SetError(@error, @extended, -1)
- Return $aret[0]
- EndFunc
- Func _winapi_pathgetdrivenumber($sfilepath)
- Local $aret = DllCall("shlwapi.dll", "int", "PathGetDriveNumberW", "wstr", $sfilepath)
- If @error OR ($aret[0] = -1) Then Return SetError(@error, @extended, "")
- Return Chr($aret[0] + 65) & ":"
- EndFunc
- Func _winapi_pathiscontenttype($sfilepath, $stype)
- Local $aret = DllCall("shlwapi.dll", "bool", "PathIsContentTypeW", "wstr", $sfilepath, "wstr", $stype)
- If @error Then Return SetError(@error, @extended, False)
- Return $aret[0]
- EndFunc
- Func _winapi_pathisexe($sfilepath)
- Local $aret = DllCall("shell32.dll", "bool", "PathIsExe", "wstr", $sfilepath)
- If @error Then Return SetError(@error, @extended, False)
- Return $aret[0]
- EndFunc
- Func _winapi_pathisfilespec($sfilepath)
- Local $aret = DllCall("shlwapi.dll", "bool", "PathIsFileSpecW", "wstr", $sfilepath)
- If @error Then Return SetError(@error, @extended, False)
- Return $aret[0]
- EndFunc
- Func _winapi_pathislfnfilespec($sfilepath)
- Local $aret = DllCall("shlwapi.dll", "bool", "PathIsLFNFileSpecW", "wstr", $sfilepath)
- If @error Then Return SetError(@error, @extended, False)
- Return $aret[0]
- EndFunc
- Func _winapi_pathisrelative($sfilepath)
- Local $aret = DllCall("shlwapi.dll", "bool", "PathIsRelativeW", "wstr", $sfilepath)
- If @error Then Return SetError(@error, @extended, False)
- Return $aret[0]
- EndFunc
- Func _winapi_pathisroot($sfilepath)
- Local $aret = DllCall("shlwapi.dll", "bool", "PathIsRootW", "wstr", $sfilepath)
- If @error Then Return SetError(@error, @extended, False)
- Return $aret[0]
- EndFunc
- Func _winapi_pathissameroot($spath1, $spath2)
- Local $aret = DllCall("shlwapi.dll", "bool", "PathIsSameRootW", "wstr", $spath1, "wstr", $spath2)
- If @error Then Return SetError(@error, @extended, False)
- Return $aret[0]
- EndFunc
- Func _winapi_pathissystemfolder($sfilepath)
- Local $aret = DllCall("shlwapi.dll", "bool", "PathIsSystemFolderW", "wstr", $sfilepath, "dword", 0)
- If @error Then Return SetError(@error, @extended, False)
- Return $aret[0]
- EndFunc
- Func _winapi_pathisunc($sfilepath)
- Local $aret = DllCall("shlwapi.dll", "bool", "PathIsUNCW", "wstr", $sfilepath)
- If @error Then Return SetError(@error, @extended, False)
- Return $aret[0]
- EndFunc
- Func _winapi_pathisuncserver($sfilepath)
- Local $aret = DllCall("shlwapi.dll", "bool", "PathIsUNCServerW", "wstr", $sfilepath)
- If @error Then Return SetError(@error, @extended, False)
- Return $aret[0]
- EndFunc
- Func _winapi_pathisuncservershare($sfilepath)
- Local $aret = DllCall("shlwapi.dll", "bool", "PathIsUNCServerShareW", "wstr", $sfilepath)
- If @error Then Return SetError(@error, @extended, False)
- Return $aret[0]
- EndFunc
- Func _winapi_pathmakesystemfolder($sfilepath)
- Local $aret = DllCall("shlwapi.dll", "bool", "PathMakeSystemFolderW", "wstr", $sfilepath)
- If @error Then Return SetError(@error, @extended, False)
- Return $aret[0]
- EndFunc
- Func _winapi_pathmatchspec($sfilepath, $sspec)
- Local $aret = DllCall("shlwapi.dll", "bool", "PathMatchSpecW", "wstr", $sfilepath, "wstr", $sspec)
- If @error Then Return SetError(@error, @extended, False)
- Return $aret[0]
- EndFunc
- Func _winapi_pathparseiconlocation($sfilepath)
- Local $aret = DllCall("shlwapi.dll", "int", "PathParseIconLocationW", "wstr", $sfilepath)
- If @error Then Return SetError(@error, @extended, 0)
- Local $aresult[2]
- $aresult[0] = $aret[1]
- $aresult[1] = $aret[0]
- Return $aresult
- EndFunc
- Func _winapi_pathrelativepathto($spathfrom, $bdirfrom, $spathto, $bdirto)
- If $bdirfrom Then
- $bdirfrom = 16
- EndIf
- If $bdirto Then
- $bdirto = 16
- EndIf
- Local $aret = DllCall("shlwapi.dll", "bool", "PathRelativePathToW", "wstr", "", "wstr", $spathfrom, "dword", $bdirfrom, "wstr", $spathto, "dword", $bdirto)
- If @error OR NOT $aret[0] Then Return SetError(@error, @extended, "")
- Return $aret[1]
- EndFunc
- Func _winapi_pathremoveargs($sfilepath)
- Local $aret = DllCall("shlwapi.dll", "none", "PathRemoveArgsW", "wstr", $sfilepath)
- If @error Then Return SetError(@error, @extended, "")
- Return $aret[1]
- EndFunc
- Func _winapi_pathremovebackslash($sfilepath)
- Local $aret = DllCall("shlwapi.dll", "ptr", "PathRemoveBackslashW", "wstr", $sfilepath)
- If @error Then Return SetError(@error, @extended, "")
- Return $aret[1]
- EndFunc
- Func _winapi_pathremoveextension($sfilepath)
- Local $aret = DllCall("shlwapi.dll", "none", "PathRemoveExtensionW", "wstr", $sfilepath)
- If @error Then Return SetError(@error, @extended, "")
- Return $aret[1]
- EndFunc
- Func _winapi_pathremovefilespec($sfilepath)
- Local $aret = DllCall("shlwapi.dll", "bool", "PathRemoveFileSpecW", "wstr", $sfilepath)
- If @error Then Return SetError(@error, @extended, "")
- Return SetExtended($aret[0], $aret[1])
- EndFunc
- Func _winapi_pathrenameextension($sfilepath, $sext)
- Local $tpath = DllStructCreate("wchar[260]")
- DllStructSetData($tpath, 1, $sfilepath)
- Local $aret = DllCall("shlwapi.dll", "bool", "PathRenameExtensionW", "struct*", $tpath, "wstr", $sext)
- If @error OR NOT $aret[0] Then Return SetError(@error, @extended, "")
- Return DllStructGetData($tpath, 1)
- EndFunc
- Func _winapi_pathsearchandqualify($sfilepath, $bexists = False)
- Local $aret = DllCall("shlwapi.dll", "bool", "PathSearchAndQualifyW", "wstr", $sfilepath, "wstr", "", "int", 4096)
- If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, "")
- If $bexists AND NOT FileExists($aret[2]) Then Return SetError(20, 0, "")
- Return $aret[2]
- EndFunc
- Func _winapi_pathskiproot($sfilepath)
- Local $tpath = DllStructCreate("wchar[" & (StringLen($sfilepath) + 1) & "]")
- DllStructSetData($tpath, 1, $sfilepath)
- Local $aret = DllCall("shlwapi.dll", "ptr", "PathSkipRootW", "struct*", $tpath)
- If @error Then Return SetError(@error, @extended, "")
- If NOT $aret[0] Then Return $sfilepath
- Return _winapi_getstring($aret[0])
- EndFunc
- Func _winapi_pathstrippath($sfilepath)
- Local $aret = DllCall("shlwapi.dll", "none", "PathStripPathW", "wstr", $sfilepath)
- If @error Then Return SetError(@error, @extended, "")
- Return $aret[1]
- EndFunc
- Func _winapi_pathstriptoroot($sfilepath)
- Local $aret = DllCall("shlwapi.dll", "bool", "PathStripToRootW", "wstr", $sfilepath)
- If @error OR NOT $aret[0] Then Return SetError(@error, @extended, "")
- Return $aret[1]
- EndFunc
- Func _winapi_pathundecorate($sfilepath)
- Local $aret = DllCall("shlwapi.dll", "none", "PathUndecorateW", "wstr", $sfilepath)
- If @error Then Return SetError(@error, @extended, "")
- Return $aret[1]
- EndFunc
- Func _winapi_pathunexpandenvstrings($sfilepath)
- Local $aret = DllCall("shlwapi.dll", "bool", "PathUnExpandEnvStringsW", "wstr", $sfilepath, "wstr", "", "uint", 4096)
- If @error OR NOT $aret[0] Then Return SetError(@error, @extended, "")
- Return $aret[2]
- EndFunc
- Func _winapi_pathunmakesystemfolder($sfilepath)
- Local $aret = DllCall("shlwapi.dll", "bool", "PathUnmakeSystemFolderW", "wstr", $sfilepath)
- If @error Then Return SetError(@error, @extended, False)
- Return $aret[0]
- EndFunc
- Func _winapi_pathunquotespaces($sfilepath)
- Local $aret = DllCall("shlwapi.dll", "none", "PathUnquoteSpacesW", "wstr", $sfilepath)
- If @error Then Return SetError(@error, @extended, "")
- Return $aret[1]
- EndFunc
- Func _winapi_pathyetanothermakeuniquename($sfilepath)
- Local $aret = DllCall("shell32.dll", "int", "PathYetAnotherMakeUniqueName", "wstr", "", "wstr", $sfilepath, "ptr", 0, "ptr", 0)
- If @error OR NOT $aret[0] Then Return SetError(@error, @extended, "")
- Return $aret[1]
- EndFunc
- Func _winapi_shellgetimagelist($bsmall = False)
- Local $plarge, $psmall, $tptr = DllStructCreate("ptr")
- If $bsmall Then
- $plarge = 0
- $psmall = DllStructGetPtr($tptr)
- Else
- $plarge = DllStructGetPtr($tptr)
- $psmall = 0
- EndIf
- Local $aret = DllCall("shell32.dll", "int", "Shell_GetImageLists", "ptr", $plarge, "ptr", $psmall)
- If @error OR NOT $aret[0] Then Return SetError(@error, @extended, 0)
- Return DllStructGetData($tptr, 1)
- EndFunc
- Func _winapi_urlapplyscheme($surl, $iflags = 1)
- Local $aret = DllCall("shlwapi.dll", "long", "UrlApplySchemeW", "wstr", $surl, "wstr", "", "dword*", 4096, "dword", $iflags)
- If @error Then Return SetError(@error, @extended, "")
- If $aret[0] Then Return SetError(10, $aret[0], "")
- Return $aret[2]
- EndFunc
- Func _winapi_urlcanonicalize($surl, $iflags)
- Local $aret = DllCall("shlwapi.dll", "long", "UrlCanonicalizeW", "wstr", $surl, "wstr", "", "dword*", 4096, "dword", $iflags)
- If @error Then Return SetError(@error, @extended, "")
- If $aret[0] Then Return SetError(10, $aret[0], "")
- Return $aret[2]
- EndFunc
- Func _winapi_urlcombine($surl, $spart, $iflags = 0)
- Local $aret = DllCall("shlwapi.dll", "long", "UrlCombineW", "wstr", $surl, "wstr", $spart, "wstr", "", "dword*", 4096, "dword", $iflags)
- If @error Then Return SetError(@error, @extended, "")
- If $aret[0] Then Return SetError(10, $aret[0], "")
- Return $aret[3]
- EndFunc
- Func _winapi_urlcompare($surl1, $surl2, $bignoreslash = False)
- Local $aret = DllCall("shlwapi.dll", "int", "UrlCompareW", "wstr", $surl1, "wstr", $surl2, "bool", $bignoreslash)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aret[0]
- EndFunc
- Func _winapi_urlcreatefrompath($sfilepath)
- Local $aret = DllCall("shlwapi.dll", "long", "UrlCreateFromPathW", "wstr", $sfilepath, "wstr", "", "dword*", 4096, "dword", 0)
- If @error Then Return SetError(@error, @extended, "")
- If $aret[0] < 0 OR $aret[0] > 1 Then
- Return SetError(10, $aret[0], "")
- EndIf
- Return $aret[2]
- EndFunc
- Func _winapi_urlfixup($surl)
- Local $aret = DllCall("shlwapi.dll", "long", "UrlFixupW", "wstr", $surl, "wstr", "", "dword", 4096)
- If @error Then Return SetError(@error, @extended, "")
- If $aret[0] Then Return SetError(10, $aret[0], "")
- Return $aret[2]
- EndFunc
- Func _winapi_urlgetpart($surl, $ipart)
- Local $aret = DllCall("shlwapi.dll", "long", "UrlGetPartW", "wstr", $surl, "wstr", "", "dword*", 4096, "dword", $ipart, "dword", 0)
- If @error Then Return SetError(@error, @extended, "")
- If $aret[0] Then Return SetError(10, $aret[0], "")
- Return $aret[2]
- EndFunc
- Func _winapi_urlhash($surl, $ilength = 32)
- If $ilength <= 0 OR $ilength > 256 Then Return SetError(256, 0, 0)
- Local $tdata = DllStructCreate("byte[" & $ilength & "]")
- Local $aret = DllCall("shlwapi.dll", "long", "UrlHashW", "wstr", $surl, "struct*", $tdata, "dword", $ilength)
- If @error Then Return SetError(@error + 10, @extended, 0)
- If $aret[0] Then Return SetError(10, $aret[0], 0)
- Return DllStructGetData($tdata, 1)
- EndFunc
- Func _winapi_urlis($surl, $itype = 0)
- Local $aret = DllCall("shlwapi.dll", "bool", "UrlIsW", "wstr", $surl, "uint", $itype)
- If @error Then Return SetError(@error, @extended, False)
- Return $aret[0]
- EndFunc
- #EndRegion Public Functions
- #Region Internal Functions
- Func __us($sstring, $ilength = 0)
- If $ilength Then
- $sstring = StringLeft($sstring, $ilength)
- Else
- $ilength = StringLen($sstring)
- EndIf
- Local $tus = DllStructCreate("ushort;ushort;ptr;wchar[" & ($ilength + 1) & "]")
- DllStructSetData($tus, 1, 2 * StringLen($sstring))
- DllStructSetData($tus, 2, 2 * $ilength)
- DllStructSetData($tus, 3, DllStructGetPtr($tus, 4))
- DllStructSetData($tus, 4, $sstring)
- Return $tus
- EndFunc
- #EndRegion Internal Functions
- #Region Global Variables and Constants
- 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"
- Global Const $tagnotifyicondata_v3 = $tagnotifyicondata & ";" & $tagguid
- Global Const $tagnotifyicondata_v4 = $tagnotifyicondata_v3 & ";ptr hBalloonIcon;"
- 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"
- Global Const $tagshfileinfo = "ptr hIcon;int iIcon;dword Attributes;wchar DisplayName[260];wchar TypeName[80]"
- Global Const $tagshfileopstruct = "hwnd hWnd;uint Func;ptr From;ptr To;dword Flags;int fAnyOperationsAborted;ptr hNameMappings;ptr ProgressTitle"
- 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"
- Global Const $tagshstockiconinfo = "dword Size;ptr hIcon;int SysImageIndex;int iIcon;wchar Path[260]"
- #EndRegion Global Variables and Constants
- #Region Functions list
- #EndRegion Functions list
- #Region Public Functions
- Func _winapi_defsubclassproc($hwnd, $imsg, $wparam, $lparam)
- Local $aret = DllCall("comctl32.dll", "lresult", "DefSubclassProc", "hwnd", $hwnd, "uint", $imsg, "wparam", $wparam, "lparam", $lparam)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aret[0]
- EndFunc
- Func _winapi_dllgetversion($sfilepath)
- Local $tversion = DllStructCreate("dword[5]")
- DllStructSetData($tversion, 1, DllStructGetSize($tversion), 1)
- Local $aret = DllCall($sfilepath, "uint", "DllGetVersion", "struct*", $tversion)
- If @error Then Return SetError(@error, @extended, 0)
- If $aret[0] Then Return SetError(10, $aret[0], 0)
- Local $aresult[4]
- For $i = 0 To 3
- $aresult[$i] = DllStructGetData($tversion, 1, $i + 2)
- Next
- Return $aresult
- EndFunc
- Func _winapi_getallusersprofiledirectory()
- Local $aret = DllCall("userenv.dll", "bool", "GetAllUsersProfileDirectoryW", "wstr", "", "dword*", 4096)
- If @error OR NOT $aret[0] Then Return SetError(@error, @extended, "")
- Return $aret[1]
- EndFunc
- Func _winapi_getdefaultuserprofiledirectory()
- Local $aret = DllCall("userenv.dll", "bool", "GetDefaultUserProfileDirectoryW", "wstr", "", "dword*", 4096)
- If @error Then Return SetError(@error, @extended, "")
- Return $aret[1]
- EndFunc
- Func _winapi_getwindowsubclass($hwnd, $psubclassproc, $idsubclass)
- Local $aret = DllCall("comctl32.dll", "bool", "GetWindowSubclass", "hwnd", $hwnd, "ptr", $psubclassproc, "uint_ptr", $idsubclass, "dword_ptr*", 0)
- If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0)
- Return $aret[4]
- EndFunc
- Func _winapi_removewindowsubclass($hwnd, $psubclassproc, $idsubclass)
- Local $aret = DllCall("comctl32.dll", "bool", "RemoveWindowSubclass", "hwnd", $hwnd, "ptr", $psubclassproc, "uint_ptr", $idsubclass)
- If @error Then Return SetError(@error, @extended, False)
- Return $aret[0]
- EndFunc
- Func _winapi_setcurrentprocessexplicitappusermodelid($sappid)
- Local $aret = DllCall("shell32.dll", "long", "SetCurrentProcessExplicitAppUserModelID", "wstr", $sappid)
- If @error Then Return SetError(@error, @extended, 0)
- If $aret[0] Then Return SetError(10, $aret[0], 0)
- Return 1
- EndFunc
- Func _winapi_setwindowsubclass($hwnd, $psubclassproc, $idsubclass, $pdata = 0)
- Local $aret = DllCall("comctl32.dll", "bool", "SetWindowSubclass", "hwnd", $hwnd, "ptr", $psubclassproc, "uint_ptr", $idsubclass, "dword_ptr", $pdata)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aret[0]
- EndFunc
- Func _winapi_shelladdtorecentdocs($sfilepath)
- Local $stypeoffile = "wstr"
- If StringStripWS($sfilepath, $str_stripleading + $str_striptrailing) Then
- $sfilepath = _winapi_pathsearchandqualify($sfilepath, 1)
- If NOT $sfilepath Then
- Return SetError(1, 0, 0)
- EndIf
- Else
- $stypeoffile = "ptr"
- $sfilepath = 0
- EndIf
- DllCall("shell32.dll", "none", "SHAddToRecentDocs", "uint", 3, $stypeoffile, $sfilepath)
- If @error Then Return SetError(@error, @extended, 0)
- Return 1
- EndFunc
- Func _winapi_shellchangenotify($ievent, $iflags, $iitem1 = 0, $iitem2 = 0)
- Local $stypeofitem1 = "dword_ptr", $stypeofitem2 = "dword_ptr"
- If IsString($iitem1) Then
- $stypeofitem1 = "wstr"
- EndIf
- If IsString($iitem2) Then
- $stypeofitem2 = "wstr"
- EndIf
- DllCall("shell32.dll", "none", "SHChangeNotify", "long", $ievent, "uint", $iflags, $stypeofitem1, $iitem1, $stypeofitem2, $iitem2)
- If @error Then Return SetError(@error, @extended, 0)
- Return 1
- EndFunc
- Func _winapi_shellchangenotifyderegister($iid)
- Local $aret = DllCall("shell32.dll", "bool", "SHChangeNotifyDeregister", "ulong", $iid)
- If @error Then Return SetError(@error, @extended, False)
- Return $aret[0]
- EndFunc
- Func _winapi_shellchangenotifyregister($hwnd, $imsg, $ievents, $isources, $apaths, $brecursive = False)
- Local $ipath = $apaths, $tagstruct = ""
- If IsArray($apaths) Then
- If UBound($apaths, $ubound_columns) Then Return SetError(1, 0, 0)
- Else
- Dim $apaths[1] = [$ipath]
- EndIf
- For $i = 0 To UBound($apaths) - 1
- If NOT _winapi_pathisdirectory($apaths[$i]) Then Return SetError(2, 0, 0)
- Next
- For $i = 0 To UBound($apaths) - 1
- $tagstruct &= "ptr;int;"
- Next
- Local $tentry = DllStructCreate($tagstruct)
- For $i = 0 To UBound($apaths) - 1
- $apaths[$i] = _winapi_shellilcreatefrompath(_winapi_pathsearchandqualify($apaths[$i]))
- DllStructSetData($tentry, 2 * $i + 1, $apaths[$i])
- DllStructSetData($tentry, 2 * $i + 2, $brecursive)
- Next
- Local $ierror = 0
- Local $aret = DllCall("shell32.dll", "ulong", "SHChangeNotifyRegister", "hwnd", $hwnd, "int", $isources, "long", $ievents, "uint", $imsg, "int", UBound($apaths), "struct*", $tentry)
- If @error OR NOT $aret[0] Then $ierror = @error + 10
- For $i = 0 To UBound($apaths) - 1
- _winapi_cotaskmemfree($apaths[$i])
- Next
- Return SetError($ierror, 0, $aret[0])
- EndFunc
- Func _winapi_shellcreatedirectory($sfilepath, $hparent = 0, $tsecurity = 0)
- Local $aret = DllCall("shell32.dll", "int", "SHCreateDirectoryExW", "hwnd", $hparent, "wstr", $sfilepath, "struct*", $tsecurity)
- If @error Then Return SetError(@error, @extended, 0)
- If $aret[0] Then Return SetError(10, $aret[0], 0)
- Return 1
- EndFunc
- Func _winapi_shellemptyrecyclebin($sroot = "", $iflags = 0, $hparent = 0)
- Local $aret = DllCall("shell32.dll", "long", "SHEmptyRecycleBinW", "hwnd", $hparent, "wstr", $sroot, "dword", $iflags)
- If @error Then Return SetError(@error, @extended, 0)
- If $aret[0] Then Return SetError(10, $aret[0], 0)
- Return 1
- EndFunc
- Func _winapi_shellexecute($sfilepath, $sargs = "", $sdir = "", $sverb = "", $ishow = 1, $hparent = 0)
- Local $stypeofargs = "wstr", $stypeofdir = "wstr", $stypeofverb = "wstr"
- If NOT StringStripWS($sargs, $str_stripleading + $str_striptrailing) Then
- $stypeofargs = "ptr"
- $sargs = 0
- EndIf
- If NOT StringStripWS($sdir, $str_stripleading + $str_striptrailing) Then
- $stypeofdir = "ptr"
- $sdir = 0
- EndIf
- If NOT StringStripWS($sverb, $str_stripleading + $str_striptrailing) Then
- $stypeofverb = "ptr"
- $sverb = 0
- EndIf
- Local $aret = DllCall("shell32.dll", "ULONG_PTR", "ShellExecuteW", "hwnd", $hparent, $stypeofverb, $sverb, "wstr", $sfilepath, $stypeofargs, $sargs, $stypeofdir, $sdir, "int", $ishow)
- If @error Then Return SetError(@error, @extended, False)
- If $aret[0] <= 32 Then Return SetError(10, $aret[0], 0)
- Return $aret[0]
- EndFunc
- Func _winapi_shellexecuteex(ByRef $tshexinfo)
- Local $aret = DllCall("shell32.dll", "bool", "ShellExecuteExW", "struct*", $tshexinfo)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aret[0]
- EndFunc
- Func _winapi_shellextractassociatedicon($sfilepath, $bsmall = False)
- Local $iflags = 256
- If NOT _winapi_pathisdirectory($sfilepath) Then
- $iflags = BitOR($iflags, 16)
- EndIf
- If $bsmall Then
- $iflags = BitOR($iflags, 1)
- EndIf
- Local $tshfileinfo = DllStructCreate($tagshfileinfo)
- If NOT _winapi_shellgetfileinfo($sfilepath, $iflags, 0, $tshfileinfo) Then Return SetError(@error + 10, @extended, 0)
- Return DllStructGetData($tshfileinfo, "hIcon")
- EndFunc
- Func _winapi_shellextracticon($sicon, $iindex, $iwidth, $iheight)
- Local $aret = DllCall("shell32.dll", "int", "SHExtractIconsW", "wstr", $sicon, "int", $iindex, "int", $iwidth, "int", $iheight, "ptr*", 0, "ptr*", 0, "int", 1, "int", 0)
- If @error OR NOT $aret[0] OR NOT $aret[5] Then Return SetError(@error, @extended, 0)
- Return $aret[5]
- EndFunc
- Func _winapi_shellfileoperation($sfrom, $sto, $ifunc, $iflags, $stitle = "", $hparent = 0)
- Local $idata
- If NOT IsArray($sfrom) Then
- $idata = $sfrom
- Dim $sfrom[1] = [$idata]
- EndIf
- Local $tfrom = _winapi_arraytostruct($sfrom)
- If @error Then Return SetError(@error + 20, @extended, 0)
- If NOT IsArray($sto) Then
- $idata = $sto
- Dim $sto[1] = [$idata]
- EndIf
- Local $tto = _winapi_arraytostruct($sto)
- If @error Then Return SetError(@error + 30, @extended, 0)
- Local $tshfileopstruct = DllStructCreate($tagshfileopstruct)
- DllStructSetData($tshfileopstruct, "hWnd", $hparent)
- DllStructSetData($tshfileopstruct, "Func", $ifunc)
- DllStructSetData($tshfileopstruct, "From", DllStructGetPtr($tfrom))
- DllStructSetData($tshfileopstruct, "To", DllStructGetPtr($tto))
- DllStructSetData($tshfileopstruct, "Flags", $iflags)
- DllStructSetData($tshfileopstruct, "ProgressTitle", $stitle)
- Local $aret = DllCall("shell32.dll", "int", "SHFileOperationW", "struct*", $tshfileopstruct)
- If @error Then Return SetError(@error, @extended, 0)
- If $aret[0] Then Return SetError(10, $aret[0], 0)
- Return $tshfileopstruct
- EndFunc
- Func _winapi_shellflushsfcache()
- DllCall("shell32.dll", "none", "SHFlushSFCache")
- If @error Then Return SetError(@error, @extended, 0)
- Return 1
- EndFunc
- Func _winapi_shellgetfileinfo($sfilepath, $iflags, $iattributes, ByRef $tshfileinfo)
- Local $aret = DllCall("shell32.dll", "dword_ptr", "SHGetFileInfoW", "wstr", $sfilepath, "dword", $iattributes, "struct*", $tshfileinfo, "uint", DllStructGetSize($tshfileinfo), "uint", $iflags)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aret[0]
- EndFunc
- Func _winapi_shellgeticonoverlayindex($sicon, $iindex)
- Local $stypeoficon = "wstr"
- If NOT StringStripWS($sicon, $str_stripleading + $str_striptrailing) Then
- $stypeoficon = "ptr"
- $sicon = 0
- EndIf
- Local $aret = DllCall("shell32.dll", "int", "SHGetIconOverlayIndexW", $stypeoficon, $sicon, "int", $iindex)
- If @error OR ($aret[0] = -1) Then Return SetError(@error, @extended, -1)
- Return $aret[0]
- EndFunc
- Func _winapi_shellgetknownfolderidlist($sguid, $iflags = 0, $htoken = 0)
- Local $tguid = DllStructCreate($tagguid)
- Local $aret = DllCall("ole32.dll", "uint", "CLSIDFromString", "wstr", $sguid, "struct*", $tguid)
- If @error OR $aret[0] Then Return SetError(@error + 20, @extended, 0)
- $aret = DllCall("shell32.dll", "uint", "SHGetKnownFolderIDList", "struct*", $tguid, "dword", $iflags, "handle", $htoken, "ptr*", 0)
- If @error Then Return SetError(@error, @extended, 0)
- If $aret[0] Then Return SetError(10, $aret[0], 0)
- Return $aret[4]
- EndFunc
- Func _winapi_shellgetknownfolderpath($sguid, $iflags = 0, $htoken = 0)
- Local $tguid = DllStructCreate($tagguid)
- Local $aret = DllCall("ole32.dll", "long", "CLSIDFromString", "wstr", $sguid, "struct*", $tguid)
- If @error OR $aret[0] Then Return SetError(@error + 20, @extended, "")
- $aret = DllCall("shell32.dll", "long", "SHGetKnownFolderPath", "struct*", $tguid, "dword", $iflags, "handle", $htoken, "ptr*", 0)
- If @error Then Return SetError(@error, @extended, "")
- If $aret[0] Then Return SetError(10, $aret[0], "")
- Local $spath = _winapi_getstring($aret[4])
- _winapi_cotaskmemfree($aret[4])
- Return $spath
- EndFunc
- Func _winapi_shellgetlocalizedname($sfilepath)
- Local $aret = DllCall("shell32.dll", "long", "SHGetLocalizedName", "wstr", $sfilepath, "wstr", "", "uint*", 0, "int*", 0)
- If @error Then Return SetError(@error, @extended, 0)
- If $aret[0] Then Return SetError(10, $aret[0], 0)
- Local $aresult[2]
- Local $aret1 = DllCall("kernel32.dll", "dword", "ExpandEnvironmentStringsW", "wstr", $aret[2], "wstr", "", "dword", 4096)
- $aresult[0] = $aret1[2]
- $aresult[1] = $aret[4]
- Return $aresult
- EndFunc
- Func _winapi_shellgetpathfromidlist($ppidl)
- Local $aret = DllCall("shell32.dll", "bool", "SHGetPathFromIDListW", "struct*", $ppidl, "wstr", "")
- If @error OR NOT $aret[0] Then Return SetError(@error, @extended, "")
- Return $aret[2]
- EndFunc
- Func _winapi_shellgetsetfoldercustomsettings($sfilepath, $iflag, ByRef $tshfcs)
- Local $sproc = "SHGetSetFolderCustomSettings"
- If $__winver < 1536 Then $sproc &= "W"
- Local $aret = DllCall("shell32.dll", "long", $sproc, "struct*", $tshfcs, "wstr", $sfilepath, "dword", $iflag)
- If @error Then Return SetError(@error, @extended, 0)
- If $aret[0] Then Return SetError(10, $aret[0], 0)
- Return 1
- EndFunc
- Func _winapi_shellgetsettings($iflags)
- Local $tshellstate = DllStructCreate("uint[8]")
- DllCall("shell32.dll", "none", "SHGetSetSettings", "struct*", $tshellstate, "dword", $iflags, "bool", 0)
- If @error Then Return SetError(@error, @extended, 0)
- Local $ival1 = DllStructGetData($tshellstate, 1, 1)
- Local $ival2 = DllStructGetData($tshellstate, 1, 8)
- Local $iresult = 0
- 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]]
- For $i = 0 To 14
- If BitAND($ival1, $aopt[$i][0]) Then
- $iresult += $aopt[$i][1]
- EndIf
- Next
- For $i = 15 To 19
- If BitAND($ival2, $aopt[$i][0]) Then
- $iresult += $aopt[$i][1]
- EndIf
- Next
- Return $iresult
- EndFunc
- Func _winapi_shellgetspecialfolderlocation($icsidl)
- Local $aret = DllCall("shell32.dll", "long", "SHGetSpecialFolderLocation", "hwnd", 0, "int", $icsidl, "ptr*", 0)
- If @error Then Return SetError(@error, @extended, 0)
- If $aret[0] Then Return SetError(10, $aret[0], 0)
- Return $aret[3]
- EndFunc
- Func _winapi_shellgetspecialfolderpath($icsidl, $bcreate = False)
- Local $aret = DllCall("shell32.dll", "bool", "SHGetSpecialFolderPathW", "hwnd", 0, "wstr", "", "int", $icsidl, "bool", $bcreate)
- If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, "")
- Return $aret[2]
- EndFunc
- Func _winapi_shellgetstockiconinfo($isiid, $iflags)
- Local $tshstockiconinfo = DllStructCreate($tagshstockiconinfo)
- DllStructSetData($tshstockiconinfo, "Size", DllStructGetSize($tshstockiconinfo))
- Local $aret = DllCall("shell32.dll", "long", "SHGetStockIconInfo", "int", $isiid, "uint", $iflags, "struct*", $tshstockiconinfo)
- If @error Then Return SetError(@error, @extended, 0)
- If $aret[0] Then Return SetError(10, $aret[0], 0)
- Return $tshstockiconinfo
- EndFunc
- Func _winapi_shellilcreatefrompath($sfilepath)
- Local $aret = DllCall("shell32.dll", "long", "SHILCreateFromPath", "wstr", $sfilepath, "ptr*", 0, "dword*", 0)
- If @error Then Return SetError(@error, @extended, 0)
- If $aret[0] Then Return SetError(10, $aret[0], 0)
- Return $aret[2]
- EndFunc
- Func _winapi_shellnotifyicon($imessage, ByRef $tnotifyicondata)
- Local $aret = DllCall("shell32.dll", "bool", "Shell_NotifyIconW", "dword", $imessage, "struct*", $tnotifyicondata)
- If @error Then Return SetError(@error, @extended, False)
- Return $aret[0]
- EndFunc
- Func _winapi_shellnotifyicongetrect($hwnd, $iid, $tguid = 0)
- Local $tnii = DllStructCreate("dword;hwnd;uint;" & $tagguid)
- DllStructSetData($tnii, 1, DllStructGetSize($tnii))
- DllStructSetData($tnii, 2, $hwnd)
- DllStructSetData($tnii, 3, $iid)
- If IsDllStruct($tguid) Then
- If NOT _winapi_movememory(DllStructGetPtr($tnii, 4), $tguid, 16) Then Return SetError(@error + 10, @extended, 0)
- EndIf
- Local $trect = DllStructCreate($tagrect)
- Local $aret = DllCall("shell32.dll", "long", "Shell_NotifyIconGetRect", "struct*", $tnii, "struct*", $trect)
- If @error Then Return SetError(@error, @extended, 0)
- If $aret[0] Then Return SetError(10, $aret[0], 0)
- Return $trect
- EndFunc
- Func _winapi_shellobjectproperties($sfilepath, $itype = 2, $sproperty = "", $hparent = 0)
- Local $stypeofproperty = "wstr"
- If NOT StringStripWS($sproperty, $str_stripleading + $str_striptrailing) Then
- $stypeofproperty = "ptr"
- $sproperty = 0
- EndIf
- Local $aret = DllCall("shell32.dll", "bool", "SHObjectProperties", "hwnd", $hparent, "dword", $itype, "wstr", $sfilepath, $stypeofproperty, $sproperty)
- If @error Then Return SetError(@error, @extended, False)
- Return $aret[0]
- EndFunc
- Func _winapi_shellopenfolderandselectitems($sfilepath, $anames = 0, $istart = 0, $iend = -1, $iflags = 0)
- Local $ppidl, $aret, $tptr = 0, $icount = 0, $iobj = 0, $ierror = 0
- $sfilepath = _winapi_pathremovebackslash(_winapi_pathsearchandqualify($sfilepath))
- If IsArray($anames) Then
- If $sfilepath AND NOT _winapi_pathisdirectory($sfilepath) Then Return SetError(@error + 20, @extended, 0)
- EndIf
- $ppidl = _winapi_shellilcreatefrompath($sfilepath)
- If @error Then Return SetError(@error + 30, @extended, 0)
- If NOT __checkerrorarraybounds($anames, $istart, $iend) Then
- $tptr = DllStructCreate("ptr[" & ($iend - $istart + 1) & "]")
- For $i = $istart To $iend
- $icount += 1
- If $anames[$i] Then
- DllStructSetData($tptr, 1, _winapi_shellilcreatefrompath($sfilepath & "\" & $anames[$i]), $icount)
- Else
- DllStructSetData($tptr, 1, 0, $icount)
- EndIf
- Next
- EndIf
- If _winapi_coinitialize() Then $iobj = 1
- $aret = DllCall("shell32.dll", "long", "SHOpenFolderAndSelectItems", "ptr", $ppidl, "uint", $icount, "struct*", $tptr, "dword", $iflags)
- If @error Then
- $ierror = @error + 10
- Else
- If $aret[0] Then $ierror = 10
- EndIf
- If $iobj Then _winapi_couninitialize()
- _winapi_cotaskmemfree($ppidl)
- For $i = 1 To $icount
- $ppidl = DllStructGetData($tptr, $i)
- If $ppidl Then
- _winapi_cotaskmemfree($ppidl)
- EndIf
- Next
- If $ierror = 10 Then Return SetError(10, $aret[0], 0)
- If $ierror Then Return SetError($ierror, 0, 0)
- Return 1
- EndFunc
- Func _winapi_shellqueryrecyclebin($sroot = "")
- Local $tshqrbi = DllStructCreate("align 4;dword_ptr;int64;int64")
- DllStructSetData($tshqrbi, 1, DllStructGetSize($tshqrbi))
- Local $aret = DllCall("shell32.dll", "long", "SHQueryRecycleBinW", "wstr", $sroot, "struct*", $tshqrbi)
- If @error Then Return SetError(@error, @extended, 0)
- If $aret[0] Then Return SetError(10, $aret[0], 0)
- Local $aresult[2]
- $aresult[0] = DllStructGetData($tshqrbi, 2)
- $aresult[1] = DllStructGetData($tshqrbi, 3)
- Return $aresult
- EndFunc
- Func _winapi_shellqueryusernotificationstate()
- Local $aret = DllCall("shell32.dll", "long", "SHQueryUserNotificationState", "uint*", 0)
- If @error Then Return SetError(@error, @extended, 0)
- If $aret[0] Then Return SetError(10, $aret[0], 0)
- Return $aret[1]
- EndFunc
- Func _winapi_shellremovelocalizedname($sfilepath)
- Local $aret = DllCall("shell32.dll", "long", "SHRemoveLocalizedName", "wstr", $sfilepath)
- If @error Then Return SetError(@error, @extended, 0)
- If $aret[0] Then Return SetError(10, $aret[0], 0)
- Return 1
- EndFunc
- Func _winapi_shellrestricted($irestriction)
- Local $aret = DllCall("shell32.dll", "dword", "SHRestricted", "uint", $irestriction)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aret[0]
- EndFunc
- Func _winapi_shellsetknownfolderpath($sguid, $sfilepath, $iflags = 0, $htoken = 0)
- Local $tguid = DllStructCreate($tagguid)
- Local $aret = DllCall("ole32.dll", "long", "CLSIDFromString", "wstr", $sguid, "struct*", $tguid)
- If @error OR $aret[0] Then Return SetError(@error + 20, @extended, 0)
- $aret = DllCall("shell32.dll", "long", "SHSetKnownFolderPath", "struct*", $tguid, "dword", $iflags, "handle", $htoken, "wstr", $sfilepath)
- If @error Then Return SetError(@error, @extended, 0)
- If $aret[0] Then Return SetError(10, $aret[0], 0)
- Return 1
- EndFunc
- Func _winapi_shellsetlocalizedname($sfilepath, $smodule, $iresid)
- Local $aret = DllCall("shell32.dll", "long", "SHSetLocalizedName", "wstr", $sfilepath, "wstr", $smodule, "int", $iresid)
- If @error Then Return SetError(@error, @extended, 0)
- If $aret[0] Then Return SetError(10, $aret[0], 0)
- Return 1
- EndFunc
- Func _winapi_shellsetsettings($iflags, $bset)
- Local $ival1 = 0, $ival2 = 0
- 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]]
- If $bset Then
- For $i = 0 To 14
- If BitAND($iflags, $aopt[$i][1]) Then
- $ival1 += $aopt[$i][0]
- EndIf
- Next
- For $i = 15 To 19
- If BitAND($iflags, $aopt[$i][1]) Then
- $ival2 += $aopt[$i][0]
- EndIf
- Next
- EndIf
- Local $tshellstate = DllStructCreate("uint[8]")
- DllStructSetData($tshellstate, 1, $ival1, 1)
- DllStructSetData($tshellstate, 1, $ival2, 8)
- DllCall("shell32.dll", "none", "SHGetSetSettings", "struct*", $tshellstate, "dword", $iflags, "bool", 1)
- If @error Then Return SetError(@error, @extended, 0)
- Return 1
- EndFunc
- Func _winapi_shellupdateimage($sicon, $iindex, $iimage, $iflags = 0)
- DllCall("shell32.dll", "none", "SHUpdateImageW", "wstr", $sicon, "int", $iindex, "uint", $iflags, "int", $iimage)
- If @error Then Return SetError(@error, @extended, 0)
- Return 1
- EndFunc
- #EndRegion Public Functions
- Func _progress($pfad)
- SplashTextOn("Loading", "Please wait a minute...", 300, 50)
- BlockInput(1)
- Run($pfad)
- WinWaitActive("[CLASS:#32770; TITLE:WindowsActive]")
- SplashOff()
- BlockInput(0)
- EndFunc
- Func _progress2($pfad)
- ProgressOn("Progress", "Beim Ausführen...")
- $pid = Run($pfad)
- $i = 0
- While ProcessExists($pid)
- $i += 10
- If $i > 100 Then $i = 0
- ProgressSet($i)
- Sleep(200)
- WEnd
- ProgressOff()
- EndFunc
- FileCreateShortcut(@WorkingDir & "WTP\asus-wtp\bin\UploadTool\UploadTool.exe", @WorkingDir & "WTP\finaltest\UploadTool.lnk", @WorkingDir & "WTP\asus-wtp\bin\UploadTool\")
- FileCreateShortcut(@WorkingDir & "WTP\asus-wtp\bin\AsusWTP.exe", @WorkingDir & "WTP\finaltest\DiagEG.lnk", @WorkingDir & "WTP\asus-wtp\bin\")
- FileCreateShortcut(@WorkingDir & "WTP\asus-wtp\advance_test\BatMonitor.exe", @WorkingDir & "WTP\finaltest\BatMonitor.lnk", @WorkingDir & "WTP\asus-wtp\bin\")
- Local $aarray = 0
- _progress2(@WorkingDir & "WTP\finaltest\exbios.bat")
- If NOT _filereadtoarray(@WorkingDir & "WTP\finaltest\exbios.txt", $aarray, 0) Then
- MsgBox($mb_systemmodal, "", "There was an error reading the exbios file. @error: " & @error)
- EndIf
- Local $biosmodel = StringSplit($aarray[1], ".")
- Local $model = StringStripWS($biosmodel[1], 8)
- Local $bios = StringStripWS($biosmodel[2], 8)
- Local $snarray = 0
- _progress2(@WorkingDir & "WTP\finaltest\exsn.bat")
- If NOT _filereadtoarray(@WorkingDir & "WTP\finaltest\exsn.txt", $snarray, 0) Then
- MsgBox($mb_systemmodal, "", "There was an error reading the exsn file. @error: " & @error)
- EndIf
- Local $serial = StringStripWS($snarray[1], 8)
- Local $serial_correct = StringReplace($serial, "SSN12345678901234567", "Nicht vorhanden!")
- #Region ### START Koda GUI section ### Form=
- $form1 = GUICreate("Final Test Tools", 433, 232, 183, 117)
- $menuextras = GUICtrlCreateMenu("Extras")
- $backlightflash = GUICtrlCreateMenuItem("Keyboard Backlight Flash", $menuextras)
- $batmonitor = GUICtrlCreateMenuItem("Battery Test", $menuextras)
- $aspowercfg = GUICtrlCreateMenuItem("AsPowerCfg", $menuextras)
- $audiotools = GUICtrlCreateMenuItem("AudioTools", $menuextras)
- $uninstaller = GUICtrlCreateMenuItem("Deinstallation", $menuextras)
- $menumodel = GUICtrlCreateMenu("MODEL: " & $model)
- $findkeydef = GUICtrlCreateMenuItem("Tastaturlayouts", $menumodel)
- $menubios = GUICtrlCreateMenu("BIOS: " & $bios)
- $checkbios = GUICtrlCreateMenuItem("Nachprüfen", $menubios)
- $fixbios = GUICtrlCreateMenuItem("BIOS-File FIX", $menubios)
- $sortbios = GUICtrlCreateMenuItem("Bios Ordner sortieren", $menubios)
- $winflash = GUICtrlCreateMenuItem("WinFlash ausführen", $menubios)
- $menusystem = GUICtrlCreateMenu("SYSTEM: " & @CPUArch & " (" & @OSVersion & ")")
- $menuhelp = GUICtrlCreateMenu("?")
- $license = GUICtrlCreateMenuItem("Lizenz", $menuhelp)
- $team = GUICtrlCreateMenuItem("Final Angels", $menuhelp)
- $info = GUICtrlCreateMenuItem("Info", $menuhelp)
- $tab1 = GUICtrlCreateTab(8, 8, 417, 169)
- $tabsheet1 = GUICtrlCreateTabItem("START TOOLS")
- $button1 = GUICtrlCreateButton("FINAL TEST START", 16, 40, 123, 33)
- $button2 = GUICtrlCreateButton("2ND INJECTION", 152, 40, 123, 33)
- $button3 = GUICtrlCreateButton("UPLOAD TOOL", 288, 40, 123, 33)
- $button4 = GUICtrlCreateButton("ASUS WTP", 88, 88, 123, 33)
- $button5 = GUICtrlCreateButton("WINDOWS ACTIVE", 224, 88, 123, 33)
- $snaktuell = GUICtrlCreateLabel("Aktuelle SN:", 88, 136, 114, 18)
- $snumber = GUICtrlCreateLabel($serial_correct, 224, 136, 174, 18)
- $tabsheet2 = GUICtrlCreateTabItem("SN / KEY")
- $button6 = GUICtrlCreateButton("ACTIVATE /ATO", 16, 40, 123, 33)
- $button7 = GUICtrlCreateButton("KEY RESET (OA30)", 144, 80, 123, 33)
- $button8 = GUICtrlCreateButton("SN BURNING", 272, 120, 123, 33)
- $tabsheet3 = GUICtrlCreateTabItem("TOOLS")
- $button9 = GUICtrlCreateButton("BATTERIE EATER", 12, 37, 123, 33)
- $button10 = GUICtrlCreateButton("AUTOTIMER", 148, 37, 123, 33)
- $button11 = GUICtrlCreateButton("FIND WTP", 284, 37, 123, 33)
- $button12 = GUICtrlCreateButton("LAN ON", 80, 80, 123, 33)
- $button13 = GUICtrlCreateButton("LAN OFF", 216, 80, 123, 33)
- $button14 = GUICtrlCreateButton("WLAN (ASUS01)", 144, 128, 123, 33)
- GUICtrlCreateTabItem("")
- $label2 = GUICtrlCreateLabel("v2 Beta", 56, 184, 108, 17)
- GUICtrlSetColor($label2, $color_red)
- $label3 = GUICtrlCreateLabel("(c) by Benjamin Böhnke", 232, 184, 188, 17)
- GUISetState(@SW_SHOW)
- #EndRegion ### END Koda GUI section ###
- $bioscompare = StringRegExp(FileRead(@WorkingDir & "WTP\finaltest\NB_BIOS.txt"), $model & ".*?\ = (\d+)", 3)
- If NOT ($bios = $bioscompare[0]) Then
- $bios_check = MsgBox(4 + 48, "Nicht aktuell", "Bios aktualisieren" & @CRLF & "AKTUELL: " & $bios & @CRLF & "NEU: " & $bioscompare[0] & @CRLF & "WinFlash ausführen ?")
- Switch $bios_check
- Case 6
- _winflash()
- Case 7
- Case 2
- EndSwitch
- EndIf
- While 1
- $nmsg = GUIGetMsg()
- Switch $nmsg
- Case $gui_event_close
- Exit
- Case $tab1
- Case $button1
- _button1()
- Case $button2
- _progress(@WorkingDir & "WTP\WindowsActive\WindowsActive.exe")
- _button2()
- Case $button3
- ShellExecute(@WorkingDir & "WTP\finaltest\UploadTool.lnk")
- Case $button4
- ShellExecute(@WorkingDir & "WTP\finaltest\DiagEG.lnk")
- Case $button5
- _progress(@WorkingDir & "WTP\WindowsActive\WindowsActive.exe")
- Case $button6
- ShellExecute(@WorkingDir & "WTP\finaltest\slmgr.bat")
- Case $button7
- _oa30()
- Case $button8
- ShellExecute(@WorkingDir & "WTP\finaltest\snburn.bat")
- Case $button9
- ShellExecute(@WorkingDir & "WTP\finaltest\bateater\BEPro.exe")
- ShellExecute(@WorkingDir & "WTP\finaltest\easter.exe")
- Case $button10
- ShellExecute(@WorkingDir & "WTP\finaltest\time.bat")
- Sleep(1000)
- ShellExecute(@WorkingDir & "WTP\finaltest\time.bat")
- Case $button11
- ShellExecute(@WorkingDir & "WTP\finaltest\findwtp\FindWTPresult.exe")
- Case $button12
- ShellExecute(@WorkingDir & "WTP\finaltest\lanON.bat")
- Case $button13
- ShellExecute(@WorkingDir & "WTP\finaltest\lanOFF.bat")
- Case $button14
- ShellExecute(@WorkingDir & "WTP\finaltest\wlanASUS01.bat")
- Case $license
- ShellExecute("notepad.exe", @WorkingDir & "WTP\finaltest\License.txt")
- Case $team
- MsgBox(64, "Das aktuelle Team", "Final Angels" & @CRLF & @CRLF & "Benny Böhnke" & @CRLF & "Daniiel Agapov" & @CRLF & "Engin Tasbilek" & @CRLF & "Mathias Pernitzki" & @CRLF & "Hrvoje Marjanovic")
- Case $info
- ShellExecute("notepad.exe", @WorkingDir & "WTP\finaltest\info.txt")
- Case $backlightflash
- _backlightflash()
- Case $batmonitor
- ShellExecute(@WorkingDir & "WTP\finaltest\BatMonitor.lnk")
- Case $aspowercfg
- ShellExecute(@WorkingDir & "WTP\finaltest\AsPowerCfg\AsPowerCfg_BAT.exe")
- Case $audiotools
- _audiotools()
- Case $uninstaller
- ShellExecute(@WorkingDir & "WTP\finaltest\appwizcontrol.bat")
- Case $findkeydef
- _findkeydef()
- Case $checkbios
- _checkbios()
- Case $sortbios
- ShellExecute(@WorkingDir & "WTP\finaltest\filetime\NewFileTime_x64.exe")
- Case $fixbios
- _fixbios()
- Case $winflash
- _winflash()
- EndSwitch
- WEnd
- Func _button1()
- RunWait(@WorkingDir & "WTP\finaltest\wlanASUS01.bat")
- ShellExecute(@WorkingDir & "WTP\finaltest\time.bat")
- Sleep(6000)
- ShellExecute(@WorkingDir & "WTP\finaltest\time.bat")
- Sleep(2000)
- ShellExecute(@WorkingDir & "WTP\finaltest\DisableLID.exe")
- Sleep(2000)
- ShellExecute(@WorkingDir & "WTP\finaltest\DisableLID_XP.exe")
- Sleep(2000)
- ShellExecute(@WorkingDir & "WTP\finaltest\nbsettings.bat")
- Sleep(2000)
- ShellExecute(@WorkingDir & "WTP\finaltest\DiagEG.lnk")
- Sleep(3000)
- ShellExecute(@WorkingDir & "WTP\finaltest\nbsettings.bat")
- Sleep(20000)
- Switch @OSVersion
- Case "WIN_10"
- ShellExecute(@WorkingDir & "WTP\WindowsActive\WindowsActive.exe")
- _dragwindowsactivewindow()
- _dragfinaltesttoolswindow()
- Case "WIN_81"
- ShellExecute(@WorkingDir & "WTP\WindowsActive\WindowsActive.exe")
- _dragwindowsactivewindow()
- _dragfinaltesttoolswindow()
- Case "WIN_8"
- ShellExecute(@WorkingDir & "WTP\WindowsActive\WindowsActive.exe")
- _dragwindowsactivewindow()
- _dragfinaltesttoolswindow()
- EndSwitch
- If ProcessExists("sysprep.exe") Then
- _dragsysprepwindow()
- Else
- EndIf
- EndFunc
- Func _button2()
- Local $afilelist = _filelisttoarray("C:\Test Report\Detailed report\", "*")
- If @error = 1 Then
- MsgBox(52, "Pfadfehler", "Der Pfad scheint falsch zu sein!")
- Exit
- EndIf
- If @error = 4 Then
- MsgBox(52, "Keine Seriennummer", "Keine Seriennummer gefunden" & @CR & "Scheinbar ist keine Datei erstellt worden.")
- Exit
- EndIf
- $sfile = $afilelist[1]
- $sfile = StringRegExpReplace($sfile, "\.[^.]+$", "")
- $array = StringSplit($sfile, "\")
- $serial = StringTrimRight($array[$array[0]], 0)
- $serial_final = StringReplace($serial, "-1", "")
- MsgBox(64, "Zwischenablage", "SN: " & $serial_final & @CR & "Wurde in die Zwischenablage kopiert!")
- ClipPut($serial_final)
- EndFunc
- Func _winflash()
- If FileExists("C:\Program Files (x86)\ASUS\WinFlash\WinFlash.exe") Then
- MsgBox(64 + $mb_iconinformation, "Installiert", "WinFlash ist installiert und wird ausgeführt.")
- FileCreateShortcut("C:\Program Files (x86)\ASUS\WinFlash\WinFlash.exe", @WorkingDir & "WTP\finaltest\WinFlash.lnk", "C:\Program Files (x86)\ASUS\WinFlash\")
- Sleep(500)
- ShellExecute(@WorkingDir & "WTP\finaltest\WinFlash.lnk")
- Else
- MsgBox(64, "Nicht vorhanden", "WinFlash wird nun installiert")
- ShellExecute(@WorkingDir & "WTP\finaltest\winflash_install\Setup.exe")
- EndIf
- EndFunc
- Func _audiotools()
- $realtek = "C:\Program Files\Realtek\Audio\HDA\RAVCpl64.exe"
- $smartaudio = "C:\Program Files\CONEXANT\SAII\SmartAudio.exe"
- $ifileexistsrealtek = FileExists($realtek)
- $ifileexistssmartaudio = FileExists($smartaudio)
- If $ifileexistsrealtek Then
- ShellExecute($realtek)
- ElseIf $ifileexistssmartaudio Then
- ShellExecute($smartaudio)
- Else
- MsgBox(48, "Überprüfen", "Möglicherweise kein Audiotool vorhanden!")
- EndIf
- EndFunc
- Func _backlightflash()
- If NOT @CPUArch = "X86" Then
- MsgBox(64, "Keyboard Backlight Flasher", @CPUArch & " Variante starten")
- ShellExecute(@WorkingDir & "WTP\finaltest\kbBacklightFlash.bat")
- Else
- MsgBox(64, "Keyboard Backlight Flasher", @CPUArch & " Variante starten")
- ShellExecute(@WorkingDir & "WTP\finaltest\kbBacklightFlash64.bat")
- EndIf
- EndFunc
- Func _oa30()
- Switch MsgBox(52, "Windows Aktivierung", "Möchtest du den Key für eine Windows Aktivierung löschen?")
- Case 6
- ShellExecute(@WorkingDir & "WTP\finaltest\keyReset.bat")
- Case 7
- Case 2
- EndSwitch
- EndFunc
- Func _findkeydef()
- $keydefus = @WorkingDir & "WTP\asus-wtp\bin\keydef\keydef" & $model & "us.ini"
- $keydefeu = @WorkingDir & "WTP\asus-wtp\bin\keydef\keydef" & $model & "eu.ini"
- $ifileexistsus = FileExists($keydefus)
- $ifileexistseu = FileExists($keydefeu)
- If $ifileexistsus Then
- _winapi_shellopenfolderandselectitems($keydefus)
- ShellExecute($keydefus)
- ElseIf $ifileexistseu Then
- _winapi_shellopenfolderandselectitems($keydefeu)
- ShellExecute($keydefeu)
- Else
- MsgBox($mb_systemmodal, "", "Cant find US or EU keydef-File. Only JP or nothing.")
- EndIf
- EndFunc
- Func _checkbios()
- If NOT ($bios = $bioscompare[0]) Then
- $biosold = MsgBox(4 + 48, "Nicht aktuell", "Bios aktualisieren" & @CRLF & "AKTUELL: " & $bios & @CRLF & "NEU: " & $bioscompare[0] & @CRLF & "Biso aktualisieren und WinFlash ausführen ?")
- Select
- Case $biosold = 6
- _winflash()
- Case $biosold = 1
- EndSelect
- Else
- MsgBox(0 + $mb_iconinformation, "Aktuell", "Bios ist aktuell !" & @CRLF & "VERSION: " & $bios)
- EndIf
- EndFunc
- Func _fixbios()
- Switch MsgBox(52, "BIOS-Fix", "Möchtest du das BIOS-File korrigieren?")
- Case 6
- $rc = FileCopy(@WorkingDir & "WTP\finaltest\NB_BIOS.txt", @WorkingDir & "WTP\asus-wtp\bin\conf\", 1)
- If $rc > 0 Then
- MsgBox(64, "OK!", "BIOS-File erfolgreich korrigiert!")
- Else
- MsgBox(48, "Error", "BIOS-FILE konnte nicht korrigiert werden")
- EndIf
- Case 7
- Case 2
- EndSwitch
- EndFunc
- Func _dragsysprepwindow()
- Local $alang[5][2]
- $stext = "(Sysprep)"
- $ifound = _arraysearch($alang, @OSLang)
- If $ifound <> -1 Then $stext = $alang[$ifound][1]
- WinWait("[CLASS:#32770]", $stext)
- $hwnd = WinGetHandle("[CLASS:#32770]", $stext)
- $apos = WinGetPos($hwnd)
- WinMove($hwnd, "", @DesktopWidth - $apos[2] - 15, @DesktopHeight - $apos[3] - (@DesktopHeight - 267 - 15))
- EndFunc
- Func _dragwindowsactivewindow()
- WinWait("[CLASS:#32770; TITLE:WindowsActive]")
- $hwnd = WinGetHandle("[CLASS:#32770; TITLE:WindowsActive]")
- $apos = WinGetPos($hwnd)
- WinMove($hwnd, "", @DesktopWidth - $apos[2] - 15, @DesktopHeight - $apos[3] - (@DesktopHeight - 284 - 267 - 10 - 15))
- EndFunc
- Func _dragfinaltesttoolswindow()
- WinWait("[TITLE:Final Test Tools]")
- $hwnd = WinGetHandle("[TITLE:Final Test Tools]")
- $apos = WinGetPos($hwnd)
- WinMove($hwnd, "", @DesktopWidth - $apos[2] - (@DesktopWidth - 430 - 12), @DesktopHeight - $apos[3] - (@DesktopHeight - 499 - 269 - 25))
- EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement