Code: | #RequireAdmin
#Region
#AutoIt3Wrapper_Icon=ICONS\Skull.ico
#AutoIt3Wrapper_Res_Comment=2.0.0
#AutoIt3Wrapper_Res_Description=Adobe-GenP-2.7
#AutoIt3Wrapper_Res_Fileversion=2.0.0.0
#AutoIt3Wrapper_Res_ProductName=2.0.0
#AutoIt3Wrapper_Res_ProductVersion=2.0.0
#AutoIt3Wrapper_Res_CompanyName=2.0.0
#AutoIt3Wrapper_Res_LegalCopyright=2.0.0
#AutoIt3Wrapper_Res_LegalTradeMarks=2.0.0
#EndRegion
GLOBAL CONST $HGDI_ERROR = PTR (+ 4294967295 )
GLOBAL CONST $INVALID_HANDLE_VALUE = PTR (+ 4294967295 )
GLOBAL CONST $CLR_INVALID = + 4294967295
GLOBAL CONST $MB_PRECOMPOSED = 1
GLOBAL CONST $MB_COMPOSITE = 2
GLOBAL CONST $MB_USEGLYPHCHARS = 4
GLOBAL CONST $ULW_ALPHA = 2
GLOBAL CONST $ULW_COLORKEY = 1
GLOBAL CONST $ULW_OPAQUE = 4
GLOBAL CONST $ULW_EX_NORESIZE = 8
GLOBAL CONST $WH_CALLWNDPROC = 4
GLOBAL CONST $WH_CALLWNDPROCRET = 12
GLOBAL CONST $WH_CBT = 5
GLOBAL CONST $WH_DEBUG = 9
GLOBAL CONST $WH_FOREGROUNDIDLE = 11
GLOBAL CONST $WH_GETMESSAGE = 3
GLOBAL CONST $WH_JOURNALPLAYBACK = 1
GLOBAL CONST $WH_JOURNALRECORD = 0
GLOBAL CONST $WH_KEYBOARD = 2
GLOBAL CONST $WH_KEYBOARD_LL = 13
GLOBAL CONST $WH_MOUSE = 7
GLOBAL CONST $WH_MOUSE_LL = 14
GLOBAL CONST $WH_MSGFILTER = + 4294967295
GLOBAL CONST $WH_SHELL = 10
GLOBAL CONST $WH_SYSMSGFILTER = 6
GLOBAL CONST $WPF_ASYNCWINDOWPLACEMENT = 4
GLOBAL CONST $WPF_RESTORETOMAXIMIZED = 2
GLOBAL CONST $WPF_SETMINPOSITION = 1
GLOBAL CONST $KF_EXTENDED = 256
GLOBAL CONST $KF_ALTDOWN = 8192
GLOBAL CONST $KF_UP = 32768
GLOBAL CONST $LLKHF_EXTENDED = BITSHIFT ($KF_EXTENDED , 8 )
GLOBAL CONST $LLKHF_INJECTED = 16
GLOBAL CONST $LLKHF_ALTDOWN = BITSHIFT ($KF_ALTDOWN , 8 )
GLOBAL CONST $LLKHF_UP = BITSHIFT ($KF_UP , 8 )
GLOBAL CONST $OFN_ALLOWMULTISELECT = 512
GLOBAL CONST $OFN_CREATEPROMPT = 8192
GLOBAL CONST $OFN_DONTADDTORECENT = 33554432
GLOBAL CONST $OFN_ENABLEHOOK = 32
GLOBAL CONST $OFN_ENABLEINCLUDENOTIFY = 4194304
GLOBAL CONST $OFN_ENABLESIZING = 8388608
GLOBAL CONST $OFN_ENABLETEMPLATE = 64
GLOBAL CONST $OFN_ENABLETEMPLATEHANDLE = 128
GLOBAL CONST $OFN_EXPLORER = 524288
GLOBAL CONST $OFN_EXTENSIONDIFFERENT = 1024
GLOBAL CONST $OFN_FILEMUSTEXIST = 4096
GLOBAL CONST $OFN_FORCESHOWHIDDEN = 268435456
GLOBAL CONST $OFN_HIDEREADONLY = 4
GLOBAL CONST $OFN_LONGNAMES = 2097152
GLOBAL CONST $OFN_NOCHANGEDIR = 8
GLOBAL CONST $OFN_NODEREFERENCELINKS = 1048576
GLOBAL CONST $OFN_NOLONGNAMES = 262144
GLOBAL CONST $OFN_NONETWORKBUTTON = 131072
GLOBAL CONST $OFN_NOREADONLYRETURN = 32768
GLOBAL CONST $OFN_NOTESTFILECREATE = 65536
GLOBAL CONST $OFN_NOVALIDATE = 256
GLOBAL CONST $OFN_OVERWRITEPROMPT = 2
GLOBAL CONST $OFN_PATHMUSTEXIST = 2048
GLOBAL CONST $OFN_READONLY = 1
GLOBAL CONST $OFN_SHAREAWARE = 16384
GLOBAL CONST $OFN_SHOWHELP = 16
GLOBAL CONST $OFN_EX_NOPLACESBAR = 1
GLOBAL CONST $STD_CUT = 0
GLOBAL CONST $STD_COPY = 1
GLOBAL CONST $STD_PASTE = 2
GLOBAL CONST $STD_UNDO = 3
GLOBAL CONST $STD_REDOW = 4
GLOBAL CONST $STD_DELETE = 5
GLOBAL CONST $STD_FILENEW = 6
GLOBAL CONST $STD_FILEOPEN = 7
GLOBAL CONST $STD_FILESAVE = 8
GLOBAL CONST $STD_PRINTPRE = 9
GLOBAL CONST $STD_PROPERTIES = 10
GLOBAL CONST $STD_HELP = 11
GLOBAL CONST $STD_FIND = 12
GLOBAL CONST $STD_REPLACE = 13
GLOBAL CONST $STD_PRINT = 14
GLOBAL CONST $KB_SENDSPECIAL = 0
GLOBAL CONST $KB_SENDRAW = 1
GLOBAL CONST $KB_CAPSOFF = 0
GLOBAL CONST $KB_CAPSON = 1
GLOBAL CONST $S_OK = 0
GLOBAL CONST $E_ABORT = 2147500036
GLOBAL CONST $E_ACCESSDENIED = 2147942405
GLOBAL CONST $E_FAIL = 2147500037
GLOBAL CONST $E_HANDLE = 2147942406
GLOBAL CONST $E_INVALIDARG = 2147942487
GLOBAL CONST $E_NOINTERFACE = 2147500034
GLOBAL CONST $E_NOTIMPL = 2147500033
GLOBAL CONST $E_OUTOFMEMORY = 2147942414
GLOBAL CONST $E_POINTER = 2147500035
GLOBAL CONST $E_UNEXPECTED = 2147549183
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 = + 4294966046
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 $ES_LEFT = 0
GLOBAL CONST $ES_CENTER = 1
GLOBAL CONST $ES_RIGHT = 2
GLOBAL CONST $ES_MULTILINE = 4
GLOBAL CONST $ES_UPPERCASE = 8
GLOBAL CONST $ES_LOWERCASE = 16
GLOBAL CONST $ES_PASSWORD = 32
GLOBAL CONST $ES_AUTOVSCROLL = 64
GLOBAL CONST $ES_AUTOHSCROLL = 128
GLOBAL CONST $ES_NOHIDESEL = 256
GLOBAL CONST $ES_OEMCONVERT = 1024
GLOBAL CONST $ES_READONLY = 2048
GLOBAL CONST $ES_WANTRETURN = 4096
GLOBAL CONST $ES_NUMBER = 8192
GLOBAL CONST $EC_ERR = + 4294967295
GLOBAL CONST $ECM_FIRST = 5376
GLOBAL CONST $EM_CANUNDO = 198
GLOBAL CONST $EM_CHARFROMPOS = 215
GLOBAL CONST $EM_EMPTYUNDOBUFFER = 205
GLOBAL CONST $EM_FMTLINES = 200
GLOBAL CONST $EM_GETCUEBANNER = ($ECM_FIRST + 2 )
GLOBAL CONST $EM_GETFIRSTVISIBLELINE = 206
GLOBAL CONST $EM_GETHANDLE = 189
GLOBAL CONST $EM_GETIMESTATUS = 217
GLOBAL CONST $EM_GETLIMITTEXT = 213
GLOBAL CONST $EM_GETLINE = 196
GLOBAL CONST $EM_GETLINECOUNT = 186
GLOBAL CONST $EM_GETMARGINS = 212
GLOBAL CONST $EM_GETMODIFY = 184
GLOBAL CONST $EM_GETPASSWORDCHAR = 210
GLOBAL CONST $EM_GETRECT = 178
GLOBAL CONST $EM_GETSEL = 176
GLOBAL CONST $EM_GETTHUMB = 190
GLOBAL CONST $EM_GETWORDBREAKPROC = 209
GLOBAL CONST $EM_HIDEBALLOONTIP = ($ECM_FIRST + 4 )
GLOBAL CONST $EM_LIMITTEXT = 197
GLOBAL CONST $EM_LINEFROMCHAR = 201
GLOBAL CONST $EM_LINEINDEX = 187
GLOBAL CONST $EM_LINELENGTH = 193
GLOBAL CONST $EM_LINESCROLL = 182
GLOBAL CONST $EM_POSFROMCHAR = 214
GLOBAL CONST $EM_REPLACESEL = 194
GLOBAL CONST $EM_SCROLL = 181
GLOBAL CONST $EM_SCROLLCARET = 183
GLOBAL CONST $EM_SETCUEBANNER = ($ECM_FIRST + 1 )
GLOBAL CONST $EM_SETHANDLE = 188
GLOBAL CONST $EM_SETIMESTATUS = 216
GLOBAL CONST $EM_SETLIMITTEXT = $EM_LIMITTEXT
GLOBAL CONST $EM_SETMARGINS = 211
GLOBAL CONST $EM_SETMODIFY = 185
GLOBAL CONST $EM_SETPASSWORDCHAR = 204
GLOBAL CONST $EM_SETREADONLY = 207
GLOBAL CONST $EM_SETRECT = 179
GLOBAL CONST $EM_SETRECTNP = 180
GLOBAL CONST $EM_SETSEL = 177
GLOBAL CONST $EM_SETTABSTOPS = 203
GLOBAL CONST $EM_SETWORDBREAKPROC = 208
GLOBAL CONST $EM_SHOWBALLOONTIP = ($ECM_FIRST + 3 )
GLOBAL CONST $EM_UNDO = 199
GLOBAL CONST $EC_LEFTMARGIN = 1
GLOBAL CONST $EC_RIGHTMARGIN = 2
GLOBAL CONST $EC_USEFONTINFO = 65535
GLOBAL CONST $EMSIS_COMPOSITIONSTRING = 1
GLOBAL CONST $EIMES_GETCOMPSTRATONCE = 1
GLOBAL CONST $EIMES_CANCELCOMPSTRINFOCUS = 2
GLOBAL CONST $EIMES_COMPLETECOMPSTRKILLFOCUS = 4
GLOBAL CONST $EN_ALIGN_LTR_EC = 1792
GLOBAL CONST $EN_ALIGN_RTL_EC = 1793
GLOBAL CONST $EN_CHANGE = 768
GLOBAL CONST $EN_ERRSPACE = 1280
GLOBAL CONST $EN_HSCROLL = 1537
GLOBAL CONST $EN_KILLFOCUS = 512
GLOBAL CONST $EN_MAXTEXT = 1281
GLOBAL CONST $EN_SETFOCUS = 256
GLOBAL CONST $EN_UPDATE = 1024
GLOBAL CONST $EN_VSCROLL = 1538
GLOBAL CONST $GUI_SS_DEFAULT_EDIT = 3150016
GLOBAL CONST $GUI_SS_DEFAULT_INPUT = 128
OPT ("TrayAutoPause" , 0 )
OPT ("TrayIconHide" , 1 )
GLOBAL CONST $GMEM_FIXED = 0
GLOBAL CONST $GMEM_MOVEABLE = 2
GLOBAL CONST $GMEM_NOCOMPACT = 16
GLOBAL CONST $GMEM_NODISCARD = 32
GLOBAL CONST $GMEM_ZEROINIT = 64
GLOBAL CONST $GMEM_MODIFY = 128
GLOBAL CONST $GMEM_DISCARDABLE = 256
GLOBAL CONST $GMEM_NOT_BANKED = 4096
GLOBAL CONST $GMEM_SHARE = 8192
GLOBAL CONST $GMEM_DDESHARE = 8192
GLOBAL CONST $GMEM_NOTIFY = 16384
GLOBAL CONST $GMEM_LOWER = 4096
GLOBAL CONST $GMEM_VALID_FLAGS = 32626
GLOBAL CONST $GMEM_INVALID_HANDLE = 32768
GLOBAL CONST $GPTR = BITOR ($GMEM_FIXED , $GMEM_ZEROINIT )
GLOBAL CONST $GHND = BITOR ($GMEM_MOVEABLE , $GMEM_ZEROINIT )
GLOBAL CONST $MEM_COMMIT = 4096
GLOBAL CONST $MEM_RESERVE = 8192
GLOBAL CONST $MEM_TOP_DOWN = 1048576
GLOBAL CONST $MEM_SHARED = 134217728
GLOBAL CONST $PAGE_NOACCESS = 1
GLOBAL CONST $PAGE_READONLY = 2
GLOBAL CONST $PAGE_READWRITE = 4
GLOBAL CONST $PAGE_EXECUTE = 16
GLOBAL CONST $PAGE_EXECUTE_READ = 32
GLOBAL CONST $PAGE_EXECUTE_READWRITE = 64
GLOBAL CONST $PAGE_EXECUTE_WRITECOPY = 128
GLOBAL CONST $PAGE_GUARD = 256
GLOBAL CONST $PAGE_NOCACHE = 512
GLOBAL CONST $PAGE_WRITECOMBINE = 1024
GLOBAL CONST $PAGE_WRITECOPY = 8
GLOBAL CONST $MEM_DECOMMIT = 16384
GLOBAL CONST $MEM_RELEASE = 32768
GLOBAL ENUM $MEM_LOAD , $MEM_TOTALPHYSRAM , $MEM_AVAILPHYSRAM , $MEM_TOTALPAGEFILE , $MEM_AVAILPAGEFILE , $MEM_TOTALVIRTUAL , $MEM_AVAILVIRTUAL
GLOBAL CONST $PROCESS_TERMINATE = 1
GLOBAL CONST $PROCESS_CREATE_THREAD = 2
GLOBAL CONST $PROCESS_SET_SESSIONID = 4
GLOBAL CONST $PROCESS_VM_OPERATION = 8
GLOBAL CONST $PROCESS_VM_READ = 16
GLOBAL CONST $PROCESS_VM_WRITE = 32
GLOBAL CONST $PROCESS_DUP_HANDLE = 64
GLOBAL CONST $PROCESS_CREATE_PROCESS = 128
GLOBAL CONST $PROCESS_SET_QUOTA = 256
GLOBAL CONST $PROCESS_SET_INFORMATION = 512
GLOBAL CONST $PROCESS_QUERY_INFORMATION = 1024
GLOBAL CONST $PROCESS_QUERY_LIMITED_INFORMATION = 4096
GLOBAL CONST $PROCESS_SUSPEND_RESUME = 2048
GLOBAL CONST $PROCESS_ALL_ACCESS = 2035711
GLOBAL CONST $SE_ASSIGNPRIMARYTOKEN_NAME = "SeAssignPrimaryTokenPrivilege"
GLOBAL CONST $SE_AUDIT_NAME = "SeAuditPrivilege"
GLOBAL CONST $SE_BACKUP_NAME = "SeBackupPrivilege"
GLOBAL CONST $SE_CHANGE_NOTIFY_NAME = "SeChangeNotifyPrivilege"
GLOBAL CONST $SE_CREATE_GLOBAL_NAME = "SeCreateGlobalPrivilege"
GLOBAL CONST $SE_CREATE_PAGEFILE_NAME = "SeCreatePagefilePrivilege"
GLOBAL CONST $SE_CREATE_PERMANENT_NAME = "SeCreatePermanentPrivilege"
GLOBAL CONST $SE_CREATE_SYMBOLIC_LINK_NAME = "SeCreateSymbolicLinkPrivilege"
GLOBAL CONST $SE_CREATE_TOKEN_NAME = "SeCreateTokenPrivilege"
GLOBAL CONST $SE_DEBUG_NAME = "SeDebugPrivilege"
GLOBAL CONST $SE_ENABLE_DELEGATION_NAME = "SeEnableDelegationPrivilege"
GLOBAL CONST $SE_IMPERSONATE_NAME = "SeImpersonatePrivilege"
GLOBAL CONST $SE_INC_BASE_PRIORITY_NAME = "SeIncreaseBasePriorityPrivilege"
GLOBAL CONST $SE_INC_WORKING_SET_NAME = "SeIncreaseWorkingSetPrivilege"
GLOBAL CONST $SE_INCREASE_QUOTA_NAME = "SeIncreaseQuotaPrivilege"
GLOBAL CONST $SE_LOAD_DRIVER_NAME = "SeLoadDriverPrivilege"
GLOBAL CONST $SE_LOCK_MEMORY_NAME = "SeLockMemoryPrivilege"
GLOBAL CONST $SE_MACHINE_ACCOUNT_NAME = "SeMachineAccountPrivilege"
GLOBAL CONST $SE_MANAGE_VOLUME_NAME = "SeManageVolumePrivilege"
GLOBAL CONST $SE_PROF_SINGLE_PROCESS_NAME = "SeProfileSingleProcessPrivilege"
GLOBAL CONST $SE_RELABEL_NAME = "SeRelabelPrivilege"
GLOBAL CONST $SE_REMOTE_SHUTDOWN_NAME = "SeRemoteShutdownPrivilege"
GLOBAL CONST $SE_RESTORE_NAME = "SeRestorePrivilege"
GLOBAL CONST $SE_SECURITY_NAME = "SeSecurityPrivilege"
GLOBAL CONST $SE_SHUTDOWN_NAME = "SeShutdownPrivilege"
GLOBAL CONST $SE_SYNC_AGENT_NAME = "SeSyncAgentPrivilege"
GLOBAL CONST $SE_SYSTEM_ENVIRONMENT_NAME = "SeSystemEnvironmentPrivilege"
GLOBAL CONST $SE_SYSTEM_PROFILE_NAME = "SeSystemProfilePrivilege"
GLOBAL CONST $SE_SYSTEMTIME_NAME = "SeSystemtimePrivilege"
GLOBAL CONST $SE_TAKE_OWNERSHIP_NAME = "SeTakeOwnershipPrivilege"
GLOBAL CONST $SE_TCB_NAME = "SeTcbPrivilege"
GLOBAL CONST $SE_TIME_ZONE_NAME = "SeTimeZonePrivilege"
GLOBAL CONST $SE_TRUSTED_CREDMAN_ACCESS_NAME = "SeTrustedCredManAccessPrivilege"
GLOBAL CONST $SE_UNSOLICITED_INPUT_NAME = "SeUnsolicitedInputPrivilege"
GLOBAL CONST $SE_UNDOCK_NAME = "SeUndockPrivilege"
GLOBAL CONST $SE_PRIVILEGE_ENABLED_BY_DEFAULT = 1
GLOBAL CONST $SE_PRIVILEGE_ENABLED = 2
GLOBAL CONST $SE_PRIVILEGE_REMOVED = 4
GLOBAL CONST $SE_PRIVILEGE_USED_FOR_ACCESS = 2147483648
GLOBAL CONST $SE_GROUP_MANDATORY = 1
GLOBAL CONST $SE_GROUP_ENABLED_BY_DEFAULT = 2
GLOBAL CONST $SE_GROUP_ENABLED = 4
GLOBAL CONST $SE_GROUP_OWNER = 8
GLOBAL CONST $SE_GROUP_USE_FOR_DENY_ONLY = 16
GLOBAL CONST $SE_GROUP_INTEGRITY = 32
GLOBAL CONST $SE_GROUP_INTEGRITY_ENABLED = 64
GLOBAL CONST $SE_GROUP_RESOURCE = 536870912
GLOBAL CONST $SE_GROUP_LOGON_ID = 3221225472
GLOBAL ENUM $TOKENPRIMARY = 1 , $TOKENIMPERSONATION
GLOBAL ENUM $SECURITYANONYMOUS = 0 , $SECURITYIDENTIFICATION , $SECURITYIMPERSONATION , $SECURITYDELEGATION
GLOBAL ENUM $TOKENUSER = 1 , $TOKENGROUPS , $TOKENPRIVILEGES , $TOKENOWNER , $TOKENPRIMARYGROUP , $TOKENDEFAULTDACL , $TOKENSOURCE , $TOKENTYPE , $TOKENIMPERSONATIONLEVEL , $TOKENSTATISTICS , $TOKENRESTRICTEDSIDS , $TOKENSESSIONID , $TOKENGROUPSANDPRIVILEGES , $TOKENSESSIONREFERENCE , $TOKENSANDBOXINERT , $TOKENAUDITPOLICY , $TOKENORIGIN , $TOKENELEVATIONTYPE , $TOKENLINKEDTOKEN , $TOKENELEVATION , $TOKENHASRESTRICTIONS , $TOKENACCESSINFORMATION , $TOKENVIRTUALIZATIONALLOWED , $TOKENVIRTUALIZATIONENABLED , $TOKENINTEGRITYLEVEL , $TOKENUIACCESS , $TOKENMANDATORYPOLICY , $TOKENLOGONSID
GLOBAL CONST $TOKEN_ASSIGN_PRIMARY = 1
GLOBAL CONST $TOKEN_DUPLICATE = 2
GLOBAL CONST $TOKEN_IMPERSONATE = 4
GLOBAL CONST $TOKEN_QUERY = 8
GLOBAL CONST $TOKEN_QUERY_SOURCE = 16
GLOBAL CONST $TOKEN_ADJUST_PRIVILEGES = 32
GLOBAL CONST $TOKEN_ADJUST_GROUPS = 64
GLOBAL CONST $TOKEN_ADJUST_DEFAULT = 128
GLOBAL CONST $TOKEN_ADJUST_SESSIONID = 256
GLOBAL CONST $TOKEN_ALL_ACCESS = 983551
GLOBAL CONST $TOKEN_READ = 131080
GLOBAL CONST $TOKEN_WRITE = 131296
GLOBAL CONST $TOKEN_EXECUTE = 131072
GLOBAL CONST $TOKEN_HAS_TRAVERSE_PRIVILEGE = 1
GLOBAL CONST $TOKEN_HAS_BACKUP_PRIVILEGE = 2
GLOBAL CONST $TOKEN_HAS_RESTORE_PRIVILEGE = 4
GLOBAL CONST $TOKEN_HAS_ADMIN_GROUP = 8
GLOBAL CONST $TOKEN_IS_RESTRICTED = 16
GLOBAL CONST $TOKEN_SESSION_NOT_REFERENCED = 32
GLOBAL CONST $TOKEN_SANDBOX_INERT = 64
GLOBAL CONST $TOKEN_HAS_IMPERSONATE_PRIVILEGE = 128
GLOBAL CONST $RIGHTS_DELETE = 65536
GLOBAL CONST $READ_CONTROL = 131072
GLOBAL CONST $WRITE_DAC = 262144
GLOBAL CONST $WRITE_OWNER = 524288
GLOBAL CONST $SYNCHRONIZE = 1048576
GLOBAL CONST $ACCESS_SYSTEM_SECURITY = 16777216
GLOBAL CONST $STANDARD_RIGHTS_REQUIRED = 983040
GLOBAL CONST $STANDARD_RIGHTS_READ = $READ_CONTROL
GLOBAL CONST $STANDARD_RIGHTS_WRITE = $READ_CONTROL
GLOBAL CONST $STANDARD_RIGHTS_EXECUTE = $READ_CONTROL
GLOBAL CONST $STANDARD_RIGHTS_ALL = 2031616
GLOBAL CONST $SPECIFIC_RIGHTS_ALL = 65535
GLOBAL ENUM $NOT_USED_ACCESS = 0 , $GRANT_ACCESS , $SET_ACCESS , $DENY_ACCESS , $REVOKE_ACCESS , $SET_AUDIT_SUCCESS , $SET_AUDIT_FAILURE
GLOBAL ENUM $TRUSTEE_IS_UNKNOWN = 0 , $TRUSTEE_IS_USER , $TRUSTEE_IS_GROUP , $TRUSTEE_IS_DOMAIN , $TRUSTEE_IS_ALIAS , $TRUSTEE_IS_WELL_KNOWN_GROUP , $TRUSTEE_IS_DELETED , $TRUSTEE_IS_INVALID , $TRUSTEE_IS_COMPUTER
GLOBAL CONST $LOGON_WITH_PROFILE = 1
GLOBAL CONST $LOGON_NETCREDENTIALS_ONLY = 2
GLOBAL ENUM $SIDTYPEUSER = 1 , $SIDTYPEGROUP , $SIDTYPEDOMAIN , $SIDTYPEALIAS , $SIDTYPEWELLKNOWNGROUP , $SIDTYPEDELETEDACCOUNT , $SIDTYPEINVALID , $SIDTYPEUNKNOWN , $SIDTYPECOMPUTER , $SIDTYPELABEL
GLOBAL CONST $SID_ADMINISTRATORS = "S-1-5-32-544"
GLOBAL CONST $SID_USERS = "S-1-5-32-545"
GLOBAL CONST $SID_GUESTS = "S-1-5-32-546"
GLOBAL CONST $SID_ACCOUNT_OPERATORS = "S-1-5-32-548"
GLOBAL CONST $SID_SERVER_OPERATORS = "S-1-5-32-549"
GLOBAL CONST $SID_PRINT_OPERATORS = "S-1-5-32-550"
GLOBAL CONST $SID_BACKUP_OPERATORS = "S-1-5-32-551"
GLOBAL CONST $SID_REPLICATOR = "S-1-5-32-552"
GLOBAL CONST $SID_OWNER = "S-1-3-0"
GLOBAL CONST $SID_EVERYONE = "S-1-1-0"
GLOBAL CONST $SID_NETWORK = "S-1-5-2"
GLOBAL CONST $SID_INTERACTIVE = "S-1-5-4"
GLOBAL CONST $SID_SYSTEM = "S-1-5-18"
GLOBAL CONST $SID_AUTHENTICATED_USERS = "S-1-5-11"
GLOBAL CONST $SID_SCHANNEL_AUTHENTICATION = "S-1-5-64-14"
GLOBAL CONST $SID_DIGEST_AUTHENTICATION = "S-1-5-64-21"
GLOBAL CONST $SID_NT_SERVICE = "S-1-5-80"
GLOBAL CONST $SID_UNTRUSTED_MANDATORY_LEVEL = "S-1-16-0"
GLOBAL CONST $SID_LOW_MANDATORY_LEVEL = "S-1-16-4096"
GLOBAL CONST $SID_MEDIUM_MANDATORY_LEVEL = "S-1-16-8192"
GLOBAL CONST $SID_MEDIUM_PLUS_MANDATORY_LEVEL = "S-1-16-8448"
GLOBAL CONST $SID_HIGH_MANDATORY_LEVEL = "S-1-16-12288"
GLOBAL CONST $SID_SYSTEM_MANDATORY_LEVEL = "S-1-16-16384"
GLOBAL CONST $SID_PROTECTED_PROCESS_MANDATORY_LEVEL = "S-1-16-20480"
GLOBAL CONST $SID_SECURE_PROCESS_MANDATORY_LEVEL = "S-1-16-28672"
GLOBAL CONST $SID_ALL_SERVICES = "S-1-5-80-0"
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 = + 4294967295
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
#Region Global Variables and Constants
GLOBAL CONST $FORMAT_MESSAGE_ALLOCATE_BUFFER = 256
GLOBAL CONST $FORMAT_MESSAGE_IGNORE_INSERTS = 512
GLOBAL CONST $FORMAT_MESSAGE_FROM_STRING = 1024
GLOBAL CONST $FORMAT_MESSAGE_FROM_HMODULE = 2048
GLOBAL CONST $FORMAT_MESSAGE_FROM_SYSTEM = 4096
GLOBAL CONST $FORMAT_MESSAGE_ARGUMENT_ARRAY = 8192
#EndRegion Global Variables and Constants
FUNC _WINAPI_BEEP ($IFREQ = 500 , $IDURATION = 1000 )
LOCAL $ARESULT = DLLCALL ("kernel32.dll" , "bool" , "Beep" , "dword" , $IFREQ , "dword" , $IDURATION )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_FORMATMESSAGE ($IFLAGS , $PSOURCE , $IMESSAGEID , $ILANGUAGEID , BYREF $PBUFFER , $ISIZE , $VARGUMENTS )
LOCAL $SBUFFERTYPE = "struct*"
IF ISSTRING ($PBUFFER ) THEN $SBUFFERTYPE = "wstr"
LOCAL $ARESULT = DLLCALL ("kernel32.dll" , "dword" , "FormatMessageW" , "dword" , $IFLAGS , "struct*" , $PSOURCE , "dword" , $IMESSAGEID , "dword" , $ILANGUAGEID , $SBUFFERTYPE , $PBUFFER , "dword" , $ISIZE , "ptr" , $VARGUMENTS )
IF @ERROR OR NOT $ARESULT [0 ] THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , 0 )
IF $SBUFFERTYPE = "wstr" THEN $PBUFFER = $ARESULT [5 ]
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_GETERRORMESSAGE ($ICODE , $ILANGUAGE = 0 , CONST $_ICURRENTERROR = @ERROR , CONST $_ICURRENTEXTENDED = @EXTENDED )
LOCAL $ARET = DLLCALL ("kernel32.dll" , "dword" , "FormatMessageW" , "dword" , 4096 , "ptr" , 0 , "dword" , $ICODE , "dword" , $ILANGUAGE , "wstr" , "" , "dword" , 4096 , "ptr" , 0 )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR , @EXTENDED , "" )
RETURN SETERROR ($_ICURRENTERROR , $_ICURRENTEXTENDED , STRINGREGEXPREPLACE ($ARET [5 ] , "[" & @LF & "," & @CR & "]*\Z" , "" ) )
ENDFUNC
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_GETLASTERRORMESSAGE (CONST $_ICURRENTERROR = @ERROR , CONST $_ICURRENTEXTENDED = @EXTENDED )
LOCAL $ILASTERROR = _WINAPI_GETLASTERROR ()
LOCAL $TBUFFERPTR = DLLSTRUCTCREATE ("ptr" )
LOCAL $NCOUNT = _WINAPI_FORMATMESSAGE (BITOR ($FORMAT_MESSAGE_ALLOCATE_BUFFER , $FORMAT_MESSAGE_FROM_SYSTEM ) , 0 , $ILASTERROR , 0 , $TBUFFERPTR , 0 , 0 )
IF @ERROR THEN RETURN SETERROR (- @ERROR , @EXTENDED , "" )
LOCAL $STEXT = ""
LOCAL $PBUFFER = DLLSTRUCTGETDATA ($TBUFFERPTR , 1 )
IF $PBUFFER THEN
IF $NCOUNT > 0 THEN
LOCAL $TBUFFER = DLLSTRUCTCREATE ("wchar[" & ($NCOUNT + 1 ) & "]" , $PBUFFER )
$STEXT = DLLSTRUCTGETDATA ($TBUFFER , 1 )
IF STRINGRIGHT ($STEXT , 2 ) = @CRLF THEN $STEXT = STRINGTRIMRIGHT ($STEXT , 2 )
ENDIF
DLLCALL ("kernel32.dll" , "handle" , "LocalFree" , "handle" , $PBUFFER )
ENDIF
RETURN SETERROR ($_ICURRENTERROR , $_ICURRENTEXTENDED , $STEXT )
ENDFUNC
FUNC _WINAPI_MESSAGEBEEP ($ITYPE = 1 )
LOCAL $ISOUND
SWITCH $ITYPE
CASE 1
$ISOUND = 0
CASE 2
$ISOUND = 16
CASE 3
$ISOUND = 32
CASE 4
$ISOUND = 48
CASE 5
$ISOUND = 64
CASE ELSE
$ISOUND = + 4294967295
ENDSWITCH
LOCAL $ARESULT = DLLCALL ("user32.dll" , "bool" , "MessageBeep" , "uint" , $ISOUND )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_MSGBOX ($IFLAGS , $STITLE , $STEXT )
BLOCKINPUT (0 )
MSGBOX ($IFLAGS , $STITLE , $STEXT & " " )
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 _WINAPI_SHOWERROR ($STEXT , $BEXIT = TRUE )
BLOCKINPUT (0 )
MSGBOX ($MB_SYSTEMMODAL , "Error" , $STEXT & " " )
IF $BEXIT THEN EXIT
ENDFUNC
FUNC _WINAPI_SHOWLASTERROR ($STEXT = "" , $BABORT = FALSE , $ILANGUAGE = 0 , CONST $_ICURRENTERROR = @ERROR , CONST $_ICURRENTEXTENDED = @EXTENDED )
LOCAL $SERROR
LOCAL $ILASTERROR = _WINAPI_GETLASTERROR ()
WHILE 1
$SERROR = _WINAPI_GETERRORMESSAGE ($ILASTERROR , $ILANGUAGE )
IF @ERROR AND $ILANGUAGE THEN
$ILANGUAGE = 0
ELSE
EXITLOOP
ENDIF
WEND
IF STRINGSTRIPWS ($STEXT , $STR_STRIPLEADING + $STR_STRIPTRAILING ) THEN
$STEXT &= @CRLF & @CRLF
ELSE
$STEXT = ""
ENDIF
_WINAPI_MSGBOX (BITOR (262144 , BITSHIFT (16 , + 4294967294 * (NOT $ILASTERROR ) ) ) , $ILASTERROR , $STEXT & $SERROR )
IF $ILASTERROR THEN
_WINAPI_SETLASTERROR ($ILASTERROR )
IF $BABORT THEN
EXIT $ILASTERROR
ENDIF
ENDIF
RETURN SETERROR ($_ICURRENTERROR , $_ICURRENTEXTENDED , 1 )
ENDFUNC
FUNC _WINAPI_SHOWMSG ($STEXT )
_WINAPI_MSGBOX ($MB_SYSTEMMODAL , "Information" , $STEXT )
ENDFUNC
FUNC __COMERRORFORMATING (BYREF $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
FUNC _SECURITY__ADJUSTTOKENPRIVILEGES ($HTOKEN , $BDISABLEALL , $TNEWSTATE , $IBUFFERLEN , $TPREVSTATE = 0 , $PREQUIRED = 0 )
LOCAL $ACALL = DLLCALL ("advapi32.dll" , "bool" , "AdjustTokenPrivileges" , "handle" , $HTOKEN , "bool" , $BDISABLEALL , "struct*" , $TNEWSTATE , "dword" , $IBUFFERLEN , "struct*" , $TPREVSTATE , "struct*" , $PREQUIRED )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN NOT ($ACALL [0 ] = 0 )
ENDFUNC
FUNC _SECURITY__CREATEPROCESSWITHTOKEN ($HTOKEN , $ILOGONFLAGS , $SCOMMANDLINE , $ICREATIONFLAGS , $SCURDIR , $TSTARTUPINFO , $TPROCESS_INFORMATION )
LOCAL $ACALL = DLLCALL ("advapi32.dll" , "bool" , "CreateProcessWithTokenW" , "handle" , $HTOKEN , "dword" , $ILOGONFLAGS , "ptr" , 0 , "wstr" , $SCOMMANDLINE , "dword" , $ICREATIONFLAGS , "struct*" , 0 , "wstr" , $SCURDIR , "struct*" , $TSTARTUPINFO , "struct*" , $TPROCESS_INFORMATION )
IF @ERROR OR NOT $ACALL [0 ] THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN TRUE
ENDFUNC
FUNC _SECURITY__DUPLICATETOKENEX ($HEXISTINGTOKEN , $IDESIREDACCESS , $IIMPERSONATIONLEVEL , $ITOKENTYPE )
LOCAL $ACALL = DLLCALL ("advapi32.dll" , "bool" , "DuplicateTokenEx" , "handle" , $HEXISTINGTOKEN , "dword" , $IDESIREDACCESS , "struct*" , 0 , "int" , $IIMPERSONATIONLEVEL , "int" , $ITOKENTYPE , "handle*" , 0 )
IF @ERROR OR NOT $ACALL [0 ] THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ACALL [6 ]
ENDFUNC
FUNC _SECURITY__GETACCOUNTSID ($SACCOUNT , $SSYSTEM = "" )
LOCAL $AACCT = _SECURITY__LOOKUPACCOUNTNAME ($SACCOUNT , $SSYSTEM )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
IF ISARRAY ($AACCT ) THEN RETURN _SECURITY__STRINGSIDTOSID ($AACCT [0 ] )
RETURN ""
ENDFUNC
FUNC _SECURITY__GETLENGTHSID ($PSID )
IF NOT _SECURITY__ISVALIDSID ($PSID ) THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , 0 )
LOCAL $ACALL = DLLCALL ("advapi32.dll" , "dword" , "GetLengthSid" , "struct*" , $PSID )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ACALL [0 ]
ENDFUNC
FUNC _SECURITY__GETTOKENINFORMATION ($HTOKEN , $ICLASS )
LOCAL $ACALL = DLLCALL ("advapi32.dll" , "bool" , "GetTokenInformation" , "handle" , $HTOKEN , "int" , $ICLASS , "struct*" , 0 , "dword" , 0 , "dword*" , 0 )
IF @ERROR OR NOT $ACALL [5 ] THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , 0 )
LOCAL $ILEN = $ACALL [5 ]
LOCAL $TBUFFER = DLLSTRUCTCREATE ("byte[" & $ILEN & "]" )
$ACALL = DLLCALL ("advapi32.dll" , "bool" , "GetTokenInformation" , "handle" , $HTOKEN , "int" , $ICLASS , "struct*" , $TBUFFER , "dword" , DLLSTRUCTGETSIZE ($TBUFFER ) , "dword*" , 0 )
IF @ERROR OR NOT $ACALL [0 ] THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $TBUFFER
ENDFUNC
FUNC _SECURITY__IMPERSONATESELF ($ILEVEL = $SECURITYIMPERSONATION )
LOCAL $ACALL = DLLCALL ("advapi32.dll" , "bool" , "ImpersonateSelf" , "int" , $ILEVEL )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN NOT ($ACALL [0 ] = 0 )
ENDFUNC
FUNC _SECURITY__ISVALIDSID ($PSID )
LOCAL $ACALL = DLLCALL ("advapi32.dll" , "bool" , "IsValidSid" , "struct*" , $PSID )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN NOT ($ACALL [0 ] = 0 )
ENDFUNC
FUNC _SECURITY__LOOKUPACCOUNTNAME ($SACCOUNT , $SSYSTEM = "" )
LOCAL $TDATA = DLLSTRUCTCREATE ("byte SID[256]" )
LOCAL $ACALL = DLLCALL ("advapi32.dll" , "bool" , "LookupAccountNameW" , "wstr" , $SSYSTEM , "wstr" , $SACCOUNT , "struct*" , $TDATA , "dword*" , DLLSTRUCTGETSIZE ($TDATA ) , "wstr" , "" , "dword*" , DLLSTRUCTGETSIZE ($TDATA ) , "int*" , 0 )
IF @ERROR OR NOT $ACALL [0 ] THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
LOCAL $AACCT [3 ]
$AACCT [0 ] = _SECURITY__SIDTOSTRINGSID (DLLSTRUCTGETPTR ($TDATA , "SID" ) )
$AACCT [1 ] = $ACALL [5 ]
$AACCT [2 ] = $ACALL [7 ]
RETURN $AACCT
ENDFUNC
FUNC _SECURITY__LOOKUPACCOUNTSID ($VSID , $SSYSTEM = "" )
LOCAL $PSID , $AACCT [3 ]
IF ISSTRING ($VSID ) THEN
$PSID = _SECURITY__STRINGSIDTOSID ($VSID )
ELSE
$PSID = $VSID
ENDIF
IF NOT _SECURITY__ISVALIDSID ($PSID ) THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , 0 )
LOCAL $STYPESYSTEM = "ptr"
IF $SSYSTEM THEN $STYPESYSTEM = "wstr"
LOCAL $ACALL = DLLCALL ("advapi32.dll" , "bool" , "LookupAccountSidW" , $STYPESYSTEM , $SSYSTEM , "struct*" , $PSID , "wstr" , "" , "dword*" , 65536 , "wstr" , "" , "dword*" , 65536 , "int*" , 0 )
IF @ERROR OR NOT $ACALL [0 ] THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
LOCAL $AACCT [3 ]
$AACCT [0 ] = $ACALL [3 ]
$AACCT [1 ] = $ACALL [5 ]
$AACCT [2 ] = $ACALL [7 ]
RETURN $AACCT
ENDFUNC
FUNC _SECURITY__LOOKUPPRIVILEGEVALUE ($SSYSTEM , $SNAME )
LOCAL $ACALL = DLLCALL ("advapi32.dll" , "bool" , "LookupPrivilegeValueW" , "wstr" , $SSYSTEM , "wstr" , $SNAME , "int64*" , 0 )
IF @ERROR OR NOT $ACALL [0 ] THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ACALL [3 ]
ENDFUNC
FUNC _SECURITY__OPENPROCESSTOKEN ($HPROCESS , $IACCESS )
LOCAL $ACALL = DLLCALL ("advapi32.dll" , "bool" , "OpenProcessToken" , "handle" , $HPROCESS , "dword" , $IACCESS , "handle*" , 0 )
IF @ERROR OR NOT $ACALL [0 ] THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ACALL [3 ]
ENDFUNC
FUNC _SECURITY__OPENTHREADTOKEN ($IACCESS , $HTHREAD = 0 , $BOPENASSELF = FALSE )
IF $HTHREAD = 0 THEN
LOCAL $ARESULT = DLLCALL ("kernel32.dll" , "handle" , "GetCurrentThread" )
IF @ERROR THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , 0 )
$HTHREAD = $ARESULT [0 ]
ENDIF
LOCAL $ACALL = DLLCALL ("advapi32.dll" , "bool" , "OpenThreadToken" , "handle" , $HTHREAD , "dword" , $IACCESS , "bool" , $BOPENASSELF , "handle*" , 0 )
IF @ERROR OR NOT $ACALL [0 ] THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ACALL [4 ]
ENDFUNC
FUNC _SECURITY__OPENTHREADTOKENEX ($IACCESS , $HTHREAD = 0 , $BOPENASSELF = FALSE )
LOCAL $HTOKEN = _SECURITY__OPENTHREADTOKEN ($IACCESS , $HTHREAD , $BOPENASSELF )
IF $HTOKEN = 0 THEN
LOCAL CONST $ERROR_NO_TOKEN = 1008
IF _WINAPI_GETLASTERROR () <> $ERROR_NO_TOKEN THEN RETURN SETERROR (20 , _WINAPI_GETLASTERROR () , 0 )
IF NOT _SECURITY__IMPERSONATESELF () THEN RETURN SETERROR (@ERROR + 10 , _WINAPI_GETLASTERROR () , 0 )
$HTOKEN = _SECURITY__OPENTHREADTOKEN ($IACCESS , $HTHREAD , $BOPENASSELF )
IF $HTOKEN = 0 THEN RETURN SETERROR (@ERROR , _WINAPI_GETLASTERROR () , 0 )
ENDIF
RETURN $HTOKEN
ENDFUNC
FUNC _SECURITY__SETPRIVILEGE ($HTOKEN , $SPRIVILEGE , $BENABLE )
LOCAL $ILUID = _SECURITY__LOOKUPPRIVILEGEVALUE ("" , $SPRIVILEGE )
IF $ILUID = 0 THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , FALSE )
LOCAL CONST $TAGTOKEN_PRIVILEGES = "dword Count;align 4;int64 LUID;dword Attributes"
LOCAL $TCURRSTATE = DLLSTRUCTCREATE ($TAGTOKEN_PRIVILEGES )
LOCAL $ICURRSTATE = DLLSTRUCTGETSIZE ($TCURRSTATE )
LOCAL $TPREVSTATE = DLLSTRUCTCREATE ($TAGTOKEN_PRIVILEGES )
LOCAL $IPREVSTATE = DLLSTRUCTGETSIZE ($TPREVSTATE )
LOCAL $TREQUIRED = DLLSTRUCTCREATE ("int Data" )
DLLSTRUCTSETDATA ($TCURRSTATE , "Count" , 1 )
DLLSTRUCTSETDATA ($TCURRSTATE , "LUID" , $ILUID )
IF NOT _SECURITY__ADJUSTTOKENPRIVILEGES ($HTOKEN , FALSE , $TCURRSTATE , $ICURRSTATE , $TPREVSTATE , $TREQUIRED ) THEN RETURN SETERROR (2 , @ERROR , FALSE )
DLLSTRUCTSETDATA ($TPREVSTATE , "Count" , 1 )
DLLSTRUCTSETDATA ($TPREVSTATE , "LUID" , $ILUID )
LOCAL $IATTRIBUTES = DLLSTRUCTGETDATA ($TPREVSTATE , "Attributes" )
IF $BENABLE THEN
$IATTRIBUTES = BITOR ($IATTRIBUTES , $SE_PRIVILEGE_ENABLED )
ELSE
$IATTRIBUTES = BITAND ($IATTRIBUTES , BITNOT ($SE_PRIVILEGE_ENABLED ) )
ENDIF
DLLSTRUCTSETDATA ($TPREVSTATE , "Attributes" , $IATTRIBUTES )
IF NOT _SECURITY__ADJUSTTOKENPRIVILEGES ($HTOKEN , FALSE , $TPREVSTATE , $IPREVSTATE , $TCURRSTATE , $TREQUIRED ) THEN RETURN SETERROR (3 , @ERROR , FALSE )
RETURN TRUE
ENDFUNC
FUNC _SECURITY__SETTOKENINFORMATION ($HTOKEN , $ITOKENINFORMATION , $VTOKENINFORMATION , $ITOKENINFORMATIONLENGTH )
LOCAL $ACALL = DLLCALL ("advapi32.dll" , "bool" , "SetTokenInformation" , "handle" , $HTOKEN , "int" , $ITOKENINFORMATION , "struct*" , $VTOKENINFORMATION , "dword" , $ITOKENINFORMATIONLENGTH )
IF @ERROR OR NOT $ACALL [0 ] THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN TRUE
ENDFUNC
FUNC _SECURITY__SIDTOSTRINGSID ($PSID )
IF NOT _SECURITY__ISVALIDSID ($PSID ) THEN RETURN SETERROR (@ERROR + 10 , 0 , "" )
LOCAL $ACALL = DLLCALL ("advapi32.dll" , "bool" , "ConvertSidToStringSidW" , "struct*" , $PSID , "ptr*" , 0 )
IF @ERROR OR NOT $ACALL [0 ] THEN RETURN SETERROR (@ERROR , @EXTENDED , "" )
LOCAL $PSTRINGSID = $ACALL [2 ]
LOCAL $ALEN = DLLCALL ("kernel32.dll" , "int" , "lstrlenW" , "struct*" , $PSTRINGSID )
LOCAL $SSID = DLLSTRUCTGETDATA (DLLSTRUCTCREATE ("wchar Text[" & $ALEN [0 ] + 1 & "]" , $PSTRINGSID ) , "Text" )
DLLCALL ("kernel32.dll" , "handle" , "LocalFree" , "handle" , $PSTRINGSID )
RETURN $SSID
ENDFUNC
FUNC _SECURITY__SIDTYPESTR ($ITYPE )
SWITCH $ITYPE
CASE $SIDTYPEUSER
RETURN "User"
CASE $SIDTYPEGROUP
RETURN "Group"
CASE $SIDTYPEDOMAIN
RETURN "Domain"
CASE $SIDTYPEALIAS
RETURN "Alias"
CASE $SIDTYPEWELLKNOWNGROUP
RETURN "Well Known Group"
CASE $SIDTYPEDELETEDACCOUNT
RETURN "Deleted Account"
CASE $SIDTYPEINVALID
RETURN "Invalid"
CASE $SIDTYPEUNKNOWN
RETURN "Unknown Type"
CASE $SIDTYPECOMPUTER
RETURN "Computer"
CASE $SIDTYPELABEL
RETURN "A mandatory integrity label SID"
CASE ELSE
RETURN "Unknown SID Type"
ENDSWITCH
ENDFUNC
FUNC _SECURITY__STRINGSIDTOSID ($SSID )
LOCAL $ACALL = DLLCALL ("advapi32.dll" , "bool" , "ConvertStringSidToSidW" , "wstr" , $SSID , "ptr*" , 0 )
IF @ERROR OR NOT $ACALL [0 ] THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
LOCAL $PSID = $ACALL [2 ]
LOCAL $TBUFFER = DLLSTRUCTCREATE ("byte Data[" & _SECURITY__GETLENGTHSID ($PSID ) & "]" , $PSID )
LOCAL $TSID = DLLSTRUCTCREATE ("byte Data[" & DLLSTRUCTGETSIZE ($TBUFFER ) & "]" )
DLLSTRUCTSETDATA ($TSID , "Data" , DLLSTRUCTGETDATA ($TBUFFER , "Data" ) )
DLLCALL ("kernel32.dll" , "handle" , "LocalFree" , "handle" , $PSID )
RETURN $TSID
ENDFUNC
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"
GLOBAL CONST $TAGMEMMAP = "handle hProc;ulong_ptr Size;ptr Mem"
FUNC _MEMFREE (BYREF $TMEMMAP )
LOCAL $PMEMORY = DLLSTRUCTGETDATA ($TMEMMAP , "Mem" )
LOCAL $HPROCESS = DLLSTRUCTGETDATA ($TMEMMAP , "hProc" )
LOCAL $BRESULT = _MEMVIRTUALFREEEX ($HPROCESS , $PMEMORY , 0 , $MEM_RELEASE )
DLLCALL ("kernel32.dll" , "bool" , "CloseHandle" , "handle" , $HPROCESS )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $BRESULT
ENDFUNC
FUNC _MEMGLOBALALLOC ($IBYTES , $IFLAGS = 0 )
LOCAL $ARESULT = DLLCALL ("kernel32.dll" , "handle" , "GlobalAlloc" , "uint" , $IFLAGS , "ulong_ptr" , $IBYTES )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _MEMGLOBALFREE ($HMEMORY )
LOCAL $ARESULT = DLLCALL ("kernel32.dll" , "ptr" , "GlobalFree" , "handle" , $HMEMORY )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _MEMGLOBALLOCK ($HMEMORY )
LOCAL $ARESULT = DLLCALL ("kernel32.dll" , "ptr" , "GlobalLock" , "handle" , $HMEMORY )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _MEMGLOBALSIZE ($HMEMORY )
LOCAL $ARESULT = DLLCALL ("kernel32.dll" , "ulong_ptr" , "GlobalSize" , "handle" , $HMEMORY )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _MEMGLOBALUNLOCK ($HMEMORY )
LOCAL $ARESULT = DLLCALL ("kernel32.dll" , "bool" , "GlobalUnlock" , "handle" , $HMEMORY )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _MEMINIT ($HWND , $ISIZE , BYREF $TMEMMAP )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "dword" , "GetWindowThreadProcessId" , "hwnd" , $HWND , "dword*" , 0 )
IF @ERROR THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , 0 )
LOCAL $IPROCESSID = $ARESULT [2 ]
IF $IPROCESSID = 0 THEN RETURN SETERROR (1 , 0 , 0 )
LOCAL $IACCESS = BITOR ($PROCESS_VM_OPERATION , $PROCESS_VM_READ , $PROCESS_VM_WRITE )
LOCAL $HPROCESS = __MEM_OPENPROCESS ($IACCESS , FALSE , $IPROCESSID , TRUE )
LOCAL $IALLOC = BITOR ($MEM_RESERVE , $MEM_COMMIT )
LOCAL $PMEMORY = _MEMVIRTUALALLOCEX ($HPROCESS , 0 , $ISIZE , $IALLOC , $PAGE_READWRITE )
IF $PMEMORY = 0 THEN RETURN SETERROR (2 , 0 , 0 )
$TMEMMAP = DLLSTRUCTCREATE ($TAGMEMMAP )
DLLSTRUCTSETDATA ($TMEMMAP , "hProc" , $HPROCESS )
DLLSTRUCTSETDATA ($TMEMMAP , "Size" , $ISIZE )
DLLSTRUCTSETDATA ($TMEMMAP , "Mem" , $PMEMORY )
RETURN $PMEMORY
ENDFUNC
FUNC _MEMMOVEMEMORY ($PSOURCE , $PDEST , $ILENGTH )
DLLCALL ("kernel32.dll" , "none" , "RtlMoveMemory" , "struct*" , $PDEST , "struct*" , $PSOURCE , "ulong_ptr" , $ILENGTH )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED )
ENDFUNC
FUNC _MEMREAD (BYREF $TMEMMAP , $PSRCE , $PDEST , $ISIZE )
LOCAL $ARESULT = DLLCALL ("kernel32.dll" , "bool" , "ReadProcessMemory" , "handle" , DLLSTRUCTGETDATA ($TMEMMAP , "hProc" ) , "ptr" , $PSRCE , "struct*" , $PDEST , "ulong_ptr" , $ISIZE , "ulong_ptr*" , 0 )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _MEMWRITE (BYREF $TMEMMAP , $PSRCE , $PDEST = 0 , $ISIZE = 0 , $SSRCE = "struct*" )
IF $PDEST = 0 THEN $PDEST = DLLSTRUCTGETDATA ($TMEMMAP , "Mem" )
IF $ISIZE = 0 THEN $ISIZE = DLLSTRUCTGETDATA ($TMEMMAP , "Size" )
LOCAL $ARESULT = DLLCALL ("kernel32.dll" , "bool" , "WriteProcessMemory" , "handle" , DLLSTRUCTGETDATA ($TMEMMAP , "hProc" ) , "ptr" , $PDEST , $SSRCE , $PSRCE , "ulong_ptr" , $ISIZE , "ulong_ptr*" , 0 )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _MEMVIRTUALALLOC ($PADDRESS , $ISIZE , $IALLOCATION , $IPROTECT )
LOCAL $ARESULT = DLLCALL ("kernel32.dll" , "ptr" , "VirtualAlloc" , "ptr" , $PADDRESS , "ulong_ptr" , $ISIZE , "dword" , $IALLOCATION , "dword" , $IPROTECT )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _MEMVIRTUALALLOCEX ($HPROCESS , $PADDRESS , $ISIZE , $IALLOCATION , $IPROTECT )
LOCAL $ARESULT = DLLCALL ("kernel32.dll" , "ptr" , "VirtualAllocEx" , "handle" , $HPROCESS , "ptr" , $PADDRESS , "ulong_ptr" , $ISIZE , "dword" , $IALLOCATION , "dword" , $IPROTECT )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _MEMVIRTUALFREE ($PADDRESS , $ISIZE , $IFREETYPE )
LOCAL $ARESULT = DLLCALL ("kernel32.dll" , "bool" , "VirtualFree" , "ptr" , $PADDRESS , "ulong_ptr" , $ISIZE , "dword" , $IFREETYPE )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _MEMVIRTUALFREEEX ($HPROCESS , $PADDRESS , $ISIZE , $IFREETYPE )
LOCAL $ARESULT = DLLCALL ("kernel32.dll" , "bool" , "VirtualFreeEx" , "handle" , $HPROCESS , "ptr" , $PADDRESS , "ulong_ptr" , $ISIZE , "dword" , $IFREETYPE )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC __MEM_OPENPROCESS ($IACCESS , $BINHERIT , $IPID , $BDEBUGPRIV = FALSE )
LOCAL $ARESULT = DLLCALL ("kernel32.dll" , "handle" , "OpenProcess" , "dword" , $IACCESS , "bool" , $BINHERIT , "dword" , $IPID )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
IF $ARESULT [0 ] THEN RETURN $ARESULT [0 ]
IF NOT $BDEBUGPRIV THEN RETURN SETERROR (100 , 0 , 0 )
LOCAL $HTOKEN = _SECURITY__OPENTHREADTOKENEX (BITOR ($TOKEN_ADJUST_PRIVILEGES , $TOKEN_QUERY ) )
IF @ERROR THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , 0 )
_SECURITY__SETPRIVILEGE ($HTOKEN , "SeDebugPrivilege" , TRUE )
LOCAL $IERROR = @ERROR
LOCAL $IEXTENDED = @EXTENDED
LOCAL $IRET = 0
IF NOT @ERROR THEN
$ARESULT = DLLCALL ("kernel32.dll" , "handle" , "OpenProcess" , "dword" , $IACCESS , "bool" , $BINHERIT , "dword" , $IPID )
$IERROR = @ERROR
$IEXTENDED = @EXTENDED
IF $ARESULT [0 ] THEN $IRET = $ARESULT [0 ]
_SECURITY__SETPRIVILEGE ($HTOKEN , "SeDebugPrivilege" , FALSE )
IF @ERROR THEN
$IERROR = @ERROR + 20
$IEXTENDED = @EXTENDED
ENDIF
ELSE
$IERROR = @ERROR + 30
ENDIF
DLLCALL ("kernel32.dll" , "bool" , "CloseHandle" , "handle" , $HTOKEN )
RETURN SETERROR ($IERROR , $IEXTENDED , $IRET )
ENDFUNC
FUNC _SENDMESSAGE ($HWND , $IMSG , $WPARAM = 0 , $LPARAM = 0 , $IRETURN = 0 , $WPARAMTYPE = "wparam" , $LPARAMTYPE = "lparam" , $SRETURNTYPE = "lresult" )
LOCAL $ARESULT = DLLCALL ("user32.dll" , $SRETURNTYPE , "SendMessageW" , "hwnd" , $HWND , "uint" , $IMSG , $WPARAMTYPE , $WPARAM , $LPARAMTYPE , $LPARAM )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , "" )
IF $IRETURN >= 0 AND $IRETURN <= 4 THEN RETURN $ARESULT [$IRETURN ]
RETURN $ARESULT
ENDFUNC
FUNC _SENDMESSAGEA ($HWND , $IMSG , $WPARAM = 0 , $LPARAM = 0 , $IRETURN = 0 , $WPARAMTYPE = "wparam" , $LPARAMTYPE = "lparam" , $SRETURNTYPE = "lresult" )
LOCAL $ARESULT = DLLCALL ("user32.dll" , $SRETURNTYPE , "SendMessageA" , "hwnd" , $HWND , "uint" , $IMSG , $WPARAMTYPE , $WPARAM , $LPARAMTYPE , $LPARAM )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , "" )
IF $IRETURN >= 0 AND $IRETURN <= 4 THEN RETURN $ARESULT [$IRETURN ]
RETURN $ARESULT
ENDFUNC
GLOBAL CONST $SBARS_SIZEGRIP = 256
GLOBAL CONST $SBT_TOOLTIPS = 2048
GLOBAL CONST $SBARS_TOOLTIPS = 2048
GLOBAL CONST $SBT_SUNKEN = 0
GLOBAL CONST $SBT_NOBORDERS = 256
GLOBAL CONST $SBT_POPOUT = 512
GLOBAL CONST $SBT_RTLREADING = 1024
GLOBAL CONST $SBT_NOTABPARSING = 2048
GLOBAL CONST $SBT_OWNERDRAW = 4096
GLOBAL CONST $__STATUSBARCONSTANT_WM_USER = 1024
GLOBAL CONST $SB_GETBORDERS = ($__STATUSBARCONSTANT_WM_USER + 7 )
GLOBAL CONST $SB_GETICON = ($__STATUSBARCONSTANT_WM_USER + 20 )
GLOBAL CONST $SB_GETPARTS = ($__STATUSBARCONSTANT_WM_USER + 6 )
GLOBAL CONST $SB_GETRECT = ($__STATUSBARCONSTANT_WM_USER + 10 )
GLOBAL CONST $SB_GETTEXTA = ($__STATUSBARCONSTANT_WM_USER + 2 )
GLOBAL CONST $SB_GETTEXTW = ($__STATUSBARCONSTANT_WM_USER + 13 )
GLOBAL CONST $SB_GETTEXT = $SB_GETTEXTA
GLOBAL CONST $SB_GETTEXTLENGTHA = ($__STATUSBARCONSTANT_WM_USER + 3 )
GLOBAL CONST $SB_GETTEXTLENGTHW = ($__STATUSBARCONSTANT_WM_USER + 12 )
GLOBAL CONST $SB_GETTEXTLENGTH = $SB_GETTEXTLENGTHA
GLOBAL CONST $SB_GETTIPTEXTA = ($__STATUSBARCONSTANT_WM_USER + 18 )
GLOBAL CONST $SB_GETTIPTEXTW = ($__STATUSBARCONSTANT_WM_USER + 19 )
GLOBAL CONST $SB_GETUNICODEFORMAT = 8192 + 6
GLOBAL CONST $SB_ISSIMPLE = ($__STATUSBARCONSTANT_WM_USER + 14 )
GLOBAL CONST $SB_SETBKCOLOR = 8192 + 1
GLOBAL CONST $SB_SETICON = ($__STATUSBARCONSTANT_WM_USER + 15 )
GLOBAL CONST $SB_SETMINHEIGHT = ($__STATUSBARCONSTANT_WM_USER + 8 )
GLOBAL CONST $SB_SETPARTS = ($__STATUSBARCONSTANT_WM_USER + 4 )
GLOBAL CONST $SB_SETTEXTA = ($__STATUSBARCONSTANT_WM_USER + 1 )
GLOBAL CONST $SB_SETTEXTW = ($__STATUSBARCONSTANT_WM_USER + 11 )
GLOBAL CONST $SB_SETTEXT = $SB_SETTEXTA
GLOBAL CONST $SB_SETTIPTEXTA = ($__STATUSBARCONSTANT_WM_USER + 16 )
GLOBAL CONST $SB_SETTIPTEXTW = ($__STATUSBARCONSTANT_WM_USER + 17 )
GLOBAL CONST $SB_SETUNICODEFORMAT = 8192 + 5
GLOBAL CONST $SB_SIMPLE = ($__STATUSBARCONSTANT_WM_USER + 9 )
GLOBAL CONST $SB_SIMPLEID = 255
GLOBAL CONST $SBN_FIRST = + 4294966416
GLOBAL CONST $SBN_SIMPLEMODECHANGE = $SBN_FIRST + 0
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 = 4294967294
GLOBAL CONST $OBJID_SIZEGRIP = 4294967289
GLOBAL CONST $OBJID_CARET = 4294967288
GLOBAL CONST $OBJID_CURSOR = 4294967287
GLOBAL CONST $OBJID_ALERT = 4294967286
GLOBAL CONST $OBJID_SOUND = 4294967285
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 = + 4294967294
GLOBAL CONST $HWND_TOP = 0
GLOBAL CONST $HWND_TOPMOST = + 4294967295
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 = + 4294967295
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_BYSHUTDOWN = 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 $WIN_STATE_EXISTS = 1
GLOBAL CONST $WIN_STATE_VISIBLE = 2
GLOBAL CONST $WIN_STATE_ENABLED = 4
GLOBAL CONST $WIN_STATE_ACTIVE = 8
GLOBAL CONST $WIN_STATE_MINIMIZED = 16
GLOBAL CONST $WIN_STATE_MAXIMIZED = 32
GLOBAL CONST $_UDF_GLOBALIDS_OFFSET = 2
GLOBAL CONST $_UDF_GLOBALID_MAX_WIN = 16
GLOBAL CONST $_UDF_STARTID = 10000
GLOBAL CONST $_UDF_GLOBALID_MAX_IDS = 55535
GLOBAL CONST $__UDFGUICONSTANT_WS_TABSTOP = 65536
GLOBAL CONST $__UDFGUICONSTANT_WS_VISIBLE = 268435456
GLOBAL CONST $__UDFGUICONSTANT_WS_CHILD = 1073741824
GLOBAL $__G_AUDF_GLOBALIDS_USED [$_UDF_GLOBALID_MAX_WIN ] [$_UDF_GLOBALID_MAX_IDS + $_UDF_GLOBALIDS_OFFSET + 1 ]
FUNC __UDF_GETNEXTGLOBALID ($HWND )
LOCAL $NCTRLID , $IUSEDINDEX = + 4294967295 , $BALLUSED = TRUE
IF NOT WINEXISTS ($HWND ) THEN RETURN SETERROR (+ 4294967295 , + 4294967295 , 0 )
FOR $IINDEX = 0 TO $_UDF_GLOBALID_MAX_WIN + 4294967295
IF $__G_AUDF_GLOBALIDS_USED [$IINDEX ] [0 ] <> 0 THEN
IF NOT WINEXISTS ($__G_AUDF_GLOBALIDS_USED [$IINDEX ] [0 ] ) THEN
FOR $X = 0 TO UBOUND ($__G_AUDF_GLOBALIDS_USED , $UBOUND_COLUMNS ) + 4294967295
$__G_AUDF_GLOBALIDS_USED [$IINDEX ] [$X ] = 0
NEXT
$__G_AUDF_GLOBALIDS_USED [$IINDEX ] [1 ] = $_UDF_STARTID
$BALLUSED = FALSE
ENDIF
ENDIF
NEXT
FOR $IINDEX = 0 TO $_UDF_GLOBALID_MAX_WIN + 4294967295
IF $__G_AUDF_GLOBALIDS_USED [$IINDEX ] [0 ] = $HWND THEN
$IUSEDINDEX = $IINDEX
EXITLOOP
ENDIF
NEXT
IF $IUSEDINDEX = + 4294967295 THEN
FOR $IINDEX = 0 TO $_UDF_GLOBALID_MAX_WIN + 4294967295
IF $__G_AUDF_GLOBALIDS_USED [$IINDEX ] [0 ] = 0 THEN
$__G_AUDF_GLOBALIDS_USED [$IINDEX ] [0 ] = $HWND
$__G_AUDF_GLOBALIDS_USED [$IINDEX ] [1 ] = $_UDF_STARTID
$BALLUSED = FALSE
$IUSEDINDEX = $IINDEX
EXITLOOP
ENDIF
NEXT
ENDIF
IF $IUSEDINDEX = + 4294967295 AND $BALLUSED THEN RETURN SETERROR (16 , 0 , 0 )
IF $__G_AUDF_GLOBALIDS_USED [$IUSEDINDEX ] [1 ] = $_UDF_STARTID + $_UDF_GLOBALID_MAX_IDS THEN
FOR $IIDINDEX = $_UDF_GLOBALIDS_OFFSET TO UBOUND ($__G_AUDF_GLOBALIDS_USED , $UBOUND_COLUMNS ) + 4294967295
IF $__G_AUDF_GLOBALIDS_USED [$IUSEDINDEX ] [$IIDINDEX ] = 0 THEN
$NCTRLID = ($IIDINDEX - $_UDF_GLOBALIDS_OFFSET ) + 10000
$__G_AUDF_GLOBALIDS_USED [$IUSEDINDEX ] [$IIDINDEX ] = $NCTRLID
RETURN $NCTRLID
ENDIF
NEXT
RETURN SETERROR (+ 4294967295 , $_UDF_GLOBALID_MAX_IDS , 0 )
ENDIF
$NCTRLID = $__G_AUDF_GLOBALIDS_USED [$IUSEDINDEX ] [1 ]
$__G_AUDF_GLOBALIDS_USED [$IUSEDINDEX ] [1 ] += 1
$__G_AUDF_GLOBALIDS_USED [$IUSEDINDEX ] [($NCTRLID + 4294957296 ) + $_UDF_GLOBALIDS_OFFSET ] = $NCTRLID
RETURN $NCTRLID
ENDFUNC
FUNC __UDF_FREEGLOBALID ($HWND , $IGLOBALID )
IF $IGLOBALID - $_UDF_STARTID < 0 OR $IGLOBALID - $_UDF_STARTID > $_UDF_GLOBALID_MAX_IDS THEN RETURN SETERROR (+ 4294967295 , 0 , FALSE )
FOR $IINDEX = 0 TO $_UDF_GLOBALID_MAX_WIN + 4294967295
IF $__G_AUDF_GLOBALIDS_USED [$IINDEX ] [0 ] = $HWND THEN
FOR $X = $_UDF_GLOBALIDS_OFFSET TO UBOUND ($__G_AUDF_GLOBALIDS_USED , $UBOUND_COLUMNS ) + 4294967295
IF $__G_AUDF_GLOBALIDS_USED [$IINDEX ] [$X ] = $IGLOBALID THEN
$__G_AUDF_GLOBALIDS_USED [$IINDEX ] [$X ] = 0
RETURN TRUE
ENDIF
NEXT
RETURN SETERROR (+ 4294967293 , 0 , FALSE )
ENDIF
NEXT
RETURN SETERROR (+ 4294967294 , 0 , FALSE )
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 = + 4294967295
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 = + 4294967295
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
GLOBAL CONST $PATH_ORIGINAL = 0
GLOBAL CONST $PATH_DRIVE = 1
GLOBAL CONST $PATH_DIRECTORY = 2
GLOBAL CONST $PATH_FILENAME = 3
GLOBAL CONST $PATH_EXTENSION = 4
#Region Global Variables and Constants
GLOBAL $__G_VENUM , $__G_VEXT = 0
GLOBAL $__G_IRGBMODE = 1
GLOBAL CONST $TAGOSVERSIONINFO = "struct;dword OSVersionInfoSize;dword MajorVersion;dword MinorVersion;dword BuildNumber;dword PlatformId;wchar CSDVersion[128];endstruct"
GLOBAL CONST $IMAGE_BITMAP = 0
GLOBAL CONST $IMAGE_ICON = 1
GLOBAL CONST $IMAGE_CURSOR = 2
GLOBAL CONST $IMAGE_ENHMETAFILE = 3
GLOBAL CONST $LR_DEFAULTCOLOR = 0
GLOBAL CONST $LR_MONOCHROME = 1
GLOBAL CONST $LR_COLOR = 2
GLOBAL CONST $LR_COPYRETURNORG = 4
GLOBAL CONST $LR_COPYDELETEORG = 8
GLOBAL CONST $LR_LOADFROMFILE = 16
GLOBAL CONST $LR_LOADTRANSPARENT = 32
GLOBAL CONST $LR_DEFAULTSIZE = 64
GLOBAL CONST $LR_VGACOLOR = 128
GLOBAL CONST $LR_LOADMAP3DCOLORS = 4096
GLOBAL CONST $LR_CREATEDIBSECTION = 8192
GLOBAL CONST $LR_COPYFROMRESOURCE = 16384
GLOBAL CONST $LR_SHARED = 32768
GLOBAL CONST $__TAGCURSORINFO = "dword Size;dword Flags;handle hCursor;" & "struct;long X;long Y;endstruct"
GLOBAL CONST $__WINVER = __WINVER ()
#EndRegion Global Variables and Constants
#Region Functions list
#EndRegion Functions list
#Region Public Functions
FUNC _WINAPI_CREATEFILE ($SFILENAME , $ICREATION , $IACCESS = 4 , $ISHARE = 0 , $IATTRIBUTES = 0 , $TSECURITY = 0 )
LOCAL $IDA = 0 , $ISM = 0 , $ICD = 0 , $IFA = 0
IF BITAND ($IACCESS , 1 ) <> 0 THEN $IDA = BITOR ($IDA , $GENERIC_EXECUTE )
IF BITAND ($IACCESS , 2 ) <> 0 THEN $IDA = BITOR ($IDA , $GENERIC_READ )
IF BITAND ($IACCESS , 4 ) <> 0 THEN $IDA = BITOR ($IDA , $GENERIC_WRITE )
IF BITAND ($ISHARE , 1 ) <> 0 THEN $ISM = BITOR ($ISM , $FILE_SHARE_DELETE )
IF BITAND ($ISHARE , 2 ) <> 0 THEN $ISM = BITOR ($ISM , $FILE_SHARE_READ )
IF BITAND ($ISHARE , 4 ) <> 0 THEN $ISM = BITOR ($ISM , $FILE_SHARE_WRITE )
SWITCH $ICREATION
CASE 0
$ICD = $CREATE_NEW
CASE 1
$ICD = $CREATE_ALWAYS
CASE 2
$ICD = $OPEN_EXISTING
CASE 3
$ICD = $OPEN_ALWAYS
CASE 4
$ICD = $TRUNCATE_EXISTING
ENDSWITCH
IF BITAND ($IATTRIBUTES , 1 ) <> 0 THEN $IFA = BITOR ($IFA , $FILE_ATTRIBUTE_ARCHIVE )
IF BITAND ($IATTRIBUTES , 2 ) <> 0 THEN $IFA = BITOR ($IFA , $FILE_ATTRIBUTE_HIDDEN )
IF BITAND ($IATTRIBUTES , 4 ) <> 0 THEN $IFA = BITOR ($IFA , $FILE_ATTRIBUTE_READONLY )
IF BITAND ($IATTRIBUTES , 8 ) <> 0 THEN $IFA = BITOR ($IFA , $FILE_ATTRIBUTE_SYSTEM )
LOCAL $ARESULT = DLLCALL ("kernel32.dll" , "handle" , "CreateFileW" , "wstr" , $SFILENAME , "dword" , $IDA , "dword" , $ISM , "struct*" , $TSECURITY , "dword" , $ICD , "dword" , $IFA , "ptr" , 0 )
IF @ERROR OR ($ARESULT [0 ] = PTR (+ 4294967295 ) ) THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_FREELIBRARY ($HMODULE )
LOCAL $ARESULT = DLLCALL ("kernel32.dll" , "bool" , "FreeLibrary" , "handle" , $HMODULE )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_GETCURSORINFO ()
LOCAL $TCURSOR = DLLSTRUCTCREATE ($__TAGCURSORINFO )
LOCAL $ICURSOR = DLLSTRUCTGETSIZE ($TCURSOR )
DLLSTRUCTSETDATA ($TCURSOR , "Size" , $ICURSOR )
LOCAL $ARET = DLLCALL ("user32.dll" , "bool" , "GetCursorInfo" , "struct*" , $TCURSOR )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , 0 )
LOCAL $ACURSOR [5 ]
$ACURSOR [0 ] = TRUE
$ACURSOR [1 ] = DLLSTRUCTGETDATA ($TCURSOR , "Flags" ) <> 0
$ACURSOR [2 ] = DLLSTRUCTGETDATA ($TCURSOR , "hCursor" )
$ACURSOR [3 ] = DLLSTRUCTGETDATA ($TCURSOR , "X" )
$ACURSOR [4 ] = DLLSTRUCTGETDATA ($TCURSOR , "Y" )
RETURN $ACURSOR
ENDFUNC
FUNC _WINAPI_GETDLGCTRLID ($HWND )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "int" , "GetDlgCtrlID" , "hwnd" , $HWND )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_GETMODULEHANDLE ($SMODULENAME )
LOCAL $SMODULENAMETYPE = "wstr"
IF $SMODULENAME = "" THEN
$SMODULENAME = 0
$SMODULENAMETYPE = "ptr"
ENDIF
LOCAL $ARESULT = DLLCALL ("kernel32.dll" , "handle" , "GetModuleHandleW" , $SMODULENAMETYPE , $SMODULENAME )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
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 (($BUNICODE "wchar" "char" ) & "[" & ($ILENGTH + 1 ) & "]" , $PSTRING )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , "" )
RETURN SETEXTENDED ($ILENGTH , DLLSTRUCTGETDATA ($TSTRING , 1 ) )
ENDFUNC
FUNC _WINAPI_ISWOW64PROCESS ($IPID = 0 )
IF NOT $IPID THEN $IPID = @AUTOITPID
LOCAL $HPROCESS = DLLCALL ("kernel32.dll" , "handle" , "OpenProcess" , "dword" , ($__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_LOADIMAGE ($HINSTANCE , $SIMAGE , $ITYPE , $IXDESIRED , $IYDESIRED , $ILOAD )
LOCAL $ARESULT , $SIMAGETYPE = "int"
IF ISSTRING ($SIMAGE ) THEN $SIMAGETYPE = "wstr"
$ARESULT = DLLCALL ("user32.dll" , "handle" , "LoadImageW" , "handle" , $HINSTANCE , $SIMAGETYPE , $SIMAGE , "uint" , $ITYPE , "int" , $IXDESIRED , "int" , $IYDESIRED , "uint" , $ILOAD )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_LOADLIBRARY ($SFILENAME )
LOCAL $ARESULT = DLLCALL ("kernel32.dll" , "handle" , "LoadLibraryW" , "wstr" , $SFILENAME )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
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_READFILE ($HFILE , $PBUFFER , $ITOREAD , BYREF $IREAD , $TOVERLAPPED = 0 )
LOCAL $ARESULT = DLLCALL ("kernel32.dll" , "bool" , "ReadFile" , "handle" , $HFILE , "struct*" , $PBUFFER , "dword" , $ITOREAD , "dword*" , 0 , "struct*" , $TOVERLAPPED )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
$IREAD = $ARESULT [4 ]
RETURN $ARESULT [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_SWITCHCOLOR ($ICOLOR )
IF $ICOLOR = + 4294967295 THEN RETURN $ICOLOR
RETURN BITOR (BITAND ($ICOLOR , 65280 ) , BITSHIFT (BITAND ($ICOLOR , 255 ) , + 4294967280 ) , BITSHIFT (BITAND ($ICOLOR , 16711680 ) , 16 ) )
ENDFUNC
FUNC _WINAPI_WRITEFILE ($HFILE , $PBUFFER , $ITOWRITE , BYREF $IWRITTEN , $TOVERLAPPED = 0 )
LOCAL $ARESULT = DLLCALL ("kernel32.dll" , "bool" , "WriteFile" , "handle" , $HFILE , "struct*" , $PBUFFER , "dword" , $ITOWRITE , "dword*" , 0 , "struct*" , $TOVERLAPPED )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
$IWRITTEN = $ARESULT [4 ]
RETURN $ARESULT [0 ]
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 ) + 4294967295
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 = FALSE , $ICURERR = @ERROR , $ICUREXT = @EXTENDED )
IF NOT $ICURERR AND NOT $ARET [0 ] THEN $ICURERR = 10
LOCAL $ALASTERROR = DLLCALL ("kernel32.dll" , "dword" , "GetLastError" )
DLLCALL ("kernel32.dll" , "bool" , "CloseHandle" , "handle" , $HFILE )
IF $ICURERR THEN DLLCALL ("kernel32.dll" , "none" , "SetLastError" , "dword" , $ALASTERROR [0 ] )
IF $BLASTERROR THEN $ICUREXT = $ALASTERROR [0 ]
RETURN SETERROR ($ICURERR , $ICUREXT , $ICURERR )
ENDFUNC
FUNC __DLL ($SPATH , $BPIN = FALSE )
LOCAL $ARET = DLLCALL ("kernel32.dll" , "bool" , "GetModuleHandleExW" , "dword" , ($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 )
DLLCALL ("kernel32.dll" , "none" , "FatalExit" , "int" , $ICODE )
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 ) + 4294967295 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 ) + 4294967295 THEN
REDIM $ADATA [$ADATA [0 ] + $IINCREMENT ]
ENDIF
ENDIF
CASE ELSE
RETURN 0
ENDSELECT
RETURN 1
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 ) , + 4294967288 ) , DLLSTRUCTGETDATA ($TOSVI , 3 ) )
ENDFUNC
#EndRegion Internal Functions
#Region Global Variables and Constants
#EndRegion Global Variables and Constants
#Region Functions list
#EndRegion Functions list
#Region Public Functions
FUNC _WINAPI_CHARTOOEM ($SSTR )
LOCAL $ARET = DLLCALL ("user32.dll" , "bool" , "CharToOemW" , "wstr" , $SSTR , "wstr" , "" )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , "" )
RETURN $ARET [2 ]
ENDFUNC
FUNC _WINAPI_CLIENTTOSCREEN ($HWND , BYREF $TPOINT )
LOCAL $ARET = DLLCALL ("user32.dll" , "bool" , "ClientToScreen" , "hwnd" , $HWND , "struct*" , $TPOINT )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , 0 )
RETURN $TPOINT
ENDFUNC
FUNC _WINAPI_DWORDTOFLOAT ($IVALUE )
LOCAL $TDWORD = DLLSTRUCTCREATE ("dword" )
LOCAL $TFLOAT = DLLSTRUCTCREATE ("float" , DLLSTRUCTGETPTR ($TDWORD ) )
DLLSTRUCTSETDATA ($TDWORD , 1 , $IVALUE )
RETURN DLLSTRUCTGETDATA ($TFLOAT , 1 )
ENDFUNC
FUNC _WINAPI_DWORDTOINT ($IVALUE )
LOCAL $TDATA = DLLSTRUCTCREATE ("int" )
DLLSTRUCTSETDATA ($TDATA , 1 , $IVALUE )
RETURN DLLSTRUCTGETDATA ($TDATA , 1 )
ENDFUNC
FUNC _WINAPI_FLOATTODWORD ($IVALUE )
LOCAL $TFLOAT = DLLSTRUCTCREATE ("float" )
LOCAL $TDWORD = DLLSTRUCTCREATE ("dword" , DLLSTRUCTGETPTR ($TFLOAT ) )
DLLSTRUCTSETDATA ($TFLOAT , 1 , $IVALUE )
RETURN DLLSTRUCTGETDATA ($TDWORD , 1 )
ENDFUNC
FUNC _WINAPI_FLOATTOINT ($NFLOAT )
LOCAL $TFLOAT = DLLSTRUCTCREATE ("float" )
LOCAL $TINT = DLLSTRUCTCREATE ("int" , DLLSTRUCTGETPTR ($TFLOAT ) )
DLLSTRUCTSETDATA ($TFLOAT , 1 , $NFLOAT )
RETURN DLLSTRUCTGETDATA ($TINT , 1 )
ENDFUNC
FUNC _WINAPI_GETXYFROMPOINT (BYREF $TPOINT , BYREF $IX , BYREF $IY )
$IX = DLLSTRUCTGETDATA ($TPOINT , "X" )
$IY = DLLSTRUCTGETDATA ($TPOINT , "Y" )
ENDFUNC
FUNC _WINAPI_GUIDFROMSTRING ($SGUID )
LOCAL $TGUID = DLLSTRUCTCREATE ($TAGGUID )
_WINAPI_GUIDFROMSTRINGEX ($SGUID , $TGUID )
IF @ERROR THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , 0 )
RETURN $TGUID
ENDFUNC
FUNC _WINAPI_GUIDFROMSTRINGEX ($SGUID , $TGUID )
LOCAL $ARESULT = DLLCALL ("ole32.dll" , "long" , "CLSIDFromString" , "wstr" , $SGUID , "struct*" , $TGUID )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_HASHDATA ($PMEMORY , $ISIZE , $ILENGTH = 32 )
IF ($ILENGTH <= 0 ) OR ($ILENGTH > 256 ) THEN RETURN SETERROR (11 , 0 , 0 )
LOCAL $TDATA = DLLSTRUCTCREATE ("byte[" & $ILENGTH & "]" )
LOCAL $ARET = DLLCALL ("shlwapi.dll" , "uint" , "HashData" , "struct*" , $PMEMORY , "dword" , $ISIZE , "struct*" , $TDATA , "dword" , $ILENGTH )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
IF $ARET [0 ] THEN RETURN SETERROR (10 , $ARET [0 ] , 0 )
RETURN DLLSTRUCTGETDATA ($TDATA , 1 )
ENDFUNC
FUNC _WINAPI_HASHSTRING ($SSTRING , $BCASESENSITIVE = TRUE , $ILENGTH = 32 )
LOCAL $ILENGTHS = STRINGLEN ($SSTRING )
IF NOT $ILENGTHS OR ($ILENGTH > 256 ) THEN RETURN SETERROR (12 , 0 , 0 )
LOCAL $TSTRING = DLLSTRUCTCREATE ("wchar[" & ($ILENGTHS + 1 ) & "]" )
IF NOT $BCASESENSITIVE THEN
$SSTRING = STRINGLOWER ($SSTRING )
ENDIF
DLLSTRUCTSETDATA ($TSTRING , 1 , $SSTRING )
LOCAL $SHASH = _WINAPI_HASHDATA ($TSTRING , 2 * $ILENGTHS , $ILENGTH )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $SHASH
ENDFUNC
FUNC _WINAPI_HIBYTE ($IVALUE )
RETURN BITAND (BITSHIFT ($IVALUE , 8 ) , 255 )
ENDFUNC
FUNC _WINAPI_HIDWORD ($IVALUE )
LOCAL $TINT64 = DLLSTRUCTCREATE ("int64" )
LOCAL $TQWORD = DLLSTRUCTCREATE ("dword;dword" , DLLSTRUCTGETPTR ($TINT64 ) )
DLLSTRUCTSETDATA ($TINT64 , 1 , $IVALUE )
RETURN DLLSTRUCTGETDATA ($TQWORD , 2 )
ENDFUNC
FUNC _WINAPI_HIWORD ($ILONG )
RETURN BITSHIFT ($ILONG , 16 )
ENDFUNC
FUNC _WINAPI_INTTODWORD ($IVALUE )
LOCAL $TDATA = DLLSTRUCTCREATE ("dword" )
DLLSTRUCTSETDATA ($TDATA , 1 , $IVALUE )
RETURN DLLSTRUCTGETDATA ($TDATA , 1 )
ENDFUNC
FUNC _WINAPI_INTTOFLOAT ($IINT )
LOCAL $TINT = DLLSTRUCTCREATE ("int" )
LOCAL $TFLOAT = DLLSTRUCTCREATE ("float" , DLLSTRUCTGETPTR ($TINT ) )
DLLSTRUCTSETDATA ($TINT , 1 , $IINT )
RETURN DLLSTRUCTGETDATA ($TFLOAT , 1 )
ENDFUNC
FUNC _WINAPI_LOBYTE ($IVALUE )
RETURN BITAND ($IVALUE , 255 )
ENDFUNC
FUNC _WINAPI_LODWORD ($IVALUE )
LOCAL $TINT64 = DLLSTRUCTCREATE ("int64" )
LOCAL $TQWORD = DLLSTRUCTCREATE ("dword;dword" , DLLSTRUCTGETPTR ($TINT64 ) )
DLLSTRUCTSETDATA ($TINT64 , 1 , $IVALUE )
RETURN DLLSTRUCTGETDATA ($TQWORD , 1 )
ENDFUNC
FUNC _WINAPI_LOWORD ($ILONG )
RETURN BITAND ($ILONG , 65535 )
ENDFUNC
FUNC _WINAPI_LONGMID ($IVALUE , $ISTART , $ICOUNT )
RETURN BITAND (BITSHIFT ($IVALUE , $ISTART ) , BITOR (BITSHIFT (BITSHIFT (2147483647 , 32 - ($ICOUNT + 1 ) ) , 1 ) , BITSHIFT (1 , - ($ICOUNT + 4294967295 ) ) ) )
ENDFUNC
FUNC _WINAPI_MAKELANGID ($ILNGIDPRIMARY , $ILNGIDSUB )
RETURN BITOR (BITSHIFT ($ILNGIDSUB , + 4294967286 ) , $ILNGIDPRIMARY )
ENDFUNC
FUNC _WINAPI_MAKELCID ($ILNGID , $ISORTID )
RETURN BITOR (BITSHIFT ($ISORTID , + 4294967280 ) , $ILNGID )
ENDFUNC
FUNC _WINAPI_MAKELONG ($ILO , $IHI )
RETURN BITOR (BITSHIFT ($IHI , + 4294967280 ) , BITAND ($ILO , 65535 ) )
ENDFUNC
FUNC _WINAPI_MAKEQWORD ($ILODWORD , $IHIDWORD )
LOCAL $TINT64 = DLLSTRUCTCREATE ("uint64" )
LOCAL $TDWORDS = DLLSTRUCTCREATE ("dword;dword" , DLLSTRUCTGETPTR ($TINT64 ) )
DLLSTRUCTSETDATA ($TDWORDS , 1 , $ILODWORD )
DLLSTRUCTSETDATA ($TDWORDS , 2 , $IHIDWORD )
RETURN DLLSTRUCTGETDATA ($TINT64 , 1 )
ENDFUNC
FUNC _WINAPI_MAKEWORD ($ILO , $IHI )
LOCAL $TWORD = DLLSTRUCTCREATE ("ushort" )
LOCAL $TBYTE = DLLSTRUCTCREATE ("byte;byte" , DLLSTRUCTGETPTR ($TWORD ) )
DLLSTRUCTSETDATA ($TBYTE , 1 , $IHI )
DLLSTRUCTSETDATA ($TBYTE , 2 , $ILO )
RETURN DLLSTRUCTGETDATA ($TWORD , 1 )
ENDFUNC
FUNC _WINAPI_MULTIBYTETOWIDECHAR ($VTEXT , $ICODEPAGE = 0 , $IFLAGS = 0 , $BRETSTRING = FALSE )
LOCAL $STEXTTYPE = "str"
IF NOT ISSTRING ($VTEXT ) THEN $STEXTTYPE = "struct*"
LOCAL $ARESULT = DLLCALL ("kernel32.dll" , "int" , "MultiByteToWideChar" , "uint" , $ICODEPAGE , "dword" , $IFLAGS , $STEXTTYPE , $VTEXT , "int" , + 4294967295 , "ptr" , 0 , "int" , 0 )
IF @ERROR OR NOT $ARESULT [0 ] THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , 0 )
LOCAL $IOUT = $ARESULT [0 ]
LOCAL $TOUT = DLLSTRUCTCREATE ("wchar[" & $IOUT & "]" )
$ARESULT = DLLCALL ("kernel32.dll" , "int" , "MultiByteToWideChar" , "uint" , $ICODEPAGE , "dword" , $IFLAGS , $STEXTTYPE , $VTEXT , "int" , + 4294967295 , "struct*" , $TOUT , "int" , $IOUT )
IF @ERROR OR NOT $ARESULT [0 ] THEN RETURN SETERROR (@ERROR + 20 , @EXTENDED , 0 )
IF $BRETSTRING THEN RETURN DLLSTRUCTGETDATA ($TOUT , 1 )
RETURN $TOUT
ENDFUNC
FUNC _WINAPI_MULTIBYTETOWIDECHAREX ($STEXT , $PTEXT , $ICODEPAGE = 0 , $IFLAGS = 0 )
LOCAL $ARESULT = DLLCALL ("kernel32.dll" , "int" , "MultiByteToWideChar" , "uint" , $ICODEPAGE , "dword" , $IFLAGS , "STR" , $STEXT , "int" , + 4294967295 , "struct*" , $PTEXT , "int" , (STRINGLEN ($STEXT ) + 1 ) * 2 )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_OEMTOCHAR ($SSTR )
LOCAL $ARET = DLLCALL ("user32.dll" , "bool" , "OemToChar" , "str" , $SSTR , "str" , "" )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , "" )
RETURN $ARET [2 ]
ENDFUNC
FUNC _WINAPI_POINTFROMRECT (BYREF $TRECT , $BCENTER = TRUE )
LOCAL $IX1 = DLLSTRUCTGETDATA ($TRECT , "Left" )
LOCAL $IY1 = DLLSTRUCTGETDATA ($TRECT , "Top" )
LOCAL $IX2 = DLLSTRUCTGETDATA ($TRECT , "Right" )
LOCAL $IY2 = DLLSTRUCTGETDATA ($TRECT , "Bottom" )
IF $BCENTER THEN
$IX1 = $IX1 + (($IX2 - $IX1 ) / 2 )
$IY1 = $IY1 + (($IY2 - $IY1 ) / 2 )
ENDIF
LOCAL $TPOINT = DLLSTRUCTCREATE ($TAGPOINT )
DLLSTRUCTSETDATA ($TPOINT , "X" , $IX1 )
DLLSTRUCTSETDATA ($TPOINT , "Y" , $IY1 )
RETURN $TPOINT
ENDFUNC
FUNC _WINAPI_PRIMARYLANGID ($ILNGID )
RETURN BITAND ($ILNGID , 1023 )
ENDFUNC
FUNC _WINAPI_SCREENTOCLIENT ($HWND , BYREF $TPOINT )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "bool" , "ScreenToClient" , "hwnd" , $HWND , "struct*" , $TPOINT )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_SHORTTOWORD ($IVALUE )
RETURN BITAND ($IVALUE , 65535 )
ENDFUNC
FUNC _WINAPI_STRFORMATBYTESIZE ($ISIZE )
LOCAL $ARET = DLLCALL ("shlwapi.dll" , "ptr" , "StrFormatByteSizeW" , "int64" , $ISIZE , "wstr" , "" , "uint" , 1024 )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , "" )
RETURN $ARET [2 ]
ENDFUNC
FUNC _WINAPI_STRFORMATBYTESIZEEX ($ISIZE )
LOCAL $ASYMBOL = DLLCALL ("kernel32.dll" , "int" , "GetLocaleInfoW" , "dword" , 1024 , "dword" , 15 , "wstr" , "" , "int" , 2048 )
IF @ERROR THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , "" )
LOCAL $SSIZE = _WINAPI_STRFORMATBYTESIZE (0 )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , "" )
RETURN STRINGREPLACE ($SSIZE , "0" , STRINGREGEXPREPLACE (NUMBER ($ISIZE ) , "(?<=\d)(?=(\d{3})+\z)" , $ASYMBOL [3 ] ) )
ENDFUNC
FUNC _WINAPI_STRFORMATKBSIZE ($ISIZE )
LOCAL $ARET = DLLCALL ("shlwapi.dll" , "ptr" , "StrFormatKBSizeW" , "int64" , $ISIZE , "wstr" , "" , "uint" , 1024 )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , "" )
RETURN $ARET [2 ]
ENDFUNC
FUNC _WINAPI_STRFROMTIMEINTERVAL ($ITIME , $IDIGITS = 7 )
LOCAL $ARET = DLLCALL ("shlwapi.dll" , "int" , "StrFromTimeIntervalW" , "wstr" , "" , "uint" , 1024 , "dword" , $ITIME , "int" , $IDIGITS )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , "" )
RETURN STRINGSTRIPWS ($ARET [1 ] , $STR_STRIPLEADING + $STR_STRIPTRAILING )
ENDFUNC
FUNC _WINAPI_STRINGFROMGUID ($TGUID )
LOCAL $ARESULT = DLLCALL ("ole32.dll" , "int" , "StringFromGUID2" , "struct*" , $TGUID , "wstr" , "" , "int" , 40 )
IF @ERROR OR NOT $ARESULT [0 ] THEN RETURN SETERROR (@ERROR , @EXTENDED , "" )
RETURN SETEXTENDED ($ARESULT [0 ] , $ARESULT [2 ] )
ENDFUNC
FUNC _WINAPI_SUBLANGID ($ILNGID )
RETURN BITSHIFT ($ILNGID , 10 )
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_WIDECHARTOMULTIBYTE ($VUNICODE , $ICODEPAGE = 0 , $BRETNOSTRUCT = TRUE , $BRETBINARY = FALSE )
LOCAL $SUNICODETYPE = "wstr"
IF NOT ISSTRING ($VUNICODE ) THEN $SUNICODETYPE = "struct*"
LOCAL $ARESULT = DLLCALL ("kernel32.dll" , "int" , "WideCharToMultiByte" , "uint" , $ICODEPAGE , "dword" , 0 , $SUNICODETYPE , $VUNICODE , "int" , + 4294967295 , "ptr" , 0 , "int" , 0 , "ptr" , 0 , "ptr" , 0 )
IF @ERROR OR NOT $ARESULT [0 ] THEN RETURN SETERROR (@ERROR + 20 , @EXTENDED , "" )
LOCAL $TMULTIBYTE = DLLSTRUCTCREATE ((($BRETBINARY ) ("byte" ) ("char" ) ) & "[" & $ARESULT [0 ] & "]" )
$ARESULT = DLLCALL ("kernel32.dll" , "int" , "WideCharToMultiByte" , "uint" , $ICODEPAGE , "dword" , 0 , $SUNICODETYPE , $VUNICODE , "int" , + 4294967295 , "struct*" , $TMULTIBYTE , "int" , $ARESULT [0 ] , "ptr" , 0 , "ptr" , 0 )
IF @ERROR OR NOT $ARESULT [0 ] THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , "" )
IF $BRETNOSTRUCT THEN RETURN DLLSTRUCTGETDATA ($TMULTIBYTE , 1 )
RETURN $TMULTIBYTE
ENDFUNC
FUNC _WINAPI_WORDTOSHORT ($IVALUE )
IF BITAND ($IVALUE , 32768 ) THEN
RETURN BITOR ($IVALUE , 4294934528 )
ENDIF
RETURN BITAND ($IVALUE , 32767 )
ENDFUNC
#EndRegion Public Functions
#Region Global Variables and Constants
GLOBAL $__G_AINPROCESS_WINAPI [64 ] [2 ] = [[0 , 0 ] ]
GLOBAL $__G_AWINLIST_WINAPI [64 ] [2 ] = [[0 , 0 ] ]
GLOBAL CONST $GW_HWNDFIRST = 0
GLOBAL CONST $GW_HWNDLAST = 1
GLOBAL CONST $GW_HWNDNEXT = 2
GLOBAL CONST $GW_HWNDPREV = 3
GLOBAL CONST $GW_OWNER = 4
GLOBAL CONST $GW_CHILD = 5
GLOBAL CONST $GW_ENABLEDPOPUP = 6
GLOBAL CONST $GWL_WNDPROC = 4294967292
GLOBAL CONST $GWL_HINSTANCE = 4294967290
GLOBAL CONST $GWL_HWNDPARENT = 4294967288
GLOBAL CONST $GWL_ID = 4294967284
GLOBAL CONST $GWL_STYLE = 4294967280
GLOBAL CONST $GWL_EXSTYLE = 4294967276
GLOBAL CONST $GWL_USERDATA = 4294967275
GLOBAL CONST $__WINAPICONSTANT_WM_SETFONT = 48
#EndRegion Global Variables and Constants
#Region Functions list
#EndRegion Functions list
#Region Public Functions
FUNC _WINAPI_CREATEWINDOWEX ($IEXSTYLE , $SCLASS , $SNAME , $ISTYLE , $IX , $IY , $IWIDTH , $IHEIGHT , $HPARENT , $HMENU = 0 , $HINSTANCE = 0 , $PPARAM = 0 )
IF $HINSTANCE = 0 THEN $HINSTANCE = _WINAPI_GETMODULEHANDLE ("" )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "hwnd" , "CreateWindowExW" , "dword" , $IEXSTYLE , "wstr" , $SCLASS , "wstr" , $SNAME , "dword" , $ISTYLE , "int" , $IX , "int" , $IY , "int" , $IWIDTH , "int" , $IHEIGHT , "hwnd" , $HPARENT , "handle" , $HMENU , "handle" , $HINSTANCE , "struct*" , $PPARAM )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_GETCLIENTRECT ($HWND )
LOCAL $TRECT = DLLSTRUCTCREATE ($TAGRECT )
LOCAL $ARET = DLLCALL ("user32.dll" , "bool" , "GetClientRect" , "hwnd" , $HWND , "struct*" , $TRECT )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , 0 )
RETURN $TRECT
ENDFUNC
FUNC _WINAPI_GETDESKTOPWINDOW ()
LOCAL $ARESULT = DLLCALL ("user32.dll" , "hwnd" , "GetDesktopWindow" )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_DESTROYWINDOW ($HWND )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "bool" , "DestroyWindow" , "hwnd" , $HWND )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_ENABLEWINDOW ($HWND , $BENABLE = TRUE )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "bool" , "EnableWindow" , "hwnd" , $HWND , "bool" , $BENABLE )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_ENUMWINDOWS ($BVISIBLE = TRUE , $HWND = DEFAULT )
__WINAPI_ENUMWINDOWSINIT ()
IF $HWND = DEFAULT THEN $HWND = _WINAPI_GETDESKTOPWINDOW ()
__WINAPI_ENUMWINDOWSCHILD ($HWND , $BVISIBLE )
RETURN $__G_AWINLIST_WINAPI
ENDFUNC
FUNC _WINAPI_ENUMWINDOWSPOPUP ()
__WINAPI_ENUMWINDOWSINIT ()
LOCAL $HWND = _WINAPI_GETWINDOW (_WINAPI_GETDESKTOPWINDOW () , $GW_CHILD )
LOCAL $SCLASS
WHILE $HWND <> 0
IF _WINAPI_ISWINDOWVISIBLE ($HWND ) THEN
$SCLASS = _WINAPI_GETCLASSNAME ($HWND )
IF $SCLASS = "#32768" THEN
__WINAPI_ENUMWINDOWSADD ($HWND )
ELSEIF $SCLASS = "ToolbarWindow32" THEN
__WINAPI_ENUMWINDOWSADD ($HWND )
ELSEIF $SCLASS = "ToolTips_Class32" THEN
__WINAPI_ENUMWINDOWSADD ($HWND )
ELSEIF $SCLASS = "BaseBar" THEN
__WINAPI_ENUMWINDOWSCHILD ($HWND )
ENDIF
ENDIF
$HWND = _WINAPI_GETWINDOW ($HWND , $GW_HWNDNEXT )
WEND
RETURN $__G_AWINLIST_WINAPI
ENDFUNC
FUNC _WINAPI_ENUMWINDOWSTOP ()
__WINAPI_ENUMWINDOWSINIT ()
LOCAL $HWND = _WINAPI_GETWINDOW (_WINAPI_GETDESKTOPWINDOW () , $GW_CHILD )
WHILE $HWND <> 0
IF _WINAPI_ISWINDOWVISIBLE ($HWND ) THEN __WINAPI_ENUMWINDOWSADD ($HWND )
$HWND = _WINAPI_GETWINDOW ($HWND , $GW_HWNDNEXT )
WEND
RETURN $__G_AWINLIST_WINAPI
ENDFUNC
FUNC _WINAPI_GETCLASSNAME ($HWND )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "int" , "GetClassNameW" , "hwnd" , $HWND , "wstr" , "" , "int" , 4096 )
IF @ERROR OR NOT $ARESULT [0 ] THEN RETURN SETERROR (@ERROR , @EXTENDED , "" )
RETURN SETEXTENDED ($ARESULT [0 ] , $ARESULT [2 ] )
ENDFUNC
FUNC _WINAPI_GETFOCUS ()
LOCAL $ARESULT = DLLCALL ("user32.dll" , "hwnd" , "GetFocus" )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_GETPARENT ($HWND )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "hwnd" , "GetParent" , "hwnd" , $HWND )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_GETSYSCOLOR ($IINDEX )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "INT" , "GetSysColor" , "int" , $IINDEX )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_GETSYSTEMMETRICS ($IINDEX )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "int" , "GetSystemMetrics" , "int" , $IINDEX )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_GETWINDOW ($HWND , $ICMD )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "hwnd" , "GetWindow" , "hwnd" , $HWND , "uint" , $ICMD )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_GETWINDOWHEIGHT ($HWND )
LOCAL $TRECT = _WINAPI_GETWINDOWRECT ($HWND )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN DLLSTRUCTGETDATA ($TRECT , "Bottom" ) - DLLSTRUCTGETDATA ($TRECT , "Top" )
ENDFUNC
FUNC _WINAPI_GETWINDOWLONG ($HWND , $IINDEX )
LOCAL $SFUNCNAME = "GetWindowLongW"
IF @AUTOITX64 THEN $SFUNCNAME = "GetWindowLongPtrW"
LOCAL $ARESULT = DLLCALL ("user32.dll" , "long_ptr" , $SFUNCNAME , "hwnd" , $HWND , "int" , $IINDEX )
IF @ERROR OR NOT $ARESULT [0 ] THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_GETWINDOWRECT ($HWND )
LOCAL $TRECT = DLLSTRUCTCREATE ($TAGRECT )
LOCAL $ARET = DLLCALL ("user32.dll" , "bool" , "GetWindowRect" , "hwnd" , $HWND , "struct*" , $TRECT )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , 0 )
RETURN $TRECT
ENDFUNC
FUNC _WINAPI_GETWINDOWTEXT ($HWND )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "int" , "GetWindowTextW" , "hwnd" , $HWND , "wstr" , "" , "int" , 4096 )
IF @ERROR OR NOT $ARESULT [0 ] THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , "" )
RETURN SETEXTENDED ($ARESULT [0 ] , $ARESULT [2 ] )
ENDFUNC
FUNC _WINAPI_GETWINDOWTHREADPROCESSID ($HWND , BYREF $IPID )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "dword" , "GetWindowThreadProcessId" , "hwnd" , $HWND , "dword*" , 0 )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
$IPID = $ARESULT [2 ]
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_GETWINDOWWIDTH ($HWND )
LOCAL $TRECT = _WINAPI_GETWINDOWRECT ($HWND )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN DLLSTRUCTGETDATA ($TRECT , "Right" ) - DLLSTRUCTGETDATA ($TRECT , "Left" )
ENDFUNC
FUNC _WINAPI_INPROCESS ($HWND , BYREF $HLASTWND )
IF $HWND = $HLASTWND THEN RETURN TRUE
FOR $II = $__G_AINPROCESS_WINAPI [0 ] [0 ] TO 1 STEP + 4294967295
IF $HWND = $__G_AINPROCESS_WINAPI [$II ] [0 ] THEN
IF $__G_AINPROCESS_WINAPI [$II ] [1 ] THEN
$HLASTWND = $HWND
RETURN TRUE
ELSE
RETURN FALSE
ENDIF
ENDIF
NEXT
LOCAL $IPID
_WINAPI_GETWINDOWTHREADPROCESSID ($HWND , $IPID )
LOCAL $ICOUNT = $__G_AINPROCESS_WINAPI [0 ] [0 ] + 1
IF $ICOUNT >= 64 THEN $ICOUNT = 1
$__G_AINPROCESS_WINAPI [0 ] [0 ] = $ICOUNT
$__G_AINPROCESS_WINAPI [$ICOUNT ] [0 ] = $HWND
$__G_AINPROCESS_WINAPI [$ICOUNT ] [1 ] = ($IPID = @AUTOITPID )
RETURN $__G_AINPROCESS_WINAPI [$ICOUNT ] [1 ]
ENDFUNC
FUNC _WINAPI_INVALIDATERECT ($HWND , $TRECT = 0 , $BERASE = TRUE )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "bool" , "InvalidateRect" , "hwnd" , $HWND , "struct*" , $TRECT , "bool" , $BERASE )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_ISCLASSNAME ($HWND , $SCLASSNAME )
LOCAL $SSEPARATOR = OPT ("GUIDataSeparatorChar" )
LOCAL $ACLASSNAME = STRINGSPLIT ($SCLASSNAME , $SSEPARATOR )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
LOCAL $SCLASSCHECK = _WINAPI_GETCLASSNAME ($HWND )
FOR $X = 1 TO UBOUND ($ACLASSNAME ) + 4294967295
IF STRINGUPPER (STRINGMID ($SCLASSCHECK , 1 , STRINGLEN ($ACLASSNAME [$X ] ) ) ) = STRINGUPPER ($ACLASSNAME [$X ] ) THEN RETURN TRUE
NEXT
RETURN FALSE
ENDFUNC
FUNC _WINAPI_ISWINDOW ($HWND )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "bool" , "IsWindow" , "hwnd" , $HWND )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_ISWINDOWVISIBLE ($HWND )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "bool" , "IsWindowVisible" , "hwnd" , $HWND )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_MOVEWINDOW ($HWND , $IX , $IY , $IWIDTH , $IHEIGHT , $BREPAINT = TRUE )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "bool" , "MoveWindow" , "hwnd" , $HWND , "int" , $IX , "int" , $IY , "int" , $IWIDTH , "int" , $IHEIGHT , "bool" , $BREPAINT )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_SETFOCUS ($HWND )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "hwnd" , "SetFocus" , "hwnd" , $HWND )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_SETFONT ($HWND , $HFONT , $BREDRAW = TRUE )
_SENDMESSAGE ($HWND , $__WINAPICONSTANT_WM_SETFONT , $HFONT , $BREDRAW , 0 , "hwnd" )
ENDFUNC
FUNC _WINAPI_SETPARENT ($HWNDCHILD , $HWNDPARENT )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "hwnd" , "SetParent" , "hwnd" , $HWNDCHILD , "hwnd" , $HWNDPARENT )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_SETWINDOWPOS ($HWND , $HAFTER , $IX , $IY , $ICX , $ICY , $IFLAGS )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "bool" , "SetWindowPos" , "hwnd" , $HWND , "hwnd" , $HAFTER , "int" , $IX , "int" , $IY , "int" , $ICX , "int" , $ICY , "uint" , $IFLAGS )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_SETWINDOWTEXT ($HWND , $STEXT )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "bool" , "SetWindowTextW" , "hwnd" , $HWND , "wstr" , $STEXT )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_SHOWWINDOW ($HWND , $ICMDSHOW = 5 )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "bool" , "ShowWindow" , "hwnd" , $HWND , "int" , $ICMDSHOW )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_UPDATEWINDOW ($HWND )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "bool" , "UpdateWindow" , "hwnd" , $HWND )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARESULT [0 ]
ENDFUNC
#EndRegion Public Functions
#Region Internal Functions
FUNC __WINAPI_ENUMWINDOWSADD ($HWND , $SCLASS = "" )
IF $SCLASS = "" THEN $SCLASS = _WINAPI_GETCLASSNAME ($HWND )
$__G_AWINLIST_WINAPI [0 ] [0 ] += 1
LOCAL $ICOUNT = $__G_AWINLIST_WINAPI [0 ] [0 ]
IF $ICOUNT >= $__G_AWINLIST_WINAPI [0 ] [1 ] THEN
REDIM $__G_AWINLIST_WINAPI [$ICOUNT + 64 ] [2 ]
$__G_AWINLIST_WINAPI [0 ] [1 ] += 64
ENDIF
$__G_AWINLIST_WINAPI [$ICOUNT ] [0 ] = $HWND
$__G_AWINLIST_WINAPI [$ICOUNT ] [1 ] = $SCLASS
ENDFUNC
FUNC __WINAPI_ENUMWINDOWSCHILD ($HWND , $BVISIBLE = TRUE )
$HWND = _WINAPI_GETWINDOW ($HWND , $GW_CHILD )
WHILE $HWND <> 0
IF (NOT $BVISIBLE ) OR _WINAPI_ISWINDOWVISIBLE ($HWND ) THEN
__WINAPI_ENUMWINDOWSADD ($HWND )
__WINAPI_ENUMWINDOWSCHILD ($HWND , $BVISIBLE )
ENDIF
$HWND = _WINAPI_GETWINDOW ($HWND , $GW_HWNDNEXT )
WEND
ENDFUNC
FUNC __WINAPI_ENUMWINDOWSINIT ()
REDIM $__G_AWINLIST_WINAPI [64 ] [2 ]
$__G_AWINLIST_WINAPI [0 ] [0 ] = 0
$__G_AWINLIST_WINAPI [0 ] [1 ] = 64
ENDFUNC
#EndRegion Internal Functions
GLOBAL $__G_HSBLASTWND
GLOBAL CONST $__STATUSBARCONSTANT_CLASSNAME = "msctls_statusbar32"
GLOBAL CONST $__STATUSBARCONSTANT_WM_SIZE = 5
GLOBAL CONST $__STATUSBARCONSTANT_CLR_DEFAULT = 4278190080
GLOBAL CONST $TAGBORDERS = "int BX;int BY;int RX"
FUNC _GUICTRLSTATUSBAR_CREATE ($HWND , $VPARTEDGE = + 4294967295 , $VPARTTEXT = "" , $ISTYLES = + 4294967295 , $IEXSTYLES = 0 )
IF NOT ISHWND ($HWND ) THEN RETURN SETERROR (1 , 0 , 0 )
LOCAL $ISTYLE = BITOR ($__UDFGUICONSTANT_WS_CHILD , $__UDFGUICONSTANT_WS_VISIBLE )
IF $ISTYLES = + 4294967295 THEN $ISTYLES = 0
IF $IEXSTYLES = + 4294967295 THEN $IEXSTYLES = 0
LOCAL $APARTWIDTH [1 ] , $APARTTEXT [1 ]
IF @NUMPARAMS > 1 THEN
IF ISARRAY ($VPARTEDGE ) THEN
$APARTWIDTH = $VPARTEDGE
ELSE
$APARTWIDTH [0 ] = $VPARTEDGE
ENDIF
IF @NUMPARAMS = 2 THEN
REDIM $APARTTEXT [UBOUND ($APARTWIDTH ) ]
ELSE
IF ISARRAY ($VPARTTEXT ) THEN
$APARTTEXT = $VPARTTEXT
ELSE
$APARTTEXT [0 ] = $VPARTTEXT
ENDIF
IF UBOUND ($APARTWIDTH ) <> UBOUND ($APARTTEXT ) THEN
LOCAL $ILAST
IF UBOUND ($APARTWIDTH ) > UBOUND ($APARTTEXT ) THEN
$ILAST = UBOUND ($APARTTEXT )
REDIM $APARTTEXT [UBOUND ($APARTWIDTH ) ]
ELSE
$ILAST = UBOUND ($APARTWIDTH )
REDIM $APARTWIDTH [UBOUND ($APARTTEXT ) ]
FOR $X = $ILAST TO UBOUND ($APARTWIDTH ) + 4294967295
$APARTWIDTH [$X ] = $APARTWIDTH [$X + 4294967295 ] + 75
NEXT
$APARTWIDTH [UBOUND ($APARTTEXT ) + 4294967295 ] = + 4294967295
ENDIF
ENDIF
ENDIF
IF NOT ISHWND ($HWND ) THEN $HWND = HWND ($HWND )
IF @NUMPARAMS > 3 THEN $ISTYLE = BITOR ($ISTYLE , $ISTYLES )
ENDIF
LOCAL $NCTRLID = __UDF_GETNEXTGLOBALID ($HWND )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
LOCAL $HWNDSBAR = _WINAPI_CREATEWINDOWEX ($IEXSTYLES , $__STATUSBARCONSTANT_CLASSNAME , "" , $ISTYLE , 0 , 0 , 0 , 0 , $HWND , $NCTRLID )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
IF @NUMPARAMS > 1 THEN
_GUICTRLSTATUSBAR_SETPARTS ($HWNDSBAR , UBOUND ($APARTWIDTH ) , $APARTWIDTH )
FOR $X = 0 TO UBOUND ($APARTTEXT ) + 4294967295
_GUICTRLSTATUSBAR_SETTEXT ($HWNDSBAR , $APARTTEXT [$X ] , $X )
NEXT
ENDIF
RETURN $HWNDSBAR
ENDFUNC
FUNC _GUICTRLSTATUSBAR_DESTROY (BYREF $HWND )
IF NOT _WINAPI_ISCLASSNAME ($HWND , $__STATUSBARCONSTANT_CLASSNAME ) THEN RETURN SETERROR (2 , 2 , FALSE )
LOCAL $IDESTROYED = 0
IF ISHWND ($HWND ) THEN
IF _WINAPI_INPROCESS ($HWND , $__G_HSBLASTWND ) THEN
LOCAL $NCTRLID = _WINAPI_GETDLGCTRLID ($HWND )
LOCAL $HPARENT = _WINAPI_GETPARENT ($HWND )
$IDESTROYED = _WINAPI_DESTROYWINDOW ($HWND )
LOCAL $IRET = __UDF_FREEGLOBALID ($HPARENT , $NCTRLID )
IF NOT $IRET THEN
ENDIF
ELSE
RETURN SETERROR (1 , 1 , FALSE )
ENDIF
ENDIF
IF $IDESTROYED THEN $HWND = 0
RETURN $IDESTROYED <> 0
ENDFUNC
FUNC _GUICTRLSTATUSBAR_EMBEDCONTROL ($HWND , $IPART , $HCONTROL , $IFIT = 4 )
LOCAL $ARECT = _GUICTRLSTATUSBAR_GETRECT ($HWND , $IPART )
LOCAL $IBARX = $ARECT [0 ]
LOCAL $IBARY = $ARECT [1 ]
LOCAL $IBARW = $ARECT [2 ] - $IBARX
LOCAL $IBARH = $ARECT [3 ] - $IBARY
LOCAL $ICONX = $IBARX
LOCAL $ICONY = $IBARY
LOCAL $ICONW = _WINAPI_GETWINDOWWIDTH ($HCONTROL )
LOCAL $ICONH = _WINAPI_GETWINDOWHEIGHT ($HCONTROL )
IF $ICONW > $IBARW THEN $ICONW = $IBARW
IF $ICONH > $IBARH THEN $ICONH = $IBARH
LOCAL $IPADX = ($IBARW - $ICONW ) / 2
LOCAL $IPADY = ($IBARH - $ICONH ) / 2
IF $IPADX < 0 THEN $IPADX = 0
IF $IPADY < 0 THEN $IPADY = 0
IF BITAND ($IFIT , 1 ) = 1 THEN $ICONX = $IBARX + $IPADX
IF BITAND ($IFIT , 2 ) = 2 THEN $ICONY = $IBARY + $IPADY
IF BITAND ($IFIT , 4 ) = 4 THEN
$IPADX = _GUICTRLSTATUSBAR_GETBORDERSRECT ($HWND )
$IPADY = _GUICTRLSTATUSBAR_GETBORDERSVERT ($HWND )
$ICONX = $IBARX
IF _GUICTRLSTATUSBAR_ISSIMPLE ($HWND ) THEN $ICONX += $IPADX
$ICONY = $IBARY + $IPADY
$ICONW = $IBARW - ($IPADX * 2 )
$ICONH = $IBARH - ($IPADY * 2 )
ENDIF
_WINAPI_SETPARENT ($HCONTROL , $HWND )
_WINAPI_MOVEWINDOW ($HCONTROL , $ICONX , $ICONY , $ICONW , $ICONH )
ENDFUNC
FUNC _GUICTRLSTATUSBAR_GETBORDERS ($HWND )
LOCAL $TBORDERS = DLLSTRUCTCREATE ($TAGBORDERS )
LOCAL $IRET
IF _WINAPI_INPROCESS ($HWND , $__G_HSBLASTWND ) THEN
$IRET = _SENDMESSAGE ($HWND , $SB_GETBORDERS , 0 , $TBORDERS , 0 , "wparam" , "struct*" )
ELSE
LOCAL $ISIZE = DLLSTRUCTGETSIZE ($TBORDERS )
LOCAL $TMEMMAP
LOCAL $PMEMORY = _MEMINIT ($HWND , $ISIZE , $TMEMMAP )
$IRET = _SENDMESSAGE ($HWND , $SB_GETBORDERS , 0 , $PMEMORY , 0 , "wparam" , "ptr" )
_MEMREAD ($TMEMMAP , $PMEMORY , $TBORDERS , $ISIZE )
_MEMFREE ($TMEMMAP )
ENDIF
LOCAL $ABORDERS [3 ]
IF $IRET = 0 THEN RETURN SETERROR (+ 4294967295 , + 4294967295 , $ABORDERS )
$ABORDERS [0 ] = DLLSTRUCTGETDATA ($TBORDERS , "BX" )
$ABORDERS [1 ] = DLLSTRUCTGETDATA ($TBORDERS , "BY" )
$ABORDERS [2 ] = DLLSTRUCTGETDATA ($TBORDERS , "RX" )
RETURN $ABORDERS
ENDFUNC
FUNC _GUICTRLSTATUSBAR_GETBORDERSHORZ ($HWND )
LOCAL $ABORDERS = _GUICTRLSTATUSBAR_GETBORDERS ($HWND )
RETURN SETERROR (@ERROR , @EXTENDED , $ABORDERS [0 ] )
ENDFUNC
FUNC _GUICTRLSTATUSBAR_GETBORDERSRECT ($HWND )
LOCAL $ABORDERS = _GUICTRLSTATUSBAR_GETBORDERS ($HWND )
RETURN SETERROR (@ERROR , @EXTENDED , $ABORDERS [2 ] )
ENDFUNC
FUNC _GUICTRLSTATUSBAR_GETBORDERSVERT ($HWND )
LOCAL $ABORDERS = _GUICTRLSTATUSBAR_GETBORDERS ($HWND )
RETURN SETERROR (@ERROR , @EXTENDED , $ABORDERS [1 ] )
ENDFUNC
FUNC _GUICTRLSTATUSBAR_GETCOUNT ($HWND )
RETURN _SENDMESSAGE ($HWND , $SB_GETPARTS )
ENDFUNC
FUNC _GUICTRLSTATUSBAR_GETHEIGHT ($HWND )
LOCAL $TRECT = _GUICTRLSTATUSBAR_GETRECTEX ($HWND , 0 )
RETURN DLLSTRUCTGETDATA ($TRECT , "Bottom" ) - DLLSTRUCTGETDATA ($TRECT , "Top" ) - (_GUICTRLSTATUSBAR_GETBORDERSVERT ($HWND ) * 2 )
ENDFUNC
FUNC _GUICTRLSTATUSBAR_GETICON ($HWND , $IINDEX = 0 )
RETURN _SENDMESSAGE ($HWND , $SB_GETICON , $IINDEX , 0 , 0 , "wparam" , "lparam" , "handle" )
ENDFUNC
FUNC _GUICTRLSTATUSBAR_GETPARTS ($HWND )
LOCAL $ICOUNT = _GUICTRLSTATUSBAR_GETCOUNT ($HWND )
LOCAL $TPARTS = DLLSTRUCTCREATE ("int[" & $ICOUNT & "]" )
LOCAL $APARTS [$ICOUNT + 1 ]
IF _WINAPI_INPROCESS ($HWND , $__G_HSBLASTWND ) THEN
$APARTS [0 ] = _SENDMESSAGE ($HWND , $SB_GETPARTS , $ICOUNT , $TPARTS , 0 , "wparam" , "struct*" )
ELSE
LOCAL $IPARTS = DLLSTRUCTGETSIZE ($TPARTS )
LOCAL $TMEMMAP
LOCAL $PMEMORY = _MEMINIT ($HWND , $IPARTS , $TMEMMAP )
$APARTS [0 ] = _SENDMESSAGE ($HWND , $SB_GETPARTS , $ICOUNT , $PMEMORY , 0 , "wparam" , "ptr" )
_MEMREAD ($TMEMMAP , $PMEMORY , $TPARTS , $IPARTS )
_MEMFREE ($TMEMMAP )
ENDIF
FOR $II = 1 TO $ICOUNT
$APARTS [$II ] = DLLSTRUCTGETDATA ($TPARTS , 1 , $II )
NEXT
RETURN $APARTS
ENDFUNC
FUNC _GUICTRLSTATUSBAR_GETRECT ($HWND , $IPART )
LOCAL $TRECT = _GUICTRLSTATUSBAR_GETRECTEX ($HWND , $IPART )
IF @ERROR THEN RETURN SETERROR (@ERROR , 0 , 0 )
LOCAL $ARECT [4 ]
$ARECT [0 ] = DLLSTRUCTGETDATA ($TRECT , "Left" )
$ARECT [1 ] = DLLSTRUCTGETDATA ($TRECT , "Top" )
$ARECT [2 ] = DLLSTRUCTGETDATA ($TRECT , "Right" )
$ARECT [3 ] = DLLSTRUCTGETDATA ($TRECT , "Bottom" )
RETURN $ARECT
ENDFUNC
FUNC _GUICTRLSTATUSBAR_GETRECTEX ($HWND , $IPART )
LOCAL $TRECT = DLLSTRUCTCREATE ($TAGRECT )
LOCAL $IRET
IF _WINAPI_INPROCESS ($HWND , $__G_HSBLASTWND ) THEN
$IRET = _SENDMESSAGE ($HWND , $SB_GETRECT , $IPART , $TRECT , 0 , "wparam" , "struct*" )
ELSE
LOCAL $IRECT = DLLSTRUCTGETSIZE ($TRECT )
LOCAL $TMEMMAP
LOCAL $PMEMORY = _MEMINIT ($HWND , $IRECT , $TMEMMAP )
$IRET = _SENDMESSAGE ($HWND , $SB_GETRECT , $IPART , $PMEMORY , 0 , "wparam" , "ptr" )
_MEMREAD ($TMEMMAP , $PMEMORY , $TRECT , $IRECT )
_MEMFREE ($TMEMMAP )
ENDIF
RETURN SETERROR ($IRET = 0 , 0 , $TRECT )
ENDFUNC
FUNC _GUICTRLSTATUSBAR_GETTEXT ($HWND , $IPART )
LOCAL $BUNICODE = _GUICTRLSTATUSBAR_GETUNICODEFORMAT ($HWND )
LOCAL $IBUFFER = _GUICTRLSTATUSBAR_GETTEXTLENGTH ($HWND , $IPART ) + 1
IF $IBUFFER = 1 THEN RETURN SETERROR (1 , 0 , "" )
LOCAL $TBUFFER
IF $BUNICODE THEN
$TBUFFER = DLLSTRUCTCREATE ("wchar Text[" & $IBUFFER & "]" )
$IBUFFER *= 2
ELSE
$TBUFFER = DLLSTRUCTCREATE ("char Text[" & $IBUFFER & "]" )
ENDIF
IF _WINAPI_INPROCESS ($HWND , $__G_HSBLASTWND ) THEN
_SENDMESSAGE ($HWND , $SB_GETTEXTW , $IPART , $TBUFFER , 0 , "wparam" , "struct*" )
ELSE
LOCAL $TMEMMAP
LOCAL $PMEMORY = _MEMINIT ($HWND , $IBUFFER , $TMEMMAP )
IF $BUNICODE THEN
_SENDMESSAGE ($HWND , $SB_GETTEXTW , $IPART , $PMEMORY , 0 , "wparam" , "ptr" )
ELSE
_SENDMESSAGE ($HWND , $SB_GETTEXT , $IPART , $PMEMORY , 0 , "wparam" , "ptr" )
ENDIF
_MEMREAD ($TMEMMAP , $PMEMORY , $TBUFFER , $IBUFFER )
_MEMFREE ($TMEMMAP )
ENDIF
RETURN DLLSTRUCTGETDATA ($TBUFFER , "Text" )
ENDFUNC
FUNC _GUICTRLSTATUSBAR_GETTEXTFLAGS ($HWND , $IPART )
IF _GUICTRLSTATUSBAR_GETUNICODEFORMAT ($HWND ) THEN
RETURN _SENDMESSAGE ($HWND , $SB_GETTEXTLENGTHW , $IPART )
ELSE
RETURN _SENDMESSAGE ($HWND , $SB_GETTEXTLENGTH , $IPART )
ENDIF
ENDFUNC
FUNC _GUICTRLSTATUSBAR_GETTEXTLENGTH ($HWND , $IPART )
RETURN _WINAPI_LOWORD (_GUICTRLSTATUSBAR_GETTEXTFLAGS ($HWND , $IPART ) )
ENDFUNC
FUNC _GUICTRLSTATUSBAR_GETTEXTLENGTHEX ($HWND , $IPART )
RETURN _WINAPI_HIWORD (_GUICTRLSTATUSBAR_GETTEXTFLAGS ($HWND , $IPART ) )
ENDFUNC
FUNC _GUICTRLSTATUSBAR_GETTIPTEXT ($HWND , $IPART )
LOCAL $BUNICODE = _GUICTRLSTATUSBAR_GETUNICODEFORMAT ($HWND )
LOCAL $TBUFFER
IF $BUNICODE THEN
$TBUFFER = DLLSTRUCTCREATE ("wchar Text[4096]" )
ELSE
$TBUFFER = DLLSTRUCTCREATE ("char Text[4096]" )
ENDIF
IF _WINAPI_INPROCESS ($HWND , $__G_HSBLASTWND ) THEN
_SENDMESSAGE ($HWND , $SB_GETTIPTEXTW , _WINAPI_MAKELONG ($IPART , 4096 ) , $TBUFFER , 0 , "wparam" , "struct*" )
ELSE
LOCAL $TMEMMAP
LOCAL $PMEMORY = _MEMINIT ($HWND , 4096 , $TMEMMAP )
IF $BUNICODE THEN
_SENDMESSAGE ($HWND , $SB_GETTIPTEXTW , _WINAPI_MAKELONG ($IPART , 4096 ) , $PMEMORY , 0 , "wparam" , "ptr" )
ELSE
_SENDMESSAGE ($HWND , $SB_GETTIPTEXTA , _WINAPI_MAKELONG ($IPART , 4096 ) , $PMEMORY , 0 , "wparam" , "ptr" )
ENDIF
_MEMREAD ($TMEMMAP , $PMEMORY , $TBUFFER , 4096 )
_MEMFREE ($TMEMMAP )
ENDIF
RETURN DLLSTRUCTGETDATA ($TBUFFER , "Text" )
ENDFUNC
FUNC _GUICTRLSTATUSBAR_GETUNICODEFORMAT ($HWND )
RETURN _SENDMESSAGE ($HWND , $SB_GETUNICODEFORMAT ) <> 0
ENDFUNC
FUNC _GUICTRLSTATUSBAR_GETWIDTH ($HWND , $IPART )
LOCAL $TRECT = _GUICTRLSTATUSBAR_GETRECTEX ($HWND , $IPART )
RETURN DLLSTRUCTGETDATA ($TRECT , "Right" ) - DLLSTRUCTGETDATA ($TRECT , "Left" ) - (_GUICTRLSTATUSBAR_GETBORDERSHORZ ($HWND ) * 2 )
ENDFUNC
FUNC _GUICTRLSTATUSBAR_ISSIMPLE ($HWND )
RETURN _SENDMESSAGE ($HWND , $SB_ISSIMPLE ) <> 0
ENDFUNC
FUNC _GUICTRLSTATUSBAR_RESIZE ($HWND )
_SENDMESSAGE ($HWND , $__STATUSBARCONSTANT_WM_SIZE )
ENDFUNC
FUNC _GUICTRLSTATUSBAR_SETBKCOLOR ($HWND , $ICOLOR )
$ICOLOR = _SENDMESSAGE ($HWND , $SB_SETBKCOLOR , 0 , $ICOLOR )
ENDFUNC
FUNC _GUICTRLSTATUSBAR_SETICON ($HWND , $IPART , $HICON = + 4294967295 , $SICONFILE = "" )
IF $HICON = + 4294967295 THEN RETURN _SENDMESSAGE ($HWND , $SB_SETICON , $IPART , $HICON , 0 , "wparam" , "handle" ) <> 0
IF STRINGLEN ($SICONFILE ) <= 0 THEN RETURN _SENDMESSAGE ($HWND , $SB_SETICON , $IPART , $HICON ) <> 0
LOCAL $TICON = DLLSTRUCTCREATE ("handle" )
LOCAL $VRESULT = DLLCALL ("shell32.dll" , "uint" , "ExtractIconExW" , "wstr" , $SICONFILE , "int" , $HICON , "ptr" , 0 , "struct*" , $TICON , "uint" , 1 )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
$VRESULT = $VRESULT [0 ]
IF $VRESULT > 0 THEN $VRESULT = _SENDMESSAGE ($HWND , $SB_SETICON , $IPART , DLLSTRUCTGETDATA ($TICON , 1 ) , 0 , "wparam" , "handle" )
DLLCALL ("user32.dll" , "bool" , "DestroyIcon" , "handle" , DLLSTRUCTGETDATA ($TICON , 1 ) )
RETURN $VRESULT
ENDFUNC
FUNC _GUICTRLSTATUSBAR_SETMINHEIGHT ($HWND , $IMINHEIGHT )
_SENDMESSAGE ($HWND , $SB_SETMINHEIGHT , $IMINHEIGHT )
_GUICTRLSTATUSBAR_RESIZE ($HWND )
ENDFUNC
FUNC _GUICTRLSTATUSBAR_SETPARTS ($HWND , $VPARTEDGE = + 4294967295 , $VPARTWIDTH = 25 )
IF ISARRAY ($VPARTEDGE ) AND ISARRAY ($VPARTWIDTH ) THEN RETURN FALSE
LOCAL $TPARTS , $IPARTS
IF ISARRAY ($VPARTEDGE ) THEN
$VPARTEDGE [UBOUND ($VPARTEDGE ) + 4294967295 ] = + 4294967295
$IPARTS = UBOUND ($VPARTEDGE )
$TPARTS = DLLSTRUCTCREATE ("int[" & $IPARTS & "]" )
FOR $X = 0 TO $IPARTS + 4294967294
DLLSTRUCTSETDATA ($TPARTS , 1 , $VPARTEDGE [$X ] , $X + 1 )
NEXT
DLLSTRUCTSETDATA ($TPARTS , 1 , + 4294967295 , $IPARTS )
ELSE
IF $VPARTEDGE < + 4294967295 THEN RETURN FALSE
IF ISARRAY ($VPARTWIDTH ) THEN
$IPARTS = UBOUND ($VPARTWIDTH )
$TPARTS = DLLSTRUCTCREATE ("int[" & $IPARTS & "]" )
LOCAL $IPARTRIGHTEDGE = 0
FOR $X = 0 TO $IPARTS + 4294967294
$IPARTRIGHTEDGE += $VPARTWIDTH [$X ]
IF $VPARTWIDTH [$X ] <= 0 THEN RETURN FALSE
DLLSTRUCTSETDATA ($TPARTS , 1 , $IPARTRIGHTEDGE , $X + 1 )
NEXT
DLLSTRUCTSETDATA ($TPARTS , 1 , + 4294967295 , $IPARTS )
ELSEIF $VPARTEDGE > 1 THEN
$IPARTS = $VPARTEDGE
$TPARTS = DLLSTRUCTCREATE ("int[" & $IPARTS & "]" )
FOR $X = 1 TO $IPARTS + 4294967295
DLLSTRUCTSETDATA ($TPARTS , 1 , $VPARTWIDTH * $X , $X )
NEXT
DLLSTRUCTSETDATA ($TPARTS , 1 , + 4294967295 , $IPARTS )
ELSE
$IPARTS = 1
$TPARTS = DLLSTRUCTCREATE ("int" )
DLLSTRUCTSETDATA ($TPARTS , 1 , + 4294967295 )
ENDIF
ENDIF
IF _WINAPI_INPROCESS ($HWND , $__G_HSBLASTWND ) THEN
_SENDMESSAGE ($HWND , $SB_SETPARTS , $IPARTS , $TPARTS , 0 , "wparam" , "struct*" )
ELSE
LOCAL $ISIZE = DLLSTRUCTGETSIZE ($TPARTS )
LOCAL $TMEMMAP
LOCAL $PMEMORY = _MEMINIT ($HWND , $ISIZE , $TMEMMAP )
_MEMWRITE ($TMEMMAP , $TPARTS )
_SENDMESSAGE ($HWND , $SB_SETPARTS , $IPARTS , $PMEMORY , 0 , "wparam" , "ptr" )
_MEMFREE ($TMEMMAP )
ENDIF
_GUICTRLSTATUSBAR_RESIZE ($HWND )
RETURN TRUE
ENDFUNC
FUNC _GUICTRLSTATUSBAR_SETSIMPLE ($HWND , $BSIMPLE = TRUE )
_SENDMESSAGE ($HWND , $SB_SIMPLE , $BSIMPLE )
ENDFUNC
FUNC _GUICTRLSTATUSBAR_SETTEXT ($HWND , $STEXT = "" , $IPART = 0 , $IUFLAG = 0 )
LOCAL $BUNICODE = _GUICTRLSTATUSBAR_GETUNICODEFORMAT ($HWND )
LOCAL $IBUFFER = STRINGLEN ($STEXT ) + 1
LOCAL $TTEXT
IF $BUNICODE THEN
$TTEXT = DLLSTRUCTCREATE ("wchar Text[" & $IBUFFER & "]" )
$IBUFFER *= 2
ELSE
$TTEXT = DLLSTRUCTCREATE ("char Text[" & $IBUFFER & "]" )
ENDIF
DLLSTRUCTSETDATA ($TTEXT , "Text" , $STEXT )
IF _GUICTRLSTATUSBAR_ISSIMPLE ($HWND ) THEN $IPART = $SB_SIMPLEID
LOCAL $IRET
IF _WINAPI_INPROCESS ($HWND , $__G_HSBLASTWND ) THEN
$IRET = _SENDMESSAGE ($HWND , $SB_SETTEXTW , BITOR ($IPART , $IUFLAG ) , $TTEXT , 0 , "wparam" , "struct*" )
ELSE
LOCAL $TMEMMAP
LOCAL $PMEMORY = _MEMINIT ($HWND , $IBUFFER , $TMEMMAP )
_MEMWRITE ($TMEMMAP , $TTEXT )
IF $BUNICODE THEN
$IRET = _SENDMESSAGE ($HWND , $SB_SETTEXTW , BITOR ($IPART , $IUFLAG ) , $PMEMORY , 0 , "wparam" , "ptr" )
ELSE
$IRET = _SENDMESSAGE ($HWND , $SB_SETTEXT , BITOR ($IPART , $IUFLAG ) , $PMEMORY , 0 , "wparam" , "ptr" )
ENDIF
_MEMFREE ($TMEMMAP )
ENDIF
RETURN $IRET <> 0
ENDFUNC
FUNC _GUICTRLSTATUSBAR_SETTIPTEXT ($HWND , $IPART , $STEXT )
LOCAL $BUNICODE = _GUICTRLSTATUSBAR_GETUNICODEFORMAT ($HWND )
LOCAL $IBUFFER = STRINGLEN ($STEXT ) + 1
LOCAL $TTEXT
IF $BUNICODE THEN
$TTEXT = DLLSTRUCTCREATE ("wchar TipText[" & $IBUFFER & "]" )
$IBUFFER *= 2
ELSE
$TTEXT = DLLSTRUCTCREATE ("char TipText[" & $IBUFFER & "]" )
ENDIF
DLLSTRUCTSETDATA ($TTEXT , "TipText" , $STEXT )
IF _WINAPI_INPROCESS ($HWND , $__G_HSBLASTWND ) THEN
_SENDMESSAGE ($HWND , $SB_SETTIPTEXTW , $IPART , $TTEXT , 0 , "wparam" , "struct*" )
ELSE
LOCAL $TMEMMAP
LOCAL $PMEMORY = _MEMINIT ($HWND , $IBUFFER , $TMEMMAP )
_MEMWRITE ($TMEMMAP , $TTEXT , $PMEMORY , $IBUFFER )
IF $BUNICODE THEN
_SENDMESSAGE ($HWND , $SB_SETTIPTEXTW , $IPART , $PMEMORY , 0 , "wparam" , "ptr" )
ELSE
_SENDMESSAGE ($HWND , $SB_SETTIPTEXTA , $IPART , $PMEMORY , 0 , "wparam" , "ptr" )
ENDIF
_MEMFREE ($TMEMMAP )
ENDIF
ENDFUNC
FUNC _GUICTRLSTATUSBAR_SETUNICODEFORMAT ($HWND , $BUNICODE = TRUE )
RETURN _SENDMESSAGE ($HWND , $SB_SETUNICODEFORMAT , $BUNICODE )
ENDFUNC
FUNC _GUICTRLSTATUSBAR_SHOWHIDE ($HWND , $ISTATE )
IF $ISTATE <> @SW_HIDE AND $ISTATE <> @SW_SHOW THEN RETURN SETERROR (1 , 1 , FALSE )
RETURN _WINAPI_SHOWWINDOW ($HWND , $ISTATE )
ENDFUNC
GLOBAL CONST $TTF_IDISHWND = 1
GLOBAL CONST $TTF_CENTERTIP = 2
GLOBAL CONST $TTF_RTLREADING = 4
GLOBAL CONST $TTF_SUBCLASS = 16
GLOBAL CONST $TTF_TRACK = 32
GLOBAL CONST $TTF_ABSOLUTE = 128
GLOBAL CONST $TTF_TRANSPARENT = 256
GLOBAL CONST $TTF_PARSELINKS = 4096
GLOBAL CONST $TTF_DI_SETITEM = 32768
GLOBAL CONST $__TOOLTIPCONSTANTS_WM_USER = 1024
GLOBAL CONST $TTM_ACTIVATE = $__TOOLTIPCONSTANTS_WM_USER + 1
GLOBAL CONST $TTM_SETDELAYTIME = $__TOOLTIPCONSTANTS_WM_USER + 3
GLOBAL CONST $TTM_ADDTOOL = $__TOOLTIPCONSTANTS_WM_USER + 4
GLOBAL CONST $TTM_DELTOOL = $__TOOLTIPCONSTANTS_WM_USER + 5
GLOBAL CONST $TTM_NEWTOOLRECT = $__TOOLTIPCONSTANTS_WM_USER + 6
GLOBAL CONST $TTM_GETTOOLINFO = $__TOOLTIPCONSTANTS_WM_USER + 8
GLOBAL CONST $TTM_SETTOOLINFO = $__TOOLTIPCONSTANTS_WM_USER + 9
GLOBAL CONST $TTM_HITTEST = $__TOOLTIPCONSTANTS_WM_USER + 10
GLOBAL CONST $TTM_GETTEXT = $__TOOLTIPCONSTANTS_WM_USER + 11
GLOBAL CONST $TTM_UPDATETIPTEXT = $__TOOLTIPCONSTANTS_WM_USER + 12
GLOBAL CONST $TTM_GETTOOLCOUNT = $__TOOLTIPCONSTANTS_WM_USER + 13
GLOBAL CONST $TTM_ENUMTOOLS = $__TOOLTIPCONSTANTS_WM_USER + 14
GLOBAL CONST $TTM_GETCURRENTTOOL = $__TOOLTIPCONSTANTS_WM_USER + 15
GLOBAL CONST $TTM_WINDOWFROMPOINT = $__TOOLTIPCONSTANTS_WM_USER + 16
GLOBAL CONST $TTM_TRACKACTIVATE = $__TOOLTIPCONSTANTS_WM_USER + 17
GLOBAL CONST $TTM_TRACKPOSITION = $__TOOLTIPCONSTANTS_WM_USER + 18
GLOBAL CONST $TTM_SETTIPBKCOLOR = $__TOOLTIPCONSTANTS_WM_USER + 19
GLOBAL CONST $TTM_SETTIPTEXTCOLOR = $__TOOLTIPCONSTANTS_WM_USER + 20
GLOBAL CONST $TTM_GETDELAYTIME = $__TOOLTIPCONSTANTS_WM_USER + 21
GLOBAL CONST $TTM_GETTIPBKCOLOR = $__TOOLTIPCONSTANTS_WM_USER + 22
GLOBAL CONST $TTM_GETTIPTEXTCOLOR = $__TOOLTIPCONSTANTS_WM_USER + 23
GLOBAL CONST $TTM_SETMAXTIPWIDTH = $__TOOLTIPCONSTANTS_WM_USER + 24
GLOBAL CONST $TTM_GETMAXTIPWIDTH = $__TOOLTIPCONSTANTS_WM_USER + 25
GLOBAL CONST $TTM_SETMARGIN = $__TOOLTIPCONSTANTS_WM_USER + 26
GLOBAL CONST $TTM_GETMARGIN = $__TOOLTIPCONSTANTS_WM_USER + 27
GLOBAL CONST $TTM_POP = $__TOOLTIPCONSTANTS_WM_USER + 28
GLOBAL CONST $TTM_UPDATE = $__TOOLTIPCONSTANTS_WM_USER + 29
GLOBAL CONST $TTM_GETBUBBLESIZE = $__TOOLTIPCONSTANTS_WM_USER + 30
GLOBAL CONST $TTM_ADJUSTRECT = $__TOOLTIPCONSTANTS_WM_USER + 31
GLOBAL CONST $TTM_SETTITLE = $__TOOLTIPCONSTANTS_WM_USER + 32
GLOBAL CONST $TTM_SETTITLEW = $__TOOLTIPCONSTANTS_WM_USER + 33
GLOBAL CONST $TTM_POPUP = $__TOOLTIPCONSTANTS_WM_USER + 34
GLOBAL CONST $TTM_GETTITLE = $__TOOLTIPCONSTANTS_WM_USER + 35
GLOBAL CONST $TTM_ADDTOOLW = $__TOOLTIPCONSTANTS_WM_USER + 50
GLOBAL CONST $TTM_DELTOOLW = $__TOOLTIPCONSTANTS_WM_USER + 51
GLOBAL CONST $TTM_NEWTOOLRECTW = $__TOOLTIPCONSTANTS_WM_USER + 52
GLOBAL CONST $TTM_GETTOOLINFOW = $__TOOLTIPCONSTANTS_WM_USER + 53
GLOBAL CONST $TTM_SETTOOLINFOW = $__TOOLTIPCONSTANTS_WM_USER + 54
GLOBAL CONST $TTM_HITTESTW = $__TOOLTIPCONSTANTS_WM_USER + 55
GLOBAL CONST $TTM_GETTEXTW = $__TOOLTIPCONSTANTS_WM_USER + 56
GLOBAL CONST $TTM_UPDATETIPTEXTW = $__TOOLTIPCONSTANTS_WM_USER + 57
GLOBAL CONST $TTM_ENUMTOOLSW = $__TOOLTIPCONSTANTS_WM_USER + 58
GLOBAL CONST $TTM_GETCURRENTTOOLW = $__TOOLTIPCONSTANTS_WM_USER + 59
GLOBAL CONST $TTM_SETWINDOWTHEME = 8192 + 11
GLOBAL CONST $TTN_FIRST = + 4294966776
GLOBAL CONST $TTN_GETDISPINFO = $TTN_FIRST + 0
GLOBAL CONST $TTN_SHOW = $TTN_FIRST + 4294967295
GLOBAL CONST $TTN_POP = $TTN_FIRST + 4294967294
GLOBAL CONST $TTN_LINKCLICK = $TTN_FIRST + 4294967293
GLOBAL CONST $TTN_GETDISPINFOW = $TTN_FIRST + 4294967286
GLOBAL CONST $TTS_ALWAYSTIP = 1
GLOBAL CONST $TTS_NOPREFIX = 2
GLOBAL CONST $TTS_NOANIMATE = 16
GLOBAL CONST $TTS_NOFADE = 32
GLOBAL CONST $TTS_BALLOON = 64
GLOBAL CONST $TTS_CLOSE = 128
GLOBAL CONST $TTS_USEVISUALSTYLE = 256
GLOBAL CONST $TTDT_AUTOMATIC = 0
GLOBAL CONST $TTDT_RESHOW = 1
GLOBAL CONST $TTDT_AUTOPOP = 2
GLOBAL CONST $TTDT_INITIAL = 3
GLOBAL ENUM $TTI_NONE , $TTI_INFO , $TTI_WARNING , $TTI_ERROR , $TTI_INFO_LARGE , $TTI_WARNING_LARGE , $TTI_ERROR_LARGE
#Region Global Variables and Constants
GLOBAL CONST $DUPLICATE_CLOSE_SOURCE = 1
GLOBAL CONST $DUPLICATE_SAME_ACCESS = 2
GLOBAL CONST $OBJ_BITMAP = 7
GLOBAL CONST $OBJ_BRUSH = 2
GLOBAL CONST $OBJ_COLORSPACE = 14
GLOBAL CONST $OBJ_DC = 3
GLOBAL CONST $OBJ_ENHMETADC = 12
GLOBAL CONST $OBJ_ENHMETAFILE = 13
GLOBAL CONST $OBJ_EXTPEN = 11
GLOBAL CONST $OBJ_FONT = 6
GLOBAL CONST $OBJ_MEMDC = 10
GLOBAL CONST $OBJ_METADC = 4
GLOBAL CONST $OBJ_METAFILE = 9
GLOBAL CONST $OBJ_PAL = 5
GLOBAL CONST $OBJ_PEN = 1
GLOBAL CONST $OBJ_REGION = 8
GLOBAL CONST $NULL_BRUSH = 5
GLOBAL CONST $NULL_PEN = 8
GLOBAL CONST $BLACK_BRUSH = 4
GLOBAL CONST $DKGRAY_BRUSH = 3
GLOBAL CONST $DC_BRUSH = 18
GLOBAL CONST $GRAY_BRUSH = 2
GLOBAL CONST $HOLLOW_BRUSH = $NULL_BRUSH
GLOBAL CONST $LTGRAY_BRUSH = 1
GLOBAL CONST $WHITE_BRUSH = 0
GLOBAL CONST $BLACK_PEN = 7
GLOBAL CONST $DC_PEN = 19
GLOBAL CONST $WHITE_PEN = 6
GLOBAL CONST $ANSI_FIXED_FONT = 11
GLOBAL CONST $ANSI_VAR_FONT = 12
GLOBAL CONST $DEVICE_DEFAULT_FONT = 14
GLOBAL CONST $DEFAULT_GUI_FONT = 17
GLOBAL CONST $OEM_FIXED_FONT = 10
GLOBAL CONST $SYSTEM_FONT = 13
GLOBAL CONST $SYSTEM_FIXED_FONT = 16
GLOBAL CONST $DEFAULT_PALETTE = 15
#EndRegion Global Variables and Constants
#Region Functions list
#EndRegion Functions list
#Region Public Functions
FUNC _WINAPI_CLOSEHANDLE ($HOBJECT )
LOCAL $ARESULT = DLLCALL ("kernel32.dll" , "bool" , "CloseHandle" , "handle" , $HOBJECT )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_DELETEOBJECT ($HOBJECT )
LOCAL $ARESULT = DLLCALL ("gdi32.dll" , "bool" , "DeleteObject" , "handle" , $HOBJECT )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_DUPLICATEHANDLE ($HSOURCEPROCESSHANDLE , $HSOURCEHANDLE , $HTARGETPROCESSHANDLE , $IDESIREDACCESS , $IINHERITHANDLE , $IOPTIONS )
LOCAL $ARESULT = DLLCALL ("kernel32.dll" , "bool" , "DuplicateHandle" , "handle" , $HSOURCEPROCESSHANDLE , "handle" , $HSOURCEHANDLE , "handle" , $HTARGETPROCESSHANDLE , "handle*" , 0 , "dword" , $IDESIREDACCESS , "bool" , $IINHERITHANDLE , "dword" , $IOPTIONS )
IF @ERROR OR NOT $ARESULT [0 ] THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [4 ]
ENDFUNC
FUNC _WINAPI_GETCURRENTOBJECT ($HDC , $ITYPE )
LOCAL $ARET = DLLCALL ("gdi32.dll" , "handle" , "GetCurrentObject" , "handle" , $HDC , "uint" , $ITYPE )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_GETCURRENTPROCESS ()
LOCAL $ARESULT = DLLCALL ("kernel32.dll" , "handle" , "GetCurrentProcess" )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_GETOBJECT ($HOBJECT , $ISIZE , $POBJECT )
LOCAL $ARESULT = DLLCALL ("gdi32.dll" , "int" , "GetObjectW" , "handle" , $HOBJECT , "int" , $ISIZE , "struct*" , $POBJECT )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_GETOBJECTINFOBYHANDLE ($HOBJECT )
LOCAL $TAGPUBLIC_OBJECT_BASIC_INFORMATION = "ulong Attributes;ulong GrantedAcess;ulong HandleCount;ulong PointerCount;ulong Reserved[10]"
LOCAL $TPOBI = DLLSTRUCTCREATE ($TAGPUBLIC_OBJECT_BASIC_INFORMATION )
LOCAL $ARET = DLLCALL ("ntdll.dll" , "long" , "ZwQueryObject" , "handle" , $HOBJECT , "uint" , 0 , "struct*" , $TPOBI , "ulong" , DLLSTRUCTGETSIZE ($TPOBI ) , "ptr" , 0 )
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 ($TPOBI , $I + 1 )
NEXT
RETURN $ARESULT
ENDFUNC
FUNC _WINAPI_GETOBJECTNAMEBYHANDLE ($HOBJECT )
LOCAL $TAGUNICODE_STRING = "struct;ushort Length;ushort MaximumLength;ptr Buffer;endstruct"
LOCAL $TAGPUBLIC_OBJECT_TYPE_INFORMATION = "struct;" & $TAGUNICODE_STRING & ";ulong Reserved[22];endstruct"
LOCAL $TPOTI = DLLSTRUCTCREATE ($TAGPUBLIC_OBJECT_TYPE_INFORMATION & ";byte[32]" )
LOCAL $ARET = DLLCALL ("ntdll.dll" , "long" , "ZwQueryObject" , "handle" , $HOBJECT , "uint" , 2 , "struct*" , $TPOTI , "ulong" , DLLSTRUCTGETSIZE ($TPOTI ) , "ulong*" , 0 )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , "" )
IF $ARET [0 ] THEN RETURN SETERROR (10 , $ARET [0 ] , "" )
LOCAL $PDATA = DLLSTRUCTGETDATA ($TPOTI , 3 )
IF NOT $PDATA THEN RETURN SETERROR (11 , 0 , "" )
RETURN _WINAPI_GETSTRING ($PDATA )
ENDFUNC
FUNC _WINAPI_GETOBJECTTYPE ($HOBJECT )
LOCAL $ARET = DLLCALL ("gdi32.dll" , "dword" , "GetObjectType" , "handle" , $HOBJECT )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_GETSTDHANDLE ($ISTDHANDLE )
IF $ISTDHANDLE < 0 OR $ISTDHANDLE > 2 THEN RETURN SETERROR (2 , 0 , + 4294967295 )
LOCAL CONST $AHANDLE [3 ] = [+ 4294967286 , + 4294967285 , + 4294967284 ]
LOCAL $ARESULT = DLLCALL ("kernel32.dll" , "handle" , "GetStdHandle" , "dword" , $AHANDLE [$ISTDHANDLE ] )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , + 4294967295 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_GETSTOCKOBJECT ($IOBJECT )
LOCAL $ARESULT = DLLCALL ("gdi32.dll" , "handle" , "GetStockObject" , "int" , $IOBJECT )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_SELECTOBJECT ($HDC , $HGDIOBJ )
LOCAL $ARESULT = DLLCALL ("gdi32.dll" , "handle" , "SelectObject" , "handle" , $HDC , "handle" , $HGDIOBJ )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_SETHANDLEINFORMATION ($HOBJECT , $IMASK , $IFLAGS )
LOCAL $ARESULT = DLLCALL ("kernel32.dll" , "bool" , "SetHandleInformation" , "handle" , $HOBJECT , "dword" , $IMASK , "dword" , $IFLAGS )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARESULT [0 ]
ENDFUNC
#EndRegion Public Functions
GLOBAL $__G_HEDITLASTWND
GLOBAL CONST $__EDITCONSTANT_CLASSNAME = "Edit"
GLOBAL CONST $__EDITCONSTANT_GUI_CHECKED = 1
GLOBAL CONST $__EDITCONSTANT_GUI_HIDE = 32
GLOBAL CONST $__EDITCONSTANT_GUI_EVENT_CLOSE = + 4294967293
GLOBAL CONST $__EDITCONSTANT_GUI_ENABLE = 64
GLOBAL CONST $__EDITCONSTANT_GUI_DISABLE = 128
GLOBAL CONST $__EDITCONSTANT_SS_CENTER = 1
GLOBAL CONST $__EDITCONSTANT_WM_SETREDRAW = 11
GLOBAL CONST $__EDITCONSTANT_WS_CAPTION = 12582912
GLOBAL CONST $__EDITCONSTANT_WS_POPUP = 2147483648
GLOBAL CONST $__EDITCONSTANT_WS_SYSMENU = 524288
GLOBAL CONST $__EDITCONSTANT_WS_MINIMIZEBOX = 131072
GLOBAL CONST $__EDITCONSTANT_DEFAULT_GUI_FONT = 17
GLOBAL CONST $__EDITCONSTANT_WM_SETFONT = 48
GLOBAL CONST $__EDITCONSTANT_WM_GETTEXTLENGTH = 14
GLOBAL CONST $__EDITCONSTANT_WM_GETTEXT = 13
GLOBAL CONST $__EDITCONSTANT_WM_SETTEXT = 12
GLOBAL CONST $__EDITCONSTANT_SB_LINEUP = 0
GLOBAL CONST $__EDITCONSTANT_SB_LINEDOWN = 1
GLOBAL CONST $__EDITCONSTANT_SB_PAGEDOWN = 3
GLOBAL CONST $__EDITCONSTANT_SB_PAGEUP = 2
GLOBAL CONST $__EDITCONSTANT_SB_SCROLLCARET = 4
GLOBAL CONST $__TAGEDITBALLOONTIP = "dword Size;ptr Title;ptr Text;int Icon"
FUNC _GUICTRLEDIT_APPENDTEXT ($HWND , $STEXT )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
LOCAL $ILENGTH = _GUICTRLEDIT_GETTEXTLEN ($HWND )
_GUICTRLEDIT_SETSEL ($HWND , $ILENGTH , $ILENGTH )
_SENDMESSAGE ($HWND , $EM_REPLACESEL , TRUE , $STEXT , 0 , "wparam" , "wstr" )
ENDFUNC
FUNC _GUICTRLEDIT_BEGINUPDATE ($HWND )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
RETURN _SENDMESSAGE ($HWND , $__EDITCONSTANT_WM_SETREDRAW , FALSE ) = 0
ENDFUNC
FUNC _GUICTRLEDIT_CANUNDO ($HWND )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
RETURN _SENDMESSAGE ($HWND , $EM_CANUNDO ) <> 0
ENDFUNC
FUNC _GUICTRLEDIT_CHARFROMPOS ($HWND , $IX , $IY )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
LOCAL $ARETURN [2 ]
LOCAL $IRET = _SENDMESSAGE ($HWND , $EM_CHARFROMPOS , 0 , _WINAPI_MAKELONG ($IX , $IY ) )
$ARETURN [0 ] = _WINAPI_LOWORD ($IRET )
$ARETURN [1 ] = _WINAPI_HIWORD ($IRET )
RETURN $ARETURN
ENDFUNC
FUNC _GUICTRLEDIT_CREATE ($HWND , $STEXT , $IX , $IY , $IWIDTH = 150 , $IHEIGHT = 150 , $ISTYLE = 3150020 , $IEXSTYLE = 512 )
IF NOT ISHWND ($HWND ) THEN RETURN SETERROR (1 , 0 , 0 )
IF NOT ISSTRING ($STEXT ) THEN RETURN SETERROR (2 , 0 , 0 )
IF $IWIDTH = + 4294967295 THEN $IWIDTH = 150
IF $IHEIGHT = + 4294967295 THEN $IHEIGHT = 150
IF $ISTYLE = + 4294967295 THEN $ISTYLE = 3150020
IF $IEXSTYLE = + 4294967295 THEN $IEXSTYLE = 512
IF BITAND ($ISTYLE , $ES_READONLY ) = $ES_READONLY THEN
$ISTYLE = BITOR ($__UDFGUICONSTANT_WS_CHILD , $__UDFGUICONSTANT_WS_VISIBLE , $ISTYLE )
ELSE
$ISTYLE = BITOR ($__UDFGUICONSTANT_WS_CHILD , $__UDFGUICONSTANT_WS_VISIBLE , $__UDFGUICONSTANT_WS_TABSTOP , $ISTYLE )
ENDIF
LOCAL $NCTRLID = __UDF_GETNEXTGLOBALID ($HWND )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
LOCAL $HEDIT = _WINAPI_CREATEWINDOWEX ($IEXSTYLE , $__EDITCONSTANT_CLASSNAME , "" , $ISTYLE , $IX , $IY , $IWIDTH , $IHEIGHT , $HWND , $NCTRLID )
_SENDMESSAGE ($HEDIT , $__EDITCONSTANT_WM_SETFONT , _WINAPI_GETSTOCKOBJECT ($__EDITCONSTANT_DEFAULT_GUI_FONT ) , TRUE )
_GUICTRLEDIT_SETTEXT ($HEDIT , $STEXT )
_GUICTRLEDIT_SETLIMITTEXT ($HEDIT , 0 )
RETURN $HEDIT
ENDFUNC
FUNC _GUICTRLEDIT_DESTROY (BYREF $HWND )
IF NOT _WINAPI_ISCLASSNAME ($HWND , $__EDITCONSTANT_CLASSNAME ) THEN RETURN SETERROR (2 , 2 , FALSE )
LOCAL $IDESTROYED = 0
IF ISHWND ($HWND ) THEN
IF _WINAPI_INPROCESS ($HWND , $__G_HEDITLASTWND ) THEN
LOCAL $NCTRLID = _WINAPI_GETDLGCTRLID ($HWND )
LOCAL $HPARENT = _WINAPI_GETPARENT ($HWND )
$IDESTROYED = _WINAPI_DESTROYWINDOW ($HWND )
LOCAL $IRET = __UDF_FREEGLOBALID ($HPARENT , $NCTRLID )
IF NOT $IRET THEN
ENDIF
ELSE
RETURN SETERROR (1 , 1 , FALSE )
ENDIF
ELSE
$IDESTROYED = GUICTRLDELETE ($HWND )
ENDIF
IF $IDESTROYED THEN $HWND = 0
RETURN $IDESTROYED <> 0
ENDFUNC
FUNC _GUICTRLEDIT_EMPTYUNDOBUFFER ($HWND )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
_SENDMESSAGE ($HWND , $EM_EMPTYUNDOBUFFER )
ENDFUNC
FUNC _GUICTRLEDIT_ENDUPDATE ($HWND )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
RETURN _SENDMESSAGE ($HWND , $__EDITCONSTANT_WM_SETREDRAW , TRUE ) = 0
ENDFUNC
FUNC _GUICTRLEDIT_FMTLINES ($HWND , $BSOFTBREAK = FALSE )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
RETURN _SENDMESSAGE ($HWND , $EM_FMTLINES , $BSOFTBREAK )
ENDFUNC
FUNC _GUICTRLEDIT_FIND ($HWND , $BREPLACE = FALSE )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
LOCAL $IPOS = 0 , $ICASE , $IOCCURANCE = 0 , $IREPLACEMENTS = 0
LOCAL $APARTSRIGHTEDGE [3 ] = [125 , 225 , + 4294967295 ]
LOCAL $IOLDMODE = OPT ("GUIOnEventMode" , 0 )
LOCAL $ASEL = _GUICTRLEDIT_GETSEL ($HWND )
LOCAL $STEXT = _GUICTRLEDIT_GETTEXT ($HWND )
LOCAL $HGUISEARCH = GUICREATE ("Find" , 349 , 177 , + 4294967295 , + 4294967295 , BITOR ($__UDFGUICONSTANT_WS_CHILD , $__EDITCONSTANT_WS_MINIMIZEBOX , $__EDITCONSTANT_WS_CAPTION , $__EDITCONSTANT_WS_POPUP , $__EDITCONSTANT_WS_SYSMENU ) )
LOCAL $IDSTATUSBAR1 = _GUICTRLSTATUSBAR_CREATE ($HGUISEARCH , $APARTSRIGHTEDGE )
_GUICTRLSTATUSBAR_SETTEXT ($IDSTATUSBAR1 , "Find: " )
GUISETICON (@SYSTEMDIR & "\shell32.dll" , 22 , $HGUISEARCH )
GUICTRLCREATELABEL ("Find what:" , 9 , 10 , 53 , 16 , $__EDITCONSTANT_SS_CENTER )
LOCAL $IDINPUTSEARCH = GUICTRLCREATEINPUT ("" , 80 , 8 , 257 , 21 )
LOCAL $IDLBLREPLACE = GUICTRLCREATELABEL ("Replace with:" , 9 , 42 , 69 , 17 , $__EDITCONSTANT_SS_CENTER )
LOCAL $IDINPUTREPLACE = GUICTRLCREATEINPUT ("" , 80 , 40 , 257 , 21 )
LOCAL $IDCHKWHOLEONLY = GUICTRLCREATECHECKBOX ("Match whole word only" , 9 , 72 , 145 , 17 )
LOCAL $IDCHKMATCHCASE = GUICTRLCREATECHECKBOX ("Match case" , 9 , 96 , 145 , 17 )
LOCAL $IDBTNFINDNEXT = GUICTRLCREATEBUTTON ("Find Next" , 168 , 72 , 161 , 21 , 0 )
LOCAL $IDBTNREPLACE = GUICTRLCREATEBUTTON ("Replace" , 168 , 96 , 161 , 21 , 0 )
LOCAL $IDBTNCLOSE = GUICTRLCREATEBUTTON ("Close" , 104 , 130 , 161 , 21 , 0 )
IF (ISARRAY ($ASEL ) AND $ASEL <> $EC_ERR ) THEN
GUICTRLSETDATA ($IDINPUTSEARCH , STRINGMID ($STEXT , $ASEL [0 ] + 1 , $ASEL [1 ] - $ASEL [0 ] ) )
IF $ASEL [0 ] <> $ASEL [1 ] THEN
$IPOS = $ASEL [0 ]
IF BITAND (GUICTRLREAD ($IDCHKMATCHCASE ) , $__EDITCONSTANT_GUI_CHECKED ) = $__EDITCONSTANT_GUI_CHECKED THEN $ICASE = 1
$IOCCURANCE = 1
LOCAL $ITPOSE
WHILE 1
$ITPOSE = STRINGINSTR ($STEXT , GUICTRLREAD ($IDINPUTSEARCH ) , $ICASE , $IOCCURANCE )
IF NOT $ITPOSE THEN
$IOCCURANCE = 0
EXITLOOP
ELSEIF $ITPOSE = $IPOS + 1 THEN
EXITLOOP
ENDIF
$IOCCURANCE += 1
WEND
ENDIF
_GUICTRLSTATUSBAR_SETTEXT ($IDSTATUSBAR1 , "Find: " & GUICTRLREAD ($IDINPUTSEARCH ) )
ENDIF
IF $BREPLACE = FALSE THEN
GUICTRLSETSTATE ($IDLBLREPLACE , $__EDITCONSTANT_GUI_HIDE )
GUICTRLSETSTATE ($IDINPUTREPLACE , $__EDITCONSTANT_GUI_HIDE )
GUICTRLSETSTATE ($IDBTNREPLACE , $__EDITCONSTANT_GUI_HIDE )
ELSE
_GUICTRLSTATUSBAR_SETTEXT ($IDSTATUSBAR1 , "Replacements: " & $IREPLACEMENTS , 1 )
_GUICTRLSTATUSBAR_SETTEXT ($IDSTATUSBAR1 , "With: " , 2 )
ENDIF
GUISETSTATE (@SW_SHOW )
LOCAL $IMSGFIND
WHILE 1
$IMSGFIND = GUIGETMSG ()
SELECT
CASE $IMSGFIND = $__EDITCONSTANT_GUI_EVENT_CLOSE OR $IMSGFIND = $IDBTNCLOSE
EXITLOOP
CASE $IMSGFIND = $IDBTNFINDNEXT
GUICTRLSETSTATE ($IDBTNFINDNEXT , $__EDITCONSTANT_GUI_DISABLE )
GUICTRLSETCURSOR ($IDBTNFINDNEXT , 15 )
SLEEP (100 )
_GUICTRLSTATUSBAR_SETTEXT ($IDSTATUSBAR1 , "Find: " & GUICTRLREAD ($IDINPUTSEARCH ) )
IF $BREPLACE = TRUE THEN
_GUICTRLSTATUSBAR_SETTEXT ($IDSTATUSBAR1 , "Find: " & GUICTRLREAD ($IDINPUTSEARCH ) )
_GUICTRLSTATUSBAR_SETTEXT ($IDSTATUSBAR1 , "With: " & GUICTRLREAD ($IDINPUTREPLACE ) , 2 )
ENDIF
__GUICTRLEDIT_FINDTEXT ($HWND , $IDINPUTSEARCH , $IDCHKMATCHCASE , $IDCHKWHOLEONLY , $IPOS , $IOCCURANCE , $IREPLACEMENTS )
SLEEP (100 )
GUICTRLSETSTATE ($IDBTNFINDNEXT , $__EDITCONSTANT_GUI_ENABLE )
GUICTRLSETCURSOR ($IDBTNFINDNEXT , 2 )
CASE $IMSGFIND = $IDBTNREPLACE
GUICTRLSETSTATE ($IDBTNREPLACE , $__EDITCONSTANT_GUI_DISABLE )
GUICTRLSETCURSOR ($IDBTNREPLACE , 15 )
SLEEP (100 )
_GUICTRLSTATUSBAR_SETTEXT ($IDSTATUSBAR1 , "Find: " & GUICTRLREAD ($IDINPUTSEARCH ) )
_GUICTRLSTATUSBAR_SETTEXT ($IDSTATUSBAR1 , "With: " & GUICTRLREAD ($IDINPUTREPLACE ) , 2 )
IF $IPOS THEN
_GUICTRLEDIT_REPLACESEL ($HWND , GUICTRLREAD ($IDINPUTREPLACE ) )
$IREPLACEMENTS += 1
$IOCCURANCE -= 1
_GUICTRLSTATUSBAR_SETTEXT ($IDSTATUSBAR1 , "Replacements: " & $IREPLACEMENTS , 1 )
ENDIF
__GUICTRLEDIT_FINDTEXT ($HWND , $IDINPUTSEARCH , $IDCHKMATCHCASE , $IDCHKWHOLEONLY , $IPOS , $IOCCURANCE , $IREPLACEMENTS )
SLEEP (100 )
GUICTRLSETSTATE ($IDBTNREPLACE , $__EDITCONSTANT_GUI_ENABLE )
GUICTRLSETCURSOR ($IDBTNREPLACE , 2 )
ENDSELECT
WEND
GUIDELETE ($HGUISEARCH )
OPT ("GUIOnEventMode" , $IOLDMODE )
ENDFUNC
FUNC _GUICTRLEDIT_GETCUEBANNER ($HWND )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
LOCAL $TTEXT = DLLSTRUCTCREATE ("wchar[4096]" )
IF _SENDMESSAGE ($HWND , $EM_GETCUEBANNER , $TTEXT , 4096 , 0 , "struct*" ) <> 1 THEN RETURN SETERROR (+ 4294967295 , 0 , "" )
RETURN _WINAPI_WIDECHARTOMULTIBYTE ($TTEXT )
ENDFUNC
FUNC __GUICTRLEDIT_FINDTEXT ($HWND , $IDINPUTSEARCH , $IDCHKMATCHCASE , $IDCHKWHOLEONLY , BYREF $IPOS , BYREF $IOCCURANCE , BYREF $IREPLACEMENTS )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
LOCAL $ICASE = 0 , $IWHOLE = 0
LOCAL $BEXACT = FALSE
LOCAL $SFIND = GUICTRLREAD ($IDINPUTSEARCH )
LOCAL $STEXT = _GUICTRLEDIT_GETTEXT ($HWND )
IF BITAND (GUICTRLREAD ($IDCHKMATCHCASE ) , $__EDITCONSTANT_GUI_CHECKED ) = $__EDITCONSTANT_GUI_CHECKED THEN $ICASE = 1
IF BITAND (GUICTRLREAD ($IDCHKWHOLEONLY ) , $__EDITCONSTANT_GUI_CHECKED ) = $__EDITCONSTANT_GUI_CHECKED THEN $IWHOLE = 1
IF $SFIND <> "" THEN
$IOCCURANCE += 1
$IPOS = STRINGINSTR ($STEXT , $SFIND , $ICASE , $IOCCURANCE )
IF $IWHOLE AND $IPOS THEN
LOCAL $S_COMPARE2 = STRINGMID ($STEXT , $IPOS + STRINGLEN ($SFIND ) , 1 )
IF $IPOS = 1 THEN
IF ($IPOS + STRINGLEN ($SFIND ) ) + 4294967295 = STRINGLEN ($STEXT ) OR ($S_COMPARE2 = " " OR $S_COMPARE2 = @LF OR $S_COMPARE2 = @CR OR $S_COMPARE2 = @CRLF OR $S_COMPARE2 = @TAB ) THEN $BEXACT = TRUE
ELSE
LOCAL $S_COMPARE1 = STRINGMID ($STEXT , $IPOS + 4294967295 , 1 )
IF ($IPOS + STRINGLEN ($SFIND ) ) + 4294967295 = STRINGLEN ($STEXT ) THEN
IF ($S_COMPARE1 = " " OR $S_COMPARE1 = @LF OR $S_COMPARE1 = @CR OR $S_COMPARE1 = @CRLF OR $S_COMPARE1 = @TAB ) THEN $BEXACT = TRUE
ELSE
IF ($S_COMPARE1 = " " OR $S_COMPARE1 = @LF OR $S_COMPARE1 = @CR OR $S_COMPARE1 = @CRLF OR $S_COMPARE1 = @TAB ) AND ($S_COMPARE2 = " " OR $S_COMPARE2 = @LF OR $S_COMPARE2 = @CR OR $S_COMPARE2 = @CRLF OR $S_COMPARE2 = @TAB ) THEN $BEXACT = TRUE
ENDIF
ENDIF
IF $BEXACT = FALSE THEN
__GUICTRLEDIT_FINDTEXT ($HWND , $IDINPUTSEARCH , $IDCHKMATCHCASE , $IDCHKWHOLEONLY , $IPOS , $IOCCURANCE , $IREPLACEMENTS )
ELSE
_GUICTRLEDIT_SETSEL ($HWND , $IPOS + 4294967295 , ($IPOS + STRINGLEN ($SFIND ) ) + 4294967295 )
_GUICTRLEDIT_SCROLL ($HWND , $__EDITCONSTANT_SB_SCROLLCARET )
ENDIF
ELSEIF $IWHOLE AND NOT $IPOS THEN
$IOCCURANCE = 0
MSGBOX ($MB_SYSTEMMODAL , "Find" , "Reached End of document, Can not find the string '" & $SFIND & "'" )
ELSEIF NOT $IWHOLE THEN
IF NOT $IPOS THEN
$IOCCURANCE = 1
_GUICTRLEDIT_SETSEL ($HWND , + 4294967295 , 0 )
_GUICTRLEDIT_SCROLL ($HWND , $__EDITCONSTANT_SB_SCROLLCARET )
$IPOS = STRINGINSTR ($STEXT , $SFIND , $ICASE , $IOCCURANCE )
IF NOT $IPOS THEN
$IOCCURANCE = 0
MSGBOX ($MB_SYSTEMMODAL , "Find" , "Reached End of document, Can not find the string '" & $SFIND & "'" )
ELSE
_GUICTRLEDIT_SETSEL ($HWND , $IPOS + 4294967295 , ($IPOS + STRINGLEN ($SFIND ) ) + 4294967295 )
_GUICTRLEDIT_SCROLL ($HWND , $__EDITCONSTANT_SB_SCROLLCARET )
ENDIF
ELSE
_GUICTRLEDIT_SETSEL ($HWND , $IPOS + 4294967295 , ($IPOS + STRINGLEN ($SFIND ) ) + 4294967295 )
_GUICTRLEDIT_SCROLL ($HWND , $__EDITCONSTANT_SB_SCROLLCARET )
ENDIF
ENDIF
ENDIF
ENDFUNC
FUNC _GUICTRLEDIT_GETFIRSTVISIBLELINE ($HWND )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
RETURN _SENDMESSAGE ($HWND , $EM_GETFIRSTVISIBLELINE )
ENDFUNC
FUNC _GUICTRLEDIT_GETHANDLE ($HWND )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
RETURN PTR (_SENDMESSAGE ($HWND , $EM_GETHANDLE ) )
ENDFUNC
FUNC _GUICTRLEDIT_GETIMESTATUS ($HWND )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
RETURN _SENDMESSAGE ($HWND , $EM_GETIMESTATUS , $EMSIS_COMPOSITIONSTRING )
ENDFUNC
FUNC _GUICTRLEDIT_GETLIMITTEXT ($HWND )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
RETURN _SENDMESSAGE ($HWND , $EM_GETLIMITTEXT )
ENDFUNC
FUNC _GUICTRLEDIT_GETLINE ($HWND , $ILINE )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
LOCAL $ILENGTH = _GUICTRLEDIT_LINELENGTH ($HWND , $ILINE )
IF $ILENGTH = 0 THEN RETURN ""
LOCAL $TBUFFER = DLLSTRUCTCREATE ("short Len;wchar Text[" & $ILENGTH & "]" )
DLLSTRUCTSETDATA ($TBUFFER , "Len" , $ILENGTH + 1 )
LOCAL $IRET = _SENDMESSAGE ($HWND , $EM_GETLINE , $ILINE , $TBUFFER , 0 , "wparam" , "struct*" )
IF $IRET = 0 THEN RETURN SETERROR ($EC_ERR , $EC_ERR , "" )
LOCAL $TTEXT = DLLSTRUCTCREATE ("wchar Text[" & $ILENGTH & "]" , DLLSTRUCTGETPTR ($TBUFFER ) )
RETURN DLLSTRUCTGETDATA ($TTEXT , "Text" )
ENDFUNC
FUNC _GUICTRLEDIT_GETLINECOUNT ($HWND )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
RETURN _SENDMESSAGE ($HWND , $EM_GETLINECOUNT )
ENDFUNC
FUNC _GUICTRLEDIT_GETMARGINS ($HWND )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
LOCAL $AMARGINS [2 ]
LOCAL $IMARGINS = _SENDMESSAGE ($HWND , $EM_GETMARGINS )
$AMARGINS [0 ] = _WINAPI_LOWORD ($IMARGINS )
$AMARGINS [1 ] = _WINAPI_HIWORD ($IMARGINS )
RETURN $AMARGINS
ENDFUNC
FUNC _GUICTRLEDIT_GETMODIFY ($HWND )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
RETURN _SENDMESSAGE ($HWND , $EM_GETMODIFY ) <> 0
ENDFUNC
FUNC _GUICTRLEDIT_GETPASSWORDCHAR ($HWND )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
RETURN _SENDMESSAGE ($HWND , $EM_GETPASSWORDCHAR )
ENDFUNC
FUNC _GUICTRLEDIT_GETRECT ($HWND )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
LOCAL $ARECT [4 ]
LOCAL $TRECT = _GUICTRLEDIT_GETRECTEX ($HWND )
$ARECT [0 ] = DLLSTRUCTGETDATA ($TRECT , "Left" )
$ARECT [1 ] = DLLSTRUCTGETDATA ($TRECT , "Top" )
$ARECT [2 ] = DLLSTRUCTGETDATA ($TRECT , "Right" )
$ARECT [3 ] = DLLSTRUCTGETDATA ($TRECT , "Bottom" )
RETURN $ARECT
ENDFUNC
FUNC _GUICTRLEDIT_GETRECTEX ($HWND )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
LOCAL $TRECT = DLLSTRUCTCREATE ($TAGRECT )
_SENDMESSAGE ($HWND , $EM_GETRECT , 0 , $TRECT , 0 , "wparam" , "struct*" )
RETURN $TRECT
ENDFUNC
FUNC _GUICTRLEDIT_GETSEL ($HWND )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
LOCAL $ASEL [2 ]
LOCAL $TSTART = DLLSTRUCTCREATE ("uint Start" )
LOCAL $TEND = DLLSTRUCTCREATE ("uint End" )
_SENDMESSAGE ($HWND , $EM_GETSEL , $TSTART , $TEND , 0 , "struct*" , "struct*" )
$ASEL [0 ] = DLLSTRUCTGETDATA ($TSTART , "Start" )
$ASEL [1 ] = DLLSTRUCTGETDATA ($TEND , "End" )
RETURN $ASEL
ENDFUNC
FUNC _GUICTRLEDIT_GETTEXT ($HWND )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
LOCAL $ITEXTLEN = _GUICTRLEDIT_GETTEXTLEN ($HWND ) + 1
LOCAL $TTEXT = DLLSTRUCTCREATE ("wchar Text[" & $ITEXTLEN & "]" )
_SENDMESSAGE ($HWND , $__EDITCONSTANT_WM_GETTEXT , $ITEXTLEN , $TTEXT , 0 , "wparam" , "struct*" )
RETURN DLLSTRUCTGETDATA ($TTEXT , "Text" )
ENDFUNC
FUNC _GUICTRLEDIT_GETTEXTLEN ($HWND )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
RETURN _SENDMESSAGE ($HWND , $__EDITCONSTANT_WM_GETTEXTLENGTH )
ENDFUNC
FUNC _GUICTRLEDIT_GETTHUMB ($HWND )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
RETURN _SENDMESSAGE ($HWND , $EM_GETTHUMB )
ENDFUNC
FUNC _GUICTRLEDIT_GETWORDBREAKPROC ($HWND )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
RETURN _SENDMESSAGE ($HWND , $EM_GETWORDBREAKPROC )
ENDFUNC
FUNC _GUICTRLEDIT_HIDEBALLOONTIP ($HWND )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
RETURN _SENDMESSAGE ($HWND , $EM_HIDEBALLOONTIP ) <> 0
ENDFUNC
FUNC _GUICTRLEDIT_INSERTTEXT ($HWND , $STEXT , $IINDEX = + 4294967295 )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
IF $IINDEX = + 4294967295 THEN
_GUICTRLEDIT_APPENDTEXT ($HWND , $STEXT )
ELSE
_GUICTRLEDIT_SETSEL ($HWND , $IINDEX , $IINDEX )
_SENDMESSAGE ($HWND , $EM_REPLACESEL , TRUE , $STEXT , 0 , "wparam" , "wstr" )
ENDIF
ENDFUNC
FUNC _GUICTRLEDIT_LINEFROMCHAR ($HWND , $IINDEX = + 4294967295 )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
RETURN _SENDMESSAGE ($HWND , $EM_LINEFROMCHAR , $IINDEX )
ENDFUNC
FUNC _GUICTRLEDIT_LINEINDEX ($HWND , $IINDEX = + 4294967295 )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
RETURN _SENDMESSAGE ($HWND , $EM_LINEINDEX , $IINDEX )
ENDFUNC
FUNC _GUICTRLEDIT_LINELENGTH ($HWND , $IINDEX = + 4294967295 )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
LOCAL $ICHARINDEX = _GUICTRLEDIT_LINEINDEX ($HWND , $IINDEX )
RETURN _SENDMESSAGE ($HWND , $EM_LINELENGTH , $ICHARINDEX )
ENDFUNC
FUNC _GUICTRLEDIT_LINESCROLL ($HWND , $IHORIZ , $IVERT )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
RETURN _SENDMESSAGE ($HWND , $EM_LINESCROLL , $IHORIZ , $IVERT ) <> 0
ENDFUNC
FUNC _GUICTRLEDIT_POSFROMCHAR ($HWND , $IINDEX )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
LOCAL $ACOORD [2 ]
LOCAL $IRET = _SENDMESSAGE ($HWND , $EM_POSFROMCHAR , $IINDEX )
$ACOORD [0 ] = _WINAPI_LOWORD ($IRET )
$ACOORD [1 ] = _WINAPI_HIWORD ($IRET )
RETURN $ACOORD
ENDFUNC
FUNC _GUICTRLEDIT_REPLACESEL ($HWND , $STEXT , $BUNDO = TRUE )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
_SENDMESSAGE ($HWND , $EM_REPLACESEL , $BUNDO , $STEXT , 0 , "wparam" , "wstr" )
ENDFUNC
FUNC _GUICTRLEDIT_SCROLL ($HWND , $IDIRECTION )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
IF BITAND ($IDIRECTION , $__EDITCONSTANT_SB_LINEDOWN ) <> $__EDITCONSTANT_SB_LINEDOWN AND BITAND ($IDIRECTION , $__EDITCONSTANT_SB_LINEUP ) <> $__EDITCONSTANT_SB_LINEUP AND BITAND ($IDIRECTION , $__EDITCONSTANT_SB_PAGEDOWN ) <> $__EDITCONSTANT_SB_PAGEDOWN AND BITAND ($IDIRECTION , $__EDITCONSTANT_SB_PAGEUP ) <> $__EDITCONSTANT_SB_PAGEUP AND BITAND ($IDIRECTION , $__EDITCONSTANT_SB_SCROLLCARET ) <> $__EDITCONSTANT_SB_SCROLLCARET THEN RETURN 0
IF $IDIRECTION == $__EDITCONSTANT_SB_SCROLLCARET THEN
RETURN _SENDMESSAGE ($HWND , $EM_SCROLLCARET )
ELSE
RETURN _SENDMESSAGE ($HWND , $EM_SCROLL , $IDIRECTION )
ENDIF
ENDFUNC
FUNC _GUICTRLEDIT_SETCUEBANNER ($HWND , $STEXT , $BONFOCUS = FALSE )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
LOCAL $TTEXT = _WINAPI_MULTIBYTETOWIDECHAR ($STEXT )
RETURN _SENDMESSAGE ($HWND , $EM_SETCUEBANNER , $BONFOCUS , $TTEXT , 0 , "wparam" , "struct*" ) = 1
ENDFUNC
FUNC _GUICTRLEDIT_SETHANDLE ($HWND , $HMEMORY )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
_SENDMESSAGE ($HWND , $EM_SETHANDLE , $HMEMORY , 0 , 0 , "handle" )
ENDFUNC
FUNC _GUICTRLEDIT_SETIMESTATUS ($HWND , $ICOMPOSITION )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
RETURN _SENDMESSAGE ($HWND , $EM_SETIMESTATUS , $EMSIS_COMPOSITIONSTRING , $ICOMPOSITION )
ENDFUNC
FUNC _GUICTRLEDIT_SETLIMITTEXT ($HWND , $ILIMIT )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
_SENDMESSAGE ($HWND , $EM_SETLIMITTEXT , $ILIMIT )
ENDFUNC
FUNC _GUICTRLEDIT_SETMARGINS ($HWND , $IMARGIN = 1 , $ILEFT = 65535 , $IRIGHT = 65535 )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
_SENDMESSAGE ($HWND , $EM_SETMARGINS , $IMARGIN , _WINAPI_MAKELONG ($ILEFT , $IRIGHT ) )
ENDFUNC
FUNC _GUICTRLEDIT_SETMODIFY ($HWND , $BMODIFIED )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
_SENDMESSAGE ($HWND , $EM_SETMODIFY , $BMODIFIED )
ENDFUNC
FUNC _GUICTRLEDIT_SETPASSWORDCHAR ($HWND , $SDISPLAYCHAR = "0" )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
$SDISPLAYCHAR = STRINGLEFT ($SDISPLAYCHAR , 1 )
IF ASC ($SDISPLAYCHAR ) = 48 THEN
_SENDMESSAGE ($HWND , $EM_SETPASSWORDCHAR )
ELSE
_SENDMESSAGE ($HWND , $EM_SETPASSWORDCHAR , ASC ($SDISPLAYCHAR ) )
ENDIF
ENDFUNC
FUNC _GUICTRLEDIT_SETREADONLY ($HWND , $BREADONLY )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
RETURN _SENDMESSAGE ($HWND , $EM_SETREADONLY , $BREADONLY ) <> 0
ENDFUNC
FUNC _GUICTRLEDIT_SETRECT ($HWND , $ARECT )
LOCAL $TRECT = DLLSTRUCTCREATE ($TAGRECT )
DLLSTRUCTSETDATA ($TRECT , "Left" , $ARECT [0 ] )
DLLSTRUCTSETDATA ($TRECT , "Top" , $ARECT [1 ] )
DLLSTRUCTSETDATA ($TRECT , "Right" , $ARECT [2 ] )
DLLSTRUCTSETDATA ($TRECT , "Bottom" , $ARECT [3 ] )
_GUICTRLEDIT_SETRECTEX ($HWND , $TRECT )
ENDFUNC
FUNC _GUICTRLEDIT_SETRECTEX ($HWND , $TRECT )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
_SENDMESSAGE ($HWND , $EM_SETRECT , 0 , $TRECT , 0 , "wparam" , "struct*" )
ENDFUNC
FUNC _GUICTRLEDIT_SETRECTNP ($HWND , $ARECT )
LOCAL $TRECT = DLLSTRUCTCREATE ($TAGRECT )
DLLSTRUCTSETDATA ($TRECT , "Left" , $ARECT [0 ] )
DLLSTRUCTSETDATA ($TRECT , "Top" , $ARECT [1 ] )
DLLSTRUCTSETDATA ($TRECT , "Right" , $ARECT [2 ] )
DLLSTRUCTSETDATA ($TRECT , "Bottom" , $ARECT [3 ] )
_GUICTRLEDIT_SETRECTNPEX ($HWND , $TRECT )
ENDFUNC
FUNC _GUICTRLEDIT_SETRECTNPEX ($HWND , $TRECT )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
_SENDMESSAGE ($HWND , $EM_SETRECTNP , 0 , $TRECT , 0 , "wparam" , "struct*" )
ENDFUNC
FUNC _GUICTRLEDIT_SETSEL ($HWND , $ISTART , $IEND )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
_SENDMESSAGE ($HWND , $EM_SETSEL , $ISTART , $IEND )
ENDFUNC
FUNC _GUICTRLEDIT_SETTABSTOPS ($HWND , $ATABSTOPS )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
IF NOT ISARRAY ($ATABSTOPS ) THEN RETURN SETERROR (+ 4294967295 , + 4294967295 , FALSE )
LOCAL $STABSTOPS = ""
LOCAL $INUMTABSTOPS = UBOUND ($ATABSTOPS )
FOR $X = 0 TO $INUMTABSTOPS + 4294967295
$STABSTOPS &= "int;"
NEXT
$STABSTOPS = STRINGTRIMRIGHT ($STABSTOPS , 1 )
LOCAL $TTABSTOPS = DLLSTRUCTCREATE ($STABSTOPS )
FOR $X = 0 TO $INUMTABSTOPS + 4294967295
DLLSTRUCTSETDATA ($TTABSTOPS , $X + 1 , $ATABSTOPS [$X ] )
NEXT
LOCAL $IRET = _SENDMESSAGE ($HWND , $EM_SETTABSTOPS , $INUMTABSTOPS , $TTABSTOPS , 0 , "wparam" , "struct*" ) <> 0
_WINAPI_INVALIDATERECT ($HWND )
RETURN $IRET
ENDFUNC
FUNC _GUICTRLEDIT_SETTEXT ($HWND , $STEXT )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
_SENDMESSAGE ($HWND , $__EDITCONSTANT_WM_SETTEXT , 0 , $STEXT , 0 , "wparam" , "wstr" )
ENDFUNC
FUNC _GUICTRLEDIT_SETWORDBREAKPROC ($HWND , $IADDRESSFUNC )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
_SENDMESSAGE ($HWND , $EM_SETWORDBREAKPROC , 0 , $IADDRESSFUNC )
ENDFUNC
FUNC _GUICTRLEDIT_SHOWBALLOONTIP ($HWND , $STITLE , $STEXT , $IICON )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
LOCAL $TTITLE = _WINAPI_MULTIBYTETOWIDECHAR ($STITLE )
LOCAL $TTEXT = _WINAPI_MULTIBYTETOWIDECHAR ($STEXT )
LOCAL $TTT = DLLSTRUCTCREATE ($__TAGEDITBALLOONTIP )
DLLSTRUCTSETDATA ($TTT , "Size" , DLLSTRUCTGETSIZE ($TTT ) )
DLLSTRUCTSETDATA ($TTT , "Title" , DLLSTRUCTGETPTR ($TTITLE ) )
DLLSTRUCTSETDATA ($TTT , "Text" , DLLSTRUCTGETPTR ($TTEXT ) )
DLLSTRUCTSETDATA ($TTT , "Icon" , $IICON )
RETURN _SENDMESSAGE ($HWND , $EM_SHOWBALLOONTIP , 0 , $TTT , 0 , "wparam" , "struct*" ) <> 0
ENDFUNC
FUNC _GUICTRLEDIT_UNDO ($HWND )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
RETURN _SENDMESSAGE ($HWND , $EM_UNDO ) <> 0
ENDFUNC
GLOBAL CONST $RT_ACCELERATOR = 9
GLOBAL CONST $RT_ANICURSOR = 21
GLOBAL CONST $RT_ANIICON = 22
GLOBAL CONST $RT_BITMAP = 2
GLOBAL CONST $RT_CURSOR = 1
GLOBAL CONST $RT_DIALOG = 5
GLOBAL CONST $RT_DLGINCLUDE = 17
GLOBAL CONST $RT_FONT = 8
GLOBAL CONST $RT_FONTDIR = 7
GLOBAL CONST $RT_GROUP_CURSOR = 12
GLOBAL CONST $RT_GROUP_ICON = 14
GLOBAL CONST $RT_HTML = 23
GLOBAL CONST $RT_ICON = 3
GLOBAL CONST $RT_MANIFEST = 24
GLOBAL CONST $RT_MENU = 4
GLOBAL CONST $RT_MESSAGETABLE = 11
GLOBAL CONST $RT_PLUGPLAY = 19
GLOBAL CONST $RT_RCDATA = 10
GLOBAL CONST $RT_STRING = 6
GLOBAL CONST $RT_VERSION = 16
GLOBAL CONST $RT_VXD = 20
GLOBAL CONST $FILE_VER_GET_LOCALISED = 1
GLOBAL CONST $FILE_VER_GET_NEUTRAL = 2
GLOBAL CONST $FILE_VER_GET_PREFETCHED = 4
GLOBAL CONST $OBM_TRTYPE = 32732
GLOBAL CONST $OBM_LFARROWI = 32734
GLOBAL CONST $OBM_RGARROWI = 32735
GLOBAL CONST $OBM_DNARROWI = 32736
GLOBAL CONST $OBM_UPARROWI = 32737
GLOBAL CONST $OBM_COMBO = 32738
GLOBAL CONST $OBM_MNARROW = 32739
GLOBAL CONST $OBM_LFARROWD = 32740
GLOBAL CONST $OBM_RGARROWD = 32741
GLOBAL CONST $OBM_DNARROWD = 32742
GLOBAL CONST $OBM_UPARROWD = 32743
GLOBAL CONST $OBM_RESTORED = 32744
GLOBAL CONST $OBM_ZOOMD = 32745
GLOBAL CONST $OBM_REDUCED = 32746
GLOBAL CONST $OBM_RESTORE = 32747
GLOBAL CONST $OBM_ZOOM = 32748
GLOBAL CONST $OBM_REDUCE = 32749
GLOBAL CONST $OBM_LFARROW = 32750
GLOBAL CONST $OBM_RGARROW = 32751
GLOBAL CONST $OBM_DNARROW = 32752
GLOBAL CONST $OBM_UPARROW = 32753
GLOBAL CONST $OBM_CLOSE = 32754
GLOBAL CONST $OBM_OLD_RESTORE = 32755
GLOBAL CONST $OBM_OLD_ZOOM = 32756
GLOBAL CONST $OBM_OLD_REDUCE = 32757
GLOBAL CONST $OBM_BTNCORNERS = 32758
GLOBAL CONST $OBM_CHECKBOXES = 32759
GLOBAL CONST $OBM_CHECK = 32760
GLOBAL CONST $OBM_BTSIZE = 32761
GLOBAL CONST $OBM_OLD_LFARROW = 32762
GLOBAL CONST $OBM_OLD_RGARROW = 32763
GLOBAL CONST $OBM_OLD_DNARROW = 32764
GLOBAL CONST $OBM_OLD_UPARROW = 32765
GLOBAL CONST $OBM_SIZE = 32766
GLOBAL CONST $OBM_OLD_CLOSE = 32767
GLOBAL CONST $OIC_SAMPLE = 32512
GLOBAL CONST $OIC_HAND = 32513
GLOBAL CONST $OIC_QUES = 32514
GLOBAL CONST $OIC_BANG = 32515
GLOBAL CONST $OIC_NOTE = 32516
GLOBAL CONST $OIC_WINLOGO = 32517
GLOBAL CONST $OIC_WARNING = $OIC_BANG
GLOBAL CONST $OIC_ERROR = $OIC_HAND
GLOBAL CONST $OIC_INFORMATION = $OIC_NOTE
GLOBAL CONST $DONT_RESOLVE_DLL_REFERENCES = 1
GLOBAL CONST $LOAD_LIBRARY_AS_DATAFILE = 2
GLOBAL CONST $LOAD_WITH_ALTERED_SEARCH_PATH = 8
GLOBAL CONST $LOAD_IGNORE_CODE_AUTHZ_LEVEL = 16
GLOBAL CONST $LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE = 64
GLOBAL CONST $LOAD_LIBRARY_AS_IMAGE_RESOURCE = 32
GLOBAL CONST $LOAD_LIBRARY_SEARCH_APPLICATION_DIR = 512
GLOBAL CONST $LOAD_LIBRARY_SEARCH_DEFAULT_DIRS = 4096
GLOBAL CONST $LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR = 256
GLOBAL CONST $LOAD_LIBRARY_SEARCH_SYSTEM32 = 2048
GLOBAL CONST $LOAD_LIBRARY_SEARCH_USER_DIRS = 1024
GLOBAL CONST $OCR_NORMAL = 32512
GLOBAL CONST $OCR_IBEAM = 32513
GLOBAL CONST $OCR_WAIT = 32514
GLOBAL CONST $OCR_CROSS = 32515
GLOBAL CONST $OCR_UP = 32516
GLOBAL CONST $OCR_SIZE = 32640
GLOBAL CONST $OCR_ICON = 32641
GLOBAL CONST $OCR_SIZENWSE = 32642
GLOBAL CONST $OCR_SIZENESW = 32643
GLOBAL CONST $OCR_SIZEWE = 32644
GLOBAL CONST $OCR_SIZENS = 32645
GLOBAL CONST $OCR_SIZEALL = 32646
GLOBAL CONST $OCR_ICOCUR = 32647
GLOBAL CONST $OCR_NO = 32648
GLOBAL CONST $OCR_HAND = 32649
GLOBAL CONST $OCR_APPSTARTING = 32650
GLOBAL CONST $OCR_HELP = 32651
GLOBAL CONST $VS_FF_DEBUG = 1
GLOBAL CONST $VS_FF_INFOINFERRED = 16
GLOBAL CONST $VS_FF_PATCHED = 4
GLOBAL CONST $VS_FF_PRERELEASE = 2
GLOBAL CONST $VS_FF_PRIVATEBUILD = 8
GLOBAL CONST $VS_FF_SPECIALBUILD = 32
GLOBAL CONST $VOS_DOS = 65536
GLOBAL CONST $VOS_NT = 262144
GLOBAL CONST $VOS__WINDOWS16 = 1
GLOBAL CONST $VOS__WINDOWS32 = 4
GLOBAL CONST $VOS_OS216 = 131072
GLOBAL CONST $VOS_OS232 = 196608
GLOBAL CONST $VOS__PM16 = 2
GLOBAL CONST $VOS__PM32 = 3
GLOBAL CONST $VOS_UNKNOWN = 0
GLOBAL CONST $VOS_DOS_WINDOWS16 = 65537
GLOBAL CONST $VOS_DOS_WINDOWS32 = 65540
GLOBAL CONST $VOS_NT_WINDOWS32 = 262148
GLOBAL CONST $VOS_OS216_PM16 = 131074
GLOBAL CONST $VOS_OS232_PM32 = 196611
GLOBAL CONST $VFT_APP = 1
GLOBAL CONST $VFT_DLL = 2
GLOBAL CONST $VFT_DRV = 3
GLOBAL CONST $VFT_FONT = 4
GLOBAL CONST $VFT_STATIC_LIB = 7
GLOBAL CONST $VFT_UNKNOWN = 0
GLOBAL CONST $VFT_VXD = 5
GLOBAL CONST $VFT2_DRV_COMM = 10
GLOBAL CONST $VFT2_DRV_DISPLAY = 4
GLOBAL CONST $VFT2_DRV_INSTALLABLE = 8
GLOBAL CONST $VFT2_DRV_KEYBOARD = 2
GLOBAL CONST $VFT2_DRV_LANGUAGE = 3
GLOBAL CONST $VFT2_DRV_MOUSE = 5
GLOBAL CONST $VFT2_DRV_NETWORK = 6
GLOBAL CONST $VFT2_DRV_PRINTER = 1
GLOBAL CONST $VFT2_DRV_SOUND = 9
GLOBAL CONST $VFT2_DRV_SYSTEM = 7
GLOBAL CONST $VFT2_DRV_VERSIONED_PRINTER = 12
GLOBAL CONST $VFT2_UNKNOWN = 0
GLOBAL CONST $VFT2_FONT_RASTER = 1
GLOBAL CONST $VFT2_FONT_TRUETYPE = 3
GLOBAL CONST $VFT2_FONT_VECTOR = 2
#Region Global Variables and Constants
GLOBAL $__G_HHEAP = 0
#EndRegion Global Variables and Constants
#Region Functions list
#EndRegion Functions list
#Region Public Functions
FUNC _WINAPI_CREATEBUFFER ($ILENGTH , $PBUFFER = 0 , $BABORT = TRUE )
$PBUFFER = __HEAPREALLOC ($PBUFFER , $ILENGTH , 0 , $BABORT )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $PBUFFER
ENDFUNC
FUNC _WINAPI_CREATEBUFFERFROMSTRUCT ($TSTRUCT , $PBUFFER = 0 , $BABORT = TRUE )
IF NOT ISDLLSTRUCT ($TSTRUCT ) THEN RETURN SETERROR (1 , 0 , 0 )
$PBUFFER = __HEAPREALLOC ($PBUFFER , DLLSTRUCTGETSIZE ($TSTRUCT ) , 0 , $BABORT )
IF @ERROR THEN RETURN SETERROR (@ERROR + 100 , @EXTENDED , 0 )
_WINAPI_MOVEMEMORY ($PBUFFER , $TSTRUCT , DLLSTRUCTGETSIZE ($TSTRUCT ) )
RETURN $PBUFFER
ENDFUNC
FUNC _WINAPI_CREATESTRING ($SSTRING , $PSTRING = 0 , $ILENGTH = + 4294967295 , $BUNICODE = TRUE , $BABORT = TRUE )
$ILENGTH = NUMBER ($ILENGTH )
IF $ILENGTH >= 0 THEN
$SSTRING = STRINGLEFT ($SSTRING , $ILENGTH )
ELSE
$ILENGTH = STRINGLEN ($SSTRING )
ENDIF
LOCAL $ISIZE = $ILENGTH + 1
IF $BUNICODE THEN
$ISIZE *= 2
ENDIF
$PSTRING = __HEAPREALLOC ($PSTRING , $ISIZE , 0 , $BABORT )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
DLLSTRUCTSETDATA (DLLSTRUCTCREATE (($BUNICODE "wchar" "char" ) & "[" & ($ILENGTH + 1 ) & "]" , $PSTRING ) , 1 , $SSTRING )
RETURN SETEXTENDED ($ILENGTH , $PSTRING )
ENDFUNC
FUNC _WINAPI_EQUALMEMORY ($PSOURCE1 , $PSOURCE2 , $ILENGTH )
IF _WINAPI_ISBADREADPTR ($PSOURCE1 , $ILENGTH ) THEN RETURN SETERROR (11 , @EXTENDED , 0 )
IF _WINAPI_ISBADREADPTR ($PSOURCE2 , $ILENGTH ) THEN RETURN SETERROR (12 , @EXTENDED , 0 )
LOCAL $ARET = DLLCALL ("ntdll.dll" , "ulong_ptr" , "RtlCompareMemory" , "struct*" , $PSOURCE1 , "struct*" , $PSOURCE2 , "ulong_ptr" , $ILENGTH )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN NUMBER ($ARET [0 ] = $ILENGTH )
ENDFUNC
FUNC _WINAPI_FILLMEMORY ($PMEMORY , $ILENGTH , $IVALUE = 0 )
IF _WINAPI_ISBADWRITEPTR ($PMEMORY , $ILENGTH ) THEN RETURN SETERROR (11 , @EXTENDED , 0 )
DLLCALL ("ntdll.dll" , "none" , "RtlFillMemory" , "struct*" , $PMEMORY , "ulong_ptr" , $ILENGTH , "byte" , $IVALUE )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN 1
ENDFUNC
FUNC _WINAPI_FREEMEMORY ($PMEMORY )
IF NOT __HEAPFREE ($PMEMORY , 1 ) THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN 1
ENDFUNC
FUNC _WINAPI_GETMEMORYSIZE ($PMEMORY )
LOCAL $IRESULT = __HEAPSIZE ($PMEMORY , 1 )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $IRESULT
ENDFUNC
FUNC _WINAPI_GLOBALMEMORYSTATUS ()
LOCAL CONST $TAGMEMORYSTATUSEX = "dword Length;dword MemoryLoad;" & "uint64 TotalPhys;uint64 AvailPhys;uint64 TotalPageFile;uint64 AvailPageFile;" & "uint64 TotalVirtual;uint64 AvailVirtual;uint64 AvailExtendedVirtual"
LOCAL $TMEM = DLLSTRUCTCREATE ($TAGMEMORYSTATUSEX )
DLLSTRUCTSETDATA ($TMEM , 1 , DLLSTRUCTGETSIZE ($TMEM ) )
LOCAL $ARET = DLLCALL ("kernel32.dll" , "bool" , "GlobalMemoryStatusEx" , "struct*" , $TMEM )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , 0 )
LOCAL $AMEM [7 ]
$AMEM [0 ] = DLLSTRUCTGETDATA ($TMEM , 2 )
$AMEM [1 ] = DLLSTRUCTGETDATA ($TMEM , 3 )
$AMEM [2 ] = DLLSTRUCTGETDATA ($TMEM , 4 )
$AMEM [3 ] = DLLSTRUCTGETDATA ($TMEM , 5 )
$AMEM [4 ] = DLLSTRUCTGETDATA ($TMEM , 6 )
$AMEM [5 ] = DLLSTRUCTGETDATA ($TMEM , 7 )
$AMEM [6 ] = DLLSTRUCTGETDATA ($TMEM , 8 )
RETURN $AMEM
ENDFUNC
FUNC _WINAPI_ISBADCODEPTR ($PADDRESS )
LOCAL $ARET = DLLCALL ("kernel32.dll" , "bool" , "IsBadCodePtr" , "struct*" , $PADDRESS )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARET [0 ]
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_ISBADSTRINGPTR ($PADDRESS , $ILENGTH )
LOCAL $ARET = DLLCALL ("kernel32.dll" , "bool" , "IsBadStringPtr" , "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_ISMEMORY ($PMEMORY )
LOCAL $BRESULT = __HEAPVALIDATE ($PMEMORY )
RETURN SETERROR (@ERROR , @EXTENDED , $BRESULT )
ENDFUNC
FUNC _WINAPI_LOCALFREE ($HMEMORY )
LOCAL $ARESULT = DLLCALL ("kernel32.dll" , "handle" , "LocalFree" , "handle" , $HMEMORY )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARESULT [0 ]
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_READPROCESSMEMORY ($HPROCESS , $PBASEADDRESS , $PBUFFER , $ISIZE , BYREF $IREAD )
LOCAL $ARESULT = DLLCALL ("kernel32.dll" , "bool" , "ReadProcessMemory" , "handle" , $HPROCESS , "ptr" , $PBASEADDRESS , "struct*" , $PBUFFER , "ulong_ptr" , $ISIZE , "ulong_ptr*" , 0 )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
$IREAD = $ARESULT [5 ]
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_WRITEPROCESSMEMORY ($HPROCESS , $PBASEADDRESS , $PBUFFER , $ISIZE , BYREF $IWRITTEN , $SBUFFER = "ptr" )
LOCAL $ARESULT = DLLCALL ("kernel32.dll" , "bool" , "WriteProcessMemory" , "handle" , $HPROCESS , "ptr" , $PBASEADDRESS , $SBUFFER , $PBUFFER , "ulong_ptr" , $ISIZE , "ulong_ptr*" , 0 )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
$IWRITTEN = $ARESULT [5 ]
RETURN $ARESULT [0 ]
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 __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 (+ 4294967295 ) ) 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
#EndRegion Internal Functions
GLOBAL CONST $SND_APPLICATION = 128
GLOBAL CONST $SND_ALIAS = 65536
GLOBAL CONST $SND_ALIAS_ID = 1114112
GLOBAL CONST $SND_ASYNC = 1
GLOBAL CONST $SND_FILENAME = 131072
GLOBAL CONST $SND_LOOP = 8
GLOBAL CONST $SND_MEMORY = 4
GLOBAL CONST $SND_NODEFAULT = 2
GLOBAL CONST $SND_NOSTOP = 16
GLOBAL CONST $SND_NOWAIT = 8192
GLOBAL CONST $SND_PURGE = 64
GLOBAL CONST $SND_RESOURCE = 262148
GLOBAL CONST $SND_SENTRY = 524288
GLOBAL CONST $SND_SYNC = 0
GLOBAL CONST $SND_SYSTEM = 2097152
GLOBAL CONST $SND_SYSTEM_NOSTOP = 2097168
GLOBAL CONST $SND_ALIAS_SYSTEMASTERISK = "SystemAsterisk"
GLOBAL CONST $SND_ALIAS_SYSTEMDEFAULT = "SystemDefault"
GLOBAL CONST $SND_ALIAS_SYSTEMEXCLAMATION = "SystemExclamation"
GLOBAL CONST $SND_ALIAS_SYSTEMEXIT = "SystemExit"
GLOBAL CONST $SND_ALIAS_SYSTEMHAND = "SystemHand"
GLOBAL CONST $SND_ALIAS_SYSTEMQUESTION = "SystemQuestion"
GLOBAL CONST $SND_ALIAS_SYSTEMSTART = "SystemStart"
GLOBAL CONST $SND_ALIAS_SYSTEMWELCOME = "SystemWelcome"
#Region Global Variables and Constants
#EndRegion Global Variables and Constants
#Region Functions list
#EndRegion Functions list
#Region Public Functions
FUNC _WINAPI_ARRAYTOSTRUCT (CONST BYREF $ADATA , $ISTART = 0 , $IEND = + 4294967295 )
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_COPYSTRUCT ($TSTRUCT , $SSTRUCT = "" )
LOCAL $ISIZE = DLLSTRUCTGETSIZE ($TSTRUCT )
IF NOT $ISIZE THEN RETURN SETERROR (1 , 0 , 0 )
LOCAL $TRESULT
IF NOT STRINGSTRIPWS ($SSTRUCT , $STR_STRIPLEADING + $STR_STRIPTRAILING + $STR_STRIPSPACES ) THEN
$TRESULT = DLLSTRUCTCREATE ("byte[" & $ISIZE & "]" )
ELSE
$TRESULT = DLLSTRUCTCREATE ($SSTRUCT )
ENDIF
IF DLLSTRUCTGETSIZE ($TRESULT ) < $ISIZE THEN RETURN SETERROR (2 , 0 , 0 )
_WINAPI_MOVEMEMORY ($TRESULT , $TSTRUCT , $ISIZE )
RETURN $TRESULT
ENDFUNC
FUNC _WINAPI_GETEXTENDED ()
RETURN $__G_VEXT
ENDFUNC
FUNC _WINAPI_GETMOUSEPOS ($BTOCLIENT = FALSE , $HWND = 0 )
LOCAL $IMODE = OPT ("MouseCoordMode" , 1 )
LOCAL $APOS = MOUSEGETPOS ()
OPT ("MouseCoordMode" , $IMODE )
LOCAL $TPOINT = DLLSTRUCTCREATE ($TAGPOINT )
DLLSTRUCTSETDATA ($TPOINT , "X" , $APOS [0 ] )
DLLSTRUCTSETDATA ($TPOINT , "Y" , $APOS [1 ] )
IF $BTOCLIENT AND NOT _WINAPI_SCREENTOCLIENT ($HWND , $TPOINT ) THEN RETURN SETERROR (@ERROR + 20 , @EXTENDED , 0 )
RETURN $TPOINT
ENDFUNC
FUNC _WINAPI_GETMOUSEPOSX ($BTOCLIENT = FALSE , $HWND = 0 )
LOCAL $TPOINT = _WINAPI_GETMOUSEPOS ($BTOCLIENT , $HWND )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN DLLSTRUCTGETDATA ($TPOINT , "X" )
ENDFUNC
FUNC _WINAPI_GETMOUSEPOSY ($BTOCLIENT = FALSE , $HWND = 0 )
LOCAL $TPOINT = _WINAPI_GETMOUSEPOS ($BTOCLIENT , $HWND )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN DLLSTRUCTGETDATA ($TPOINT , "Y" )
ENDFUNC
FUNC _WINAPI_MULDIV ($INUMBER , $INUMERATOR , $IDENOMINATOR )
LOCAL $ARESULT = DLLCALL ("kernel32.dll" , "int" , "MulDiv" , "int" , $INUMBER , "int" , $INUMERATOR , "int" , $IDENOMINATOR )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , + 4294967295 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_PLAYSOUND ($SSOUND , $IFLAGS = $SND_SYSTEM_NOSTOP , $HINSTANCE = 0 )
LOCAL $STYPEOFSOUND = "ptr"
IF $SSOUND THEN
IF ISSTRING ($SSOUND ) THEN
$STYPEOFSOUND = "wstr"
ENDIF
ELSE
$SSOUND = 0
$IFLAGS = 0
ENDIF
LOCAL $ARET = DLLCALL ("winmm.dll" , "bool" , "PlaySoundW" , $STYPEOFSOUND , $SSOUND , "handle" , $HINSTANCE , "dword" , $IFLAGS )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_STRINGLENA (CONST BYREF $TSTRING )
LOCAL $ARESULT = DLLCALL ("kernel32.dll" , "int" , "lstrlenA" , "struct*" , $TSTRING )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_STRINGLENW (CONST BYREF $TSTRING )
LOCAL $ARESULT = DLLCALL ("kernel32.dll" , "int" , "lstrlenW" , "struct*" , $TSTRING )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [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 , + 4294967295 )
RETURN $ARESULT
ENDFUNC
FUNC _WINAPI_UNIONSTRUCT ($TSTRUCT1 , $TSTRUCT2 , $SSTRUCT = "" )
LOCAL $ASIZE [2 ] = [DLLSTRUCTGETSIZE ($TSTRUCT1 ) , DLLSTRUCTGETSIZE ($TSTRUCT2 ) ]
IF NOT $ASIZE [0 ] OR NOT $ASIZE [1 ] THEN RETURN SETERROR (1 , 0 , 0 )
LOCAL $TRESULT
IF NOT STRINGSTRIPWS ($SSTRUCT , $STR_STRIPLEADING + $STR_STRIPTRAILING + $STR_STRIPSPACES ) THEN
$TRESULT = DLLSTRUCTCREATE ("byte[" & ($ASIZE [0 ] + $ASIZE [1 ] ) & "]" )
ELSE
$TRESULT = DLLSTRUCTCREATE ($SSTRUCT )
ENDIF
IF DLLSTRUCTGETSIZE ($TRESULT ) < ($ASIZE [0 ] + $ASIZE [1 ] ) THEN RETURN SETERROR (2 , 0 , 0 )
_WINAPI_MOVEMEMORY ($TRESULT , $TSTRUCT1 , $ASIZE [0 ] )
_WINAPI_MOVEMEMORY (DLLSTRUCTGETPTR ($TRESULT ) + $ASIZE [0 ] , $TSTRUCT2 , $ASIZE [1 ] )
RETURN $TRESULT
ENDFUNC
#EndRegion Public Functions
#Region Global Variables and Constants
GLOBAL CONST $TAGBITMAP = "struct;long bmType;long bmWidth;long bmHeight;long bmWidthBytes;ushort bmPlanes;ushort bmBitsPixel;ptr bmBits;endstruct"
GLOBAL CONST $TAGBITMAPV5HEADER = "struct;dword bV5Size;long bV5Width;long bV5Height;ushort bV5Planes;ushort bV5BitCount;dword bV5Compression;dword bV5SizeImage;long bV5XPelsPerMeter;long bV5YPelsPerMeter;dword bV5ClrUsed;dword bV5ClrImportant;dword bV5RedMask;dword bV5GreenMask;dword bV5BlueMask;dword bV5AlphaMask;dword bV5CSType;int bV5Endpoints[9];dword bV5GammaRed;dword bV5GammaGreen;dword bV5GammaBlue;dword bV5Intent;dword bV5ProfileData;dword bV5ProfileSize;dword bV5Reserved;endstruct"
GLOBAL CONST $TAGDIBSECTION = $TAGBITMAP & ";" & $TAGBITMAPINFOHEADER & ";dword dsBitfields[3];ptr dshSection;dword dsOffset"
GLOBAL CONST $TMPF_FIXED_PITCH = 1
GLOBAL CONST $TMPF_VECTOR = 2
GLOBAL CONST $TMPF_TRUETYPE = 4
GLOBAL CONST $TMPF_DEVICE = 8
GLOBAL CONST $__WINAPICONSTANT_FW_NORMAL = 400
GLOBAL CONST $__WINAPICONSTANT_DEFAULT_CHARSET = 1
GLOBAL CONST $__WINAPICONSTANT_OUT_DEFAULT_PRECIS = 0
GLOBAL CONST $__WINAPICONSTANT_CLIP_DEFAULT_PRECIS = 0
GLOBAL CONST $__WINAPICONSTANT_DEFAULT_QUALITY = 0
#EndRegion Global Variables and Constants
#Region Functions list
#EndRegion Functions list
#Region Public Functions
FUNC _WINAPI_BITBLT ($HDESTDC , $IXDEST , $IYDEST , $IWIDTH , $IHEIGHT , $HSRCDC , $IXSRC , $IYSRC , $IROP )
LOCAL $ARESULT = DLLCALL ("gdi32.dll" , "bool" , "BitBlt" , "handle" , $HDESTDC , "int" , $IXDEST , "int" , $IYDEST , "int" , $IWIDTH , "int" , $IHEIGHT , "handle" , $HSRCDC , "int" , $IXSRC , "int" , $IYSRC , "dword" , $IROP )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_COMBINERGN ($HRGNDEST , $HRGNSRC1 , $HRGNSRC2 , $ICOMBINEMODE )
LOCAL $ARESULT = DLLCALL ("gdi32.dll" , "int" , "CombineRgn" , "handle" , $HRGNDEST , "handle" , $HRGNSRC1 , "handle" , $HRGNSRC2 , "int" , $ICOMBINEMODE )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_COPYBITMAP ($HBITMAP )
$HBITMAP = _WINAPI_COPYIMAGE ($HBITMAP , 0 , 0 , 0 , 8192 )
RETURN SETERROR (@ERROR , @EXTENDED , $HBITMAP )
ENDFUNC
FUNC _WINAPI_COPYIMAGE ($HIMAGE , $ITYPE = 0 , $IXDESIREDPIXELS = 0 , $IYDESIREDPIXELS = 0 , $IFLAGS = 0 )
LOCAL $ARET = DLLCALL ("user32.dll" , "handle" , "CopyImage" , "handle" , $HIMAGE , "uint" , $ITYPE , "int" , $IXDESIREDPIXELS , "int" , $IYDESIREDPIXELS , "uint" , $IFLAGS )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_CREATEANDBITMAP ($HBITMAP )
LOCAL $IERROR = 0 , $HDIB = 0
$HBITMAP = _WINAPI_COPYBITMAP ($HBITMAP )
IF NOT $HBITMAP THEN RETURN SETERROR (@ERROR + 20 , @EXTENDED , 0 )
DO
LOCAL $ATDIB [2 ]
$ATDIB [0 ] = DLLSTRUCTCREATE ($TAGDIBSECTION )
IF (NOT _WINAPI_GETOBJECT ($HBITMAP , DLLSTRUCTGETSIZE ($ATDIB [0 ] ) , $ATDIB [0 ] ) ) OR (DLLSTRUCTGETDATA ($ATDIB [0 ] , "bmBitsPixel" ) <> 32 ) OR (DLLSTRUCTGETDATA ($ATDIB [0 ] , "biCompression" ) ) THEN
$IERROR = 10
EXITLOOP
ENDIF
$ATDIB [1 ] = DLLSTRUCTCREATE ($TAGBITMAP )
$HDIB = _WINAPI_CREATEDIB (DLLSTRUCTGETDATA ($ATDIB [0 ] , "bmWidth" ) , DLLSTRUCTGETDATA ($ATDIB [0 ] , "bmHeight" ) , 1 )
IF NOT _WINAPI_GETOBJECT ($HDIB , DLLSTRUCTGETSIZE ($ATDIB [1 ] ) , $ATDIB [1 ] ) THEN
$IERROR = 11
EXITLOOP
ENDIF
LOCAL $ARET = DLLCALL ("user32.dll" , "lresult" , "CallWindowProc" , "ptr" , __ANDPROC () , "ptr" , 0 , "uint" , 0 , "wparam" , DLLSTRUCTGETPTR ($ATDIB [0 ] ) , "lparam" , DLLSTRUCTGETPTR ($ATDIB [1 ] ) )
IF @ERROR THEN
$IERROR = @ERROR
EXITLOOP
ENDIF
IF NOT $ARET [0 ] THEN
$IERROR = 12
EXITLOOP
ENDIF
$IERROR = 0
UNTIL 1
_WINAPI_DELETEOBJECT ($HBITMAP )
IF $IERROR THEN
IF $HDIB THEN
_WINAPI_DELETEOBJECT ($HDIB )
ENDIF
$HDIB = 0
ENDIF
RETURN SETERROR ($IERROR , 0 , $HDIB )
ENDFUNC
FUNC _WINAPI_CREATEBITMAP ($IWIDTH , $IHEIGHT , $IPLANES = 1 , $IBITSPERPEL = 1 , $PBITS = 0 )
LOCAL $ARESULT = DLLCALL ("gdi32.dll" , "handle" , "CreateBitmap" , "int" , $IWIDTH , "int" , $IHEIGHT , "uint" , $IPLANES , "uint" , $IBITSPERPEL , "struct*" , $PBITS )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_CREATECOMPATIBLEBITMAP ($HDC , $IWIDTH , $IHEIGHT )
LOCAL $ARESULT = DLLCALL ("gdi32.dll" , "handle" , "CreateCompatibleBitmap" , "handle" , $HDC , "int" , $IWIDTH , "int" , $IHEIGHT )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_CREATEDIB ($IWIDTH , $IHEIGHT , $IBITSPERPEL = 32 , $TCOLORTABLE = 0 , $ICOLORCOUNT = 0 )
LOCAL $ARGBQ [2 ] , $ICOLORS , $TAGRGBQ
SWITCH $IBITSPERPEL
CASE 1
$ICOLORS = 2
CASE 4
$ICOLORS = 16
CASE 8
$ICOLORS = 256
CASE ELSE
$ICOLORS = 0
ENDSWITCH
IF $ICOLORS THEN
IF NOT ISDLLSTRUCT ($TCOLORTABLE ) THEN
SWITCH $IBITSPERPEL
CASE 1
$ARGBQ [0 ] = 0
$ARGBQ [1 ] = 16777215
$TCOLORTABLE = _WINAPI_CREATEDIBCOLORTABLE ($ARGBQ )
CASE ELSE
ENDSWITCH
ELSE
IF $ICOLORS > $ICOLORCOUNT THEN
$ICOLORS = $ICOLORCOUNT
ENDIF
IF (NOT $ICOLORS ) OR ((4 * $ICOLORS ) > DLLSTRUCTGETSIZE ($TCOLORTABLE ) ) THEN
RETURN SETERROR (20 , 0 , 0 )
ENDIF
ENDIF
$TAGRGBQ = ";dword aRGBQuad[" & $ICOLORS & "]"
ELSE
$TAGRGBQ = ""
ENDIF
LOCAL $TBITMAPINFO = DLLSTRUCTCREATE ($TAGBITMAPINFOHEADER & $TAGRGBQ )
DLLSTRUCTSETDATA ($TBITMAPINFO , "biSize" , 40 )
DLLSTRUCTSETDATA ($TBITMAPINFO , "biWidth" , $IWIDTH )
DLLSTRUCTSETDATA ($TBITMAPINFO , "biHeight" , $IHEIGHT )
DLLSTRUCTSETDATA ($TBITMAPINFO , "biPlanes" , 1 )
DLLSTRUCTSETDATA ($TBITMAPINFO , "biBitCount" , $IBITSPERPEL )
DLLSTRUCTSETDATA ($TBITMAPINFO , "biCompression" , 0 )
DLLSTRUCTSETDATA ($TBITMAPINFO , "biSizeImage" , 0 )
DLLSTRUCTSETDATA ($TBITMAPINFO , "biXPelsPerMeter" , 0 )
DLLSTRUCTSETDATA ($TBITMAPINFO , "biYPelsPerMeter" , 0 )
DLLSTRUCTSETDATA ($TBITMAPINFO , "biClrUsed" , $ICOLORS )
DLLSTRUCTSETDATA ($TBITMAPINFO , "biClrImportant" , 0 )
IF $ICOLORS THEN
IF ISDLLSTRUCT ($TCOLORTABLE ) THEN
_WINAPI_MOVEMEMORY (DLLSTRUCTGETPTR ($TBITMAPINFO , "aRGBQuad" ) , $TCOLORTABLE , 4 * $ICOLORS )
ELSE
_WINAPI_ZEROMEMORY (DLLSTRUCTGETPTR ($TBITMAPINFO , "aRGBQuad" ) , 4 * $ICOLORS )
ENDIF
ENDIF
LOCAL $HBITMAP = _WINAPI_CREATEDIBSECTION (0 , $TBITMAPINFO , 0 , $__G_VEXT )
IF NOT $HBITMAP THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $HBITMAP
ENDFUNC
FUNC _WINAPI_CREATEDIBSECTION ($HDC , $TBITMAPINFO , $IUSAGE , BYREF $PBITS , $HSECTION = 0 , $IOFFSET = 0 )
$PBITS = 0
LOCAL $ARET = DLLCALL ("gdi32.dll" , "handle" , "CreateDIBSection" , "handle" , $HDC , "struct*" , $TBITMAPINFO , "uint" , $IUSAGE , "ptr*" , 0 , "handle" , $HSECTION , "dword" , $IOFFSET )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
$PBITS = $ARET [4 ]
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_CREATEDIBCOLORTABLE (CONST BYREF $ACOLORTABLE , $ISTART = 0 , $IEND = + 4294967295 )
IF __CHECKERRORARRAYBOUNDS ($ACOLORTABLE , $ISTART , $IEND ) THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , 0 )
LOCAL $TCOLORTABLE = DLLSTRUCTCREATE ("dword[" & ($IEND - $ISTART + 1 ) & "]" )
LOCAL $ICOUNT = 1
FOR $I = $ISTART TO $IEND
DLLSTRUCTSETDATA ($TCOLORTABLE , 1 , _WINAPI_SWITCHCOLOR (__RGB ($ACOLORTABLE [$I ] ) ) , $ICOUNT )
$ICOUNT += 1
NEXT
RETURN $TCOLORTABLE
ENDFUNC
FUNC _WINAPI_CREATEFONT ($IHEIGHT , $IWIDTH , $IESCAPE = 0 , $IORIENTN = 0 , $IWEIGHT = $__WINAPICONSTANT_FW_NORMAL , $BITALIC = FALSE , $BUNDERLINE = FALSE , $BSTRIKEOUT = FALSE , $ICHARSET = $__WINAPICONSTANT_DEFAULT_CHARSET , $IOUTPUTPREC = $__WINAPICONSTANT_OUT_DEFAULT_PRECIS , $ICLIPPREC = $__WINAPICONSTANT_CLIP_DEFAULT_PRECIS , $IQUALITY = $__WINAPICONSTANT_DEFAULT_QUALITY , $IPITCH = 0 , $SFACE = "Arial" )
LOCAL $ARESULT = DLLCALL ("gdi32.dll" , "handle" , "CreateFontW" , "int" , $IHEIGHT , "int" , $IWIDTH , "int" , $IESCAPE , "int" , $IORIENTN , "int" , $IWEIGHT , "dword" , $BITALIC , "dword" , $BUNDERLINE , "dword" , $BSTRIKEOUT , "dword" , $ICHARSET , "dword" , $IOUTPUTPREC , "dword" , $ICLIPPREC , "dword" , $IQUALITY , "dword" , $IPITCH , "wstr" , $SFACE )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_CREATEFONTINDIRECT ($TLOGFONT )
LOCAL $ARESULT = DLLCALL ("gdi32.dll" , "handle" , "CreateFontIndirectW" , "struct*" , $TLOGFONT )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_CREATERECTRGN ($ILEFTRECT , $ITOPRECT , $IRIGHTRECT , $IBOTTOMRECT )
LOCAL $ARESULT = DLLCALL ("gdi32.dll" , "handle" , "CreateRectRgn" , "int" , $ILEFTRECT , "int" , $ITOPRECT , "int" , $IRIGHTRECT , "int" , $IBOTTOMRECT )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_CREATEROUNDRECTRGN ($ILEFTRECT , $ITOPRECT , $IRIGHTRECT , $IBOTTOMRECT , $IWIDTHELLIPSE , $IHEIGHTELLIPSE )
LOCAL $ARESULT = DLLCALL ("gdi32.dll" , "handle" , "CreateRoundRectRgn" , "int" , $ILEFTRECT , "int" , $ITOPRECT , "int" , $IRIGHTRECT , "int" , $IBOTTOMRECT , "int" , $IWIDTHELLIPSE , "int" , $IHEIGHTELLIPSE )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_CREATESOLIDBRUSH ($ICOLOR )
LOCAL $ARESULT = DLLCALL ("gdi32.dll" , "handle" , "CreateSolidBrush" , "INT" , $ICOLOR )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_GETBITMAPDIMENSION ($HBITMAP )
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_GETSYSCOLORBRUSH ($IINDEX )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "handle" , "GetSysColorBrush" , "int" , $IINDEX )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_GETTEXTEXTENTPOINT32 ($HDC , $STEXT )
LOCAL $TSIZE = DLLSTRUCTCREATE ($TAGSIZE )
LOCAL $ISIZE = STRINGLEN ($STEXT )
LOCAL $ARET = DLLCALL ("gdi32.dll" , "bool" , "GetTextExtentPoint32W" , "handle" , $HDC , "wstr" , $STEXT , "int" , $ISIZE , "struct*" , $TSIZE )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , 0 )
RETURN $TSIZE
ENDFUNC
FUNC _WINAPI_GETTEXTMETRICS ($HDC )
LOCAL $TTEXTMETRIC = DLLSTRUCTCREATE ($TAGTEXTMETRIC )
LOCAL $ARET = DLLCALL ("gdi32.dll" , "bool" , "GetTextMetricsW" , "handle" , $HDC , "struct*" , $TTEXTMETRIC )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , 0 )
RETURN $TTEXTMETRIC
ENDFUNC
FUNC _WINAPI_GETWINDOWRGN ($HWND , $HRGN )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "int" , "GetWindowRgn" , "hwnd" , $HWND , "handle" , $HRGN )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_ISALPHABITMAP ($HBITMAP )
$HBITMAP = _WINAPI_COPYBITMAP ($HBITMAP )
IF NOT $HBITMAP THEN RETURN SETERROR (@ERROR + 20 , @EXTENDED , 0 )
LOCAL $ARET , $IERROR = 0
DO
LOCAL $TDIB = DLLSTRUCTCREATE ($TAGDIBSECTION )
IF (NOT _WINAPI_GETOBJECT ($HBITMAP , DLLSTRUCTGETSIZE ($TDIB ) , $TDIB ) ) OR (DLLSTRUCTGETDATA ($TDIB , "bmBitsPixel" ) <> 32 ) OR (DLLSTRUCTGETDATA ($TDIB , "biCompression" ) ) THEN
$IERROR = 1
EXITLOOP
ENDIF
$ARET = DLLCALL ("user32.dll" , "int" , "CallWindowProc" , "ptr" , __ALPHAPROC () , "ptr" , 0 , "uint" , 0 , "struct*" , $TDIB , "ptr" , 0 )
IF @ERROR OR ($ARET [0 ] = + 4294967295 ) THEN
$IERROR = @ERROR + 10
EXITLOOP
ENDIF
UNTIL 1
_WINAPI_DELETEOBJECT ($HBITMAP )
IF $IERROR THEN RETURN SETERROR ($IERROR , 0 , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_PTINRECT (BYREF $TRECT , BYREF $TPOINT )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "bool" , "PtInRect" , "struct*" , $TRECT , "struct" , $TPOINT )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_REDRAWWINDOW ($HWND , $TRECT = 0 , $HREGION = 0 , $IFLAGS = 5 )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "bool" , "RedrawWindow" , "hwnd" , $HWND , "struct*" , $TRECT , "handle" , $HREGION , "uint" , $IFLAGS )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_SETWINDOWRGN ($HWND , $HRGN , $BREDRAW = TRUE )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "int" , "SetWindowRgn" , "hwnd" , $HWND , "handle" , $HRGN , "bool" , $BREDRAW )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARESULT [0 ]
ENDFUNC
#EndRegion Public Functions
#Region Embedded DLL Functions
FUNC __ALPHAPROC ()
STATIC $PPROC = 0
IF NOT $PPROC THEN
IF @AUTOITX64 THEN
$PPROC = __INIT (BINARY ("0x48894C240848895424104C894424184C894C24205541574831C050504883EC28" & "48837C24600074054831C0EB0748C7C0010000004821C0751F488B6C24604883" & "7D180074054831C0EB0748C7C0010000004821C07502EB0948C7C001000000EB" & "034831C04821C0740C48C7C0FFFFFFFF4863C0EB6F48C744242800000000488B" & "6C24604C637D04488B6C2460486345084C0FAFF849C1E7024983C7FC4C3B7C24" & "287C36488B6C24604C8B7D184C037C24284983C7034C897C2430488B6C243080" & "7D0000740C48C7C0010000004863C0EB1348834424280471A54831C04863C0EB" & "034831C04883C438415F5DC3" ) )
ELSE
$PPROC = __INIT (BINARY ("0x555331C05050837C241C00740431C0EB05B80100000021C075198B6C241C837D" & "1400740431C0EB05B80100000021C07502EB07B801000000EB0231C021C07407" & "B8FFFFFFFFEB4FC70424000000008B6C241C8B5D048B6C241C0FAF5D08C1E302" & "83C3FC3B1C247C288B6C241C8B5D14031C2483C303895C24048B6C2404807D00" & "007407B801000000EB0C8304240471BE31C0EB0231C083C4085B5DC21000" ) )
ENDIF
ENDIF
RETURN $PPROC
ENDFUNC
FUNC __ANDPROC ()
STATIC $PPROC = 0
IF NOT $PPROC THEN
IF @AUTOITX64 THEN
$PPROC = __INIT (BINARY ("0x48894C240848895424104C894424184C894C2420554157415648C7C009000000" & "4883EC0848C704240000000048FFC875EF4883EC284883BC24A0000000007405" & "4831C0EB0748C7C0010000004821C00F85840000004883BC24A8000000007405" & "4831C0EB0748C7C0010000004821C07555488BAC24A000000048837D18007405" & "4831C0EB0748C7C0010000004821C07522488BAC24A800000048837D18007405" & "4831C0EB0748C7C0010000004821C07502EB0948C7C001000000EB034831C048" & "21C07502EB0948C7C001000000EB034831C04821C07502EB0948C7C001000000" & "EB034831C04821C0740B4831C04863C0E9D701000048C74424280000000048C7" & "44243000000000488BAC24A00000004C637D0849FFCF4C3B7C24300F8C9C0100" & "0048C74424380000000048C74424400000000048C744244800000000488BAC24" & "A00000004C637D0449FFCF4C3B7C24480F8CDB000000488BAC24A00000004C8B" & "7D184C037C24284983C7034C897C2450488B6C2450807D000074264C8B7C2440" & "4C8B74243849F7DE4983C61F4C89F148C7C00100000048D3E04909C74C897C24" & "4048FF4424384C8B7C24384983FF1F7E6F4C8B7C244049F7D74C897C244048C7" & "442458180000004831C0483B4424587F3D488BAC24A80000004C8B7D184C037C" & "24604C897C24504C8B7C2440488B4C245849D3FF4C89F850488B6C2458588845" & "0048FF4424604883442458F871B948C74424380000000048C744244000000000" & "48834424280448FF4424480F810BFFFFFF48837C24380074794C8B7C244049F7" & "D74C8B74243849F7DE4983C6204C89F148C7C0FFFFFFFF48D3E04921C74C897C" & "244048C7442458180000004831C0483B4424587F3D488BAC24A80000004C8B7D" & "184C037C24604C897C24504C8B7C2440488B4C245849D3FF4C89F850488B6C24" & "585888450048FF4424604883442458F871B948FF4424300F814AFEFFFF48C7C0" & "010000004863C0EB034831C04883C470415E415F5DC3" ) )
ELSE
$PPROC = __INIT (BINARY ("0x555357BA0800000083EC04C70424000000004A75F3837C243800740431C0EB05" & "B80100000021C07562837C243C00740431C0EB05B80100000021C0753F8B6C24" & "38837D1400740431C0EB05B80100000021C075198B6C243C837D1400740431C0" & "EB05B80100000021C07502EB07B801000000EB0231C021C07502EB07B8010000" & "00EB0231C021C07502EB07B801000000EB0231C021C0740731C0E969010000C7" & "042400000000C7442404000000008B6C24388B5D084B3B5C24040F8C3F010000" & "C744240800000000C744240C00000000C7442410000000008B6C24388B5D044B" & "3B5C24100F8CA90000008B6C24388B5D14031C2483C303895C24148B6C241480" & "7D0000741C8B5C240C8B7C2408F7DF83C71F89F9B801000000D3E009C3895C24" & "0CFF4424088B5C240883FB1F7E578B5C240CF7D3895C240CC744241818000000" & "31C03B4424187F2D8B6C243C8B5D14035C241C895C24148B5C240C8B4C2418D3" & "FB538B6C241858884500FF44241C83442418F871CBC744240800000000C74424" & "0C0000000083042404FF4424100F8145FFFFFF837C240800745B8B5C240CF7D3" & "8B7C2408F7DF83C72089F9B8FFFFFFFFD3E021C3895C240CC744241818000000" & "31C03B4424187F2D8B6C243C8B5D14035C241C895C24148B5C240C8B4C2418D3" & "FB538B6C241858884500FF44241C83442418F871CBFF4424040F81AFFEFFFFB8" & "01000000EB0231C083C4205F5B5DC21000" ) )
ENDIF
ENDIF
RETURN $PPROC
ENDFUNC
FUNC __XORPROC ()
STATIC $PPROC = 0
IF NOT $PPROC THEN
IF @AUTOITX64 THEN
$PPROC = __INIT (BINARY ("0x48894C240848895424104C894424184C894C24205541574831C050504883EC28" & "48837C24600074054831C0EB0748C7C0010000004821C0751B48837C24680074" & "054831C0EB0748C7C0010000004821C07502EB0948C7C001000000EB034831C0" & "4821C074084831C04863C0EB7748C7442428000000004C637C24584983C7FC4C" & "3B7C24287C4F4C8B7C24604C037C24284C897C2430488B6C2430807D00007405" & "4831C0EB0748C7C0010000004821C0741C4C8B7C24684C037C24284983C7034C" & "897C2430488B6C2430C64500FF48834424280471A148C7C0010000004863C0EB" & "034831C04883C438415F5DC3" ) )
ELSE
$PPROC = __INIT (BINARY ("0x555331C05050837C241C00740431C0EB05B80100000021C07516837C24200074" & "0431C0EB05B80100000021C07502EB07B801000000EB0231C021C0740431C0EB" & "5AC70424000000008B5C241883C3FC3B1C247C3E8B5C241C031C24895C24048B" & "6C2404807D0000740431C0EB05B80100000021C074168B5C2420031C2483C303" & "895C24048B6C2404C64500FF8304240471B6B801000000EB0231C083C4085B5D" & "C21000" ) )
ENDIF
ENDIF
RETURN $PPROC
ENDFUNC
#EndRegion Embedded DLL Functions
#Region Internal Functions
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
#EndRegion Internal Functions
#Region Global Variables and Constants
GLOBAL CONST $DI_MASK = 1
GLOBAL CONST $DI_IMAGE = 2
GLOBAL CONST $DI_NORMAL = 3
GLOBAL CONST $DI_COMPAT = 4
GLOBAL CONST $DI_DEFAULTSIZE = 8
GLOBAL CONST $DI_NOMIRROR = 16
GLOBAL CONST $DISPLAY_DEVICE_ATTACHED_TO_DESKTOP = 1
GLOBAL CONST $DISPLAY_DEVICE_MULTI_DRIVER = 2
GLOBAL CONST $DISPLAY_DEVICE_PRIMARY_DEVICE = 4
GLOBAL CONST $DISPLAY_DEVICE_MIRRORING_DRIVER = 8
GLOBAL CONST $DISPLAY_DEVICE_VGA_COMPATIBLE = 16
GLOBAL CONST $DISPLAY_DEVICE_REMOVABLE = 32
GLOBAL CONST $DISPLAY_DEVICE_DISCONNECT = 33554432
GLOBAL CONST $DISPLAY_DEVICE_REMOTE = 67108864
GLOBAL CONST $DISPLAY_DEVICE_MODESPRUNED = 134217728
#EndRegion Global Variables and Constants
#Region Functions list
#EndRegion Functions list
#Region Public Functions
FUNC _WINAPI_CREATECOMPATIBLEDC ($HDC )
LOCAL $ARESULT = DLLCALL ("gdi32.dll" , "handle" , "CreateCompatibleDC" , "handle" , $HDC )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_DELETEDC ($HDC )
LOCAL $ARESULT = DLLCALL ("gdi32.dll" , "bool" , "DeleteDC" , "handle" , $HDC )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_DRAWEDGE ($HDC , $TRECT , $IEDGETYPE , $IFLAGS )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "bool" , "DrawEdge" , "handle" , $HDC , "struct*" , $TRECT , "uint" , $IEDGETYPE , "uint" , $IFLAGS )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_DRAWFRAMECONTROL ($HDC , $TRECT , $ITYPE , $ISTATE )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "bool" , "DrawFrameControl" , "handle" , $HDC , "struct*" , $TRECT , "uint" , $ITYPE , "uint" , $ISTATE )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_DRAWICON ($HDC , $IX , $IY , $HICON )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "bool" , "DrawIcon" , "handle" , $HDC , "int" , $IX , "int" , $IY , "handle" , $HICON )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_DRAWICONEX ($HDC , $IX , $IY , $HICON , $IWIDTH = 0 , $IHEIGHT = 0 , $ISTEP = 0 , $HBRUSH = 0 , $IFLAGS = 3 )
LOCAL $IOPTIONS
SWITCH $IFLAGS
CASE 1
$IOPTIONS = $DI_MASK
CASE 2
$IOPTIONS = $DI_IMAGE
CASE 3
$IOPTIONS = $DI_NORMAL
CASE 4
$IOPTIONS = $DI_COMPAT
CASE 5
$IOPTIONS = $DI_DEFAULTSIZE
CASE ELSE
$IOPTIONS = $DI_NOMIRROR
ENDSWITCH
LOCAL $ARESULT = DLLCALL ("user32.dll" , "bool" , "DrawIconEx" , "handle" , $HDC , "int" , $IX , "int" , $IY , "handle" , $HICON , "int" , $IWIDTH , "int" , $IHEIGHT , "uint" , $ISTEP , "handle" , $HBRUSH , "uint" , $IOPTIONS )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_DRAWTEXT ($HDC , $STEXT , BYREF $TRECT , $IFLAGS )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "int" , "DrawTextW" , "handle" , $HDC , "wstr" , $STEXT , "int" , + 4294967295 , "struct*" , $TRECT , "uint" , $IFLAGS )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_ENUMDISPLAYDEVICES ($SDEVICE , $IDEVNUM )
LOCAL $TNAME = 0 , $IFLAGS = 0 , $ADEVICE [5 ]
IF $SDEVICE <> "" THEN
$TNAME = DLLSTRUCTCREATE ("wchar Text[" & STRINGLEN ($SDEVICE ) + 1 & "]" )
DLLSTRUCTSETDATA ($TNAME , "Text" , $SDEVICE )
ENDIF
LOCAL CONST $TAGDISPLAY_DEVICE = "dword Size;wchar Name[32];wchar String[128];dword Flags;wchar ID[128];wchar Key[128]"
LOCAL $TDEVICE = DLLSTRUCTCREATE ($TAGDISPLAY_DEVICE )
LOCAL $IDEVICE = DLLSTRUCTGETSIZE ($TDEVICE )
DLLSTRUCTSETDATA ($TDEVICE , "Size" , $IDEVICE )
LOCAL $ARET = DLLCALL ("user32.dll" , "bool" , "EnumDisplayDevicesW" , "struct*" , $TNAME , "dword" , $IDEVNUM , "struct*" , $TDEVICE , "dword" , 1 )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , 0 )
LOCAL $IN = DLLSTRUCTGETDATA ($TDEVICE , "Flags" )
IF BITAND ($IN , $DISPLAY_DEVICE_ATTACHED_TO_DESKTOP ) <> 0 THEN $IFLAGS = BITOR ($IFLAGS , 1 )
IF BITAND ($IN , $DISPLAY_DEVICE_PRIMARY_DEVICE ) <> 0 THEN $IFLAGS = BITOR ($IFLAGS , 2 )
IF BITAND ($IN , $DISPLAY_DEVICE_MIRRORING_DRIVER ) <> 0 THEN $IFLAGS = BITOR ($IFLAGS , 4 )
IF BITAND ($IN , $DISPLAY_DEVICE_VGA_COMPATIBLE ) <> 0 THEN $IFLAGS = BITOR ($IFLAGS , 8 )
IF BITAND ($IN , $DISPLAY_DEVICE_REMOVABLE ) <> 0 THEN $IFLAGS = BITOR ($IFLAGS , 16 )
IF BITAND ($IN , $DISPLAY_DEVICE_MODESPRUNED ) <> 0 THEN $IFLAGS = BITOR ($IFLAGS , 32 )
$ADEVICE [0 ] = TRUE
$ADEVICE [1 ] = DLLSTRUCTGETDATA ($TDEVICE , "Name" )
$ADEVICE [2 ] = DLLSTRUCTGETDATA ($TDEVICE , "String" )
$ADEVICE [3 ] = $IFLAGS
$ADEVICE [4 ] = DLLSTRUCTGETDATA ($TDEVICE , "ID" )
RETURN $ADEVICE
ENDFUNC
FUNC _WINAPI_FILLRECT ($HDC , $TRECT , $HBRUSH )
LOCAL $ARESULT
IF ISPTR ($HBRUSH ) THEN
$ARESULT = DLLCALL ("user32.dll" , "int" , "FillRect" , "handle" , $HDC , "struct*" , $TRECT , "handle" , $HBRUSH )
ELSE
$ARESULT = DLLCALL ("user32.dll" , "int" , "FillRect" , "handle" , $HDC , "struct*" , $TRECT , "dword_ptr" , $HBRUSH )
ENDIF
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_FRAMERECT ($HDC , $TRECT , $HBRUSH )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "int" , "FrameRect" , "handle" , $HDC , "struct*" , $TRECT , "handle" , $HBRUSH )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_GETBKMODE ($HDC )
LOCAL $ARESULT = DLLCALL ("gdi32.dll" , "int" , "GetBkMode" , "handle" , $HDC )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_GETDC ($HWND )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "handle" , "GetDC" , "hwnd" , $HWND )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_GETDCEX ($HWND , $HRGN , $IFLAGS )
LOCAL $ARET = DLLCALL ("user32.dll" , "handle" , "GetDCEx" , "hwnd" , $HWND , "handle" , $HRGN , "dword" , $IFLAGS )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_GETDEVICECAPS ($HDC , $IINDEX )
LOCAL $ARESULT = DLLCALL ("gdi32.dll" , "int" , "GetDeviceCaps" , "handle" , $HDC , "int" , $IINDEX )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_GETTEXTCOLOR ($HDC )
LOCAL $ARET = DLLCALL ("gdi32.dll" , "dword" , "GetTextColor" , "handle" , $HDC )
IF @ERROR OR ($ARET [0 ] = 0xFFFFFFFF ) THEN RETURN SETERROR (@ERROR , @EXTENDED , + 4294967295 )
RETURN __RGB ($ARET [0 ] )
ENDFUNC
FUNC _WINAPI_GETWINDOWDC ($HWND )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "handle" , "GetWindowDC" , "hwnd" , $HWND )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_PRINTWINDOW ($HWND , $HDC , $BCLIENT = FALSE )
LOCAL $ARET = DLLCALL ("user32.dll" , "bool" , "PrintWindow" , "hwnd" , $HWND , "handle" , $HDC , "uint" , $BCLIENT )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_RELEASEDC ($HWND , $HDC )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "int" , "ReleaseDC" , "hwnd" , $HWND , "handle" , $HDC )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_RESTOREDC ($HDC , $IID )
LOCAL $ARET = DLLCALL ("gdi32.dll" , "bool" , "RestoreDC" , "handle" , $HDC , "int" , $IID )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_SAVEDC ($HDC )
LOCAL $ARET = DLLCALL ("gdi32.dll" , "int" , "SaveDC" , "handle" , $HDC )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_SETBKCOLOR ($HDC , $ICOLOR )
LOCAL $ARESULT = DLLCALL ("gdi32.dll" , "INT" , "SetBkColor" , "handle" , $HDC , "INT" , $ICOLOR )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , + 4294967295 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_SETBKMODE ($HDC , $IBKMODE )
LOCAL $ARESULT = DLLCALL ("gdi32.dll" , "int" , "SetBkMode" , "handle" , $HDC , "int" , $IBKMODE )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_SETTEXTCOLOR ($HDC , $ICOLOR )
LOCAL $ARESULT = DLLCALL ("gdi32.dll" , "INT" , "SetTextColor" , "handle" , $HDC , "INT" , $ICOLOR )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , + 4294967295 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_TWIPSPERPIXELX ()
LOCAL $HDC , $ITWIPSPERPIXELX
$HDC = _WINAPI_GETDC (0 )
LOCAL CONST $__WINAPICONSTANT_LOGPIXELSX = 88
$ITWIPSPERPIXELX = 1440 / _WINAPI_GETDEVICECAPS ($HDC , $__WINAPICONSTANT_LOGPIXELSX )
_WINAPI_RELEASEDC (0 , $HDC )
RETURN $ITWIPSPERPIXELX
ENDFUNC
FUNC _WINAPI_TWIPSPERPIXELY ()
LOCAL $HDC , $ITWIPSPERPIXELY
$HDC = _WINAPI_GETDC (0 )
LOCAL CONST $__WINAPICONSTANT_LOGPIXELSY = 90
$ITWIPSPERPIXELY = 1440 / _WINAPI_GETDEVICECAPS ($HDC , $__WINAPICONSTANT_LOGPIXELSY )
_WINAPI_RELEASEDC (0 , $HDC )
RETURN $ITWIPSPERPIXELY
ENDFUNC
#EndRegion Public Functions
#Region Internal Functions
#EndRegion Internal Functions
#Region Global Variables and Constants
#EndRegion Global Variables and Constants
#Region Functions list
#EndRegion Functions list
#Region Public Functions
GLOBAL CONST $TAGICONINFO = "bool Icon;dword XHotSpot;dword YHotSpot;handle hMask;handle hColor"
FUNC _WINAPI_ADDICONTRANSPARENCY ($HICON , $IPERCENT = 50 , $BDELETE = FALSE )
LOCAL $TBITMAP , $HDIB = 0 , $HRESULT = 0
LOCAL $AHBITMAP [2 ]
LOCAL $TICONINFO = DLLSTRUCTCREATE ($TAGICONINFO )
LOCAL $ARET = DLLCALL ("user32.dll" , "bool" , "GetIconInfo" , "handle" , $HICON , "struct*" , $TICONINFO )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , 0 )
FOR $I = 0 TO 1
$AHBITMAP [$I ] = DLLSTRUCTGETDATA ($TICONINFO , $I + 4 )
NEXT
LOCAL $IERROR = 0
DO
$HDIB = _WINAPI_COPYBITMAP ($AHBITMAP [1 ] )
IF NOT $HDIB THEN
$IERROR = 20
EXITLOOP
ENDIF
$TBITMAP = DLLSTRUCTCREATE ($TAGBITMAP )
IF (NOT _WINAPI_GETOBJECT ($HDIB , DLLSTRUCTGETSIZE ($TBITMAP ) , $TBITMAP ) ) OR (DLLSTRUCTGETDATA ($TBITMAP , "bmBitsPixel" ) <> 32 ) THEN
$IERROR = 21
EXITLOOP
ENDIF
$ARET = DLLCALL ("user32.dll" , "lresult" , "CallWindowProc" , "PTR" , __TRANSPARENCYPROC () , "hwnd" , 0 , "uint" , $IPERCENT , "wparam" , DLLSTRUCTGETPTR ($TBITMAP ) , "lparam" , 0 )
IF @ERROR OR NOT $ARET [0 ] THEN
$IERROR = @ERROR + 30
EXITLOOP
ENDIF
IF $ARET [0 ] = + 4294967295 THEN
$HRESULT = _WINAPI_CREATEEMPTYICON (DLLSTRUCTGETDATA ($TBITMAP , "bmWidth" ) , DLLSTRUCTGETDATA ($TBITMAP , "bmHeight" ) )
ELSE
$HRESULT = _WINAPI_CREATEICONINDIRECT ($HDIB , $AHBITMAP [0 ] )
ENDIF
IF NOT $HRESULT THEN $IERROR = 22
UNTIL 1
IF $HDIB THEN
_WINAPI_DELETEOBJECT ($HDIB )
ENDIF
FOR $I = 0 TO 1
IF $AHBITMAP [$I ] THEN
_WINAPI_DELETEOBJECT ($AHBITMAP [$I ] )
ENDIF
NEXT
IF $IERROR THEN RETURN SETERROR ($IERROR , 0 , 0 )
IF $BDELETE THEN
_WINAPI_DESTROYICON ($HICON )
ENDIF
RETURN $HRESULT
ENDFUNC
FUNC _WINAPI_COPYICON ($HICON )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "handle" , "CopyIcon" , "handle" , $HICON )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_CREATE32BITHICON ($HICON , $BDELETE = FALSE )
LOCAL $AHBITMAP [2 ] , $HRESULT = 0
LOCAL $ADIB [2 ] [2 ] = [[0 , 0 ] , [0 , 0 ] ]
LOCAL $TICONINFO = DLLSTRUCTCREATE ($TAGICONINFO )
LOCAL $ARET = DLLCALL ("user32.dll" , "bool" , "GetIconInfo" , "handle" , $HICON , "struct*" , $TICONINFO )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
IF NOT $ARET [0 ] THEN RETURN SETERROR (10 , 0 , 0 )
FOR $I = 0 TO 1
$AHBITMAP [$I ] = DLLSTRUCTGETDATA ($TICONINFO , $I + 4 )
NEXT
IF _WINAPI_ISALPHABITMAP ($AHBITMAP [1 ] ) THEN
$ADIB [0 ] [0 ] = _WINAPI_CREATEANDBITMAP ($AHBITMAP [1 ] )
IF NOT @ERROR THEN
$HRESULT = _WINAPI_CREATEICONINDIRECT ($AHBITMAP [1 ] , $ADIB [0 ] [0 ] )
ENDIF
ELSE
LOCAL $TSIZE = _WINAPI_GETBITMAPDIMENSION ($AHBITMAP [1 ] )
LOCAL $ASIZE [2 ]
FOR $I = 0 TO 1
$ASIZE [$I ] = DLLSTRUCTGETDATA ($TSIZE , $I + 1 )
NEXT
LOCAL $HSRCDC = _WINAPI_CREATECOMPATIBLEDC (0 )
LOCAL $HDSTDC = _WINAPI_CREATECOMPATIBLEDC (0 )
LOCAL $HSRCSV , $HDSTSV
FOR $I = 0 TO 1
$ADIB [$I ] [0 ] = _WINAPI_CREATEDIB ($ASIZE [0 ] , $ASIZE [1 ] )
$ADIB [$I ] [1 ] = $__G_VEXT
$HSRCSV = _WINAPI_SELECTOBJECT ($HSRCDC , $AHBITMAP [$I ] )
$HDSTSV = _WINAPI_SELECTOBJECT ($HDSTDC , $ADIB [$I ] [0 ] )
_WINAPI_BITBLT ($HDSTDC , 0 , 0 , $ASIZE [0 ] , $ASIZE [1 ] , $HSRCDC , 0 , 0 , 12583114 )
_WINAPI_SELECTOBJECT ($HSRCDC , $HSRCSV )
_WINAPI_SELECTOBJECT ($HDSTDC , $HDSTSV )
NEXT
_WINAPI_DELETEDC ($HSRCDC )
_WINAPI_DELETEDC ($HDSTDC )
$ARET = DLLCALL ("user32.dll" , "lresult" , "CallWindowProc" , "ptr" , __XORPROC () , "ptr" , 0 , "uint" , $ASIZE [0 ] * $ASIZE [1 ] * 4 , "wparam" , $ADIB [0 ] [1 ] , "lparam" , $ADIB [1 ] [1 ] )
IF NOT @ERROR AND $ARET [0 ] THEN
$HRESULT = _WINAPI_CREATEICONINDIRECT ($ADIB [1 ] [0 ] , $AHBITMAP [0 ] )
ENDIF
ENDIF
FOR $I = 0 TO 1
_WINAPI_DELETEOBJECT ($AHBITMAP [$I ] )
IF $ADIB [$I ] [0 ] THEN
_WINAPI_DELETEOBJECT ($ADIB [$I ] [0 ] )
ENDIF
NEXT
IF NOT $HRESULT THEN RETURN SETERROR (11 , 0 , 0 )
IF $BDELETE THEN
_WINAPI_DESTROYICON ($HICON )
ENDIF
RETURN $HRESULT
ENDFUNC
FUNC _WINAPI_CREATEEMPTYICON ($IWIDTH , $IHEIGHT , $IBITSPERPEL = 32 )
LOCAL $HXOR = _WINAPI_CREATEDIB ($IWIDTH , $IHEIGHT , $IBITSPERPEL )
LOCAL $HAND = _WINAPI_CREATEDIB ($IWIDTH , $IHEIGHT , 1 )
LOCAL $HDC = _WINAPI_CREATECOMPATIBLEDC (0 )
LOCAL $HSV = _WINAPI_SELECTOBJECT ($HDC , $HAND )
LOCAL $HBRUSH = _WINAPI_CREATESOLIDBRUSH (16777215 )
LOCAL $TRECT = _WINAPI_CREATERECT (0 , 0 , $IWIDTH , $IHEIGHT )
_WINAPI_FILLRECT ($HDC , $TRECT , $HBRUSH )
_WINAPI_DELETEOBJECT ($HBRUSH )
_WINAPI_SELECTOBJECT ($HDC , $HSV )
_WINAPI_DELETEDC ($HDC )
LOCAL $HICON = _WINAPI_CREATEICONINDIRECT ($HXOR , $HAND )
LOCAL $IERROR = @ERROR
IF $HXOR THEN
_WINAPI_DELETEOBJECT ($HXOR )
ENDIF
IF $HAND THEN
_WINAPI_DELETEOBJECT ($HAND )
ENDIF
IF NOT $HICON THEN RETURN SETERROR ($IERROR + 10 , 0 , 0 )
RETURN $HICON
ENDFUNC
FUNC _WINAPI_CREATEICON ($HINSTANCE , $IWIDTH , $IHEIGHT , $IPLANES , $IBITSPIXEL , $PANDBITS , $PXORBITS )
LOCAL $ARET = DLLCALL ("user32.dll" , "handle" , "CreateIcon" , "handle" , $HINSTANCE , "int" , $IWIDTH , "int" , $IHEIGHT , "byte" , $IPLANES , "byte" , $IBITSPIXEL , "struct*" , $PANDBITS , "struct*" , $PXORBITS )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_CREATEICONFROMRESOURCEEX ($PDATA , $ISIZE , $BICON = TRUE , $IXDESIREDPIXELS = 0 , $IYDESIREDPIXELS = 0 , $IFLAGS = 0 )
LOCAL $ARET = DLLCALL ("user32.dll" , "handle" , "CreateIconFromResourceEx" , "ptr" , $PDATA , "dword" , $ISIZE , "bool" , $BICON , "dword" , 196608 , "int" , $IXDESIREDPIXELS , "int" , $IYDESIREDPIXELS , "uint" , $IFLAGS )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_CREATEICONINDIRECT ($HBITMAP , $HMASK , $IXHOTSPOT = 0 , $IYHOTSPOT = 0 , $BICON = TRUE )
LOCAL $TICONINFO = DLLSTRUCTCREATE ($TAGICONINFO )
DLLSTRUCTSETDATA ($TICONINFO , 1 , $BICON )
DLLSTRUCTSETDATA ($TICONINFO , 2 , $IXHOTSPOT )
DLLSTRUCTSETDATA ($TICONINFO , 3 , $IYHOTSPOT )
DLLSTRUCTSETDATA ($TICONINFO , 4 , $HMASK )
DLLSTRUCTSETDATA ($TICONINFO , 5 , $HBITMAP )
LOCAL $ARET = DLLCALL ("user32.dll" , "handle" , "CreateIconIndirect" , "struct*" , $TICONINFO )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_DESTROYICON ($HICON )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "bool" , "DestroyIcon" , "handle" , $HICON )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_EXTRACTICON ($SICON , $IINDEX , $BSMALL = FALSE )
LOCAL $PLARGE , $PSMALL , $TPTR = DLLSTRUCTCREATE ("ptr" )
IF $BSMALL THEN
$PLARGE = 0
$PSMALL = DLLSTRUCTGETPTR ($TPTR )
ELSE
$PLARGE = DLLSTRUCTGETPTR ($TPTR )
$PSMALL = 0
ENDIF
DLLCALL ("shell32.dll" , "uint" , "ExtractIconExW" , "wstr" , $SICON , "int" , $IINDEX , "ptr" , $PLARGE , "ptr" , $PSMALL , "uint" , 1 )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN DLLSTRUCTGETDATA ($TPTR , 1 )
ENDFUNC
FUNC _WINAPI_EXTRACTICONEX ($SFILEPATH , $IINDEX , $PALARGE , $PASMALL , $IICONS )
LOCAL $ARESULT = DLLCALL ("shell32.dll" , "uint" , "ExtractIconExW" , "wstr" , $SFILEPATH , "int" , $IINDEX , "struct*" , $PALARGE , "struct*" , $PASMALL , "uint" , $IICONS )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_FILEICONINIT ($BRESTORE = TRUE )
LOCAL $ARET = DLLCALL ("shell32.dll" , "int" , 660 , "int" , $BRESTORE )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , 0 )
RETURN 1
ENDFUNC
FUNC _WINAPI_GETICONDIMENSION ($HICON )
LOCAL $TICONINFO = DLLSTRUCTCREATE ($TAGICONINFO )
LOCAL $ARET = DLLCALL ("user32.dll" , "bool" , "GetIconInfo" , "handle" , $HICON , "struct*" , $TICONINFO )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , 0 )
LOCAL $TSIZE = _WINAPI_GETBITMAPDIMENSION (DLLSTRUCTGETDATA ($TICONINFO , 5 ) )
FOR $I = 4 TO 5
_WINAPI_DELETEOBJECT (DLLSTRUCTGETDATA ($TICONINFO , $I ) )
NEXT
IF NOT ISDLLSTRUCT ($TSIZE ) THEN RETURN SETERROR (20 , 0 , 0 )
RETURN $TSIZE
ENDFUNC
FUNC _WINAPI_GETICONINFO ($HICON )
LOCAL $TINFO = DLLSTRUCTCREATE ($TAGICONINFO )
LOCAL $ARET = DLLCALL ("user32.dll" , "bool" , "GetIconInfo" , "handle" , $HICON , "struct*" , $TINFO )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , 0 )
LOCAL $AICON [6 ]
$AICON [0 ] = TRUE
$AICON [1 ] = DLLSTRUCTGETDATA ($TINFO , "Icon" ) <> 0
$AICON [2 ] = DLLSTRUCTGETDATA ($TINFO , "XHotSpot" )
$AICON [3 ] = DLLSTRUCTGETDATA ($TINFO , "YHotSpot" )
$AICON [4 ] = DLLSTRUCTGETDATA ($TINFO , "hMask" )
$AICON [5 ] = DLLSTRUCTGETDATA ($TINFO , "hColor" )
RETURN $AICON
ENDFUNC
FUNC _WINAPI_GETICONINFOEX ($HICON )
LOCAL $TIIEX = DLLSTRUCTCREATE ("dword;int;dword;dword;ptr;ptr;ushort;wchar[260];wchar[260]" )
DLLSTRUCTSETDATA ($TIIEX , 1 , DLLSTRUCTGETSIZE ($TIIEX ) )
LOCAL $ARET = DLLCALL ("user32.dll" , "bool" , "GetIconInfoExW" , "handle" , $HICON , "struct*" , $TIIEX )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , 0 )
LOCAL $ARESULT [8 ]
FOR $I = 0 TO 7
$ARESULT [$I ] = DLLSTRUCTGETDATA ($TIIEX , $I + 2 )
NEXT
RETURN $ARESULT
ENDFUNC
FUNC _WINAPI_LOADICON ($HINSTANCE , $SNAME )
LOCAL $STYPEOFNAME = "int"
IF ISSTRING ($SNAME ) THEN
$STYPEOFNAME = "wstr"
ENDIF
LOCAL $ARET = DLLCALL ("user32.dll" , "handle" , "LoadIconW" , "handle" , $HINSTANCE , $STYPEOFNAME , $SNAME )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_LOADICONMETRIC ($HINSTANCE , $SNAME , $IMETRIC )
LOCAL $STYPEOFNAME = "int"
IF ISSTRING ($SNAME ) THEN
$STYPEOFNAME = "wstr"
ENDIF
LOCAL $ARET = DLLCALL ("comctl32.dll" , "long" , "LoadIconMetric" , "handle" , $HINSTANCE , $STYPEOFNAME , $SNAME , "int" , $IMETRIC , "handle*" , 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_LOADICONWITHSCALEDOWN ($HINSTANCE , $SNAME , $IWIDTH , $IHEIGHT )
LOCAL $STYPEOFNAME = "int"
IF ISSTRING ($SNAME ) THEN
$STYPEOFNAME = "wstr"
ENDIF
LOCAL $ARET = DLLCALL ("comctl32.dll" , "long" , "LoadIconWithScaleDown" , "handle" , $HINSTANCE , $STYPEOFNAME , $SNAME , "int" , $IWIDTH , "int" , $IHEIGHT , "handle*" , 0 )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
IF $ARET [0 ] THEN RETURN SETERROR (10 , $ARET [0 ] , 0 )
RETURN $ARET [5 ]
ENDFUNC
FUNC _WINAPI_LOADSHELL32ICON ($IICONID )
LOCAL $TICONS = DLLSTRUCTCREATE ("ptr Data" )
LOCAL $IICONS = _WINAPI_EXTRACTICONEX ("shell32.dll" , $IICONID , 0 , $TICONS , 1 )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
IF $IICONS <= 0 THEN RETURN SETERROR (10 , 0 , 0 )
RETURN DLLSTRUCTGETDATA ($TICONS , "Data" )
ENDFUNC
FUNC _WINAPI_LOOKUPICONIDFROMDIRECTORYEX ($PDATA , $BICON = TRUE , $IXDESIREDPIXELS = 0 , $IYDESIREDPIXELS = 0 , $IFLAGS = 0 )
LOCAL $ARET = DLLCALL ("user32.dll" , "int" , "LookupIconIdFromDirectoryEx" , "ptr" , $PDATA , "bool" , $BICON , "int" , $IXDESIREDPIXELS , "int" , $IYDESIREDPIXELS , "uint" , $IFLAGS )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_MIRRORICON ($HICON , $BDELETE = FALSE )
IF NOT $BDELETE THEN
$HICON = _WINAPI_COPYICON ($HICON )
ENDIF
LOCAL $ARET = DLLCALL ("comctl32.dll" , "int" , 414 , "ptr" , 0 , "ptr*" , $HICON )
IF @ERROR OR NOT $ARET [0 ] THEN
LOCAL $IERROR = @ERROR + 10
IF $HICON AND NOT $BDELETE THEN
_WINAPI_DESTROYICON ($HICON )
ENDIF
RETURN SETERROR ($IERROR , 0 , 0 )
ENDIF
RETURN $ARET [2 ]
ENDFUNC
#EndRegion Public Functions
#Region Embedded DLL Functions
FUNC __TRANSPARENCYPROC ()
STATIC $PPROC = 0
IF NOT $PPROC THEN
IF @AUTOITX64 THEN
$PPROC = __INIT (BINARY ("0x48894C240848895424104C894424184C894C24205541574831C0505050505050" & "4883EC284883BC24800000000074054831C0EB0748C7C0010000004821C07522" & "488BAC248000000048837D180074054831C0EB0748C7C0010000004821C07502" & "EB0948C7C001000000EB034831C04821C0740B4831C04863C0E93C0100004C63" & "7C24784983FF647E0F48C7C0010000004863C0E9220100004C637C24784D21FF" & "7D08C74424780000000048C74424280100000048C74424300000000048C74424" & "3800000000488BAC24800000004C637D04488BAC2480000000486345084C0FAF" & "F849C1E7024983C7FC4C3B7C24380F8C88000000488BAC24800000004C8B7D18" & "4C037C24384983C7034C897C2440488B6C2440480FB64500505888442448807C" & "244800744B4C0FB67C244848634424784C0FAFF84C89F848C7C1640000004899" & "48F7F94989C74C89F850488B6C244858884500488B6C2440807D0000740948C7" & "4424280000000048C7442430010000004883442438040F8149FFFFFF48837C24" & "3000741148837C242800740948C7C001000000EB034831C04821C0740E48C7C0" & "FFFFFFFF4863C0EB11EB0C48C7C0010000004863C0EB034831C04883C458415F" & "5DC3" ) )
ELSE
$PPROC = __INIT (BINARY ("0x555331C05050505050837C242800740431C0EB05B80100000021C075198B6C24" & "28837D1400740431C0EB05B80100000021C07502EB07B801000000EB0231C021" & "C0740731C0E9E50000008B5C242483FB647E0AB801000000E9D20000008B5C24" & "2421DB7D08C744242400000000C7042401000000C744240400000000C7442408" & "000000008B6C24288B5D048B6C24280FAF5D08C1E30283C3FC3B5C24087C648B" & "6C24288B5D14035C240883C303895C240C8B6C240C0FB6450088442410807C24" & "100074380FB65C24100FAF5C242489D8B96400000099F7F989C3538B6C241058" & "8845008B6C240C807D00007407C7042400000000C74424040100000083442408" & "047181837C240400740D833C24007407B801000000EB0231C021C07409B8FFFF" & "FFFFEB0BEB07B801000000EB0231C083C4145B5DC21000" ) )
ENDIF
ENDIF
RETURN $PPROC
ENDFUNC
#EndRegion Embedded DLL Functions
GLOBAL $__G_HBUTTONLASTWND
GLOBAL CONST $TAGBUTTON_IMAGELIST = "ptr ImageList;" & $TAGRECT & ";uint Align"
GLOBAL CONST $TAGBUTTON_SPLITINFO = "uint mask;handle himlGlyph;uint uSplitStyle;" & $TAGSIZE
GLOBAL CONST $__BUTTONCONSTANT_CLASSNAME = "Button"
GLOBAL CONST $__BUTTONCONSTANT_GWL_STYLE = 4294967280
GLOBAL CONST $__BUTTONCONSTANT_WM_SETFONT = 48
GLOBAL CONST $__BUTTONCONSTANT_DEFAULT_GUI_FONT = 17
FUNC _GUICTRLBUTTON_CLICK ($HWND )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
_SENDMESSAGE ($HWND , $BM_CLICK )
ENDFUNC
FUNC _GUICTRLBUTTON_CREATE ($HWND , $STEXT , $IX , $IY , $IWIDTH , $IHEIGHT , $ISTYLE = + 4294967295 , $IEXSTYLE = + 4294967295 )
IF NOT ISHWND ($HWND ) THEN
RETURN SETERROR (1 , 0 , 0 )
ENDIF
IF NOT ISSTRING ($STEXT ) THEN
RETURN SETERROR (2 , 0 , 0 )
ENDIF
LOCAL $IFORCEDSTYLE = BITOR ($__UDFGUICONSTANT_WS_TABSTOP , $__UDFGUICONSTANT_WS_VISIBLE , $__UDFGUICONSTANT_WS_CHILD , $BS_NOTIFY )
IF $ISTYLE = + 4294967295 THEN
$ISTYLE = $IFORCEDSTYLE
ELSE
$ISTYLE = BITOR ($ISTYLE , $IFORCEDSTYLE )
ENDIF
IF $IEXSTYLE = + 4294967295 THEN $IEXSTYLE = 0
LOCAL $NCTRLID = __UDF_GETNEXTGLOBALID ($HWND )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
LOCAL $HBUTTON = _WINAPI_CREATEWINDOWEX ($IEXSTYLE , $__BUTTONCONSTANT_CLASSNAME , $STEXT , $ISTYLE , $IX , $IY , $IWIDTH , $IHEIGHT , $HWND , $NCTRLID )
_SENDMESSAGE ($HBUTTON , $__BUTTONCONSTANT_WM_SETFONT , _WINAPI_GETSTOCKOBJECT ($__BUTTONCONSTANT_DEFAULT_GUI_FONT ) , TRUE )
RETURN $HBUTTON
ENDFUNC
FUNC _GUICTRLBUTTON_DESTROY (BYREF $HWND )
IF NOT _WINAPI_ISCLASSNAME ($HWND , $__BUTTONCONSTANT_CLASSNAME ) THEN RETURN SETERROR (2 , 2 , FALSE )
LOCAL $IDESTROYED = 0
IF ISHWND ($HWND ) THEN
IF _WINAPI_INPROCESS ($HWND , $__G_HBUTTONLASTWND ) THEN
LOCAL $NCTRLID = _WINAPI_GETDLGCTRLID ($HWND )
LOCAL $HPARENT = _WINAPI_GETPARENT ($HWND )
$IDESTROYED = _WINAPI_DESTROYWINDOW ($HWND )
LOCAL $IRET = __UDF_FREEGLOBALID ($HPARENT , $NCTRLID )
IF NOT $IRET THEN
ENDIF
ELSE
RETURN SETERROR (1 , 1 , FALSE )
ENDIF
ELSE
$IDESTROYED = GUICTRLDELETE ($HWND )
ENDIF
IF $IDESTROYED THEN $HWND = 0
RETURN $IDESTROYED <> 0
ENDFUNC
FUNC _GUICTRLBUTTON_ENABLE ($HWND , $BENABLE = TRUE )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
IF _WINAPI_ISCLASSNAME ($HWND , $__BUTTONCONSTANT_CLASSNAME ) THEN RETURN _WINAPI_ENABLEWINDOW ($HWND , $BENABLE ) = $BENABLE
ENDFUNC
FUNC _GUICTRLBUTTON_GETCHECK ($HWND )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
RETURN _SENDMESSAGE ($HWND , $BM_GETCHECK )
ENDFUNC
FUNC _GUICTRLBUTTON_GETFOCUS ($HWND )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
IF _WINAPI_ISCLASSNAME ($HWND , $__BUTTONCONSTANT_CLASSNAME ) THEN RETURN _WINAPI_GETFOCUS () = $HWND
ENDFUNC
FUNC _GUICTRLBUTTON_GETIDEALSIZE ($HWND )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
LOCAL $TSIZE = DLLSTRUCTCREATE ($TAGSIZE ) , $ASIZE [2 ]
LOCAL $IRET = _SENDMESSAGE ($HWND , $BCM_GETIDEALSIZE , 0 , $TSIZE , 0 , "wparam" , "struct*" )
IF NOT $IRET THEN RETURN SETERROR (+ 4294967295 , + 4294967295 , $ASIZE )
$ASIZE [0 ] = DLLSTRUCTGETDATA ($TSIZE , "X" )
$ASIZE [1 ] = DLLSTRUCTGETDATA ($TSIZE , "Y" )
RETURN $ASIZE
ENDFUNC
FUNC _GUICTRLBUTTON_GETIMAGE ($HWND )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
LOCAL $IRET = _SENDMESSAGE ($HWND , $BM_GETIMAGE , 0 , 0 , 0 , "wparam" , "lparam" , "hwnd" )
IF $IRET <> 0 THEN RETURN $IRET
$IRET = _SENDMESSAGE ($HWND , $BM_GETIMAGE , 1 , 0 , 0 , "wparam" , "lparam" , "hwnd" )
IF $IRET = 0 THEN RETURN 0
RETURN $IRET
ENDFUNC
FUNC _GUICTRLBUTTON_GETIMAGELIST ($HWND )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
LOCAL $TBUTTON_IMAGELIST = DLLSTRUCTCREATE ($TAGBUTTON_IMAGELIST ) , $AIMAGELIST [6 ]
IF NOT _SENDMESSAGE ($HWND , $BCM_GETIMAGELIST , 0 , $TBUTTON_IMAGELIST , 0 , "wparam" , "struct*" ) THEN RETURN SETERROR (+ 4294967295 , + 4294967295 , $AIMAGELIST )
$AIMAGELIST [0 ] = DLLSTRUCTGETDATA ($TBUTTON_IMAGELIST , "ImageList" )
$AIMAGELIST [1 ] = DLLSTRUCTGETDATA ($TBUTTON_IMAGELIST , "Left" )
$AIMAGELIST [2 ] = DLLSTRUCTGETDATA ($TBUTTON_IMAGELIST , "Right" )
$AIMAGELIST [3 ] = DLLSTRUCTGETDATA ($TBUTTON_IMAGELIST , "Top" )
$AIMAGELIST [4 ] = DLLSTRUCTGETDATA ($TBUTTON_IMAGELIST , "Bottom" )
$AIMAGELIST [5 ] = DLLSTRUCTGETDATA ($TBUTTON_IMAGELIST , "Align" )
RETURN $AIMAGELIST
ENDFUNC
FUNC _GUICTRLBUTTON_GETNOTE ($HWND )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
LOCAL $ILEN = _GUICTRLBUTTON_GETNOTELENGTH ($HWND ) + 1
LOCAL $TNOTE = DLLSTRUCTCREATE ("wchar Note[" & $ILEN & "]" )
LOCAL $TLEN = DLLSTRUCTCREATE ("dword" )
DLLSTRUCTSETDATA ($TLEN , 1 , $ILEN )
IF NOT _SENDMESSAGE ($HWND , $BCM_GETNOTE , $TLEN , $TNOTE , 0 , "struct*" , "struct*" ) THEN RETURN SETERROR (+ 4294967295 , 0 , "" )
RETURN _WINAPI_WIDECHARTOMULTIBYTE ($TNOTE )
ENDFUNC
FUNC _GUICTRLBUTTON_GETNOTELENGTH ($HWND )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
RETURN _SENDMESSAGE ($HWND , $BCM_GETNOTELENGTH )
ENDFUNC
FUNC _GUICTRLBUTTON_GETSPLITINFO ($HWND )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
LOCAL $TSPLITINFO = DLLSTRUCTCREATE ($TAGBUTTON_SPLITINFO ) , $AINFO [4 ]
DLLSTRUCTSETDATA ($TSPLITINFO , "mask" , BITOR ($BCSIF_GLYPH , $BCSIF_IMAGE , $BCSIF_SIZE , $BCSIF_STYLE ) )
IF NOT _SENDMESSAGE ($HWND , $BCM_GETSPLITINFO , 0 , $TSPLITINFO , 0 , "wparam" , "struct*" ) THEN RETURN SETERROR (+ 4294967295 , 0 , $AINFO )
$AINFO [0 ] = DLLSTRUCTGETDATA ($TSPLITINFO , "himlGlyph" )
$AINFO [1 ] = DLLSTRUCTGETDATA ($TSPLITINFO , "uSplitStyle" )
$AINFO [2 ] = DLLSTRUCTGETDATA ($TSPLITINFO , "X" )
$AINFO [3 ] = DLLSTRUCTGETDATA ($TSPLITINFO , "Y" )
RETURN $AINFO
ENDFUNC
FUNC _GUICTRLBUTTON_GETSTATE ($HWND )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
RETURN _SENDMESSAGE ($HWND , $BM_GETSTATE )
ENDFUNC
FUNC _GUICTRLBUTTON_GETTEXT ($HWND )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
IF _WINAPI_ISCLASSNAME ($HWND , $__BUTTONCONSTANT_CLASSNAME ) THEN RETURN _WINAPI_GETWINDOWTEXT ($HWND )
RETURN ""
ENDFUNC
FUNC _GUICTRLBUTTON_GETTEXTMARGIN ($HWND )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
LOCAL $TRECT = DLLSTRUCTCREATE ($TAGRECT ) , $ARECT [4 ]
IF NOT _SENDMESSAGE ($HWND , $BCM_GETTEXTMARGIN , 0 , $TRECT , 0 , "wparam" , "struct*" ) THEN RETURN SETERROR (+ 4294967295 , + 4294967295 , $ARECT )
$ARECT [0 ] = DLLSTRUCTGETDATA ($TRECT , "Left" )
$ARECT [1 ] = DLLSTRUCTGETDATA ($TRECT , "Top" )
$ARECT [2 ] = DLLSTRUCTGETDATA ($TRECT , "Right" )
$ARECT [3 ] = DLLSTRUCTGETDATA ($TRECT , "Bottom" )
RETURN $ARECT
ENDFUNC
FUNC _GUICTRLBUTTON_SETCHECK ($HWND , $ISTATE = $BST_CHECKED )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
_SENDMESSAGE ($HWND , $BM_SETCHECK , $ISTATE )
ENDFUNC
FUNC _GUICTRLBUTTON_SETDONTCLICK ($HWND , $BSTATE = TRUE )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
_SENDMESSAGE ($HWND , $BM_SETDONTCLICK , $BSTATE )
ENDFUNC
FUNC _GUICTRLBUTTON_SETDROPDOWNSTATE ($HWND , $BSTATE = TRUE )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
RETURN _SENDMESSAGE ($HWND , $BCM_SETDROPDOWNSTATE , $BSTATE ) <> 0
ENDFUNC
FUNC _GUICTRLBUTTON_SETFOCUS ($HWND , $BFOCUS = TRUE )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
IF _WINAPI_ISCLASSNAME ($HWND , $__BUTTONCONSTANT_CLASSNAME ) THEN
IF $BFOCUS THEN
RETURN _WINAPI_SETFOCUS ($HWND ) <> 0
ELSE
RETURN _WINAPI_SETFOCUS (_WINAPI_GETPARENT ($HWND ) ) <> 0
ENDIF
ENDIF
ENDFUNC
FUNC _GUICTRLBUTTON_SETIMAGE ($HWND , $SIMAGEFILE , $IICONID = + 4294967295 , $BLARGE = FALSE )
LOCAL $HIMAGE , $HPREVIMAGE
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
IF STRINGUPPER (STRINGMID ($SIMAGEFILE , STRINGLEN ($SIMAGEFILE ) + 4294967294 ) ) = "BMP" THEN
IF BITAND (_WINAPI_GETWINDOWLONG ($HWND , $__BUTTONCONSTANT_GWL_STYLE ) , $BS_BITMAP ) = $BS_BITMAP THEN
$HIMAGE = _WINAPI_LOADIMAGE (0 , $SIMAGEFILE , 0 , 0 , 0 , BITOR ($LR_LOADFROMFILE , $LR_CREATEDIBSECTION ) )
IF NOT $HIMAGE THEN RETURN SETERROR (+ 4294967295 , + 4294967295 , FALSE )
$HPREVIMAGE = _SENDMESSAGE ($HWND , $BM_SETIMAGE , 0 , $HIMAGE )
IF $HPREVIMAGE THEN
IF NOT _WINAPI_DELETEOBJECT ($HPREVIMAGE ) THEN _WINAPI_DESTROYICON ($HPREVIMAGE )
ENDIF
_WINAPI_UPDATEWINDOW ($HWND )
RETURN TRUE
ENDIF
ELSE
IF $IICONID = + 4294967295 THEN
$HIMAGE = _WINAPI_LOADIMAGE (0 , $SIMAGEFILE , 1 , 0 , 0 , BITOR ($LR_LOADFROMFILE , $LR_CREATEDIBSECTION ) )
IF NOT $HIMAGE THEN RETURN SETERROR (+ 4294967295 , + 4294967295 , FALSE )
$HPREVIMAGE = _SENDMESSAGE ($HWND , $BM_SETIMAGE , 1 , $HIMAGE )
IF $HPREVIMAGE THEN
IF NOT _WINAPI_DELETEOBJECT ($HPREVIMAGE ) THEN _WINAPI_DESTROYICON ($HPREVIMAGE )
ENDIF
_WINAPI_UPDATEWINDOW ($HWND )
RETURN TRUE
ELSE
LOCAL $TICON = DLLSTRUCTCREATE ("handle Handle" )
LOCAL $IRET
IF $BLARGE THEN
$IRET = _WINAPI_EXTRACTICONEX ($SIMAGEFILE , $IICONID , $TICON , 0 , 1 )
ELSE
$IRET = _WINAPI_EXTRACTICONEX ($SIMAGEFILE , $IICONID , 0 , $TICON , 1 )
ENDIF
IF NOT $IRET THEN RETURN SETERROR (+ 4294967295 , + 4294967295 , FALSE )
$HPREVIMAGE = _SENDMESSAGE ($HWND , $BM_SETIMAGE , 1 , DLLSTRUCTGETDATA ($TICON , "Handle" ) )
IF $HPREVIMAGE THEN
IF NOT _WINAPI_DELETEOBJECT ($HPREVIMAGE ) THEN _WINAPI_DESTROYICON ($HPREVIMAGE )
ENDIF
_WINAPI_UPDATEWINDOW ($HWND )
RETURN TRUE
ENDIF
ENDIF
RETURN FALSE
ENDFUNC
FUNC _GUICTRLBUTTON_SETIMAGELIST ($HWND , $HIMAGE , $IALIGN = 0 , $ILEFT = 1 , $ITOP = 1 , $IRIGHT = 1 , $IBOTTOM = 1 )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
IF $IALIGN < 0 OR $IALIGN > 4 THEN $IALIGN = 0
LOCAL $TBUTTON_IMAGELIST = DLLSTRUCTCREATE ($TAGBUTTON_IMAGELIST )
DLLSTRUCTSETDATA ($TBUTTON_IMAGELIST , "ImageList" , $HIMAGE )
DLLSTRUCTSETDATA ($TBUTTON_IMAGELIST , "Left" , $ILEFT )
DLLSTRUCTSETDATA ($TBUTTON_IMAGELIST , "Top" , $ITOP )
DLLSTRUCTSETDATA ($TBUTTON_IMAGELIST , "Right" , $IRIGHT )
DLLSTRUCTSETDATA ($TBUTTON_IMAGELIST , "Bottom" , $IBOTTOM )
DLLSTRUCTSETDATA ($TBUTTON_IMAGELIST , "Align" , $IALIGN )
LOCAL $BENABLED = _GUICTRLBUTTON_ENABLE ($HWND , FALSE )
LOCAL $IRET = _SENDMESSAGE ($HWND , $BCM_SETIMAGELIST , 0 , $TBUTTON_IMAGELIST , 0 , "wparam" , "struct*" ) <> 0
_GUICTRLBUTTON_ENABLE ($HWND )
IF NOT $BENABLED THEN _GUICTRLBUTTON_ENABLE ($HWND , FALSE )
RETURN $IRET
ENDFUNC
FUNC _GUICTRLBUTTON_SETNOTE ($HWND , $SNOTE )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
LOCAL $TNOTE = _WINAPI_MULTIBYTETOWIDECHAR ($SNOTE )
RETURN _SENDMESSAGE ($HWND , $BCM_SETNOTE , 0 , $TNOTE , 0 , "wparam" , "struct*" ) <> 0
ENDFUNC
FUNC _GUICTRLBUTTON_SETSHIELD ($HWND , $BREQUIRED = TRUE )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
RETURN _SENDMESSAGE ($HWND , $BCM_SETSHIELD , 0 , $BREQUIRED ) = 1
ENDFUNC
FUNC _GUICTRLBUTTON_SETSIZE ($HWND , $IWIDTH , $IHEIGHT )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
IF NOT _WINAPI_ISCLASSNAME ($HWND , $__BUTTONCONSTANT_CLASSNAME ) THEN RETURN SETERROR (+ 4294967295 , + 4294967295 , FALSE )
LOCAL $HPARENT = _WINAPI_GETPARENT ($HWND )
IF NOT $HPARENT THEN RETURN SETERROR (+ 4294967295 , + 4294967295 , FALSE )
LOCAL $APOS = WINGETPOS ($HWND )
IF NOT ISARRAY ($APOS ) THEN RETURN SETERROR (+ 4294967295 , + 4294967295 , FALSE )
LOCAL $TPOINT = DLLSTRUCTCREATE ($TAGPOINT )
DLLSTRUCTSETDATA ($TPOINT , "X" , $APOS [0 ] )
DLLSTRUCTSETDATA ($TPOINT , "Y" , $APOS [1 ] )
IF NOT _WINAPI_SCREENTOCLIENT ($HPARENT , $TPOINT ) THEN RETURN SETERROR (+ 4294967295 , + 4294967295 , FALSE )
LOCAL $IRET = WINMOVE ($HWND , "" , DLLSTRUCTGETDATA ($TPOINT , "X" ) , DLLSTRUCTGETDATA ($TPOINT , "Y" ) , $IWIDTH , $IHEIGHT )
RETURN SETERROR ($IRET + 4294967295 , $IRET + 4294967295 , $IRET <> 0 )
ENDFUNC
FUNC _GUICTRLBUTTON_SETSPLITINFO ($HWND , $HIMLGLYPH = + 4294967295 , $ISPLITSTYLE = $BCSS_ALIGNLEFT , $IWIDTH = 0 , $IHEIGHT = 0 )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
LOCAL $TSPLITINFO = DLLSTRUCTCREATE ($TAGBUTTON_SPLITINFO ) , $IMASK = 0
IF $HIMLGLYPH <> + 4294967295 THEN
$IMASK = BITOR ($IMASK , $BCSIF_GLYPH )
DLLSTRUCTSETDATA ($TSPLITINFO , "himlGlyph" , $HIMLGLYPH )
ENDIF
$IMASK = BITOR ($IMASK , $BCSIF_STYLE )
IF BITAND ($ISPLITSTYLE , $BCSS_IMAGE ) = $BCSS_IMAGE THEN $IMASK = BITOR ($IMASK , $BCSIF_IMAGE )
DLLSTRUCTSETDATA ($TSPLITINFO , "uSplitStyle" , $ISPLITSTYLE )
IF $IWIDTH > 0 OR $IHEIGHT > 0 THEN
$IMASK = BITOR ($IMASK , $BCSIF_SIZE )
DLLSTRUCTSETDATA ($TSPLITINFO , "X" , $IWIDTH )
DLLSTRUCTSETDATA ($TSPLITINFO , "Y" , $IHEIGHT )
ENDIF
DLLSTRUCTSETDATA ($TSPLITINFO , "mask" , $IMASK )
RETURN _SENDMESSAGE ($HWND , $BCM_SETSPLITINFO , 0 , $TSPLITINFO , 0 , "wparam" , "struct*" ) <> 0
ENDFUNC
FUNC _GUICTRLBUTTON_SETSTATE ($HWND , $BHIGHLIGHTED = TRUE )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
_SENDMESSAGE ($HWND , $BM_SETSTATE , $BHIGHLIGHTED )
ENDFUNC
FUNC _GUICTRLBUTTON_SETSTYLE ($HWND , $ISTYLE )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
_SENDMESSAGE ($HWND , $BM_SETSTYLE , $ISTYLE , TRUE )
_WINAPI_UPDATEWINDOW ($HWND )
ENDFUNC
FUNC _GUICTRLBUTTON_SETTEXT ($HWND , $STEXT )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
IF _WINAPI_ISCLASSNAME ($HWND , $__BUTTONCONSTANT_CLASSNAME ) THEN RETURN _WINAPI_SETWINDOWTEXT ($HWND , $STEXT )
ENDFUNC
FUNC _GUICTRLBUTTON_SETTEXTMARGIN ($HWND , $ILEFT = 1 , $ITOP = 1 , $IRIGHT = 1 , $IBOTTOM = 1 )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
LOCAL $TRECT = DLLSTRUCTCREATE ($TAGRECT )
DLLSTRUCTSETDATA ($TRECT , "Left" , $ILEFT )
DLLSTRUCTSETDATA ($TRECT , "Top" , $ITOP )
DLLSTRUCTSETDATA ($TRECT , "Right" , $IRIGHT )
DLLSTRUCTSETDATA ($TRECT , "Bottom" , $IBOTTOM )
RETURN _SENDMESSAGE ($HWND , $BCM_SETTEXTMARGIN , 0 , $TRECT , 0 , "wparam" , "struct*" ) <> 0
ENDFUNC
FUNC _GUICTRLBUTTON_SHOW ($HWND , $BSHOW = TRUE )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
IF _WINAPI_ISCLASSNAME ($HWND , $__BUTTONCONSTANT_CLASSNAME ) THEN
IF $BSHOW THEN
RETURN _WINAPI_SHOWWINDOW ($HWND , @SW_SHOW )
ELSE
RETURN _WINAPI_SHOWWINDOW ($HWND , @SW_HIDE )
ENDIF
ENDIF
ENDFUNC
GLOBAL CONST $GUI_EVENT_SINGLE = 0
GLOBAL CONST $GUI_EVENT_ARRAY = 1
GLOBAL CONST $GUI_EVENT_NONE = 0
GLOBAL CONST $GUI_EVENT_CLOSE = + 4294967293
GLOBAL CONST $GUI_EVENT_MINIMIZE = + 4294967292
GLOBAL CONST $GUI_EVENT_RESTORE = + 4294967291
GLOBAL CONST $GUI_EVENT_MAXIMIZE = + 4294967290
GLOBAL CONST $GUI_EVENT_PRIMARYDOWN = + 4294967289
GLOBAL CONST $GUI_EVENT_PRIMARYUP = + 4294967288
GLOBAL CONST $GUI_EVENT_SECONDARYDOWN = + 4294967287
GLOBAL CONST $GUI_EVENT_SECONDARYUP = + 4294967286
GLOBAL CONST $GUI_EVENT_MOUSEMOVE = + 4294967285
GLOBAL CONST $GUI_EVENT_RESIZED = + 4294967284
GLOBAL CONST $GUI_EVENT_DROPPED = + 4294967283
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 = + 4294967294
GLOBAL CONST $GUI_BKCOLOR_DEFAULT = + 4294967295
GLOBAL CONST $GUI_BKCOLOR_TRANSPARENT = + 4294967294
GLOBAL CONST $GUI_BKCOLOR_LV_ALTERNATE = 4261412864
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 $PBS_MARQUEE = 8
GLOBAL CONST $PBS_SMOOTH = 1
GLOBAL CONST $PBS_SMOOTHREVERSE = 16
GLOBAL CONST $PBS_VERTICAL = 4
GLOBAL CONST $GUI_SS_DEFAULT_PROGRESS = 0
GLOBAL CONST $__PROGRESSBARCONSTANT_WM_USER = 1024
GLOBAL CONST $PBM_DELTAPOS = $__PROGRESSBARCONSTANT_WM_USER + 3
GLOBAL CONST $PBM_GETBARCOLOR = 1039
GLOBAL CONST $PBM_GETBKCOLOR = 1038
GLOBAL CONST $PBM_GETPOS = $__PROGRESSBARCONSTANT_WM_USER + 8
GLOBAL CONST $PBM_GETRANGE = $__PROGRESSBARCONSTANT_WM_USER + 7
GLOBAL CONST $PBM_GETSTATE = 1041
GLOBAL CONST $PBM_GETSTEP = 1037
GLOBAL CONST $PBM_SETBARCOLOR = $__PROGRESSBARCONSTANT_WM_USER + 9
GLOBAL CONST $PBM_SETBKCOLOR = 8192 + 1
GLOBAL CONST $PBM_SETMARQUEE = $__PROGRESSBARCONSTANT_WM_USER + 10
GLOBAL CONST $PBM_SETPOS = $__PROGRESSBARCONSTANT_WM_USER + 2
GLOBAL CONST $PBM_SETRANGE = $__PROGRESSBARCONSTANT_WM_USER + 1
GLOBAL CONST $PBM_SETRANGE32 = $__PROGRESSBARCONSTANT_WM_USER + 6
GLOBAL CONST $PBM_SETSTATE = 1040
GLOBAL CONST $PBM_SETSTEP = $__PROGRESSBARCONSTANT_WM_USER + 4
GLOBAL CONST $PBM_STEPIT = $__PROGRESSBARCONSTANT_WM_USER + 5
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 = 2156396544
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 + 4294967295
GLOBAL CONST $NM_CLICK = $NM_FIRST + 4294967294
GLOBAL CONST $NM_DBLCLK = $NM_FIRST + 4294967293
GLOBAL CONST $NM_RETURN = $NM_FIRST + 4294967292
GLOBAL CONST $NM_RCLICK = $NM_FIRST + 4294967291
GLOBAL CONST $NM_RDBLCLK = $NM_FIRST + 4294967290
GLOBAL CONST $NM_SETFOCUS = $NM_FIRST + 4294967289
GLOBAL CONST $NM_KILLFOCUS = $NM_FIRST + 4294967288
GLOBAL CONST $NM_CUSTOMDRAW = $NM_FIRST + 4294967284
GLOBAL CONST $NM_HOVER = $NM_FIRST + 4294967283
GLOBAL CONST $NM_NCHITTEST = $NM_FIRST + 4294967282
GLOBAL CONST $NM_KEYDOWN = $NM_FIRST + 4294967281
GLOBAL CONST $NM_RELEASEDCAPTURE = $NM_FIRST + 4294967280
GLOBAL CONST $NM_SETCURSOR = $NM_FIRST + 4294967279
GLOBAL CONST $NM_CHAR = $NM_FIRST + 4294967278
GLOBAL CONST $NM_TOOLTIPSCREATED = $NM_FIRST + 4294967277
GLOBAL CONST $NM_LDOWN = $NM_FIRST + 4294967276
GLOBAL CONST $NM_RDOWN = $NM_FIRST + 4294967275
GLOBAL CONST $NM_THEMECHANGED = $NM_FIRST + 4294967274
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_CXFIXEDFRAME = 7
GLOBAL CONST $SM_CXDLGFRAME = $SM_CXFIXEDFRAME
GLOBAL CONST $SM_CYFIXEDFRAME = 8
GLOBAL CONST $SM_CYDLGFRAME = $SM_CYFIXEDFRAME
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_CXSIZEFRAME = 32
GLOBAL CONST $SM_CXFRAME = $SM_CXSIZEFRAME
GLOBAL CONST $SM_CYSIZEFRAME = 33
GLOBAL CONST $SM_CYFRAME = $SM_CYSIZEFRAME
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 = + 4294967294
GLOBAL CONST $HTTRANSPARENT = + 4294967295
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 = + 4294967295
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 )
#Region Global Variables and Constants
GLOBAL CONST $_ARRAYCONSTANT_SORTINFOSIZE = 11
GLOBAL $__G_AARRAYDISPLAY_SORTINFO [$_ARRAYCONSTANT_SORTINFOSIZE ]
GLOBAL CONST $ARRAYDISPLAY_COLALIGNLEFT = 0
GLOBAL CONST $ARRAYDISPLAY_TRANSPOSE = 1
GLOBAL CONST $ARRAYDISPLAY_COLALIGNRIGHT = 2
GLOBAL CONST $ARRAYDISPLAY_COLALIGNCENTER = 4
GLOBAL CONST $ARRAYDISPLAY_VERBOSE = 8
GLOBAL CONST $ARRAYDISPLAY_NOROW = 64
GLOBAL CONST $_ARRAYCONSTANT_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 $_ARRAYCONSTANT_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"
#EndRegion Global Variables and Constants
#Region Functions list
#EndRegion Functions list
FUNC __ARRAYDISPLAY_SHARE (CONST BYREF $AARRAY , $STITLE = DEFAULT , $SARRAYRANGE = DEFAULT , $IFLAGS = DEFAULT , $VUSER_SEPARATOR = DEFAULT , $SHEADER = DEFAULT , $IMAX_COLWIDTH = DEFAULT , $HUSER_FUNCTION = DEFAULT , $BDEBUG = TRUE )
LOCAL $VTMP , $SMSGBOXTITLE = (($BDEBUG ) ("DebugArray" ) ("ArrayDisplay" ) )
IF $STITLE = DEFAULT THEN $STITLE = $SMSGBOXTITLE
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 $HUSER_FUNCTION = DEFAULT THEN $HUSER_FUNCTION = 0
LOCAL $ITRANSPOSE = BITAND ($IFLAGS , $ARRAYDISPLAY_TRANSPOSE )
LOCAL $ICOLALIGN = BITAND ($IFLAGS , 6 )
LOCAL $IVERBOSE = BITAND ($IFLAGS , $ARRAYDISPLAY_VERBOSE )
LOCAL $INOROW = BITAND ($IFLAGS , $ARRAYDISPLAY_NOROW )
LOCAL $IBUTTONBORDER = (($BDEBUG ) (40 ) (20 ) )
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
IF $IDIMENSION = 1 THEN
$ITRANSPOSE = 0
ENDIF
ELSE
$SMSG = "No array variable passed to function"
ENDIF
IF $SMSG THEN
IF $IVERBOSE AND MSGBOX ($MB_SYSTEMMODAL + $MB_ICONERROR + $MB_YESNO , $SMSGBOXTITLE & " Error: " & $STITLE , $SMSG & @CRLF & @CRLF & "Exit the script?" ) = $IDYES THEN
EXIT
ELSE
RETURN SETERROR ($IRET , 0 , 0 )
ENDIF
ENDIF
LOCAL $ICW_COLWIDTH = NUMBER ($VUSER_SEPARATOR )
LOCAL $SCURR_SEPARATOR = OPT ("GUIDataSeparatorChar" )
IF $VUSER_SEPARATOR = "" THEN $VUSER_SEPARATOR = $SCURR_SEPARATOR
LOCAL $IITEM_START = 0 , $IITEM_END = $IROWCOUNT + 4294967295 , $ISUBITEM_START = 0 , $ISUBITEM_END = (($IDIMENSION = 2 ) ($ICOLCOUNT + 4294967295 ) (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 ] )
IF $AVRANGESPLIT [2 ] <> "" THEN
$IITEM_END = NUMBER ($AVRANGESPLIT [2 ] )
ENDIF
ENDIF
ENDIF
IF $IITEM_START < 0 THEN $IITEM_START = 0
IF $IITEM_END > $IROWCOUNT + 4294967295 THEN $IITEM_END = $IROWCOUNT + 4294967295
IF $IITEM_START > $IITEM_END THEN
$VTMP = $IITEM_START
$IITEM_START = $IITEM_END
$IITEM_END = $VTMP
ENDIF
IF $IITEM_START <> 0 OR $IITEM_END <> $IROWCOUNT + 4294967295 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 ] )
IF $AVRANGESPLIT [2 ] <> "" THEN
$ISUBITEM_END = NUMBER ($AVRANGESPLIT [2 ] )
ENDIF
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 + 4294967295 THEN $ISUBITEM_END = $ICOLCOUNT + 4294967295
IF $ISUBITEM_START <> 0 OR $ISUBITEM_END <> $ICOLCOUNT + 4294967295 THEN $BRANGE_FLAG = TRUE
ENDIF
ENDIF
LOCAL $SDISPLAYDATA = "[" & $IROWCOUNT & "]"
IF $IDIMENSION = 2 THEN
$SDISPLAYDATA &= " [" & $ICOLCOUNT & "]"
ENDIF
LOCAL $STIPDATA = ""
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
$SHEADER = "Col"
FOR $J = $IITEM_START TO $IITEM_END
$SHEADER &= $SCURR_SEPARATOR & "Row " & $J
NEXT
ELSE
IF $ASHEADER [0 ] THEN
FOR $IINDEX = $ISUBITEM_START TO $ISUBITEM_END
IF $IINDEX >= UBOUND ($ASHEADER ) THEN EXITLOOP
$SHEADER &= $SCURR_SEPARATOR & $ASHEADER [$IINDEX ]
NEXT
ENDIF
FOR $J = $IINDEX TO $ISUBITEM_END
$SHEADER &= $SCURR_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 ($SMSGBOXTITLE , "Preparing display" & @CRLF & @CRLF & "Please be patient" , 300 , 100 )
ENDIF
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 = + 4294967293
LOCAL CONST $_ARRAYCONSTANT_GUI_FOCUS = 256
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 = + 4294967295
LOCAL CONST $_ARRAYCONSTANT_LVSCW_AUTOSIZE_USEHEADER = + 4294967294
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_1 = $AIGUISIZE [0 ] / 2
LOCAL $IBUTTONWIDTH_2 = $AIGUISIZE [0 ] / 3
LOCAL $IDLISTVIEW = GUICTRLCREATELISTVIEW ($SHEADER , 0 , 0 , $AIGUISIZE [0 ] , $AIGUISIZE [1 ] - $IBUTTONBORDER , $_ARRAYCONSTANT_LVS_SHOWSELALWAYS )
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 $BDEBUG THEN
$IDCOPY_ID = GUICTRLCREATEBUTTON ("Copy Data && Hdr/Row" , 0 , $AIGUISIZE [1 ] - $IBUTTONBORDER , $IBUTTONWIDTH_1 , 20 )
$IDCOPY_DATA = GUICTRLCREATEBUTTON ("Copy Data Only" , $IBUTTONWIDTH_1 , $AIGUISIZE [1 ] - $IBUTTONBORDER , $IBUTTONWIDTH_1 , 20 )
LOCAL $IBUTTONWIDTH_VAR = $IBUTTONWIDTH_1
LOCAL $IOFFSET = $IBUTTONWIDTH_1
IF ISFUNC ($HUSER_FUNCTION ) THEN
$IDUSER_FUNC = GUICTRLCREATEBUTTON ("Run User Func" , $IBUTTONWIDTH_2 , $AIGUISIZE [1 ] + 4294967276 , $IBUTTONWIDTH_2 , 20 )
$IBUTTONWIDTH_VAR = $IBUTTONWIDTH_2
$IOFFSET = $IBUTTONWIDTH_2 * 2
ENDIF
$IDEXIT_SCRIPT = GUICTRLCREATEBUTTON ("Exit Script" , $IOFFSET , $AIGUISIZE [1 ] + 4294967276 , $IBUTTONWIDTH_VAR , 20 )
$IDDATA_LABEL = GUICTRLCREATELABEL ($SDISPLAYDATA , 0 , $AIGUISIZE [1 ] + 4294967276 , $IBUTTONWIDTH_VAR , 18 , BITOR ($_ARRAYCONSTANT_SS_CENTER , $_ARRAYCONSTANT_SS_CENTERIMAGE ) )
ELSE
$IDDATA_LABEL = GUICTRLCREATELABEL ($SDISPLAYDATA , 0 , $AIGUISIZE [1 ] + 4294967276 , $AIGUISIZE [0 ] , 18 , BITOR ($_ARRAYCONSTANT_SS_CENTER , $_ARRAYCONSTANT_SS_CENTERIMAGE ) )
ENDIF
SELECT
CASE $ITRANSPOSE OR $BRANGE_FLAG
GUICTRLSETCOLOR ($IDDATA_LABEL , 16711680 )
GUICTRLSETTIP ($IDDATA_LABEL , $STIPDATA )
ENDSELECT
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 $IROWINDEX , $ICOLFILL
IF $ITRANSPOSE THEN
FOR $I = $ISUBITEM_START TO $ISUBITEM_END
$IROWINDEX = __ARRAYDISPLAY_ADDITEM ($IDLISTVIEW , "NULL" )
IF $INOROW THEN
$ICOLFILL = 0
ELSE
__ARRAYDISPLAY_ADDSUBITEM ($IDLISTVIEW , $IROWINDEX , "Col " & $I , 0 )
$ICOLFILL = 1
ENDIF
FOR $J = $IITEM_START TO $IITEM_END
IF $IDIMENSION = 2 THEN
$VTMP = $AARRAY [$J ] [$I ]
ELSE
$VTMP = $AARRAY [$J ]
ENDIF
SWITCH VARGETTYPE ($VTMP )
CASE "Array"
__ARRAYDISPLAY_ADDSUBITEM ($IDLISTVIEW , $IROWINDEX , "{Array}" , $ICOLFILL )
CASE ELSE
__ARRAYDISPLAY_ADDSUBITEM ($IDLISTVIEW , $IROWINDEX , $VTMP , $ICOLFILL )
ENDSWITCH
$ICOLFILL += 1
NEXT
NEXT
ELSE
FOR $I = $IITEM_START TO $IITEM_END
$IROWINDEX = __ARRAYDISPLAY_ADDITEM ($IDLISTVIEW , "NULL" )
IF $INOROW THEN
$ICOLFILL = 0
ELSE
__ARRAYDISPLAY_ADDSUBITEM ($IDLISTVIEW , $IROWINDEX , "Row " & $I , 0 )
$ICOLFILL = 1
ENDIF
FOR $J = $ISUBITEM_START TO $ISUBITEM_END
IF $IDIMENSION = 2 THEN
$VTMP = $AARRAY [$I ] [$J ]
ELSE
$VTMP = $AARRAY [$I ]
ENDIF
SWITCH VARGETTYPE ($VTMP )
CASE "Array"
__ARRAYDISPLAY_ADDSUBITEM ($IDLISTVIEW , $IROWINDEX , "{Array}" , $ICOLFILL )
CASE ELSE
__ARRAYDISPLAY_ADDSUBITEM ($IDLISTVIEW , $IROWINDEX , $VTMP , $ICOLFILL )
ENDSWITCH
$ICOLFILL += 1
NEXT
NEXT
ENDIF
IF $ICOLALIGN THEN
FOR $I = 0 TO $ICOLFILL + 4294967295
__ARRAYDISPLAY_JUSTIFYCOLUMN ($IDLISTVIEW , $I , $ICOLALIGN / 2 )
NEXT
ENDIF
GUICTRLSENDMSG ($IDLISTVIEW , $_ARRAYCONSTANT_WM_SETREDRAW , 1 , 0 )
LOCAL $IBORDER = (($IROWINDEX > 19 ) (65 ) (45 ) )
LOCAL $IWIDTH = $IBORDER , $ICOLWIDTH = 0 , $AICOLWIDTH [$ICOLFILL ] , $IMIN_COLWIDTH = 55
FOR $I = 0 TO UBOUND ($AICOLWIDTH ) + 4294967295
GUICTRLSENDMSG ($IDLISTVIEW , $_ARRAYCONSTANT_LVM_SETCOLUMNWIDTH , $I , $_ARRAYCONSTANT_LVSCW_AUTOSIZE )
$ICOLWIDTH = GUICTRLSENDMSG ($IDLISTVIEW , $_ARRAYCONSTANT_LVM_GETCOLUMNWIDTH , $I , 0 )
IF $SHEADER <> "" THEN
GUICTRLSENDMSG ($IDLISTVIEW , $_ARRAYCONSTANT_LVM_SETCOLUMNWIDTH , $I , $_ARRAYCONSTANT_LVSCW_AUTOSIZE_USEHEADER )
LOCAL $ICOLWIDTHHEADER = GUICTRLSENDMSG ($IDLISTVIEW , $_ARRAYCONSTANT_LVM_GETCOLUMNWIDTH , $I , 0 )
IF $ICOLWIDTH < $IMIN_COLWIDTH AND $ICOLWIDTHHEADER < $IMIN_COLWIDTH THEN
GUICTRLSENDMSG ($IDLISTVIEW , $_ARRAYCONSTANT_LVM_SETCOLUMNWIDTH , $I , $IMIN_COLWIDTH )
$ICOLWIDTH = $IMIN_COLWIDTH
ELSEIF $ICOLWIDTHHEADER < $ICOLWIDTH THEN
GUICTRLSENDMSG ($IDLISTVIEW , $_ARRAYCONSTANT_LVM_SETCOLUMNWIDTH , $I , $ICOLWIDTH )
ELSE
$ICOLWIDTH = $ICOLWIDTHHEADER
ENDIF
ELSE
IF $ICOLWIDTH < $IMIN_COLWIDTH THEN
GUICTRLSENDMSG ($IDLISTVIEW , $_ARRAYCONSTANT_LVM_SETCOLUMNWIDTH , $I , $IMIN_COLWIDTH )
$ICOLWIDTH = $IMIN_COLWIDTH
ENDIF
ENDIF
$IWIDTH += $ICOLWIDTH
$AICOLWIDTH [$I ] = $ICOLWIDTH
NEXT
IF $IWIDTH > @DESKTOPWIDTH + 4294967196 THEN
$IWIDTH = $IBORDER
FOR $I = 0 TO UBOUND ($AICOLWIDTH ) + 4294967295
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 + 4294967196 THEN
$IWIDTH = @DESKTOPWIDTH + 4294967196
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 = (($IROWINDEX + 4 ) * (DLLSTRUCTGETDATA ($TRECT , "Bottom" ) - DLLSTRUCTGETDATA ($TRECT , "Top" ) ) ) + $AIWIN_POS [3 ] - $AILV_POS [3 ]
IF $IHEIGHT > @DESKTOPHEIGHT + 4294967196 THEN
$IHEIGHT = @DESKTOPHEIGHT + 4294967196
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
__ARRAYDISPLAY_REGISTERSORTCALLBACK ($IDLISTVIEW , 2 , TRUE , "__ArrayDisplay_SortCallBack" )
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 ($SMSGBOXTITLE , "Copying data" & @CRLF & @CRLF & "Please be patient" , 300 , 100 )
ENDIF
LOCAL $SCLIP = "" , $SITEM , $ASPLIT
FOR $I = 0 TO GUICTRLSENDMSG ($IDLISTVIEW , $_ARRAYCONSTANT_LVM_GETITEMCOUNT , 0 , 0 ) + 4294967295
IF $ISEL_COUNT AND NOT (GUICTRLSENDMSG ($IDLISTVIEW , $_ARRAYCONSTANT_LVM_GETITEMSTATE , $I , $_ARRAYCONSTANT_LVIS_SELECTED ) <> 0 ) THEN
CONTINUELOOP
ENDIF
$SITEM = __ARRAYDISPLAY_GETITEMTEXTSTRING ($IDLISTVIEW , $I )
IF $IMSG = $IDCOPY_ID AND $INOROW THEN
$SITEM = "Row " & ($I + (($ITRANSPOSE ) ($ISUBITEM_START ) ($IITEM_START ) ) ) & $SCURR_SEPARATOR & $SITEM
ENDIF
IF $IMSG = $IDCOPY_DATA AND NOT $INOROW THEN
$SITEM = STRINGREGEXPREPLACE ($SITEM , "^Row\s\d+\|(.*)$" , "$1" )
ENDIF
IF $ICW_COLWIDTH THEN
$ASPLIT = STRINGSPLIT ($SITEM , $SCURR_SEPARATOR )
$SITEM = ""
FOR $J = 1 TO $ASPLIT [0 ]
$SITEM &= STRINGFORMAT ("%-" & $ICW_COLWIDTH + 1 & "s" , STRINGLEFT ($ASPLIT [$J ] , $ICW_COLWIDTH ) )
NEXT
ELSE
$SITEM = STRINGREPLACE ($SITEM , $SCURR_SEPARATOR , $VUSER_SEPARATOR )
ENDIF
$SCLIP &= $SITEM & @CRLF
NEXT
$SITEM = $SHEADER
IF $IMSG = $IDCOPY_ID THEN
$SITEM = $SHEADER
IF $INOROW THEN
$SITEM = "Row|" & $SITEM
ENDIF
IF $ICW_COLWIDTH THEN
$ASPLIT = STRINGSPLIT ($SITEM , $SCURR_SEPARATOR )
$SITEM = ""
FOR $J = 1 TO $ASPLIT [0 ]
$SITEM &= STRINGFORMAT ("%-" & $ICW_COLWIDTH + 1 & "s" , STRINGLEFT ($ASPLIT [$J ] , $ICW_COLWIDTH ) )
NEXT
ELSE
$SITEM = STRINGREPLACE ($SITEM , $SCURR_SEPARATOR , $VUSER_SEPARATOR )
ENDIF
$SCLIP = $SITEM & @CRLF & $SCLIP
ENDIF
CLIPPUT ($SCLIP )
SPLASHOFF ()
GUICTRLSETSTATE ($IDLISTVIEW , $_ARRAYCONSTANT_GUI_FOCUS )
CASE $IDLISTVIEW
__ARRAYDISPLAY_SORTITEMS ($IDLISTVIEW , GUICTRLGETSTATE ($IDLISTVIEW ) )
CASE $IDUSER_FUNC
LOCAL $AISELITEMS [1 ] = [0 ]
FOR $I = 0 TO GUICTRLSENDMSG ($IDLISTVIEW , $_ARRAYCONSTANT_LVM_GETITEMCOUNT , 0 , 0 ) + 4294967295
IF (GUICTRLSENDMSG ($IDLISTVIEW , $_ARRAYCONSTANT_LVM_GETITEMSTATE , $I , $_ARRAYCONSTANT_LVIS_SELECTED ) <> 0 ) THEN
$AISELITEMS [0 ] += 1
REDIM $AISELITEMS [$AISELITEMS [0 ] + 1 ]
$AISELITEMS [$AISELITEMS [0 ] ] = $I + $IITEM_START
ENDIF
NEXT
$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 )
RETURN 1
ENDFUNC
FUNC __ARRAYDISPLAY_REGISTERSORTCALLBACK ($HWND , $VCOMPARETYPE = 2 , $BARROWS = TRUE , $SSORT_CALLBACK = "__ArrayDisplay_SortCallBack" )
#Au3Stripper_Ignore_Funcs=$sSort_Callback
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
LOCAL $HHEADER = HWND (GUICTRLSENDMSG ($HWND , 4127 , 0 , 0 ) )
$__G_AARRAYDISPLAY_SORTINFO [1 ] = $HWND
$__G_AARRAYDISPLAY_SORTINFO [2 ] = DLLCALLBACKREGISTER ($SSORT_CALLBACK , "int" , "int;int;hwnd" )
$__G_AARRAYDISPLAY_SORTINFO [3 ] = + 4294967295
$__G_AARRAYDISPLAY_SORTINFO [4 ] = + 4294967295
$__G_AARRAYDISPLAY_SORTINFO [5 ] = 1
$__G_AARRAYDISPLAY_SORTINFO [6 ] = + 4294967295
$__G_AARRAYDISPLAY_SORTINFO [7 ] = 0
$__G_AARRAYDISPLAY_SORTINFO [8 ] = $VCOMPARETYPE
$__G_AARRAYDISPLAY_SORTINFO [9 ] = $BARROWS
$__G_AARRAYDISPLAY_SORTINFO [10 ] = $HHEADER
RETURN $__G_AARRAYDISPLAY_SORTINFO [2 ] <> 0
ENDFUNC
#Au3Stripper_Ignore_Funcs=__ArrayDisplay_SortCallBack
FUNC __ARRAYDISPLAY_SORTCALLBACK ($NITEM1 , $NITEM2 , $HWND )
IF $__G_AARRAYDISPLAY_SORTINFO [3 ] = $__G_AARRAYDISPLAY_SORTINFO [4 ] THEN
IF NOT $__G_AARRAYDISPLAY_SORTINFO [7 ] THEN
$__G_AARRAYDISPLAY_SORTINFO [5 ] *= + 4294967295
$__G_AARRAYDISPLAY_SORTINFO [7 ] = 1
ENDIF
ELSE
$__G_AARRAYDISPLAY_SORTINFO [7 ] = 1
ENDIF
$__G_AARRAYDISPLAY_SORTINFO [6 ] = $__G_AARRAYDISPLAY_SORTINFO [3 ]
LOCAL $SVAL1 = __ARRAYDISPLAY_GETITEMTEXT ($HWND , $NITEM1 , $__G_AARRAYDISPLAY_SORTINFO [3 ] )
LOCAL $SVAL2 = __ARRAYDISPLAY_GETITEMTEXT ($HWND , $NITEM2 , $__G_AARRAYDISPLAY_SORTINFO [3 ] )
IF $__G_AARRAYDISPLAY_SORTINFO [8 ] = 1 THEN
IF (STRINGISFLOAT ($SVAL1 ) OR STRINGISINT ($SVAL1 ) ) THEN $SVAL1 = NUMBER ($SVAL1 )
IF (STRINGISFLOAT ($SVAL2 ) OR STRINGISINT ($SVAL2 ) ) THEN $SVAL2 = NUMBER ($SVAL2 )
ENDIF
LOCAL $NRESULT
IF $__G_AARRAYDISPLAY_SORTINFO [8 ] < 2 THEN
$NRESULT = 0
IF $SVAL1 < $SVAL2 THEN
$NRESULT = + 4294967295
ELSEIF $SVAL1 > $SVAL2 THEN
$NRESULT = 1
ENDIF
ELSE
$NRESULT = DLLCALL ("shlwapi.dll" , "int" , "StrCmpLogicalW" , "wstr" , $SVAL1 , "wstr" , $SVAL2 ) [0 ]
ENDIF
$NRESULT = $NRESULT * $__G_AARRAYDISPLAY_SORTINFO [5 ]
RETURN $NRESULT
ENDFUNC
FUNC __ARRAYDISPLAY_SORTITEMS ($HWND , $ICOL )
IF NOT ISHWND ($HWND ) THEN $HWND = GUICTRLGETHANDLE ($HWND )
LOCAL $PFUNCTION = DLLCALLBACKGETPTR ($__G_AARRAYDISPLAY_SORTINFO [2 ] )
$__G_AARRAYDISPLAY_SORTINFO [3 ] = $ICOL
$__G_AARRAYDISPLAY_SORTINFO [7 ] = 0
$__G_AARRAYDISPLAY_SORTINFO [4 ] = $__G_AARRAYDISPLAY_SORTINFO [6 ]
LOCAL $ARESULT = DLLCALL ("user32.dll" , "lresult" , "SendMessageW" , "hwnd" , $HWND , "uint" , 4177 , "hwnd" , $HWND , "ptr" , $PFUNCTION )
IF $ARESULT [0 ] <> 0 THEN
IF $__G_AARRAYDISPLAY_SORTINFO [9 ] THEN
LOCAL $HHEADER = $__G_AARRAYDISPLAY_SORTINFO [10 ] , $IFORMAT
FOR $X = 0 TO __ARRAYDISPLAY_GETITEMCOUNT ($HHEADER ) + 4294967295
$IFORMAT = __ARRAYDISPLAY_GETITEMFORMAT ($HHEADER , $X )
IF BITAND ($IFORMAT , 512 ) THEN
__ARRAYDISPLAY_SETITEMFORMAT ($HHEADER , $X , BITXOR ($IFORMAT , 512 ) )
ELSEIF BITAND ($IFORMAT , 1024 ) THEN
__ARRAYDISPLAY_SETITEMFORMAT ($HHEADER , $X , BITXOR ($IFORMAT , 1024 ) )
ENDIF
NEXT
$IFORMAT = __ARRAYDISPLAY_GETITEMFORMAT ($HHEADER , $ICOL )
IF $__G_AARRAYDISPLAY_SORTINFO [5 ] = 1 THEN
__ARRAYDISPLAY_SETITEMFORMAT ($HHEADER , $ICOL , BITOR ($IFORMAT , 1024 ) )
ELSE
__ARRAYDISPLAY_SETITEMFORMAT ($HHEADER , $ICOL , BITOR ($IFORMAT , 512 ) )
ENDIF
ENDIF
RETURN TRUE
ENDIF
RETURN FALSE
ENDFUNC
FUNC __ARRAYDISPLAY_ADDITEM ($HWND , $STEXT )
LOCAL $TITEM = DLLSTRUCTCREATE ($_ARRAYCONSTANT_TAGLVITEM )
DLLSTRUCTSETDATA ($TITEM , "Param" , 0 )
LOCAL $IBUFFER = STRINGLEN ($STEXT ) + 1
LOCAL $TBUFFER = DLLSTRUCTCREATE ("wchar Text[" & $IBUFFER & "]" )
$IBUFFER *= 2
DLLSTRUCTSETDATA ($TBUFFER , "Text" , $STEXT )
DLLSTRUCTSETDATA ($TITEM , "Text" , DLLSTRUCTGETPTR ($TBUFFER ) )
DLLSTRUCTSETDATA ($TITEM , "TextMax" , $IBUFFER )
LOCAL $IMASK = 5
DLLSTRUCTSETDATA ($TITEM , "Mask" , $IMASK )
DLLSTRUCTSETDATA ($TITEM , "Item" , 999999999 )
DLLSTRUCTSETDATA ($TITEM , "Image" , + 4294967295 )
LOCAL $PITEM = DLLSTRUCTGETPTR ($TITEM )
LOCAL $IRET = GUICTRLSENDMSG ($HWND , 4173 , 0 , $PITEM )
RETURN $IRET
ENDFUNC
FUNC __ARRAYDISPLAY_ADDSUBITEM ($HWND , $IINDEX , $STEXT , $ISUBITEM )
LOCAL $IBUFFER = STRINGLEN ($STEXT ) + 1
LOCAL $TBUFFER = DLLSTRUCTCREATE ("wchar Text[" & $IBUFFER & "]" )
$IBUFFER *= 2
LOCAL $PBUFFER = DLLSTRUCTGETPTR ($TBUFFER )
LOCAL $TITEM = DLLSTRUCTCREATE ($_ARRAYCONSTANT_TAGLVITEM )
LOCAL $IMASK = 1
DLLSTRUCTSETDATA ($TBUFFER , "Text" , $STEXT )
DLLSTRUCTSETDATA ($TITEM , "Mask" , $IMASK )
DLLSTRUCTSETDATA ($TITEM , "Item" , $IINDEX )
DLLSTRUCTSETDATA ($TITEM , "SubItem" , $ISUBITEM )
DLLSTRUCTSETDATA ($TITEM , "Image" , + 4294967295 )
LOCAL $PITEM = DLLSTRUCTGETPTR ($TITEM )
DLLSTRUCTSETDATA ($TITEM , "Text" , $PBUFFER )
LOCAL $IRET = GUICTRLSENDMSG ($HWND , 4172 , 0 , $PITEM )
RETURN $IRET <> 0
ENDFUNC
FUNC __ARRAYDISPLAY_GETCOLUMNCOUNT ($HWND )
LOCAL $HHEADER = HWND (GUICTRLSENDMSG ($HWND , 4127 , 0 , 0 ) )
RETURN __ARRAYDISPLAY_GETITEMCOUNT ($HHEADER )
ENDFUNC
FUNC __ARRAYDISPLAY_GETHEADER ($HWND )
RETURN HWND (GUICTRLSENDMSG ($HWND , 4127 , 0 , 0 ) )
ENDFUNC
FUNC __ARRAYDISPLAY_GETITEM ($HWND , $IINDEX , BYREF $TITEM )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "lresult" , "SendMessageW" , "hwnd" , $HWND , "uint" , 4619 , "wparam" , $IINDEX , "struct*" , $TITEM )
RETURN $ARESULT [0 ] <> 0
ENDFUNC
FUNC __ARRAYDISPLAY_GETITEMCOUNT ($HWND )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "lresult" , "SendMessageW" , "hwnd" , $HWND , "uint" , 4608 , "wparam" , 0 , "lparam" , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC __ARRAYDISPLAY_GETITEMFORMAT ($HWND , $IINDEX )
LOCAL $TITEM = DLLSTRUCTCREATE ($_ARRAYCONSTANT_TAGHDITEM )
DLLSTRUCTSETDATA ($TITEM , "Mask" , 4 )
__ARRAYDISPLAY_GETITEM ($HWND , $IINDEX , $TITEM )
RETURN DLLSTRUCTGETDATA ($TITEM , "Fmt" )
ENDFUNC
FUNC __ARRAYDISPLAY_GETITEMTEXT ($HWND , $IINDEX , $ISUBITEM = 0 )
LOCAL $TBUFFER = DLLSTRUCTCREATE ("wchar Text[4096]" )
LOCAL $PBUFFER = DLLSTRUCTGETPTR ($TBUFFER )
LOCAL $TITEM = DLLSTRUCTCREATE ($_ARRAYCONSTANT_TAGLVITEM )
DLLSTRUCTSETDATA ($TITEM , "SubItem" , $ISUBITEM )
DLLSTRUCTSETDATA ($TITEM , "TextMax" , 4096 )
DLLSTRUCTSETDATA ($TITEM , "Text" , $PBUFFER )
IF ISHWND ($HWND ) THEN
DLLCALL ("user32.dll" , "lresult" , "SendMessageW" , "hwnd" , $HWND , "uint" , 4211 , "wparam" , $IINDEX , "struct*" , $TITEM )
ELSE
LOCAL $PITEM = DLLSTRUCTGETPTR ($TITEM )
GUICTRLSENDMSG ($HWND , 4211 , $IINDEX , $PITEM )
ENDIF
RETURN DLLSTRUCTGETDATA ($TBUFFER , "Text" )
ENDFUNC
FUNC __ARRAYDISPLAY_GETITEMTEXTSTRING ($HWND , $IITEM )
LOCAL $SROW = "" , $SSEPARATORCHAR = OPT ("GUIDataSeparatorChar" )
LOCAL $ISELECTED = $IITEM
FOR $X = 0 TO __ARRAYDISPLAY_GETCOLUMNCOUNT ($HWND ) + 4294967295
$SROW &= __ARRAYDISPLAY_GETITEMTEXT ($HWND , $ISELECTED , $X ) & $SSEPARATORCHAR
NEXT
RETURN STRINGTRIMRIGHT ($SROW , 1 )
ENDFUNC
FUNC __ARRAYDISPLAY_JUSTIFYCOLUMN ($IDLISTVIEW , $IINDEX , $IALIGN = + 4294967295 )
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" )
IF $IALIGN < 0 OR $IALIGN > 2 THEN $IALIGN = 0
DLLSTRUCTSETDATA ($TCOLUMN , "Mask" , 1 )
DLLSTRUCTSETDATA ($TCOLUMN , "Fmt" , $IALIGN )
LOCAL $PCOLUMN = DLLSTRUCTGETPTR ($TCOLUMN )
LOCAL $IRET = GUICTRLSENDMSG ($IDLISTVIEW , 4192 , $IINDEX , $PCOLUMN )
RETURN $IRET <> 0
ENDFUNC
FUNC __ARRAYDISPLAY_SETITEMFORMAT ($HWND , $IINDEX , $IFORMAT )
LOCAL $TITEM = DLLSTRUCTCREATE ($_ARRAYCONSTANT_TAGHDITEM )
DLLSTRUCTSETDATA ($TITEM , "Mask" , 4 )
DLLSTRUCTSETDATA ($TITEM , "Fmt" , $IFORMAT )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "lresult" , "SendMessageW" , "hwnd" , $HWND , "uint" , 4620 , "wparam" , $IINDEX , "struct*" , $TITEM )
RETURN $ARESULT [0 ] <> 0
ENDFUNC
GLOBAL ENUM $ARRAYFILL_FORCE_DEFAULT , $ARRAYFILL_FORCE_SINGLEITEM , $ARRAYFILL_FORCE_INT , $ARRAYFILL_FORCE_NUMBER , $ARRAYFILL_FORCE_PTR , $ARRAYFILL_FORCE_HWND , $ARRAYFILL_FORCE_STRING , $ARRAYFILL_FORCE_BOOLEAN
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 , + 4294967295 )
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
CASE $ARRAYFILL_FORCE_BOOLEAN
$HDATATYPE = "Boolean"
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 , + 4294967295 )
$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 + 4294967295
IF STRING ($HDATATYPE ) = "Boolean" THEN
SWITCH $VVALUE [$I ]
CASE "True" , "1"
$AARRAY [$IDIM_1 + $I ] = TRUE
CASE "False" , "0" , ""
$AARRAY [$IDIM_1 + $I ] = FALSE
ENDSWITCH
ELSEIF ISFUNC ($HDATATYPE ) THEN
$AARRAY [$IDIM_1 + $I ] = $HDATATYPE ($VVALUE [$I ] )
ELSE
$AARRAY [$IDIM_1 + $I ] = $VVALUE [$I ]
ENDIF
NEXT
RETURN $IDIM_1 + $IADD + 4294967295
CASE 2
LOCAL $IDIM_2 = UBOUND ($AARRAY , $UBOUND_COLUMNS )
IF $ISTART < 0 OR $ISTART > $IDIM_2 + 4294967295 THEN RETURN SETERROR (4 , 0 , + 4294967295 )
LOCAL $IVALDIM_1 , $IVALDIM_2 = 0 , $ICOLCOUNT
IF ISARRAY ($VVALUE ) THEN
IF UBOUND ($VVALUE , $UBOUND_DIMENSIONS ) <> 2 THEN RETURN SETERROR (5 , 0 , + 4294967295 )
$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 + 4294967295
$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 + 4294967295
$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 , + 4294967295 )
REDIM $AARRAY [$IDIM_1 + $IVALDIM_1 ] [$IDIM_2 ]
FOR $IWRITETO_INDEX = 0 TO $IVALDIM_1 + 4294967295
FOR $J = 0 TO $IDIM_2 + 4294967295
IF $J < $ISTART THEN
$AARRAY [$IWRITETO_INDEX + $IDIM_1 ] [$J ] = ""
ELSEIF $J - $ISTART > $IVALDIM_2 + 4294967295 THEN
$AARRAY [$IWRITETO_INDEX + $IDIM_1 ] [$J ] = ""
ELSE
IF STRING ($HDATATYPE ) = "Boolean" THEN
SWITCH $VVALUE [$IWRITETO_INDEX ] [$J - $ISTART ]
CASE "True" , "1"
$AARRAY [$IWRITETO_INDEX + $IDIM_1 ] [$J ] = TRUE
CASE "False" , "0" , ""
$AARRAY [$IWRITETO_INDEX + $IDIM_1 ] [$J ] = FALSE
ENDSWITCH
ELSEIF 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 , + 4294967295 )
ENDSWITCH
RETURN UBOUND ($AARRAY , $UBOUND_ROWS ) + 4294967295
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 , + 4294967295 )
LOCAL $IDIM_1 = UBOUND ($AARRAY , $UBOUND_ROWS )
IF $IDIM_1 = 0 THEN RETURN SETERROR (6 , 0 , + 4294967295 )
IF $IEND < 1 OR $IEND > $IDIM_1 + 4294967295 THEN $IEND = $IDIM_1 + 4294967295
IF $ISTART < 0 THEN $ISTART = 0
IF $ISTART > $IEND THEN RETURN SETERROR (4 , 0 , + 4294967295 )
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 , + 4294967295 )
WHILE $ISTART <= $IMID AND $VVALUE <> $AARRAY [$IMID ]
IF $VVALUE < $AARRAY [$IMID ] THEN
$IEND = $IMID + 4294967295
ELSE
$ISTART = $IMID + 1
ENDIF
$IMID = INT (($IEND + $ISTART ) / 2 )
WEND
IF $ISTART > $IEND THEN RETURN SETERROR (3 , 0 , + 4294967295 )
CASE 2
LOCAL $IDIM_2 = UBOUND ($AARRAY , $UBOUND_COLUMNS ) + 4294967295
IF $ICOLUMN < 0 OR $ICOLUMN > $IDIM_2 THEN RETURN SETERROR (7 , 0 , + 4294967295 )
IF $AARRAY [$ISTART ] [$ICOLUMN ] > $VVALUE OR $AARRAY [$IEND ] [$ICOLUMN ] < $VVALUE THEN RETURN SETERROR (2 , 0 , + 4294967295 )
WHILE $ISTART <= $IMID AND $VVALUE <> $AARRAY [$IMID ] [$ICOLUMN ]
IF $VVALUE < $AARRAY [$IMID ] [$ICOLUMN ] THEN
$IEND = $IMID + 4294967295
ELSE
$ISTART = $IMID + 1
ENDIF
$IMID = INT (($IEND + $ISTART ) / 2 )
WEND
IF $ISTART > $IEND THEN RETURN SETERROR (3 , 0 , + 4294967295 )
CASE ELSE
RETURN SETERROR (5 , 0 , + 4294967295 )
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 , + 4294967295 )
LOCAL $IDIM_1 = UBOUND ($AARRAY , $UBOUND_ROWS )
IF UBOUND ($AARRAY , $UBOUND_DIMENSIONS ) <> 2 THEN RETURN SETERROR (2 , 0 , + 4294967295 )
LOCAL $IDIM_2 = UBOUND ($AARRAY , $UBOUND_COLUMNS )
SWITCH $IDIM_2
CASE 2
IF $ICOLUMN < 0 OR $ICOLUMN > 1 THEN RETURN SETERROR (3 , 0 , + 4294967295 )
IF $BCONVERT THEN
LOCAL $ATEMPARRAY [$IDIM_1 ]
FOR $I = 0 TO $IDIM_1 + 4294967295
$ATEMPARRAY [$I ] = $AARRAY [$I ] [(NOT $ICOLUMN ) ]
NEXT
$AARRAY = $ATEMPARRAY
ELSE
CONTINUECASE
ENDIF
CASE ELSE
IF $ICOLUMN < 0 OR $ICOLUMN > $IDIM_2 + 4294967295 THEN RETURN SETERROR (3 , 0 , + 4294967295 )
FOR $I = 0 TO $IDIM_1 + 4294967295
FOR $J = $ICOLUMN TO $IDIM_2 + 4294967294
$AARRAY [$I ] [$J ] = $AARRAY [$I ] [$J + 1 ]
NEXT
NEXT
REDIM $AARRAY [$IDIM_1 ] [$IDIM_2 + 4294967295 ]
ENDSWITCH
RETURN UBOUND ($AARRAY , $UBOUND_COLUMNS )
ENDFUNC
FUNC _ARRAYCOLINSERT (BYREF $AARRAY , $ICOLUMN )
IF NOT ISARRAY ($AARRAY ) THEN RETURN SETERROR (1 , 0 , + 4294967295 )
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 + 4294967295
$ATEMPARRAY [$I ] [(NOT $ICOLUMN ) ] = $AARRAY [$I ]
NEXT
CASE ELSE
RETURN SETERROR (3 , 0 , + 4294967295 )
ENDSWITCH
$AARRAY = $ATEMPARRAY
CASE 2
LOCAL $IDIM_2 = UBOUND ($AARRAY , $UBOUND_COLUMNS )
IF $ICOLUMN < 0 OR $ICOLUMN > $IDIM_2 THEN RETURN SETERROR (3 , 0 , + 4294967295 )
REDIM $AARRAY [$IDIM_1 ] [$IDIM_2 + 1 ]
FOR $I = 0 TO $IDIM_1 + 4294967295
FOR $J = $IDIM_2 TO $ICOLUMN + 1 STEP + 4294967295
$AARRAY [$I ] [$J ] = $AARRAY [$I ] [$J + 4294967295 ]
NEXT
$AARRAY [$I ] [$ICOLUMN ] = ""
NEXT
CASE ELSE
RETURN SETERROR (2 , 0 , + 4294967295 )
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 + 4294967295
$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 + 4294967295
$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 , + 4294967295 )
IF NOT ISARRAY ($AARRAYSOURCE ) THEN RETURN SETERROR (2 , 0 , + 4294967295 )
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 + 4294967295 THEN RETURN SETERROR (6 , 0 , + 4294967295 )
SWITCH $IDIM_TOTAL_TGT
CASE 1
IF $IDIM_TOTAL_SRC <> 1 THEN RETURN SETERROR (4 , 0 , + 4294967295 )
REDIM $AARRAYTARGET [$IDIM_1_TGT + $IDIM_1_SRC - $ISTART ]
FOR $I = $ISTART TO $IDIM_1_SRC + 4294967295
$AARRAYTARGET [$IDIM_1_TGT + $I - $ISTART ] = $AARRAYSOURCE [$I ]
NEXT
CASE 2
IF $IDIM_TOTAL_SRC <> 2 THEN RETURN SETERROR (4 , 0 , + 4294967295 )
LOCAL $IDIM_2_TGT = UBOUND ($AARRAYTARGET , $UBOUND_COLUMNS )
IF UBOUND ($AARRAYSOURCE , $UBOUND_COLUMNS ) <> $IDIM_2_TGT THEN RETURN SETERROR (5 , 0 , + 4294967295 )
REDIM $AARRAYTARGET [$IDIM_1_TGT + $IDIM_1_SRC - $ISTART ] [$IDIM_2_TGT ]
FOR $I = $ISTART TO $IDIM_1_SRC + 4294967295
FOR $J = 0 TO $IDIM_2_TGT + 4294967295
$AARRAYTARGET [$IDIM_1_TGT + $I - $ISTART ] [$J ] = $AARRAYSOURCE [$I ] [$J ]
NEXT
NEXT
CASE ELSE
RETURN SETERROR (3 , 0 , + 4294967295 )
ENDSWITCH
RETURN UBOUND ($AARRAYTARGET , $UBOUND_ROWS )
ENDFUNC
FUNC _ARRAYDELETE (BYREF $AARRAY , $VRANGE )
IF NOT ISARRAY ($AARRAY ) THEN RETURN SETERROR (1 , 0 , + 4294967295 )
LOCAL $IDIM_1 = UBOUND ($AARRAY , $UBOUND_ROWS ) + 4294967295
IF ISARRAY ($VRANGE ) THEN
IF UBOUND ($VRANGE , $UBOUND_DIMENSIONS ) <> 1 OR UBOUND ($VRANGE , $UBOUND_ROWS ) < 2 THEN RETURN SETERROR (4 , 0 , + 4294967295 )
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 , + 4294967295 )
$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 ] + 4294967295
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 , + 4294967295 )
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 ) + 4294967295
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 )
#forceref $vUser_Separator
LOCAL $IRET = __ARRAYDISPLAY_SHARE ($AARRAY , $STITLE , $SARRAYRANGE , $IFLAGS , DEFAULT , $SHEADER , $IMAX_COLWIDTH , 0 , FALSE )
RETURN SETERROR (@ERROR , @EXTENDED , $IRET )
ENDFUNC
FUNC _ARRAYEXTRACT (CONST BYREF $AARRAY , $ISTART_ROW = + 4294967295 , $IEND_ROW = + 4294967295 , $ISTART_COL = + 4294967295 , $IEND_COL = + 4294967295 )
IF $ISTART_ROW = DEFAULT THEN $ISTART_ROW = + 4294967295
IF $IEND_ROW = DEFAULT THEN $IEND_ROW = + 4294967295
IF $ISTART_COL = DEFAULT THEN $ISTART_COL = + 4294967295
IF $IEND_COL = DEFAULT THEN $IEND_COL = + 4294967295
IF NOT ISARRAY ($AARRAY ) THEN RETURN SETERROR (1 , 0 , + 4294967295 )
LOCAL $IDIM_1 = UBOUND ($AARRAY , $UBOUND_ROWS ) + 4294967295
IF $IEND_ROW = + 4294967295 THEN $IEND_ROW = $IDIM_1
IF $ISTART_ROW = + 4294967295 THEN $ISTART_ROW = 0
IF $ISTART_ROW < + 4294967295 OR $IEND_ROW < + 4294967295 THEN RETURN SETERROR (3 , 0 , + 4294967295 )
IF $ISTART_ROW > $IDIM_1 OR $IEND_ROW > $IDIM_1 THEN RETURN SETERROR (3 , 0 , + 4294967295 )
IF $ISTART_ROW > $IEND_ROW THEN RETURN SETERROR (4 , 0 , + 4294967295 )
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 ) + 4294967295
IF $IEND_COL = + 4294967295 THEN $IEND_COL = $IDIM_2
IF $ISTART_COL = + 4294967295 THEN $ISTART_COL = 0
IF $ISTART_COL < + 4294967295 OR $IEND_COL < + 4294967295 THEN RETURN SETERROR (5 , 0 , + 4294967295 )
IF $ISTART_COL > $IDIM_2 OR $IEND_COL > $IDIM_2 THEN RETURN SETERROR (5 , 0 , + 4294967295 )
IF $ISTART_COL > $IEND_COL THEN RETURN SETERROR (6 , 0 , + 4294967295 )
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 , + 4294967295 )
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 , + 4294967295 )
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 , + 4294967295 )
LOCAL $IDIM_1 = UBOUND ($AARRAY , $UBOUND_ROWS ) + 4294967295
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 , + 4294967295 )
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 , + 4294967295 )
$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 ] + 4294967295
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 , + 4294967295 )
FOR $I = 2 TO $VRANGE [0 ]
IF $VRANGE [$I ] < $VRANGE [$I + 4294967295 ] THEN RETURN SETERROR (3 , 0 , + 4294967295 )
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 + 4294967295
$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 , + 4294967295 )
$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 + 4294967295
$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 + 4294967295 ] )
ELSE
$AARRAY [$ICOPYTO_INDEX ] = $VVALUE [$IINSERTPOINT_INDEX + 4294967295 ]
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 + 4294967295 THEN RETURN SETERROR (6 , 0 , + 4294967295 )
LOCAL $IVALDIM_1 , $IVALDIM_2
IF ISARRAY ($VVALUE ) THEN
IF UBOUND ($VVALUE , $UBOUND_DIMENSIONS ) <> 2 THEN RETURN SETERROR (7 , 0 , + 4294967295 )
$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 + 4294967295
$ASPLIT_2 = STRINGSPLIT ($ASPLIT_1 [$I ] , $SDELIM_ITEM , $STR_NOCOUNT + $STR_ENTIRESPLIT )
FOR $J = 0 TO $IVALDIM_2 + 4294967295
$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 , + 4294967295 )
REDIM $AARRAY [$IDIM_1 + $VRANGE [0 ] + 1 ] [$IDIM_2 ]
FOR $IREADFROMINDEX = $IDIM_1 TO 0 STEP + 4294967295
FOR $J = 0 TO $IDIM_2 + 4294967295
$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 + 4294967295
IF $J < $ISTART THEN
$AARRAY [$ICOPYTO_INDEX ] [$J ] = ""
ELSEIF $J - $ISTART > $IVALDIM_2 + 4294967295 THEN
$AARRAY [$ICOPYTO_INDEX ] [$J ] = ""
ELSE
IF $IINSERTPOINT_INDEX + 4294967295 < $IVALDIM_1 THEN
IF ISFUNC ($HDATATYPE ) THEN
$AARRAY [$ICOPYTO_INDEX ] [$J ] = $HDATATYPE ($VVALUE [$IINSERTPOINT_INDEX + 4294967295 ] [$J - $ISTART ] )
ELSE
$AARRAY [$ICOPYTO_INDEX ] [$J ] = $VVALUE [$IINSERTPOINT_INDEX + 4294967295 ] [$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 , + 4294967295 )
ENDSWITCH
RETURN UBOUND ($AARRAY , $UBOUND_ROWS )
ENDFUNC
FUNC _ARRAYMAX (CONST BYREF $AARRAY , $ICOMPNUMERIC = 0 , $ISTART = + 4294967295 , $IEND = + 4294967295 , $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 = + 4294967295 , $IEND = + 4294967295 , $ISUBITEM = 0 )
IF $ICOMPNUMERIC = DEFAULT THEN $ICOMPNUMERIC = 0
IF $ISTART = DEFAULT THEN $ISTART = + 4294967295
IF $IEND = DEFAULT THEN $IEND = + 4294967295
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 = + 4294967295 , $IEND = + 4294967295 , $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 = + 4294967295 , $IEND = + 4294967295 , $ISUBITEM = 0 )
IF $ICOMPNUMERIC = DEFAULT THEN $ICOMPNUMERIC = 0
IF $ISTART = DEFAULT THEN $ISTART = + 4294967295
IF $IEND = DEFAULT THEN $IEND = + 4294967295
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 + 4294967295
$AIDX [$I ] = $I
NEXT
FOR $I = $ISIZE TO 1 STEP + 4294967295
$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 ) + 4294967295
IF $IUBOUND = + 4294967295 THEN RETURN SETERROR (3 , 0 , "" )
LOCAL $SLASTVAL = $AARRAY [$IUBOUND ]
IF $IUBOUND > + 4294967295 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 ) + 4294967295
IF ISARRAY ($VVALUE ) THEN
LOCAL $IUBOUNDS = UBOUND ($VVALUE )
IF ($IUBOUNDS + 4294967295 ) > $IUBOUND THEN RETURN SETERROR (2 , 0 , 0 )
IF $IDIRECTION THEN
FOR $I = $IUBOUND TO $IUBOUNDS STEP + 4294967295
$AARRAY [$I ] = $AARRAY [$I - $IUBOUNDS ]
NEXT
FOR $I = 0 TO $IUBOUNDS + 4294967295
$AARRAY [$I ] = $VVALUE [$I ]
NEXT
ELSE
FOR $I = 0 TO $IUBOUND - $IUBOUNDS
$AARRAY [$I ] = $AARRAY [$I + $IUBOUNDS ]
NEXT
FOR $I = 0 TO $IUBOUNDS + 4294967295
$AARRAY [$I + $IUBOUND - $IUBOUNDS + 1 ] = $VVALUE [$I ]
NEXT
ENDIF
ELSE
IF $IUBOUND > + 4294967295 THEN
IF $IDIRECTION THEN
FOR $I = $IUBOUND TO 1 STEP + 4294967295
$AARRAY [$I ] = $AARRAY [$I + 4294967295 ]
NEXT
$AARRAY [0 ] = $VVALUE
ELSE
FOR $I = 0 TO $IUBOUND + 4294967295
$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 ) + 4294967295
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 + 4294967295 ) / 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 = + 4294967295 , $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 = + 4294967295
IF $BROW = DEFAULT THEN $BROW = FALSE
IF NOT ISARRAY ($AARRAY ) THEN RETURN SETERROR (1 , 0 , + 4294967295 )
LOCAL $IDIM_1 = UBOUND ($AARRAY ) + 4294967295
IF $IDIM_1 = + 4294967295 THEN RETURN SETERROR (3 , 0 , + 4294967295 )
LOCAL $IDIM_2 = UBOUND ($AARRAY , $UBOUND_COLUMNS ) + 4294967295
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 , + 4294967295 )
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 , + 4294967295 )
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 , + 4294967295 )
ENDIF
LOCAL $ISTEP = 1
IF NOT $IFORWARD THEN
LOCAL $ITMP = $ISTART
$ISTART = $IEND
$IEND = $ITMP
$ISTEP = + 4294967295
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 ] [$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
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 , + 4294967295 )
ENDSWITCH
RETURN SETERROR (6 , 0 , + 4294967295 )
ENDFUNC
FUNC _ARRAYSHUFFLE (BYREF $AARRAY , $ISTART_ROW = 0 , $IEND_ROW = 0 , $ICOL = + 4294967295 )
IF $ISTART_ROW = DEFAULT THEN $ISTART_ROW = 0
IF $IEND_ROW = DEFAULT THEN $IEND_ROW = 0
IF $ICOL = DEFAULT THEN $ICOL = + 4294967295
IF NOT ISARRAY ($AARRAY ) THEN RETURN SETERROR (1 , 0 , + 4294967295 )
LOCAL $IDIM_1 = UBOUND ($AARRAY , $UBOUND_ROWS )
IF $IEND_ROW = 0 THEN $IEND_ROW = $IDIM_1 + 4294967295
IF $ISTART_ROW < 0 OR $ISTART_ROW > $IDIM_1 + 4294967295 THEN RETURN SETERROR (3 , 0 , + 4294967295 )
IF $IEND_ROW < 1 OR $IEND_ROW > $IDIM_1 + 4294967295 THEN RETURN SETERROR (3 , 0 , + 4294967295 )
IF $ISTART_ROW > $IEND_ROW THEN RETURN SETERROR (4 , 0 , + 4294967295 )
LOCAL $VTMP , $IRAND
SWITCH UBOUND ($AARRAY , $UBOUND_DIMENSIONS )
CASE 1
FOR $I = $IEND_ROW TO $ISTART_ROW + 1 STEP + 4294967295
$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 < + 4294967295 OR $ICOL > $IDIM_2 + 4294967295 THEN RETURN SETERROR (5 , 0 , + 4294967295 )
LOCAL $ICOL_START , $ICOL_END
IF $ICOL = + 4294967295 THEN
$ICOL_START = 0
$ICOL_END = $IDIM_2 + 4294967295
ELSE
$ICOL_START = $ICOL
$ICOL_END = $ICOL
ENDIF
FOR $I = $IEND_ROW TO $ISTART_ROW + 1 STEP + 4294967295
$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 , + 4294967295 )
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 ) + 4294967295
IF $IUBOUND = + 4294967295 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 )
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 ) + 4294967295
IF $ISUBITEM > $ISUBMAX THEN RETURN SETERROR (3 , 0 , 0 )
IF $IDESCENDING THEN
$IDESCENDING = + 4294967295
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 + 4294967295 TO $ISTART STEP + 4294967295
$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 + 4294967295 TO $ISTART STEP + 4294967295
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 + 4294967295 ] 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 + 4294967295 ]
$AARRAY [$ILESS + 4294967295 ] = $IPIVOT_1
$AARRAY [$IPIVOT_RIGHT ] = $AARRAY [$IGREATER + 1 ]
$AARRAY [$IGREATER + 1 ] = $IPIVOT_2
__ARRAYDUALPIVOTSORT ($AARRAY , $IPIVOT_LEFT , $ILESS + 4294967294 , 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 + 4294967295 , TRUE )
__ARRAYDUALPIVOTSORT ($AARRAY , $IGREATER + 1 , $IPIVOT_RIGHT , FALSE )
ENDIF
ENDFUNC
FUNC _ARRAYSWAP (BYREF $AARRAY , $IINDEX_1 , $IINDEX_2 , $BCOL = FALSE , $ISTART = + 4294967295 , $IEND = + 4294967295 )
IF $BCOL = DEFAULT THEN $BCOL = FALSE
IF $ISTART = DEFAULT THEN $ISTART = + 4294967295
IF $IEND = DEFAULT THEN $IEND = + 4294967295
IF NOT ISARRAY ($AARRAY ) THEN RETURN SETERROR (1 , 0 , + 4294967295 )
LOCAL $IDIM_1 = UBOUND ($AARRAY , $UBOUND_ROWS ) + 4294967295
LOCAL $IDIM_2 = UBOUND ($AARRAY , $UBOUND_COLUMNS ) + 4294967295
IF $IDIM_2 = + 4294967295 THEN
$BCOL = FALSE
$ISTART = + 4294967295
$IEND = + 4294967295
ENDIF
IF $ISTART > $IEND THEN RETURN SETERROR (5 , 0 , + 4294967295 )
IF $BCOL THEN
IF $IINDEX_1 < 0 OR $IINDEX_2 > $IDIM_2 THEN RETURN SETERROR (3 , 0 , + 4294967295 )
IF $ISTART = + 4294967295 THEN $ISTART = 0
IF $IEND = + 4294967295 THEN $IEND = $IDIM_1
ELSE
IF $IINDEX_1 < 0 OR $IINDEX_2 > $IDIM_1 THEN RETURN SETERROR (3 , 0 , + 4294967295 )
IF $ISTART = + 4294967295 THEN $ISTART = 0
IF $IEND = + 4294967295 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 < + 4294967295 OR $IEND < + 4294967295 THEN RETURN SETERROR (4 , 0 , + 4294967295 )
IF $BCOL THEN
IF $ISTART > $IDIM_1 OR $IEND > $IDIM_1 THEN RETURN SETERROR (4 , 0 , + 4294967295 )
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 , + 4294967295 )
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 , + 4294967295 )
ENDSWITCH
RETURN 1
ENDFUNC
FUNC _ARRAYTOCLIP (CONST BYREF $AARRAY , $SDELIM_COL = "|" , $ISTART_ROW = + 4294967295 , $IEND_ROW = + 4294967295 , $SDELIM_ROW = @CRLF , $ISTART_COL = + 4294967295 , $IEND_COL = + 4294967295 )
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 (+ 4294967295 , 0 , 0 )
ENDFUNC
FUNC _ARRAYTOSTRING (CONST BYREF $AARRAY , $SDELIM_COL = "|" , $ISTART_ROW = + 4294967295 , $IEND_ROW = + 4294967295 , $SDELIM_ROW = @CRLF , $ISTART_COL = + 4294967295 , $IEND_COL = + 4294967295 )
IF $SDELIM_COL = DEFAULT THEN $SDELIM_COL = "|"
IF $SDELIM_ROW = DEFAULT THEN $SDELIM_ROW = @CRLF
IF $ISTART_ROW = DEFAULT THEN $ISTART_ROW = + 4294967295
IF $IEND_ROW = DEFAULT THEN $IEND_ROW = + 4294967295
IF $ISTART_COL = DEFAULT THEN $ISTART_COL = + 4294967295
IF $IEND_COL = DEFAULT THEN $IEND_COL = + 4294967295
IF NOT ISARRAY ($AARRAY ) THEN RETURN SETERROR (1 , 0 , + 4294967295 )
LOCAL $IDIM_1 = UBOUND ($AARRAY , $UBOUND_ROWS ) + 4294967295
IF $ISTART_ROW = + 4294967295 THEN $ISTART_ROW = 0
IF $IEND_ROW = + 4294967295 THEN $IEND_ROW = $IDIM_1
IF $ISTART_ROW < + 4294967295 OR $IEND_ROW < + 4294967295 THEN RETURN SETERROR (3 , 0 , + 4294967295 )
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 , + 4294967295 )
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 ) + 4294967295
IF $ISTART_COL = + 4294967295 THEN $ISTART_COL = 0
IF $IEND_COL = + 4294967295 THEN $IEND_COL = $IDIM_2
IF $ISTART_COL < + 4294967295 OR $IEND_COL < + 4294967295 THEN RETURN SETERROR (5 , 0 , + 4294967295 )
IF $ISTART_COL > $IDIM_2 OR $IEND_COL > $IDIM_2 THEN RETURN SETERROR (5 , 0 , + 4294967295 )
IF $ISTART_COL > $IEND_COL THEN RETURN SETERROR (6 , 0 , + 4294967295 )
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 , + 4294967295 )
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 ) + 4294967295
$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 + 4294967295
FOR $J = 0 TO $IDIM_2 + 4294967295
$ATEMP [$J ] [$I ] = $AARRAY [$I ] [$J ]
NEXT
NEXT
$AARRAY = $ATEMP
ELSE
LOCAL $VELEMENT
FOR $I = 0 TO $IDIM_1 + 4294967295
FOR $J = $I + 1 TO $IDIM_2 + 4294967295
$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 ) + 4294967295
IF $IEND = 0 THEN $IEND = $IDIM_1
IF $ISTART > $IEND THEN RETURN SETERROR (3 , 0 , + 4294967295 )
IF $ISTART < 0 OR $IEND < 0 THEN RETURN SETERROR (3 , 0 , + 4294967295 )
IF $ISTART > $IDIM_1 OR $IEND > $IDIM_1 THEN RETURN SETERROR (3 , 0 , + 4294967295 )
IF $ISTART > $IEND THEN RETURN SETERROR (4 , 0 , + 4294967295 )
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 ) + 4294967295
IF $ISUBITEM < 0 OR $ISUBITEM > $IDIM_2 THEN RETURN SETERROR (5 , 0 , + 4294967295 )
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 $BINT , $SVARTYPE
IF $IDIMS = 1 THEN
$BINT = ISINT ($AARRAY [$IBASE ] )
$SVARTYPE = VARGETTYPE ($AARRAY [$IBASE ] )
ELSE
$BINT = ISINT ($AARRAY [$IBASE ] [$ICOLUMN ] )
$SVARTYPE = VARGETTYPE ($AARRAY [$IBASE ] [$ICOLUMN ] )
ENDIF
IF $BINT AND $SVARTYPE = "Int64" THEN
$IINTTYPE = $ARRAYUNIQUE_FORCE64
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 ) + 4294967295
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 ) + 4294967295
$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 ) + 4294967295
$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 + 4294967295 THEN
FOR $I = 0 TO $ISIZE + 4294967295
$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 + 4294967295
$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 + 4294967295
$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 + 4294967295
WHILE $AIDX [$I ] == $IN - $IR + $I
$I -= 1
WEND
$AIDX [$I ] += 1
FOR $J = $I + 1 TO $IR + 4294967295
$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 , + 4294967295 )
LOCAL $IDIM_1 = UBOUND ($AARRAY , $UBOUND_ROWS ) + 4294967295
IF $IDIM_1 < 0 THEN RETURN SETERROR (1 , 0 , + 4294967295 )
IF $IEND = + 4294967295 THEN $IEND = $IDIM_1
IF $ISTART = + 4294967295 THEN $ISTART = 0
IF $ISTART < + 4294967295 OR $IEND < + 4294967295 THEN RETURN SETERROR (3 , 0 , + 4294967295 )
IF $ISTART > $IDIM_1 OR $IEND > $IDIM_1 THEN RETURN SETERROR (3 , 0 , + 4294967295 )
IF $ISTART > $IEND THEN RETURN SETERROR (4 , 0 , + 4294967295 )
IF $IDIM_1 < 0 THEN RETURN SETERROR (5 , 0 , + 4294967295 )
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 ) + 4294967295 THEN RETURN SETERROR (6 , 0 , + 4294967295 )
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 , + 4294967295 )
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 $FW_DONTCARE = 0
GLOBAL CONST $FW_THIN = 100
GLOBAL CONST $FW_EXTRALIGHT = 200
GLOBAL CONST $FW_ULTRALIGHT = 200
GLOBAL CONST $FW_LIGHT = 300
GLOBAL CONST $FW_NORMAL = 400
GLOBAL CONST $FW_REGULAR = 400
GLOBAL CONST $FW_MEDIUM = 500
GLOBAL CONST $FW_SEMIBOLD = 600
GLOBAL CONST $FW_DEMIBOLD = 600
GLOBAL CONST $FW_BOLD = 700
GLOBAL CONST $FW_EXTRABOLD = 800
GLOBAL CONST $FW_ULTRABOLD = 800
GLOBAL CONST $FW_HEAVY = 900
GLOBAL CONST $FW_BLACK = 900
GLOBAL CONST $CF_EFFECTS = 256
GLOBAL CONST $CF_PRINTERFONTS = 2
GLOBAL CONST $CF_SCREENFONTS = 1
GLOBAL CONST $CF_NOSCRIPTSEL = 8388608
GLOBAL CONST $CF_INITTOLOGFONTSTRUCT = 64
GLOBAL CONST $LOGPIXELSX = 88
GLOBAL CONST $LOGPIXELSY = 90
GLOBAL CONST $ANSI_CHARSET = 0
GLOBAL CONST $ARABIC_CHARSET = 178
GLOBAL CONST $BALTIC_CHARSET = 186
GLOBAL CONST $CHINESEBIG5_CHARSET = 136
GLOBAL CONST $DEFAULT_CHARSET = 1
GLOBAL CONST $EASTEUROPE_CHARSET = 238
GLOBAL CONST $GB2312_CHARSET = 134
GLOBAL CONST $GREEK_CHARSET = 161
GLOBAL CONST $HANGEUL_CHARSET = 129
GLOBAL CONST $HEBREW_CHARSET = 177
GLOBAL CONST $JOHAB_CHARSET = 130
GLOBAL CONST $MAC_CHARSET = 77
GLOBAL CONST $OEM_CHARSET = 255
GLOBAL CONST $RUSSIAN_CHARSET = 204
GLOBAL CONST $SHIFTJIS_CHARSET = 128
GLOBAL CONST $SYMBOL_CHARSET = 2
GLOBAL CONST $THAI_CHARSET = 222
GLOBAL CONST $TURKISH_CHARSET = 162
GLOBAL CONST $VIETNAMESE_CHARSET = 163
GLOBAL CONST $OUT_CHARACTER_PRECIS = 2
GLOBAL CONST $OUT_DEFAULT_PRECIS = 0
GLOBAL CONST $OUT_DEVICE_PRECIS = 5
GLOBAL CONST $OUT_OUTLINE_PRECIS = 8
GLOBAL CONST $OUT_PS_ONLY_PRECIS = 10
GLOBAL CONST $OUT_RASTER_PRECIS = 6
GLOBAL CONST $OUT_STRING_PRECIS = 1
GLOBAL CONST $OUT_STROKE_PRECIS = 3
GLOBAL CONST $OUT_TT_ONLY_PRECIS = 7
GLOBAL CONST $OUT_TT_PRECIS = 4
GLOBAL CONST $CLIP_CHARACTER_PRECIS = 1
GLOBAL CONST $CLIP_DEFAULT_PRECIS = 0
GLOBAL CONST $CLIP_DFA_DISABLE = 48
GLOBAL CONST $CLIP_EMBEDDED = 128
GLOBAL CONST $CLIP_LH_ANGLES = 16
GLOBAL CONST $CLIP_MASK = 15
GLOBAL CONST $CLIP_DFA_OVERRIDE = 64
GLOBAL CONST $CLIP_STROKE_PRECIS = 2
GLOBAL CONST $CLIP_TT_ALWAYS = 32
GLOBAL CONST $ANTIALIASED_QUALITY = 4
GLOBAL CONST $DEFAULT_QUALITY = 0
GLOBAL CONST $DRAFT_QUALITY = 1
GLOBAL CONST $NONANTIALIASED_QUALITY = 3
GLOBAL CONST $PROOF_QUALITY = 2
GLOBAL CONST $CLEARTYPE_QUALITY = 5
GLOBAL CONST $DEFAULT_PITCH = 0
GLOBAL CONST $FIXED_PITCH = 1
GLOBAL CONST $VARIABLE_PITCH = 2
GLOBAL CONST $FF_DECORATIVE = 80
GLOBAL CONST $FF_DONTCARE = 0
GLOBAL CONST $FF_MODERN = 48
GLOBAL CONST $FF_ROMAN = 16
GLOBAL CONST $FF_SCRIPT = 64
GLOBAL CONST $FF_SWISS = 32
GLOBAL CONST $FS_REGULAR = 0
GLOBAL CONST $FS_BOLD = 1
GLOBAL CONST $FS_ITALIC = 2
GLOBAL CONST $__MISCCONSTANT_CC_ANYCOLOR = 256
GLOBAL CONST $__MISCCONSTANT_CC_FULLOPEN = 2
GLOBAL CONST $__MISCCONSTANT_CC_RGBINIT = 1
GLOBAL CONST $TAGCHOOSECOLOR = "dword Size;hwnd hWndOwnder;handle hInstance;dword rgbResult;ptr CustColors;dword Flags;lparam lCustData;" & "ptr lpfnHook;ptr lpTemplateName"
GLOBAL CONST $TAGCHOOSEFONT = "dword Size;hwnd hWndOwner;handle hDC;ptr LogFont;int PointSize;dword Flags;dword rgbColors;lparam CustData;" & "ptr fnHook;ptr TemplateName;handle hInstance;ptr szStyle;word FontType;int SizeMin;int SizeMax"
FUNC _CHOOSECOLOR ($IRETURNTYPE = 0 , $ICOLORREF = 0 , $IREFTYPE = 0 , $HWNDOWNDER = 0 )
LOCAL $TAGCUSTCOLORS = "dword[16]"
LOCAL $TCHOOSE = DLLSTRUCTCREATE ($TAGCHOOSECOLOR )
LOCAL $TCC = DLLSTRUCTCREATE ($TAGCUSTCOLORS )
IF $IREFTYPE = 1 THEN
$ICOLORREF = INT ($ICOLORREF )
ELSEIF $IREFTYPE = 2 THEN
$ICOLORREF = HEX (STRING ($ICOLORREF ) , 6 )
$ICOLORREF = "0x" & STRINGMID ($ICOLORREF , 5 , 2 ) & STRINGMID ($ICOLORREF , 3 , 2 ) & STRINGMID ($ICOLORREF , 1 , 2 )
ENDIF
DLLSTRUCTSETDATA ($TCHOOSE , "Size" , DLLSTRUCTGETSIZE ($TCHOOSE ) )
DLLSTRUCTSETDATA ($TCHOOSE , "hWndOwnder" , $HWNDOWNDER )
DLLSTRUCTSETDATA ($TCHOOSE , "rgbResult" , $ICOLORREF )
DLLSTRUCTSETDATA ($TCHOOSE , "CustColors" , DLLSTRUCTGETPTR ($TCC ) )
DLLSTRUCTSETDATA ($TCHOOSE , "Flags" , BITOR ($__MISCCONSTANT_CC_ANYCOLOR , $__MISCCONSTANT_CC_FULLOPEN , $__MISCCONSTANT_CC_RGBINIT ) )
LOCAL $ARESULT = DLLCALL ("comdlg32.dll" , "bool" , "ChooseColor" , "struct*" , $TCHOOSE )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , + 4294967295 )
IF $ARESULT [0 ] = 0 THEN RETURN SETERROR (+ 4294967293 , + 4294967293 , + 4294967295 )
LOCAL $SCOLOR_PICKED = DLLSTRUCTGETDATA ($TCHOOSE , "rgbResult" )
IF $IRETURNTYPE = 1 THEN
RETURN "0x" & HEX (STRING ($SCOLOR_PICKED ) , 6 )
ELSEIF $IRETURNTYPE = 2 THEN
$SCOLOR_PICKED = HEX (STRING ($SCOLOR_PICKED ) , 6 )
RETURN "0x" & STRINGMID ($SCOLOR_PICKED , 5 , 2 ) & STRINGMID ($SCOLOR_PICKED , 3 , 2 ) & STRINGMID ($SCOLOR_PICKED , 1 , 2 )
ELSEIF $IRETURNTYPE = 0 THEN
RETURN $SCOLOR_PICKED
ELSE
RETURN SETERROR (+ 4294967292 , + 4294967292 , + 4294967295 )
ENDIF
ENDFUNC
FUNC _CHOOSEFONT ($SFONTNAME = "Courier New" , $IPOINTSIZE = 10 , $IFONTCOLORREF = 0 , $IFONTWEIGHT = 0 , $BITALIC = FALSE , $BUNDERLINE = FALSE , $BSTRIKETHRU = FALSE , $HWNDOWNER = 0 )
LOCAL $IITALIC = 0 , $IUNDERLINE = 0 , $ISTRIKEOUT = 0
$IFONTCOLORREF = BITOR (BITSHIFT (BITAND ($IFONTCOLORREF , 255 ) , + 4294967280 ) , BITAND ($IFONTCOLORREF , 65280 ) , BITSHIFT (BITAND ($IFONTCOLORREF , 16711680 ) , 16 ) )
LOCAL $HDC = __MISC_GETDC (0 )
LOCAL $IHEIGHT = ROUND (($IPOINTSIZE * __MISC_GETDEVICECAPS ($HDC , $LOGPIXELSX ) ) / 72 , 0 )
__MISC_RELEASEDC (0 , $HDC )
LOCAL $TCHOOSEFONT = DLLSTRUCTCREATE ($TAGCHOOSEFONT )
LOCAL $TLOGFONT = DLLSTRUCTCREATE ($TAGLOGFONT )
DLLSTRUCTSETDATA ($TCHOOSEFONT , "Size" , DLLSTRUCTGETSIZE ($TCHOOSEFONT ) )
DLLSTRUCTSETDATA ($TCHOOSEFONT , "hWndOwner" , $HWNDOWNER )
DLLSTRUCTSETDATA ($TCHOOSEFONT , "LogFont" , DLLSTRUCTGETPTR ($TLOGFONT ) )
DLLSTRUCTSETDATA ($TCHOOSEFONT , "PointSize" , $IPOINTSIZE )
DLLSTRUCTSETDATA ($TCHOOSEFONT , "Flags" , BITOR ($CF_SCREENFONTS , $CF_PRINTERFONTS , $CF_EFFECTS , $CF_INITTOLOGFONTSTRUCT , $CF_NOSCRIPTSEL ) )
DLLSTRUCTSETDATA ($TCHOOSEFONT , "rgbColors" , $IFONTCOLORREF )
DLLSTRUCTSETDATA ($TCHOOSEFONT , "FontType" , 0 )
DLLSTRUCTSETDATA ($TLOGFONT , "Height" , $IHEIGHT )
DLLSTRUCTSETDATA ($TLOGFONT , "Weight" , $IFONTWEIGHT )
DLLSTRUCTSETDATA ($TLOGFONT , "Italic" , $BITALIC )
DLLSTRUCTSETDATA ($TLOGFONT , "Underline" , $BUNDERLINE )
DLLSTRUCTSETDATA ($TLOGFONT , "Strikeout" , $BSTRIKETHRU )
DLLSTRUCTSETDATA ($TLOGFONT , "FaceName" , $SFONTNAME )
LOCAL $ARESULT = DLLCALL ("comdlg32.dll" , "bool" , "ChooseFontW" , "struct*" , $TCHOOSEFONT )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , + 4294967295 )
IF $ARESULT [0 ] = 0 THEN RETURN SETERROR (+ 4294967293 , + 4294967293 , + 4294967295 )
LOCAL $SFACENAME = DLLSTRUCTGETDATA ($TLOGFONT , "FaceName" )
IF STRINGLEN ($SFACENAME ) = 0 AND STRINGLEN ($SFONTNAME ) > 0 THEN $SFACENAME = $SFONTNAME
IF DLLSTRUCTGETDATA ($TLOGFONT , "Italic" ) THEN $IITALIC = 2
IF DLLSTRUCTGETDATA ($TLOGFONT , "Underline" ) THEN $IUNDERLINE = 4
IF DLLSTRUCTGETDATA ($TLOGFONT , "Strikeout" ) THEN $ISTRIKEOUT = 8
LOCAL $IATTRIBUTES = BITOR ($IITALIC , $IUNDERLINE , $ISTRIKEOUT )
LOCAL $ISIZE = DLLSTRUCTGETDATA ($TCHOOSEFONT , "PointSize" ) / 10
LOCAL $ICOLORREF = DLLSTRUCTGETDATA ($TCHOOSEFONT , "rgbColors" )
LOCAL $IWEIGHT = DLLSTRUCTGETDATA ($TLOGFONT , "Weight" )
LOCAL $SCOLOR_PICKED = HEX (STRING ($ICOLORREF ) , 6 )
RETURN STRINGSPLIT ($IATTRIBUTES & "," & $SFACENAME & "," & $ISIZE & "," & $IWEIGHT & "," & $ICOLORREF & "," & "0x" & $SCOLOR_PICKED & "," & "0x" & STRINGMID ($SCOLOR_PICKED , 5 , 2 ) & STRINGMID ($SCOLOR_PICKED , 3 , 2 ) & STRINGMID ($SCOLOR_PICKED , 1 , 2 ) , "," )
ENDFUNC
FUNC _CLIPPUTFILE ($SFILEPATH , $SDELIMITER = "|" )
LOCAL CONST $GMEM_MOVEABLE = 2 , $CF_HDROP = 15
$SFILEPATH &= $SDELIMITER & $SDELIMITER
LOCAL $NGLOBMEMSIZE = 2 * (STRINGLEN ($SFILEPATH ) + 20 )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "bool" , "OpenClipboard" , "hwnd" , 0 )
IF @ERROR OR $ARESULT [0 ] = 0 THEN RETURN SETERROR (1 , _WINAPI_GETLASTERROR () , FALSE )
LOCAL $IERROR = 0 , $ILASTERROR = 0
$ARESULT = DLLCALL ("user32.dll" , "bool" , "EmptyClipboard" )
IF @ERROR OR NOT $ARESULT [0 ] THEN
$IERROR = 2
$ILASTERROR = _WINAPI_GETLASTERROR ()
ELSE
$ARESULT = DLLCALL ("kernel32.dll" , "handle" , "GlobalAlloc" , "uint" , $GMEM_MOVEABLE , "ulong_ptr" , $NGLOBMEMSIZE )
IF @ERROR OR NOT $ARESULT [0 ] THEN
$IERROR = 3
$ILASTERROR = _WINAPI_GETLASTERROR ()
ELSE
LOCAL $HGLOBAL = $ARESULT [0 ]
$ARESULT = DLLCALL ("kernel32.dll" , "ptr" , "GlobalLock" , "handle" , $HGLOBAL )
IF @ERROR OR NOT $ARESULT [0 ] THEN
$IERROR = 4
$ILASTERROR = _WINAPI_GETLASTERROR ()
ELSE
LOCAL $HLOCK = $ARESULT [0 ]
LOCAL $TDROPFILES = DLLSTRUCTCREATE ("dword pFiles;" & $TAGPOINT & ";bool fNC;bool fWide;wchar[" & STRINGLEN ($SFILEPATH ) + 1 & "]" , $HLOCK )
IF @ERROR THEN RETURN SETERROR (5 , 6 , FALSE )
LOCAL $TSTRUCT = DLLSTRUCTCREATE ("dword;long;long;bool;bool" )
DLLSTRUCTSETDATA ($TDROPFILES , "pFiles" , DLLSTRUCTGETSIZE ($TSTRUCT ) )
DLLSTRUCTSETDATA ($TDROPFILES , "X" , 0 )
DLLSTRUCTSETDATA ($TDROPFILES , "Y" , 0 )
DLLSTRUCTSETDATA ($TDROPFILES , "fNC" , 0 )
DLLSTRUCTSETDATA ($TDROPFILES , "fWide" , 1 )
DLLSTRUCTSETDATA ($TDROPFILES , 6 , $SFILEPATH )
FOR $I = 1 TO STRINGLEN ($SFILEPATH )
IF DLLSTRUCTGETDATA ($TDROPFILES , 6 , $I ) = $SDELIMITER THEN DLLSTRUCTSETDATA ($TDROPFILES , 6 , CHR (0 ) , $I )
NEXT
$ARESULT = DLLCALL ("user32.dll" , "handle" , "SetClipboardData" , "uint" , $CF_HDROP , "handle" , $HGLOBAL )
IF @ERROR OR NOT $ARESULT [0 ] THEN
$IERROR = 6
$ILASTERROR = _WINAPI_GETLASTERROR ()
ENDIF
$ARESULT = DLLCALL ("kernel32.dll" , "bool" , "GlobalUnlock" , "handle" , $HGLOBAL )
IF (@ERROR OR NOT $ARESULT [0 ] ) AND NOT $IERROR AND _WINAPI_GETLASTERROR () THEN
$IERROR = 8
$ILASTERROR = _WINAPI_GETLASTERROR ()
ENDIF
ENDIF
$ARESULT = DLLCALL ("kernel32.dll" , "ptr" , "GlobalFree" , "handle" , $HGLOBAL )
IF (@ERROR OR $ARESULT [0 ] ) AND NOT $IERROR THEN
$IERROR = 9
$ILASTERROR = _WINAPI_GETLASTERROR ()
ENDIF
ENDIF
ENDIF
$ARESULT = DLLCALL ("user32.dll" , "bool" , "CloseClipboard" )
IF (@ERROR OR NOT $ARESULT [0 ] ) AND NOT $IERROR THEN RETURN SETERROR (7 , _WINAPI_GETLASTERROR () , FALSE )
IF $IERROR THEN RETURN SETERROR ($IERROR , $ILASTERROR , FALSE )
RETURN TRUE
ENDFUNC
FUNC _MOUSETRAP ($ILEFT = 0 , $ITOP = 0 , $IRIGHT = 0 , $IBOTTOM = 0 )
LOCAL $ARETURN = 0
IF $ILEFT = DEFAULT THEN $ILEFT = 0
IF $ITOP = DEFAULT THEN $ITOP = 0
IF $IRIGHT = DEFAULT THEN $IRIGHT = 0
IF $IBOTTOM = DEFAULT THEN $IBOTTOM = 0
IF @NUMPARAMS = 0 THEN
$ARETURN = DLLCALL ("user32.dll" , "bool" , "ClipCursor" , "ptr" , 0 )
IF @ERROR OR NOT $ARETURN [0 ] THEN RETURN SETERROR (1 , _WINAPI_GETLASTERROR () , FALSE )
ELSE
IF @NUMPARAMS = 2 THEN
$IRIGHT = $ILEFT + 1
$IBOTTOM = $ITOP + 1
ENDIF
LOCAL $TRECT = DLLSTRUCTCREATE ($TAGRECT )
DLLSTRUCTSETDATA ($TRECT , "Left" , $ILEFT )
DLLSTRUCTSETDATA ($TRECT , "Top" , $ITOP )
DLLSTRUCTSETDATA ($TRECT , "Right" , $IRIGHT )
DLLSTRUCTSETDATA ($TRECT , "Bottom" , $IBOTTOM )
$ARETURN = DLLCALL ("user32.dll" , "bool" , "ClipCursor" , "struct*" , $TRECT )
IF @ERROR OR NOT $ARETURN [0 ] THEN RETURN SETERROR (2 , _WINAPI_GETLASTERROR () , FALSE )
ENDIF
RETURN TRUE
ENDFUNC
FUNC _SINGLETON ($SOCCURRENCENAME , $IFLAG = 0 )
LOCAL CONST $ERROR_ALREADY_EXISTS = 183
LOCAL CONST $SECURITY_DESCRIPTOR_REVISION = 1
LOCAL $TSECURITYATTRIBUTES = 0
IF BITAND ($IFLAG , 2 ) THEN
LOCAL $TSECURITYDESCRIPTOR = DLLSTRUCTCREATE ("byte;byte;word;ptr[4]" )
LOCAL $ARET = DLLCALL ("advapi32.dll" , "bool" , "InitializeSecurityDescriptor" , "struct*" , $TSECURITYDESCRIPTOR , "dword" , $SECURITY_DESCRIPTOR_REVISION )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
IF $ARET [0 ] THEN
$ARET = DLLCALL ("advapi32.dll" , "bool" , "SetSecurityDescriptorDacl" , "struct*" , $TSECURITYDESCRIPTOR , "bool" , 1 , "ptr" , 0 , "bool" , 0 )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
IF $ARET [0 ] THEN
$TSECURITYATTRIBUTES = DLLSTRUCTCREATE ($TAGSECURITY_ATTRIBUTES )
DLLSTRUCTSETDATA ($TSECURITYATTRIBUTES , 1 , DLLSTRUCTGETSIZE ($TSECURITYATTRIBUTES ) )
DLLSTRUCTSETDATA ($TSECURITYATTRIBUTES , 2 , DLLSTRUCTGETPTR ($TSECURITYDESCRIPTOR ) )
DLLSTRUCTSETDATA ($TSECURITYATTRIBUTES , 3 , 0 )
ENDIF
ENDIF
ENDIF
LOCAL $AHANDLE = DLLCALL ("kernel32.dll" , "handle" , "CreateMutexW" , "struct*" , $TSECURITYATTRIBUTES , "bool" , 1 , "wstr" , $SOCCURRENCENAME )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
LOCAL $ALASTERROR = DLLCALL ("kernel32.dll" , "dword" , "GetLastError" )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
IF $ALASTERROR [0 ] = $ERROR_ALREADY_EXISTS THEN
IF BITAND ($IFLAG , 1 ) THEN
DLLCALL ("kernel32.dll" , "bool" , "CloseHandle" , "handle" , $AHANDLE [0 ] )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN SETERROR ($ALASTERROR [0 ] , $ALASTERROR [0 ] , 0 )
ELSE
EXIT + 4294967295
ENDIF
ENDIF
RETURN $AHANDLE [0 ]
ENDFUNC
FUNC _ISPRESSED ($SHEXKEY , $VDLL = "user32.dll" )
LOCAL $ARETURN = DLLCALL ($VDLL , "short" , "GetAsyncKeyState" , "int" , "0x" & $SHEXKEY )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN BITAND ($ARETURN [0 ] , 32768 ) <> 0
ENDFUNC
FUNC _VERSIONCOMPARE ($SVERSION1 , $SVERSION2 )
IF $SVERSION1 = $SVERSION2 THEN RETURN 0
LOCAL $SSUBVERSION1 = "" , $SSUBVERSION2 = ""
IF STRINGISALPHA (STRINGRIGHT ($SVERSION1 , 1 ) ) THEN
$SSUBVERSION1 = STRINGRIGHT ($SVERSION1 , 1 )
$SVERSION1 = STRINGTRIMRIGHT ($SVERSION1 , 1 )
ENDIF
IF STRINGISALPHA (STRINGRIGHT ($SVERSION2 , 1 ) ) THEN
$SSUBVERSION2 = STRINGRIGHT ($SVERSION2 , 1 )
$SVERSION2 = STRINGTRIMRIGHT ($SVERSION2 , 1 )
ENDIF
LOCAL $AVERSION1 = STRINGSPLIT ($SVERSION1 , ".," ) , $AVERSION2 = STRINGSPLIT ($SVERSION2 , ".," )
LOCAL $IPARTDIFFERENCE = ($AVERSION1 [0 ] - $AVERSION2 [0 ] )
IF $IPARTDIFFERENCE < 0 THEN
REDIM $AVERSION1 [UBOUND ($AVERSION2 ) ]
$AVERSION1 [0 ] = UBOUND ($AVERSION1 ) + 4294967295
FOR $I = (UBOUND ($AVERSION1 ) - ABS ($IPARTDIFFERENCE ) ) TO $AVERSION1 [0 ]
$AVERSION1 [$I ] = "0"
NEXT
ELSEIF $IPARTDIFFERENCE > 0 THEN
REDIM $AVERSION2 [UBOUND ($AVERSION1 ) ]
$AVERSION2 [0 ] = UBOUND ($AVERSION2 ) + 4294967295
FOR $I = (UBOUND ($AVERSION2 ) - ABS ($IPARTDIFFERENCE ) ) TO $AVERSION2 [0 ]
$AVERSION2 [$I ] = "0"
NEXT
ENDIF
FOR $I = 1 TO $AVERSION1 [0 ]
IF STRINGISDIGIT ($AVERSION1 [$I ] ) AND STRINGISDIGIT ($AVERSION2 [$I ] ) THEN
IF NUMBER ($AVERSION1 [$I ] ) > NUMBER ($AVERSION2 [$I ] ) THEN
RETURN SETEXTENDED (2 , 1 )
ELSEIF NUMBER ($AVERSION1 [$I ] ) < NUMBER ($AVERSION2 [$I ] ) THEN
RETURN SETEXTENDED (2 , + 4294967295 )
ELSEIF $I = $AVERSION1 [0 ] THEN
IF $SSUBVERSION1 > $SSUBVERSION2 THEN
RETURN SETEXTENDED (3 , 1 )
ELSEIF $SSUBVERSION1 < $SSUBVERSION2 THEN
RETURN SETEXTENDED (3 , + 4294967295 )
ENDIF
ENDIF
ELSE
IF $AVERSION1 [$I ] > $AVERSION2 [$I ] THEN
RETURN SETEXTENDED (1 , 1 )
ELSEIF $AVERSION1 [$I ] < $AVERSION2 [$I ] THEN
RETURN SETEXTENDED (1 , + 4294967295 )
ENDIF
ENDIF
NEXT
RETURN SETEXTENDED (ABS ($IPARTDIFFERENCE ) , 0 )
ENDFUNC
FUNC __MISC_GETDC ($HWND )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "handle" , "GetDC" , "hwnd" , $HWND )
IF @ERROR OR NOT $ARESULT [0 ] THEN RETURN SETERROR (1 , _WINAPI_GETLASTERROR () , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC __MISC_GETDEVICECAPS ($HDC , $IINDEX )
LOCAL $ARESULT = DLLCALL ("gdi32.dll" , "int" , "GetDeviceCaps" , "handle" , $HDC , "int" , $IINDEX )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC __MISC_RELEASEDC ($HWND , $HDC )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "int" , "ReleaseDC" , "hwnd" , $HWND , "handle" , $HDC )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARESULT [0 ] <> 0
ENDFUNC
GLOBAL CONST $CREATE_BREAKAWAY_FROM_JOB = 16777216
GLOBAL CONST $CREATE_DEFAULT_ERROR_MODE = 67108864
GLOBAL CONST $CREATE_NEW_CONSOLE = 16
GLOBAL CONST $CREATE_NEW_PROCESS_GROUP = 512
GLOBAL CONST $CREATE_NO_WINDOW = 134217728
GLOBAL CONST $CREATE_PROTECTED_PROCESS = 262144
GLOBAL CONST $CREATE_PRESERVE_CODE_AUTHZ_LEVEL = 33554432
GLOBAL CONST $CREATE_SEPARATE_WOW_VDM = 2048
GLOBAL CONST $CREATE_SHARED_WOW_VDM = 4096
GLOBAL CONST $CREATE_SUSPENDED = 4
GLOBAL CONST $CREATE_UNICODE_ENVIRONMENT = 1024
GLOBAL CONST $LIST_MODULES_32BIT = 1
GLOBAL CONST $LIST_MODULES_64BIT = 2
GLOBAL CONST $LIST_MODULES_ALL = 3
GLOBAL CONST $LIST_MODULES_DEFAULT = 0
GLOBAL CONST $ABOVE_NORMAL_PRIORITY_CLASS = 32768
GLOBAL CONST $BELOW_NORMAL_PRIORITY_CLASS = 16384
GLOBAL CONST $HIGH_PRIORITY_CLASS = 128
GLOBAL CONST $IDLE_PRIORITY_CLASS = 64
GLOBAL CONST $NORMAL_PRIORITY_CLASS = 32
GLOBAL CONST $REALTIME_PRIORITY_CLASS = 256
GLOBAL CONST $PROCESS_MODE_BACKGROUND_BEGIN = 1048576
GLOBAL CONST $PROCESS_MODE_BACKGROUND_END = 2097152
GLOBAL CONST $MUTEX_MODIFY_STATE = 1
GLOBAL CONST $MUTEX_ALL_ACCESS = 2031617
GLOBAL CONST $JOB_OBJECT_ASSIGN_PROCESS = 1
GLOBAL CONST $JOB_OBJECT_QUERY = 4
GLOBAL CONST $JOB_OBJECT_SET_ATTRIBUTES = 2
GLOBAL CONST $JOB_OBJECT_SET_SECURITY_ATTRIBUTES = 16
GLOBAL CONST $JOB_OBJECT_TERMINATE = 8
GLOBAL CONST $JOB_OBJECT_ALL_ACCESS = 2031647
GLOBAL CONST $JOB_OBJECT_LIMIT_ACTIVE_PROCESS = 8
GLOBAL CONST $JOB_OBJECT_LIMIT_AFFINITY = 16
GLOBAL CONST $JOB_OBJECT_LIMIT_BREAKAWAY_OK = 2048
GLOBAL CONST $JOB_OBJECT_LIMIT_DIE_ON_UNHANDLED_EXCEPTION = 1024
GLOBAL CONST $JOB_OBJECT_LIMIT_JOB_MEMORY = 512
GLOBAL CONST $JOB_OBJECT_LIMIT_JOB_TIME = 4
GLOBAL CONST $JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE = 8192
GLOBAL CONST $JOB_OBJECT_LIMIT_PRESERVE_JOB_TIME = 64
GLOBAL CONST $JOB_OBJECT_LIMIT_PRIORITY_CLASS = 32
GLOBAL CONST $JOB_OBJECT_LIMIT_PROCESS_MEMORY = 256
GLOBAL CONST $JOB_OBJECT_LIMIT_PROCESS_TIME = 2
GLOBAL CONST $JOB_OBJECT_LIMIT_SCHEDULING_CLASS = 128
GLOBAL CONST $JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK = 4096
GLOBAL CONST $JOB_OBJECT_LIMIT_WORKINGSET = 1
GLOBAL CONST $JOB_OBJECT_UILIMIT_DESKTOP = 64
GLOBAL CONST $JOB_OBJECT_UILIMIT_DISPLAYSETTINGS = 16
GLOBAL CONST $JOB_OBJECT_UILIMIT_EXITWINDOWS = 128
GLOBAL CONST $JOB_OBJECT_UILIMIT_GLOBALATOMS = 32
GLOBAL CONST $JOB_OBJECT_UILIMIT_HANDLES = 1
GLOBAL CONST $JOB_OBJECT_UILIMIT_READCLIPBOARD = 2
GLOBAL CONST $JOB_OBJECT_UILIMIT_SYSTEMPARAMETERS = 8
GLOBAL CONST $JOB_OBJECT_UILIMIT_WRITECLIPBOARD = 4
GLOBAL CONST $JOB_OBJECT_SECURITY_FILTER_TOKENS = 8
GLOBAL CONST $JOB_OBJECT_SECURITY_NO_ADMIN = 1
GLOBAL CONST $JOB_OBJECT_SECURITY_ONLY_TOKEN = 4
GLOBAL CONST $JOB_OBJECT_SECURITY_RESTRICTED_TOKEN = 2
GLOBAL CONST $JOB_OBJECT_TERMINATE_AT_END_OF_JOB = 0
GLOBAL CONST $JOB_OBJECT_POST_AT_END_OF_JOB = 1
GLOBAL CONST $SEMAPHORE_MODIFY_STATE = 2
GLOBAL CONST $SEMAPHORE_QUERY_STATE = 1
GLOBAL CONST $SEMAPHORE_ALL_ACCESS = 2031619
GLOBAL CONST $ES_AWAYMODE_REQUIRED = 64
GLOBAL CONST $ES_CONTINUOUS = 2147483648
GLOBAL CONST $ES_DISPLAY_REQUIRED = 2
GLOBAL CONST $ES_SYSTEM_REQUIRED = 1
GLOBAL CONST $ES_USER_PRESENT = 4
GLOBAL CONST $COINIT_APARTMENTTHREADED = 2
GLOBAL CONST $COINIT_DISABLE_OLE1DDE = 4
GLOBAL CONST $COINIT_MULTITHREADED = 0
GLOBAL CONST $COINIT_SPEED_OVER_MEMORY = 8
#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 = + 4294967295
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_PATHFINDONPATH (CONST $SFILEPATH , $AEXTRAPATHS = "" , CONST $SPATHDELIMITER = @LF )
LOCAL $IEXTRACOUNT = 0
IF ISSTRING ($AEXTRAPATHS ) THEN
IF STRINGLEN ($AEXTRAPATHS ) THEN
$AEXTRAPATHS = STRINGSPLIT ($AEXTRAPATHS , $SPATHDELIMITER , $STR_ENTIRESPLIT + $STR_NOCOUNT )
$IEXTRACOUNT = UBOUND ($AEXTRAPATHS , $UBOUND_ROWS )
ENDIF
ELSEIF ISARRAY ($AEXTRAPATHS ) THEN
$IEXTRACOUNT = UBOUND ($AEXTRAPATHS )
ENDIF
LOCAL $TPATHS , $TPATHPTRS
IF $IEXTRACOUNT THEN
LOCAL $TAGSTRUCT = ""
FOR $PATH IN $AEXTRAPATHS
$TAGSTRUCT &= "wchar[" & STRINGLEN ($PATH ) + 1 & "];"
NEXT
$TPATHS = DLLSTRUCTCREATE ($TAGSTRUCT )
$TPATHPTRS = DLLSTRUCTCREATE ("ptr[" & $IEXTRACOUNT + 1 & "]" )
FOR $I = 1 TO $IEXTRACOUNT
DLLSTRUCTSETDATA ($TPATHS , $I , $AEXTRAPATHS [$I + 4294967295 ] )
DLLSTRUCTSETDATA ($TPATHPTRS , 1 , DLLSTRUCTGETPTR ($TPATHS , $I ) , $I )
NEXT
DLLSTRUCTSETDATA ($TPATHPTRS , 1 , PTR (0 ) , $IEXTRACOUNT + 1 )
ENDIF
LOCAL $ARESULT = DLLCALL ("shlwapi.dll" , "bool" , "PathFindOnPathW" , "wstr" , $SFILEPATH , "struct*" , $TPATHPTRS )
IF @ERROR OR NOT $ARESULT [0 ] THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , $SFILEPATH )
RETURN $ARESULT [1 ]
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 , + 4294967295 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_PATHGETDRIVENUMBER ($SFILEPATH )
LOCAL $ARET = DLLCALL ("shlwapi.dll" , "int" , "PathGetDriveNumberW" , "wstr" , $SFILEPATH )
IF @ERROR OR ($ARET [0 ] = + 4294967295 ) 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 $TAGIO_COUNTERS = "struct;uint64 ReadOperationCount;uint64 WriteOperationCount;uint64 OtherOperationCount;uint64 ReadTransferCount;uint64 WriteTransferCount;uint64 OtherTransferCount;endstruct"
GLOBAL CONST $TAGJOBOBJECT_ASSOCIATE_COMPLETION_PORT = "ulong_ptr CompletionKey;ptr CompletionPort"
GLOBAL CONST $TAGJOBOBJECT_BASIC_ACCOUNTING_INFORMATION = "struct;int64 TotalUserTime;int64 TotalKernelTime;int64 ThisPeriodTotalUserTime;int64 ThisPeriodTotalKernelTime;dword TotalPageFaultCount;dword TotalProcesses;dword ActiveProcesses;dword TotalTerminatedProcesses;endstruct"
GLOBAL CONST $TAGJOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION = $TAGJOBOBJECT_BASIC_ACCOUNTING_INFORMATION & ";" & $TAGIO_COUNTERS
GLOBAL CONST $TAGJOBOBJECT_BASIC_LIMIT_INFORMATION = "struct;int64 PerProcessUserTimeLimit;int64 PerJobUserTimeLimit;dword LimitFlags;ulong_ptr MinimumWorkingSetSize;ulong_ptr MaximumWorkingSetSize;dword ActiveProcessLimit;ulong_ptr Affinity;dword PriorityClass;dword SchedulingClass;endstruct"
GLOBAL CONST $TAGJOBOBJECT_BASIC_PROCESS_ID_LIST = "dword NumberOfAssignedProcesses;dword NumberOfProcessIdsInList"
GLOBAL CONST $TAGJOBOBJECT_BASIC_UI_RESTRICTIONS = "dword UIRestrictionsClass"
GLOBAL CONST $TAGJOBOBJECT_END_OF_JOB_TIME_INFORMATION = "dword EndOfJobTimeAction"
GLOBAL CONST $TAGJOBOBJECT_EXTENDED_LIMIT_INFORMATION = $TAGJOBOBJECT_BASIC_LIMIT_INFORMATION & ";" & $TAGIO_COUNTERS & ";ulong_ptr ProcessMemoryLimit;ulong_ptr JobMemoryLimit;ulong_ptr PeakProcessMemoryUsed;ulong_ptr PeakJobMemoryUsed"
GLOBAL CONST $TAGJOBOBJECT_GROUP_INFORMATION = ""
GLOBAL CONST $TAGJOBOBJECT_SECURITY_LIMIT_INFORMATION = "dword SecurityLimitFlags;ptr JobToken;ptr SidsToDisable;ptr PrivilegesToDelete;ptr RestrictedSids"
GLOBAL CONST $TAGMODULEINFO = "ptr BaseOfDll;dword SizeOfImage;ptr EntryPoint"
GLOBAL CONST $TAGPROCESSENTRY32 = "dword Size;dword Usage;dword ProcessID;ulong_ptr DefaultHeapID;dword ModuleID;dword Threads;dword ParentProcessID;long PriClassBase;dword Flags;wchar ExeFile[260]"
#EndRegion Global Variables and Constants
#Region Functions list
#EndRegion Functions list
#Region Public Functions
FUNC _WINAPI_ADJUSTTOKENPRIVILEGES ($HTOKEN , $APRIVILEGES , $IATTRIBUTES , BYREF $AADJUST )
$AADJUST = 0
IF NOT $APRIVILEGES AND ISNUMBER ($APRIVILEGES ) THEN RETURN 0
LOCAL $TTP1 = 0 , $TTP2 , $ICOUNT , $ARET , $BDISABLE = FALSE
IF $APRIVILEGES = + 4294967295 THEN
$TTP2 = DLLSTRUCTCREATE ("dword" )
$ARET = DLLCALL ("advapi32.dll" , "bool" , "AdjustTokenPrivileges" , "handle" , $HTOKEN , "bool" , 1 , "ptr" , 0 , "dword" , 0 , "struct*" , $TTP2 , "dword*" , 0 )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
LOCAL $ILASTERROR = _WINAPI_GETLASTERROR ()
SWITCH $ILASTERROR
CASE 122
$TTP2 = DLLSTRUCTCREATE ("dword;dword[" & ($ARET [6 ] / 4 + 4294967295 ) & "]" )
IF @ERROR THEN
CONTINUECASE
ENDIF
CASE ELSE
RETURN SETERROR (10 , $ILASTERROR , 0 )
ENDSWITCH
$BDISABLE = TRUE
ELSE
LOCAL $APREV = 0
IF NOT ISARRAY ($APRIVILEGES ) THEN
DIM $APREV [1 ] [2 ]
$APREV [0 ] [0 ] = $APRIVILEGES
$APREV [0 ] [1 ] = $IATTRIBUTES
ELSE
IF NOT UBOUND ($APRIVILEGES , $UBOUND_COLUMNS ) THEN
$ICOUNT = UBOUND ($APRIVILEGES )
DIM $APREV [$ICOUNT ] [2 ]
FOR $I = 0 TO $ICOUNT + 4294967295
$APREV [$I ] [0 ] = $APRIVILEGES [$I ]
$APREV [$I ] [1 ] = $IATTRIBUTES
NEXT
ENDIF
ENDIF
IF ISARRAY ($APREV ) THEN
$APRIVILEGES = $APREV
ENDIF
LOCAL $TAGSTRUCT = "dword;dword[" & (3 * UBOUND ($APRIVILEGES ) ) & "]"
$TTP1 = DLLSTRUCTCREATE ($TAGSTRUCT )
$TTP2 = DLLSTRUCTCREATE ($TAGSTRUCT )
IF @ERROR THEN RETURN SETERROR (@ERROR + 20 , 0 , 0 )
DLLSTRUCTSETDATA ($TTP1 , 1 , UBOUND ($APRIVILEGES ) )
FOR $I = 0 TO UBOUND ($APRIVILEGES ) + 4294967295
DLLSTRUCTSETDATA ($TTP1 , 2 , $APRIVILEGES [$I ] [1 ] , 3 * $I + 3 )
$ARET = DLLCALL ("advapi32.dll" , "bool" , "LookupPrivilegeValueW" , "ptr" , 0 , "wstr" , $APRIVILEGES [$I ] [0 ] , "ptr" , DLLSTRUCTGETPTR ($TTP1 , 2 ) + 12 * $I )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR + 100 , @EXTENDED , 0 )
NEXT
ENDIF
$ARET = DLLCALL ("advapi32.dll" , "bool" , "AdjustTokenPrivileges" , "handle" , $HTOKEN , "bool" , $BDISABLE , "struct*" , $TTP1 , "dword" , DLLSTRUCTGETSIZE ($TTP2 ) , "struct*" , $TTP2 , "dword*" , 0 )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR + 200 , @EXTENDED , 0 )
LOCAL $IRESULT
SWITCH _WINAPI_GETLASTERROR ()
CASE 1300
$IRESULT = 1
CASE ELSE
$IRESULT = 0
ENDSWITCH
$ICOUNT = DLLSTRUCTGETDATA ($TTP2 , 1 )
IF $ICOUNT THEN
LOCAL $TDATA = DLLSTRUCTCREATE ("wchar[128]" )
DIM $APRIVILEGES [$ICOUNT ] [2 ]
FOR $I = 0 TO $ICOUNT + 4294967295
$ARET = DLLCALL ("advapi32.dll" , "bool" , "LookupPrivilegeNameW" , "ptr" , 0 , "ptr" , DLLSTRUCTGETPTR ($TTP2 , 2 ) + 12 * $I , "struct*" , $TDATA , "dword*" , 128 )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR + 300 , @EXTENDED , 0 )
$APRIVILEGES [$I ] [1 ] = DLLSTRUCTGETDATA ($TTP2 , 2 , 3 * $I + 3 )
$APRIVILEGES [$I ] [0 ] = DLLSTRUCTGETDATA ($TDATA , 1 )
NEXT
$AADJUST = $APRIVILEGES
ENDIF
RETURN SETEXTENDED ($IRESULT , 1 )
ENDFUNC
FUNC _WINAPI_ASSIGNPROCESSTOJOBOBJECT ($HJOB , $HPROCESS )
LOCAL $ARET = DLLCALL ("kernel32.dll" , "bool" , "AssignProcessToJobObject" , "handle" , $HJOB , "handle" , $HPROCESS )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_ATTACHCONSOLE ($IPID = + 4294967295 )
LOCAL $ARESULT = DLLCALL ("kernel32.dll" , "bool" , "AttachConsole" , "dword" , $IPID )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_ATTACHTHREADINPUT ($IATTACH , $IATTACHTO , $BATTACH )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "bool" , "AttachThreadInput" , "dword" , $IATTACH , "dword" , $IATTACHTO , "bool" , $BATTACH )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_CREATEEVENT ($TATTRIBUTES = 0 , $BMANUALRESET = TRUE , $BINITIALSTATE = TRUE , $SNAME = "" )
LOCAL $SNAMETYPE = "wstr"
IF $SNAME = "" THEN
$SNAME = 0
$SNAMETYPE = "ptr"
ENDIF
LOCAL $ARESULT = DLLCALL ("kernel32.dll" , "handle" , "CreateEventW" , "struct*" , $TATTRIBUTES , "bool" , $BMANUALRESET , "bool" , $BINITIALSTATE , $SNAMETYPE , $SNAME )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_CREATEJOBOBJECT ($SNAME = "" , $TSECURITY = 0 )
LOCAL $STYPEOFNAME = "wstr"
IF NOT STRINGSTRIPWS ($SNAME , $STR_STRIPLEADING + $STR_STRIPTRAILING ) THEN
$STYPEOFNAME = "ptr"
$SNAME = 0
ENDIF
LOCAL $ARET = DLLCALL ("kernel32.dll" , "handle" , "CreateJobObjectW" , "struct*" , $TSECURITY , $STYPEOFNAME , $SNAME )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_CREATEMUTEX ($SMUTEX , $BINITIAL = TRUE , $TSECURITY = 0 )
LOCAL $ARET = DLLCALL ("kernel32.dll" , "handle" , "CreateMutexW" , "struct*" , $TSECURITY , "bool" , $BINITIAL , "wstr" , $SMUTEX )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_CREATEPROCESS ($SAPPNAME , $SCOMMAND , $TSECURITY , $TTHREAD , $BINHERIT , $IFLAGS , $PENVIRON , $SDIR , $TSTARTUPINFO , $TPROCESS )
LOCAL $TCOMMAND = 0
LOCAL $SAPPNAMETYPE = "wstr" , $SDIRTYPE = "wstr"
IF $SAPPNAME = "" THEN
$SAPPNAMETYPE = "ptr"
$SAPPNAME = 0
ENDIF
IF $SCOMMAND <> "" THEN
$TCOMMAND = DLLSTRUCTCREATE ("wchar Text[" & 260 + 1 & "]" )
DLLSTRUCTSETDATA ($TCOMMAND , "Text" , $SCOMMAND )
ENDIF
IF $SDIR = "" THEN
$SDIRTYPE = "ptr"
$SDIR = 0
ENDIF
LOCAL $ARESULT = DLLCALL ("kernel32.dll" , "bool" , "CreateProcessW" , $SAPPNAMETYPE , $SAPPNAME , "struct*" , $TCOMMAND , "struct*" , $TSECURITY , "struct*" , $TTHREAD , "bool" , $BINHERIT , "dword" , $IFLAGS , "struct*" , $PENVIRON , $SDIRTYPE , $SDIR , "struct*" , $TSTARTUPINFO , "struct*" , $TPROCESS )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_CREATEPROCESSWITHTOKEN ($SAPP , $SCMD , $IFLAGS , $TSTARTUPINFO , $TPROCESSINFO , $HTOKEN , $ILOGON = 0 , $PENVIRONMENT = 0 , $SDIR = "" )
LOCAL $STYPEOFAPP = "wstr" , $STYPEOFCMD = "wstr" , $STYPEOFDIR = "wstr"
IF NOT STRINGSTRIPWS ($SAPP , $STR_STRIPLEADING + $STR_STRIPTRAILING ) THEN
$STYPEOFAPP = "ptr"
$SAPP = 0
ENDIF
IF NOT STRINGSTRIPWS ($SCMD , $STR_STRIPLEADING + $STR_STRIPTRAILING ) THEN
$STYPEOFCMD = "ptr"
$SCMD = 0
ENDIF
IF NOT STRINGSTRIPWS ($SDIR , $STR_STRIPLEADING + $STR_STRIPTRAILING ) THEN
$STYPEOFDIR = "ptr"
$SDIR = 0
ENDIF
LOCAL $ARET = DLLCALL ("advapi32.dll" , "bool" , "CreateProcessWithTokenW" , "handle" , $HTOKEN , "dword" , $ILOGON , $STYPEOFAPP , $SAPP , $STYPEOFCMD , $SCMD , "dword" , $IFLAGS , "struct*" , $PENVIRONMENT , $STYPEOFDIR , $SDIR , "struct*" , $TSTARTUPINFO , "struct*" , $TPROCESSINFO )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_CREATESEMAPHORE ($SSEMAPHORE , $IINITIAL , $IMAXIMUM , $TSECURITY = 0 )
LOCAL $ARET = DLLCALL ("kernel32.dll" , "handle" , "CreateSemaphoreW" , "struct*" , $TSECURITY , "long" , $IINITIAL , "long" , $IMAXIMUM , "wstr" , $SSEMAPHORE )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_DUPLICATETOKENEX ($HTOKEN , $IACCESS , $ILEVEL , $ITYPE = 1 , $TSECURITY = 0 )
LOCAL $ARET = DLLCALL ("advapi32.dll" , "bool" , "DuplicateTokenEx" , "handle" , $HTOKEN , "dword" , $IACCESS , "struct*" , $TSECURITY , "int" , $ILEVEL , "int" , $ITYPE , "handle*" , 0 )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [6 ]
ENDFUNC
FUNC _WINAPI_EMPTYWORKINGSET ($IPID = 0 )
IF NOT $IPID THEN $IPID = @AUTOITPID
LOCAL $HPROCESS = DLLCALL ("kernel32.dll" , "handle" , "OpenProcess" , "dword" , (($__WINVER < 1536 ) 1280 4352 ) , "bool" , 0 , "dword" , $IPID )
IF @ERROR OR NOT $HPROCESS [0 ] THEN RETURN SETERROR (@ERROR + 20 , @EXTENDED , 0 )
LOCAL $ARET = DLLCALL (@SYSTEMDIR & "\psapi.dll" , "bool" , "EmptyWorkingSet" , "handle" , $HPROCESS [0 ] )
IF __CHECKERRORCLOSEHANDLE ($ARET , $HPROCESS [0 ] ) THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN 1
ENDFUNC
FUNC _WINAPI_ENUMCHILDPROCESS ($IPID = 0 )
IF NOT $IPID THEN $IPID = @AUTOITPID
LOCAL $HSNAPSHOT = DLLCALL ("kernel32.dll" , "handle" , "CreateToolhelp32Snapshot" , "dword" , 2 , "dword" , 0 )
IF @ERROR OR ($HSNAPSHOT [0 ] = PTR (+ 4294967295 ) ) THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , 0 )
LOCAL $TPROCESSENTRY32 = DLLSTRUCTCREATE ($TAGPROCESSENTRY32 )
LOCAL $ARESULT [101 ] [2 ] = [[0 ] ]
$HSNAPSHOT = $HSNAPSHOT [0 ]
DLLSTRUCTSETDATA ($TPROCESSENTRY32 , "Size" , DLLSTRUCTGETSIZE ($TPROCESSENTRY32 ) )
LOCAL $ARET = DLLCALL ("kernel32.dll" , "bool" , "Process32FirstW" , "handle" , $HSNAPSHOT , "struct*" , $TPROCESSENTRY32 )
LOCAL $IERROR = @ERROR
WHILE (NOT @ERROR ) AND ($ARET [0 ] )
IF DLLSTRUCTGETDATA ($TPROCESSENTRY32 , "ParentProcessID" ) = $IPID THEN
__INC ($ARESULT )
$ARESULT [$ARESULT [0 ] [0 ] ] [0 ] = DLLSTRUCTGETDATA ($TPROCESSENTRY32 , "ProcessID" )
$ARESULT [$ARESULT [0 ] [0 ] ] [1 ] = DLLSTRUCTGETDATA ($TPROCESSENTRY32 , "ExeFile" )
ENDIF
$ARET = DLLCALL ("kernel32.dll" , "bool" , "Process32NextW" , "handle" , $HSNAPSHOT , "struct*" , $TPROCESSENTRY32 )
$IERROR = @ERROR
WEND
DLLCALL ("kernel32.dll" , "bool" , "CloseHandle" , "handle" , $HSNAPSHOT )
IF NOT $ARESULT [0 ] [0 ] THEN RETURN SETERROR ($IERROR + 20 , 0 , 0 )
__INC ($ARESULT , + 4294967295 )
RETURN $ARESULT
ENDFUNC
FUNC _WINAPI_ENUMDEVICEDRIVERS ()
LOCAL $ARET = DLLCALL (@SYSTEMDIR & "\psapi.dll" , "bool" , "EnumDeviceDrivers" , "ptr" , 0 , "dword" , 0 , "dword*" , 0 )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , 0 )
LOCAL $ISIZE
IF @AUTOITX64 THEN
$ISIZE = $ARET [3 ] / 8
ELSE
$ISIZE = $ARET [3 ] / 4
ENDIF
LOCAL $TDATA = DLLSTRUCTCREATE ("ptr[" & $ISIZE & "]" )
$ARET = DLLCALL (@SYSTEMDIR & "\psapi.dll" , "bool" , "EnumDeviceDrivers" , "struct*" , $TDATA , "dword" , DLLSTRUCTGETSIZE ($TDATA ) , "dword*" , 0 )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR + 20 , @EXTENDED , 0 )
LOCAL $ARESULT [$ISIZE + 1 ] = [$ISIZE ]
FOR $I = 1 TO $ISIZE
$ARESULT [$I ] = DLLSTRUCTGETDATA ($TDATA , 1 , $I )
NEXT
RETURN $ARESULT
ENDFUNC
FUNC _WINAPI_ENUMPROCESSHANDLES ($IPID = 0 , $ITYPE = 0 )
IF NOT $IPID THEN $IPID = @AUTOITPID
LOCAL $ARESULT [101 ] [4 ] = [[0 ] ]
LOCAL $TSHI = DLLSTRUCTCREATE ("ulong;byte[4194304]" )
LOCAL $ARET = DLLCALL ("ntdll.dll" , "long" , "ZwQuerySystemInformation" , "uint" , 16 , "struct*" , $TSHI , "ulong" , DLLSTRUCTGETSIZE ($TSHI ) , "ulong*" , 0 )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
IF $ARET [0 ] THEN RETURN SETERROR (10 , $ARET [0 ] , 0 )
LOCAL $PDATA = DLLSTRUCTGETPTR ($TSHI , 2 )
LOCAL $THANDLE
FOR $I = 1 TO DLLSTRUCTGETDATA ($TSHI , 1 )
$THANDLE = DLLSTRUCTCREATE ("align 4;ulong;byte;byte;ushort;ptr;ulong" , $PDATA + (@AUTOITX64 (4 + ($I + 4294967295 ) * 24 ) (($I + 4294967295 ) * 16 ) ) )
IF (DLLSTRUCTGETDATA ($THANDLE , 1 ) = $IPID ) AND ((NOT $ITYPE ) OR ($ITYPE = DLLSTRUCTGETDATA ($THANDLE , 2 ) ) ) THEN
__INC ($ARESULT )
$ARESULT [$ARESULT [0 ] [0 ] ] [0 ] = PTR (DLLSTRUCTGETDATA ($THANDLE , 4 ) )
$ARESULT [$ARESULT [0 ] [0 ] ] [1 ] = DLLSTRUCTGETDATA ($THANDLE , 2 )
$ARESULT [$ARESULT [0 ] [0 ] ] [2 ] = DLLSTRUCTGETDATA ($THANDLE , 3 )
$ARESULT [$ARESULT [0 ] [0 ] ] [3 ] = DLLSTRUCTGETDATA ($THANDLE , 6 )
ENDIF
NEXT
IF NOT $ARESULT [0 ] [0 ] THEN RETURN SETERROR (11 , 0 , 0 )
__INC ($ARESULT , + 4294967295 )
RETURN $ARESULT
ENDFUNC
FUNC _WINAPI_ENUMPROCESSMODULES ($IPID = 0 , $IFLAG = 0 )
IF NOT $IPID THEN $IPID = @AUTOITPID
LOCAL $HPROCESS = DLLCALL ("kernel32.dll" , "handle" , "OpenProcess" , "dword" , (($__WINVER < 1536 ) 1040 4112 ) , "bool" , 0 , "dword" , $IPID )
IF @ERROR OR NOT $HPROCESS [0 ] THEN RETURN SETERROR (@ERROR + 20 , @EXTENDED , 0 )
LOCAL $ICOUNT , $ARET , $IERROR = 0
DO
IF $__WINVER >= 1536 THEN
$ARET = DLLCALL (@SYSTEMDIR & "\psapi.dll" , "bool" , "EnumProcessModulesEx" , "handle" , $HPROCESS [0 ] , "ptr" , 0 , "dword" , 0 , "dword*" , 0 , "dword" , $IFLAG )
ELSE
$ARET = DLLCALL (@SYSTEMDIR & "\psapi.dll" , "bool" , "EnumProcessModules" , "handle" , $HPROCESS [0 ] , "ptr" , 0 , "dword" , 0 , "dword*" , 0 )
ENDIF
IF @ERROR OR NOT $ARET [0 ] THEN
$IERROR = @ERROR + 10
EXITLOOP
ENDIF
IF @AUTOITX64 THEN
$ICOUNT = $ARET [4 ] / 8
ELSE
$ICOUNT = $ARET [4 ] / 4
ENDIF
LOCAL $TPTR = DLLSTRUCTCREATE ("ptr[" & $ICOUNT & "]" )
IF @ERROR THEN
$IERROR = @ERROR + 30
EXITLOOP
ENDIF
IF $__WINVER >= 1536 THEN
$ARET = DLLCALL (@SYSTEMDIR & "\psapi.dll" , "bool" , "EnumProcessModulesEx" , "handle" , $HPROCESS [0 ] , "struct*" , $TPTR , "dword" , DLLSTRUCTGETSIZE ($TPTR ) , "dword*" , 0 , "dword" , $IFLAG )
ELSE
$ARET = DLLCALL (@SYSTEMDIR & "\psapi.dll" , "bool" , "EnumProcessModules" , "handle" , $HPROCESS [0 ] , "struct*" , $TPTR , "dword" , DLLSTRUCTGETSIZE ($TPTR ) , "dword*" , 0 )
ENDIF
IF @ERROR OR NOT $ARET [0 ] THEN
$IERROR = @ERROR + 40
EXITLOOP
ENDIF
LOCAL $ARESULT [$ICOUNT + 1 ] [2 ] = [[$ICOUNT ] ]
FOR $I = 1 TO $ICOUNT
$ARESULT [$I ] [0 ] = DLLSTRUCTGETDATA ($TPTR , 1 , $I )
$ARESULT [$I ] [1 ] = _WINAPI_GETMODULEFILENAMEEX ($HPROCESS [0 ] , $ARESULT [$I ] [0 ] )
NEXT
UNTIL 1
DLLCALL ("kernel32.dll" , "bool" , "CloseHandle" , "handle" , $HPROCESS [0 ] )
IF $IERROR THEN RETURN SETERROR ($IERROR , 0 , 0 )
RETURN $ARESULT
ENDFUNC
FUNC _WINAPI_ENUMPROCESSTHREADS ($IPID = 0 )
IF NOT $IPID THEN $IPID = @AUTOITPID
LOCAL $HSNAPSHOT = DLLCALL ("kernel32.dll" , "handle" , "CreateToolhelp32Snapshot" , "dword" , 4 , "dword" , 0 )
IF @ERROR OR NOT $HSNAPSHOT [0 ] THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , 0 )
LOCAL CONST $TAGTHREADENTRY32 = "dword Size;dword Usage;dword ThreadID;dword OwnerProcessID;long BasePri;long DeltaPri;dword Flags"
LOCAL $TTHREADENTRY32 = DLLSTRUCTCREATE ($TAGTHREADENTRY32 )
LOCAL $ARESULT [101 ] = [0 ]
$HSNAPSHOT = $HSNAPSHOT [0 ]
DLLSTRUCTSETDATA ($TTHREADENTRY32 , "Size" , DLLSTRUCTGETSIZE ($TTHREADENTRY32 ) )
LOCAL $ARET = DLLCALL ("kernel32.dll" , "bool" , "Thread32First" , "handle" , $HSNAPSHOT , "struct*" , $TTHREADENTRY32 )
WHILE NOT @ERROR AND $ARET [0 ]
IF DLLSTRUCTGETDATA ($TTHREADENTRY32 , "OwnerProcessID" ) = $IPID THEN
__INC ($ARESULT )
$ARESULT [$ARESULT [0 ] ] = DLLSTRUCTGETDATA ($TTHREADENTRY32 , "ThreadID" )
ENDIF
$ARET = DLLCALL ("kernel32.dll" , "bool" , "Thread32Next" , "handle" , $HSNAPSHOT , "struct*" , $TTHREADENTRY32 )
WEND
DLLCALL ("kernel32.dll" , "bool" , "CloseHandle" , "handle" , $HSNAPSHOT )
IF NOT $ARESULT [0 ] THEN RETURN SETERROR (1 , 0 , 0 )
__INC ($ARESULT , + 4294967295 )
RETURN $ARESULT
ENDFUNC
FUNC _WINAPI_ENUMPROCESSWINDOWS ($IPID = 0 , $BVISIBLE = TRUE )
LOCAL $ATHREADS = _WINAPI_ENUMPROCESSTHREADS ($IPID )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
LOCAL $HENUMPROC = DLLCALLBACKREGISTER ("__EnumWindowsProc" , "bool" , "hwnd;lparam" )
DIM $__G_VENUM [101 ] [2 ] = [[0 ] ]
FOR $I = 1 TO $ATHREADS [0 ]
DLLCALL ("user32.dll" , "bool" , "EnumThreadWindows" , "dword" , $ATHREADS [$I ] , "ptr" , DLLCALLBACKGETPTR ($HENUMPROC ) , "lparam" , $BVISIBLE )
IF @ERROR THEN
EXITLOOP
ENDIF
NEXT
DLLCALLBACKFREE ($HENUMPROC )
IF NOT $__G_VENUM [0 ] [0 ] THEN RETURN SETERROR (11 , 0 , 0 )
__INC ($__G_VENUM , + 4294967295 )
RETURN $__G_VENUM
ENDFUNC
FUNC _WINAPI_FATALAPPEXIT ($SMESSAGE )
DLLCALL ("kernel32.dll" , "none" , "FatalAppExitW" , "uint" , 0 , "wstr" , $SMESSAGE )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED )
ENDFUNC
FUNC _WINAPI_GETCURRENTPROCESSEXPLICITAPPUSERMODELID ()
LOCAL $ARET = DLLCALL ("shell32.dll" , "long" , "GetCurrentProcessExplicitAppUserModelID" , "ptr*" , 0 )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , "" )
IF $ARET [0 ] THEN RETURN SETERROR (10 , $ARET [0 ] , "" )
LOCAL $SID = _WINAPI_GETSTRING ($ARET [1 ] )
_WINAPI_COTASKMEMFREE ($ARET [1 ] )
RETURN $SID
ENDFUNC
FUNC _WINAPI_GETCURRENTPROCESSID ()
LOCAL $ARESULT = DLLCALL ("kernel32.dll" , "dword" , "GetCurrentProcessId" )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_GETCURRENTTHREAD ()
LOCAL $ARESULT = DLLCALL ("kernel32.dll" , "handle" , "GetCurrentThread" )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_GETCURRENTTHREADID ()
LOCAL $ARESULT = DLLCALL ("kernel32.dll" , "dword" , "GetCurrentThreadId" )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_GETDEVICEDRIVERBASENAME ($PDRIVER )
LOCAL $ARET = DLLCALL (@SYSTEMDIR & "\psapi.dll" , "dword" , "GetDeviceDriverBaseNameW" , "ptr" , $PDRIVER , "wstr" , "" , "dword" , 4096 )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , "" )
RETURN $ARET [2 ]
ENDFUNC
FUNC _WINAPI_GETDEVICEDRIVERFILENAME ($PDRIVER )
LOCAL $ARET = DLLCALL (@SYSTEMDIR & "\psapi.dll" , "dword" , "GetDeviceDriverFileNameW" , "ptr" , $PDRIVER , "wstr" , "" , "dword" , 4096 )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , "" )
RETURN $ARET [2 ]
ENDFUNC
FUNC _WINAPI_GETEXITCODEPROCESS ($HPROCESS )
LOCAL $ARET = DLLCALL ("kernel32.dll" , "bool" , "GetExitCodeProcess" , "handle" , $HPROCESS , "dword*" , 0 )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [2 ]
ENDFUNC
FUNC _WINAPI_GETGUIRESOURCES ($IFLAG = 0 , $HPROCESS = + 4294967295 )
IF $HPROCESS = + 4294967295 THEN $HPROCESS = _WINAPI_GETCURRENTPROCESS ()
LOCAL $ARESULT = DLLCALL ("user32.dll" , "dword" , "GetGuiResources" , "handle" , $HPROCESS , "dword" , $IFLAG )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_GETMODULEFILENAMEEX ($HPROCESS , $HMODULE = 0 )
LOCAL $ARET = DLLCALL (@SYSTEMDIR & "\psapi.dll" , "dword" , "GetModuleFileNameExW" , "handle" , $HPROCESS , "handle" , $HMODULE , "wstr" , "" , "int" , 4096 )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , "" )
RETURN $ARET [3 ]
ENDFUNC
FUNC _WINAPI_GETMODULEINFORMATION ($HPROCESS , $HMODULE = 0 )
LOCAL $TMODULEINFO = DLLSTRUCTCREATE ($TAGMODULEINFO )
LOCAL $ARET = DLLCALL (@SYSTEMDIR & "\psapi.dll" , "bool" , "GetModuleInformation" , "handle" , $HPROCESS , "handle" , $HMODULE , "struct*" , $TMODULEINFO , "dword" , DLLSTRUCTGETSIZE ($TMODULEINFO ) )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , 0 )
RETURN $TMODULEINFO
ENDFUNC
FUNC _WINAPI_GETPARENTPROCESS ($IPID = 0 )
IF NOT $IPID THEN $IPID = @AUTOITPID
LOCAL $HSNAPSHOT = DLLCALL ("kernel32.dll" , "handle" , "CreateToolhelp32Snapshot" , "dword" , 2 , "dword" , 0 )
IF @ERROR OR NOT $HSNAPSHOT [0 ] THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , 0 )
LOCAL $TPROCESSENTRY32 = DLLSTRUCTCREATE ($TAGPROCESSENTRY32 )
LOCAL $IRESULT = 0
$HSNAPSHOT = $HSNAPSHOT [0 ]
DLLSTRUCTSETDATA ($TPROCESSENTRY32 , "Size" , DLLSTRUCTGETSIZE ($TPROCESSENTRY32 ) )
LOCAL $ARET = DLLCALL ("kernel32.dll" , "bool" , "Process32FirstW" , "handle" , $HSNAPSHOT , "struct*" , $TPROCESSENTRY32 )
LOCAL $IERROR = @ERROR
WHILE (NOT @ERROR ) AND ($ARET [0 ] )
IF DLLSTRUCTGETDATA ($TPROCESSENTRY32 , "ProcessID" ) = $IPID THEN
$IRESULT = DLLSTRUCTGETDATA ($TPROCESSENTRY32 , "ParentProcessID" )
EXITLOOP
ENDIF
$ARET = DLLCALL ("kernel32.dll" , "bool" , "Process32NextW" , "handle" , $HSNAPSHOT , "struct*" , $TPROCESSENTRY32 )
$IERROR = @ERROR
WEND
DLLCALL ("kernel32.dll" , "bool" , "CloseHandle" , "handle" , $HSNAPSHOT )
IF NOT $IRESULT THEN RETURN SETERROR ($IERROR , 0 , 0 )
RETURN $IRESULT
ENDFUNC
FUNC _WINAPI_GETPRIORITYCLASS ($IPID = 0 )
IF NOT $IPID THEN $IPID = @AUTOITPID
LOCAL $HPROCESS = DLLCALL ("kernel32.dll" , "handle" , "OpenProcess" , "dword" , (($__WINVER < 1536 ) 1024 4096 ) , "bool" , 0 , "dword" , $IPID )
IF @ERROR OR NOT $HPROCESS [0 ] THEN RETURN SETERROR (@ERROR + 20 , @EXTENDED , 0 )
LOCAL $IERROR = 0
LOCAL $ARET = DLLCALL ("kernel32.dll" , "dword" , "GetPriorityClass" , "handle" , $HPROCESS [0 ] )
IF @ERROR THEN $IERROR = @ERROR
DLLCALL ("kernel32.dll" , "bool" , "CloseHandle" , "handle" , $HPROCESS [0 ] )
IF $IERROR THEN RETURN SETERROR ($IERROR , 0 , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_GETPROCESSAFFINITYMASK ($HPROCESS )
LOCAL $ARESULT = DLLCALL ("kernel32.dll" , "bool" , "GetProcessAffinityMask" , "handle" , $HPROCESS , "dword_ptr*" , 0 , "dword_ptr*" , 0 )
IF @ERROR OR NOT $ARESULT [0 ] THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , 0 )
LOCAL $AMASK [3 ]
$AMASK [0 ] = TRUE
$AMASK [1 ] = $ARESULT [2 ]
$AMASK [2 ] = $ARESULT [3 ]
RETURN $AMASK
ENDFUNC
FUNC _WINAPI_GETPROCESSCOMMANDLINE ($IPID = 0 )
IF NOT $IPID THEN $IPID = @AUTOITPID
LOCAL $HPROCESS = DLLCALL ("kernel32.dll" , "handle" , "OpenProcess" , "dword" , (($__WINVER < 1536 ) 1040 4112 ) , "bool" , 0 , "dword" , $IPID )
IF @ERROR OR NOT $HPROCESS [0 ] THEN RETURN SETERROR (@ERROR + 20 , @EXTENDED , "" )
$HPROCESS = $HPROCESS [0 ]
LOCAL $TPBI = DLLSTRUCTCREATE ("ulong_ptr ExitStatus;ptr PebBaseAddress;ulong_ptr AffinityMask;ulong_ptr BasePriority;ulong_ptr UniqueProcessId;ulong_ptr InheritedFromUniqueProcessId" )
LOCAL $TPEB = DLLSTRUCTCREATE ("byte InheritedAddressSpace;byte ReadImageFileExecOptions;byte BeingDebugged;byte Spare;ptr Mutant;ptr ImageBaseAddress;ptr LoaderData;ptr ProcessParameters;ptr SubSystemData;ptr ProcessHeap;ptr FastPebLock;ptr FastPebLockRoutine;ptr FastPebUnlockRoutine;ulong EnvironmentUpdateCount;ptr KernelCallbackTable;ptr EventLogSection;ptr EventLog;ptr FreeList;ulong TlsExpansionCounter;ptr TlsBitmap;ulong TlsBitmapBits[2];ptr ReadOnlySharedMemoryBase;ptr ReadOnlySharedMemoryHeap;ptr ReadOnlyStaticServerData;ptr AnsiCodePageData;ptr OemCodePageData;ptr UnicodeCaseTableData;ulong NumberOfProcessors;ulong NtGlobalFlag;byte Spare2[4];int64 CriticalSectionTimeout;ulong HeapSegmentReserve;ulong HeapSegmentCommit;ulong HeapDeCommitTotalFreeThreshold;ulong HeapDeCommitFreeBlockThreshold;ulong NumberOfHeaps;ulong MaximumNumberOfHeaps;ptr ProcessHeaps;ptr GdiSharedHandleTable;ptr ProcessStarterHelper;ptr GdiDCAttributeList;ptr LoaderLock;ulong OSMajorVersion;ulong OSMinorVersion;ulong OSBuildNumber;ulong OSPlatformId;ulong ImageSubSystem;ulong ImageSubSystemMajorVersion;ulong ImageSubSystemMinorVersion;ulong GdiHandleBuffer[34];ulong PostProcessInitRoutine;ulong TlsExpansionBitmap;byte TlsExpansionBitmapBits[128];ulong SessionId" )
LOCAL $TUPP = DLLSTRUCTCREATE ("ulong AllocationSize;ulong ActualSize;ulong Flags;ulong Unknown1;ushort LengthUnknown2;ushort MaxLengthUnknown2;ptr Unknown2;ptr InputHandle;ptr OutputHandle;ptr ErrorHandle;ushort LengthCurrentDirectory;ushort MaxLengthCurrentDirectory;ptr CurrentDirectory;ptr CurrentDirectoryHandle;ushort LengthSearchPaths;ushort MaxLengthSearchPaths;ptr SearchPaths;ushort LengthApplicationName;ushort MaxLengthApplicationName;ptr ApplicationName;ushort LengthCommandLine;ushort MaxLengthCommandLine;ptr CommandLine;ptr EnvironmentBlock;ulong Unknown[9];ushort LengthUnknown3;ushort MaxLengthUnknown3;ptr Unknown3;ushort LengthUnknown4;ushort MaxLengthUnknown4;ptr Unknown4;ushort LengthUnknown5;ushort MaxLengthUnknown5;ptr Unknown5" )
LOCAL $TCMD
LOCAL $ARET , $IERROR = 0
DO
$ARET = DLLCALL ("ntdll.dll" , "long" , "NtQueryInformationProcess" , "handle" , $HPROCESS , "ulong" , 0 , "struct*" , $TPBI , "ulong" , DLLSTRUCTGETSIZE ($TPBI ) , "ulong*" , 0 )
IF @ERROR OR $ARET [0 ] THEN
$IERROR = @ERROR + 30
EXITLOOP
ENDIF
$ARET = DLLCALL ("kernel32.dll" , "bool" , "ReadProcessMemory" , "handle" , $HPROCESS , "ptr" , DLLSTRUCTGETDATA ($TPBI , "PebBaseAddress" ) , "struct*" , $TPEB , "ulong_ptr" , DLLSTRUCTGETSIZE ($TPEB ) , "ulong_ptr*" , 0 )
IF @ERROR OR NOT $ARET [0 ] OR (NOT $ARET [5 ] ) THEN
$IERROR = @ERROR + 40
EXITLOOP
ENDIF
$ARET = DLLCALL ("kernel32.dll" , "bool" , "ReadProcessMemory" , "handle" , $HPROCESS , "ptr" , DLLSTRUCTGETDATA ($TPEB , "ProcessParameters" ) , "struct*" , $TUPP , "ulong_ptr" , DLLSTRUCTGETSIZE ($TUPP ) , "ulong_ptr*" , 0 )
IF @ERROR OR NOT $ARET [0 ] OR (NOT $ARET [5 ] ) THEN
$IERROR = @ERROR + 50
EXITLOOP
ENDIF
$TCMD = DLLSTRUCTCREATE ("byte[" & DLLSTRUCTGETDATA ($TUPP , "MaxLengthCommandLine" ) & "]" )
IF @ERROR THEN
$IERROR = @ERROR + 60
EXITLOOP
ENDIF
$ARET = DLLCALL ("kernel32.dll" , "bool" , "ReadProcessMemory" , "handle" , $HPROCESS , "ptr" , DLLSTRUCTGETDATA ($TUPP , "CommandLine" ) , "struct*" , $TCMD , "ulong_ptr" , DLLSTRUCTGETSIZE ($TCMD ) , "ulong_ptr*" , 0 )
IF @ERROR OR NOT $ARET [0 ] OR (NOT $ARET [5 ] ) THEN
$IERROR = @ERROR + 70
EXITLOOP
ENDIF
UNTIL 1
DLLCALL ("kernel32.dll" , "bool" , "CloseHandle" , "handle" , $HPROCESS )
IF $IERROR THEN RETURN SETERROR ($IERROR , 0 , "" )
RETURN STRINGSTRIPWS (_WINAPI_PATHGETARGS (_WINAPI_GETSTRING (DLLSTRUCTGETPTR ($TCMD , 1 ) ) ) , $STR_STRIPLEADING + $STR_STRIPTRAILING )
ENDFUNC
FUNC _WINAPI_GETPROCESSFILENAME ($IPID = 0 )
IF NOT $IPID THEN $IPID = @AUTOITPID
LOCAL $HPROCESS = DLLCALL ("kernel32.dll" , "handle" , "OpenProcess" , "dword" , (($__WINVER < 1536 ) 1040 4112 ) , "bool" , 0 , "dword" , $IPID )
IF @ERROR OR NOT $HPROCESS [0 ] THEN RETURN SETERROR (@ERROR + 20 , @EXTENDED , "" )
LOCAL $SPATH = _WINAPI_GETMODULEFILENAMEEX ($HPROCESS [0 ] )
LOCAL $IERROR = @ERROR
DLLCALL ("kernel32.dll" , "bool" , "CloseHandle" , "handle" , $HPROCESS [0 ] )
IF $IERROR THEN RETURN SETERROR (@ERROR , 0 , "" )
RETURN $SPATH
ENDFUNC
FUNC _WINAPI_GETPROCESSHANDLECOUNT ($IPID = 0 )
IF NOT $IPID THEN $IPID = @AUTOITPID
LOCAL $HPROCESS = DLLCALL ("kernel32.dll" , "handle" , "OpenProcess" , "dword" , (($__WINVER < 1536 ) 1024 4096 ) , "bool" , 0 , "dword" , $IPID )
IF @ERROR OR NOT $HPROCESS [0 ] THEN RETURN SETERROR (@ERROR + 20 , @EXTENDED , 0 )
LOCAL $ARET = DLLCALL ("kernel32.dll" , "bool" , "GetProcessHandleCount" , "handle" , $HPROCESS [0 ] , "dword*" , 0 )
IF __CHECKERRORCLOSEHANDLE ($ARET , $HPROCESS [0 ] ) THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [2 ]
ENDFUNC
FUNC _WINAPI_GETPROCESSID ($HPROCESS )
LOCAL $ARET = DLLCALL ("kernel32.dll" , "dword" , "GetProcessId" , "handle" , $HPROCESS )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_GETPROCESSIOCOUNTERS ($IPID = 0 )
IF NOT $IPID THEN $IPID = @AUTOITPID
LOCAL $HPROCESS = DLLCALL ("kernel32.dll" , "handle" , "OpenProcess" , "dword" , (($__WINVER < 1536 ) 1024 4096 ) , "bool" , 0 , "dword" , $IPID )
IF @ERROR OR NOT $HPROCESS [0 ] THEN RETURN SETERROR (@ERROR + 20 , @EXTENDED , 0 )
LOCAL $TIO_COUNTERS = DLLSTRUCTCREATE ("uint64[6]" )
LOCAL $ARET = DLLCALL ("kernel32.dll" , "bool" , "GetProcessIoCounters" , "handle" , $HPROCESS [0 ] , "struct*" , $TIO_COUNTERS )
IF __CHECKERRORCLOSEHANDLE ($ARET , $HPROCESS [0 ] ) THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
LOCAL $ARESULT [6 ]
FOR $I = 0 TO 5
$ARESULT [$I ] = DLLSTRUCTGETDATA ($TIO_COUNTERS , 1 , $I + 1 )
NEXT
RETURN $ARESULT
ENDFUNC
FUNC _WINAPI_GETPROCESSMEMORYINFO ($IPID = 0 )
IF NOT $IPID THEN $IPID = @AUTOITPID
LOCAL $HPROCESS = DLLCALL ("kernel32.dll" , "handle" , "OpenProcess" , "dword" , (($__WINVER < 1536 ) 1040 4112 ) , "bool" , 0 , "dword" , $IPID )
IF @ERROR OR NOT $HPROCESS [0 ] THEN RETURN SETERROR (@ERROR + 20 , @EXTENDED , 0 )
LOCAL $TPMC_EX = DLLSTRUCTCREATE ("dword;dword;ulong_ptr;ulong_ptr;ulong_ptr;ulong_ptr;ulong_ptr;ulong_ptr;ulong_ptr;ulong_ptr;ulong_ptr" )
LOCAL $ARET = DLLCALL (@SYSTEMDIR & "\psapi.dll" , "bool" , "GetProcessMemoryInfo" , "handle" , $HPROCESS [0 ] , "struct*" , $TPMC_EX , "int" , DLLSTRUCTGETSIZE ($TPMC_EX ) )
IF __CHECKERRORCLOSEHANDLE ($ARET , $HPROCESS [0 ] ) THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
LOCAL $ARESULT [10 ]
FOR $I = 0 TO 9
$ARESULT [$I ] = DLLSTRUCTGETDATA ($TPMC_EX , $I + 2 )
NEXT
RETURN $ARESULT
ENDFUNC
FUNC _WINAPI_GETPROCESSNAME ($IPID = 0 )
IF NOT $IPID THEN $IPID = @AUTOITPID
LOCAL $HSNAPSHOT = DLLCALL ("kernel32.dll" , "handle" , "CreateToolhelp32Snapshot" , "dword" , 2 , "dword" , 0 )
IF @ERROR OR NOT $HSNAPSHOT [0 ] THEN RETURN SETERROR (@ERROR + 20 , @EXTENDED , "" )
$HSNAPSHOT = $HSNAPSHOT [0 ]
LOCAL $TPROCESSENTRY32 = DLLSTRUCTCREATE ($TAGPROCESSENTRY32 )
DLLSTRUCTSETDATA ($TPROCESSENTRY32 , "Size" , DLLSTRUCTGETSIZE ($TPROCESSENTRY32 ) )
LOCAL $ARET = DLLCALL ("kernel32.dll" , "bool" , "Process32FirstW" , "handle" , $HSNAPSHOT , "struct*" , $TPROCESSENTRY32 )
LOCAL $IERROR = @ERROR
WHILE (NOT @ERROR ) AND ($ARET [0 ] )
IF DLLSTRUCTGETDATA ($TPROCESSENTRY32 , "ProcessID" ) = $IPID THEN
EXITLOOP
ENDIF
$ARET = DLLCALL ("kernel32.dll" , "bool" , "Process32NextW" , "handle" , $HSNAPSHOT , "struct*" , $TPROCESSENTRY32 )
$IERROR = @ERROR
WEND
DLLCALL ("kernel32.dll" , "bool" , "CloseHandle" , "handle" , $HSNAPSHOT )
IF $IERROR THEN RETURN SETERROR ($IERROR , 0 , "" )
IF NOT $ARET [0 ] THEN SETERROR (10 , 0 , "" )
RETURN DLLSTRUCTGETDATA ($TPROCESSENTRY32 , "ExeFile" )
ENDFUNC
FUNC _WINAPI_GETPROCESSTIMES ($IPID = 0 )
IF NOT $IPID THEN $IPID = @AUTOITPID
LOCAL $HPROCESS = DLLCALL ("kernel32.dll" , "handle" , "OpenProcess" , "dword" , (($__WINVER < 1536 ) 1024 4096 ) , "bool" , 0 , "dword" , $IPID )
IF @ERROR OR NOT $HPROCESS [0 ] THEN RETURN SETERROR (@ERROR + 20 , @EXTENDED , 0 )
LOCAL $TFILETIME = DLLSTRUCTCREATE ($TAGFILETIME )
LOCAL $ARET = DLLCALL ("kernel32.dll" , "bool" , "GetProcessTimes" , "handle" , $HPROCESS [0 ] , "struct*" , $TFILETIME , "uint64*" , 0 , "uint64*" , 0 , "uint64*" , 0 )
IF __CHECKERRORCLOSEHANDLE ($ARET , $HPROCESS [0 ] ) THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
LOCAL $ARESULT [3 ]
$ARESULT [0 ] = $TFILETIME
$ARESULT [1 ] = $ARET [4 ]
$ARESULT [2 ] = $ARET [5 ]
RETURN $ARESULT
ENDFUNC
FUNC _WINAPI_GETPROCESSUSER ($IPID = 0 )
IF NOT $IPID THEN $IPID = @AUTOITPID
LOCAL $TSID , $HTOKEN , $ARET
LOCAL $IERROR = 0
LOCAL $HPROCESS = DLLCALL ("kernel32.dll" , "handle" , "OpenProcess" , "dword" , (($__WINVER < 1536 ) 1024 4096 ) , "bool" , 0 , "dword" , $IPID )
IF @ERROR OR NOT $HPROCESS [0 ] THEN RETURN SETERROR (@ERROR + 20 , @EXTENDED , 0 )
DO
$HTOKEN = _WINAPI_OPENPROCESSTOKEN (8 , $HPROCESS [0 ] )
IF NOT $HTOKEN THEN
$IERROR = @ERROR + 10
EXITLOOP
ENDIF
$TSID = DLLSTRUCTCREATE ("ptr;byte[1024]" )
$ARET = DLLCALL ("advapi32.dll" , "bool" , "GetTokenInformation" , "handle" , $HTOKEN , "uint" , 1 , "struct*" , $TSID , "dword" , DLLSTRUCTGETSIZE ($TSID ) , "dword*" , 0 )
IF @ERROR OR NOT $ARET [0 ] THEN
$IERROR = @ERROR + 30
EXITLOOP
ENDIF
$ARET = DLLCALL ("advapi32.dll" , "bool" , "LookupAccountSidW" , "ptr" , 0 , "ptr" , DLLSTRUCTGETDATA ($TSID , 1 ) , "wstr" , "" , "dword*" , 2048 , "wstr" , "" , "dword*" , 2048 , "uint*" , 0 )
IF @ERROR OR NOT $ARET [0 ] THEN
$IERROR = @ERROR + 40
EXITLOOP
ENDIF
UNTIL 1
IF $HTOKEN THEN
DLLCALL ("kernel32.dll" , "bool" , "CloseHandle" , "handle" , $HTOKEN )
ENDIF
DLLCALL ("kernel32.dll" , "bool" , "CloseHandle" , "handle" , $HPROCESS [0 ] )
IF $IERROR THEN RETURN SETERROR ($IERROR , 0 , 0 )
LOCAL $ARESULT [2 ]
$ARESULT [0 ] = $ARET [3 ]
$ARESULT [1 ] = $ARET [5 ]
RETURN $ARESULT
ENDFUNC
FUNC _WINAPI_GETPROCESSWORKINGDIRECTORY ($IPID = 0 )
IF NOT $IPID THEN $IPID = @AUTOITPID
LOCAL $ARET , $IERROR = 0
LOCAL $HPROCESS = DLLCALL ("kernel32.dll" , "handle" , "OpenProcess" , "dword" , (($__WINVER < 1536 ) 1040 4112 ) , "bool" , 0 , "dword" , $IPID )
IF @ERROR OR NOT $HPROCESS [0 ] THEN RETURN SETERROR (@ERROR + 20 , @EXTENDED , "" )
$HPROCESS = $HPROCESS [0 ]
LOCAL $TPBI = DLLSTRUCTCREATE ("ulong_ptr ExitStatus;ptr PebBaseAddress;ulong_ptr AffinityMask;ulong_ptr BasePriority;ulong_ptr UniqueProcessId;ulong_ptr InheritedFromUniqueProcessId" )
LOCAL $TPEB = DLLSTRUCTCREATE ("byte InheritedAddressSpace;byte ReadImageFileExecOptions;byte BeingDebugged;byte Spare;ptr Mutant;ptr ImageBaseAddress;ptr LoaderData;ptr ProcessParameters;ptr SubSystemData;ptr ProcessHeap;ptr FastPebLock;ptr FastPebLockRoutine;ptr FastPebUnlockRoutine;ulong EnvironmentUpdateCount;ptr KernelCallbackTable;ptr EventLogSection;ptr EventLog;ptr FreeList;ulong TlsExpansionCounter;ptr TlsBitmap;ulong TlsBitmapBits[2];ptr ReadOnlySharedMemoryBase;ptr ReadOnlySharedMemoryHeap;ptr ReadOnlyStaticServerData;ptr AnsiCodePageData;ptr OemCodePageData;ptr UnicodeCaseTableData;ulong NumberOfProcessors;ulong NtGlobalFlag;byte Spare2[4];int64 CriticalSectionTimeout;ulong HeapSegmentReserve;ulong HeapSegmentCommit;ulong HeapDeCommitTotalFreeThreshold;ulong HeapDeCommitFreeBlockThreshold;ulong NumberOfHeaps;ulong MaximumNumberOfHeaps;ptr ProcessHeaps;ptr GdiSharedHandleTable;ptr ProcessStarterHelper;ptr GdiDCAttributeList;ptr LoaderLock;ulong OSMajorVersion;ulong OSMinorVersion;ulong OSBuildNumber;ulong OSPlatformId;ulong ImageSubSystem;ulong ImageSubSystemMajorVersion;ulong ImageSubSystemMinorVersion;ulong GdiHandleBuffer[34];ulong PostProcessInitRoutine;ulong TlsExpansionBitmap;byte TlsExpansionBitmapBits[128];ulong SessionId" )
LOCAL $TUPP = DLLSTRUCTCREATE ("ulong AllocationSize;ulong ActualSize;ulong Flags;ulong Unknown1;ushort LengthUnknown2;ushort MaxLengthUnknown2;ptr Unknown2;ptr InputHandle;ptr OutputHandle;ptr ErrorHandle;ushort LengthCurrentDirectory;ushort MaxLengthCurrentDirectory;ptr CurrentDirectory;ptr CurrentDirectoryHandle;ushort LengthSearchPaths;ushort MaxLengthSearchPaths;ptr SearchPaths;ushort LengthApplicationName;ushort MaxLengthApplicationName;ptr ApplicationName;ushort LengthCommandLine;ushort MaxLengthCommandLine;ptr CommandLine;ptr EnvironmentBlock;ulong Unknown[9];ushort LengthUnknown3;ushort MaxLengthUnknown3;ptr Unknown3;ushort LengthUnknown4;ushort MaxLengthUnknown4;ptr Unknown4;ushort LengthUnknown5;ushort MaxLengthUnknown5;ptr Unknown5" )
LOCAL $TDIR
DO
$ARET = DLLCALL ("ntdll.dll" , "long" , "NtQueryInformationProcess" , "handle" , $HPROCESS , "ulong" , 0 , "struct*" , $TPBI , "ulong" , DLLSTRUCTGETSIZE ($TPBI ) , "ulong*" , 0 )
IF @ERROR OR ($ARET [0 ] ) THEN
$IERROR = @ERROR + 10
EXITLOOP
ENDIF
$ARET = DLLCALL ("kernel32.dll" , "bool" , "ReadProcessMemory" , "handle" , $HPROCESS , "ptr" , DLLSTRUCTGETDATA ($TPBI , "PebBaseAddress" ) , "struct*" , $TPEB , "ulong_ptr" , DLLSTRUCTGETSIZE ($TPEB ) , "ulong_ptr*" , 0 )
IF @ERROR OR (NOT $ARET [0 ] ) OR (NOT $ARET [5 ] ) THEN
$IERROR = @ERROR + 30
EXITLOOP
ENDIF
$ARET = DLLCALL ("kernel32.dll" , "bool" , "ReadProcessMemory" , "handle" , $HPROCESS , "ptr" , DLLSTRUCTGETDATA ($TPEB , "ProcessParameters" ) , "struct*" , $TUPP , "ulong_ptr" , DLLSTRUCTGETSIZE ($TUPP ) , "ulong_ptr*" , 0 )
IF @ERROR OR (NOT $ARET [0 ] ) OR (NOT $ARET [5 ] ) THEN
$IERROR = @ERROR + 40
EXITLOOP
ENDIF
$TDIR = DLLSTRUCTCREATE ("byte[" & DLLSTRUCTGETDATA ($TUPP , "MaxLengthCurrentDirectory" ) & "]" )
IF @ERROR THEN
$IERROR = @ERROR + 50
EXITLOOP
ENDIF
$ARET = DLLCALL ("kernel32.dll" , "bool" , "ReadProcessMemory" , "handle" , $HPROCESS , "ptr" , DLLSTRUCTGETDATA ($TUPP , "CurrentDirectory" ) , "struct*" , $TDIR , "ulong_ptr" , DLLSTRUCTGETSIZE ($TDIR ) , "ulong_ptr*" , 0 )
IF @ERROR OR (NOT $ARET [0 ] ) OR (NOT $ARET [5 ] ) THEN
$IERROR = @ERROR + 60
EXITLOOP
ENDIF
$IERROR = 0
UNTIL 1
DLLCALL ("kernel32.dll" , "bool" , "CloseHandle" , "handle" , $HPROCESS )
IF $IERROR THEN RETURN SETERROR ($IERROR , 0 , "" )
RETURN _WINAPI_PATHREMOVEBACKSLASH (_WINAPI_GETSTRING (DLLSTRUCTGETPTR ($TDIR ) ) )
ENDFUNC
FUNC _WINAPI_GETTHREADDESKTOP ($ITHREADID )
LOCAL $ARET = DLLCALL ("user32.dll" , "handle" , "GetThreadDesktop" , "dword" , $ITHREADID )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_GETTHREADERRORMODE ()
LOCAL $ARET = DLLCALL ("kernel32.dll" , "dword" , "GetThreadErrorMode" )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_GETWINDOWFILENAME ($HWND )
LOCAL $IPID = 0
LOCAL $ARESULT = DLLCALL ("user32.dll" , "bool" , "IsWindow" , "hwnd" , $HWND )
IF $ARESULT [0 ] THEN
$ARESULT = DLLCALL ("user32.dll" , "dword" , "GetWindowThreadProcessId" , "hwnd" , $HWND , "dword*" , 0 )
$IPID = $ARESULT [2 ]
ENDIF
IF NOT $IPID THEN RETURN SETERROR (1 , 0 , "" )
LOCAL $SRESULT = _WINAPI_GETPROCESSFILENAME ($IPID )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , "" )
RETURN $SRESULT
ENDFUNC
FUNC _WINAPI_ISELEVATED ()
LOCAL $IELEV , $ARET , $IERROR = 0
LOCAL $HTOKEN = _WINAPI_OPENPROCESSTOKEN (8 )
IF NOT $HTOKEN THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , FALSE )
DO
$ARET = DLLCALL ("advapi32.dll" , "bool" , "GetTokenInformation" , "handle" , $HTOKEN , "uint" , 20 , "uint*" , 0 , "dword" , 4 , "dword*" , 0 )
IF @ERROR OR NOT $ARET [0 ] THEN
$IERROR = @ERROR + 10
EXITLOOP
ENDIF
$IELEV = $ARET [3 ]
$ARET = DLLCALL ("advapi32.dll" , "bool" , "GetTokenInformation" , "handle" , $HTOKEN , "uint" , 18 , "uint*" , 0 , "dword" , 4 , "dword*" , 0 )
IF @ERROR OR NOT $ARET [0 ] THEN
$IERROR = @ERROR + 20
EXITLOOP
ENDIF
UNTIL 1
DLLCALL ("kernel32.dll" , "bool" , "CloseHandle" , "handle" , $HTOKEN )
IF $IERROR THEN RETURN SETERROR ($IERROR , 0 , FALSE )
RETURN SETEXTENDED ($ARET [0 ] + 4294967295 , $IELEV )
ENDFUNC
FUNC _WINAPI_ISPROCESSINJOB ($HPROCESS , $HJOB = 0 )
LOCAL $ARET = DLLCALL ("kernel32.dll" , "bool" , "IsProcessInJob" , "handle" , $HPROCESS , "handle" , $HJOB , "bool*" , 0 )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARET [3 ]
ENDFUNC
FUNC _WINAPI_OPENJOBOBJECT ($SNAME , $IACCESS = $JOB_OBJECT_ALL_ACCESS , $BINHERIT = FALSE )
LOCAL $ARET = DLLCALL ("kernel32.dll" , "handle" , "OpenJobObjectW" , "dword" , $IACCESS , "bool" , $BINHERIT , "wstr" , $SNAME )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_OPENMUTEX ($SMUTEX , $IACCESS = $MUTEX_ALL_ACCESS , $BINHERIT = FALSE )
LOCAL $ARET = DLLCALL ("kernel32.dll" , "handle" , "OpenMutexW" , "dword" , $IACCESS , "bool" , $BINHERIT , "wstr" , $SMUTEX )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_OPENPROCESS ($IACCESS , $BINHERIT , $IPID , $BDEBUGPRIV = FALSE )
LOCAL $ARESULT = DLLCALL ("kernel32.dll" , "handle" , "OpenProcess" , "dword" , $IACCESS , "bool" , $BINHERIT , "dword" , $IPID )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
IF $ARESULT [0 ] THEN RETURN $ARESULT [0 ]
IF NOT $BDEBUGPRIV THEN RETURN SETERROR (100 , 0 , 0 )
LOCAL $HTOKEN = _SECURITY__OPENTHREADTOKENEX (BITOR ($TOKEN_ADJUST_PRIVILEGES , $TOKEN_QUERY ) )
IF @ERROR THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , 0 )
_SECURITY__SETPRIVILEGE ($HTOKEN , "SeDebugPrivilege" , TRUE )
LOCAL $IERROR = @ERROR
LOCAL $IEXTENDED = @EXTENDED
LOCAL $IRET = 0
IF NOT @ERROR THEN
$ARESULT = DLLCALL ("kernel32.dll" , "handle" , "OpenProcess" , "dword" , $IACCESS , "bool" , $BINHERIT , "dword" , $IPID )
$IERROR = @ERROR
$IEXTENDED = @EXTENDED
IF $ARESULT [0 ] THEN $IRET = $ARESULT [0 ]
_SECURITY__SETPRIVILEGE ($HTOKEN , "SeDebugPrivilege" , FALSE )
IF @ERROR THEN
$IERROR = @ERROR + 20
$IEXTENDED = @EXTENDED
ENDIF
ELSE
$IERROR = @ERROR + 30
ENDIF
DLLCALL ("kernel32.dll" , "bool" , "CloseHandle" , "handle" , $HTOKEN )
RETURN SETERROR ($IERROR , $IEXTENDED , $IRET )
ENDFUNC
FUNC _WINAPI_OPENPROCESSTOKEN ($IACCESS , $HPROCESS = 0 )
IF NOT $HPROCESS THEN
$HPROCESS = DLLCALL ("kernel32.dll" , "handle" , "GetCurrentProcess" )
$HPROCESS = $HPROCESS [0 ]
ENDIF
LOCAL $ARET = DLLCALL ("advapi32.dll" , "bool" , "OpenProcessToken" , "handle" , $HPROCESS , "dword" , $IACCESS , "handle*" , 0 )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [3 ]
ENDFUNC
FUNC _WINAPI_OPENSEMAPHORE ($SSEMAPHORE , $IACCESS = 2031619 , $BINHERIT = FALSE )
LOCAL $ARET = DLLCALL ("kernel32.dll" , "handle" , "OpenSemaphoreW" , "dword" , $IACCESS , "bool" , $BINHERIT , "wstr" , $SSEMAPHORE )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_QUERYINFORMATIONJOBOBJECT ($HJOB , $IJOBOBJECTINFOCLASS , BYREF $TJOBOBJECTINFO )
LOCAL $ARET = DLLCALL ("kernel32.dll" , "bool" , "QueryInformationJobObject" , "handle" , $HJOB , "int" , $IJOBOBJECTINFOCLASS , "struct*" , $TJOBOBJECTINFO , "dword" , DLLSTRUCTGETSIZE ($TJOBOBJECTINFO ) , "dword*" , 0 )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [5 ]
ENDFUNC
FUNC _WINAPI_RELEASEMUTEX ($HMUTEX )
LOCAL $ARET = DLLCALL ("kernel32.dll" , "bool" , "ReleaseMutex" , "handle" , $HMUTEX )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_RELEASESEMAPHORE ($HSEMAPHORE , $IINCREASE = 1 )
LOCAL $ARET = DLLCALL ("kernel32.dll" , "bool" , "ReleaseSemaphore" , "handle" , $HSEMAPHORE , "long" , $IINCREASE , "long*" , 0 )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , 0 )
RETURN $ARET [3 ]
ENDFUNC
FUNC _WINAPI_RESETEVENT ($HEVENT )
LOCAL $ARET = DLLCALL ("kernel32.dll" , "bool" , "ResetEvent" , "handle" , $HEVENT )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_SETEVENT ($HEVENT )
LOCAL $ARESULT = DLLCALL ("kernel32.dll" , "bool" , "SetEvent" , "handle" , $HEVENT )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_SETINFORMATIONJOBOBJECT ($HJOB , $IJOBOBJECTINFOCLASS , $TJOBOBJECTINFO )
LOCAL $ARET = DLLCALL ("kernel32.dll" , "bool" , "SetInformationJobObject" , "handle" , $HJOB , "int" , $IJOBOBJECTINFOCLASS , "struct*" , $TJOBOBJECTINFO , "dword" , DLLSTRUCTGETSIZE ($TJOBOBJECTINFO ) )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_SETPRIORITYCLASS ($IPRIORITY , $IPID = 0 )
IF NOT $IPID THEN $IPID = @AUTOITPID
LOCAL $HPROCESS = DLLCALL ("kernel32.dll" , "handle" , "OpenProcess" , "dword" , (($__WINVER < 1536 ) 1536 4608 ) , "bool" , 0 , "dword" , $IPID )
IF @ERROR OR NOT $HPROCESS [0 ] THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , 0 )
LOCAL $IERROR = 0
LOCAL $ARET = DLLCALL ("kernel32.dll" , "bool" , "SetPriorityClass" , "handle" , $HPROCESS [0 ] , "dword" , $IPRIORITY )
IF @ERROR THEN $IERROR = @ERROR
DLLCALL ("kernel32.dll" , "bool" , "CloseHandle" , "handle" , $HPROCESS [0 ] )
IF $IERROR THEN RETURN SETERROR ($IERROR , 0 , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_SETPROCESSAFFINITYMASK ($HPROCESS , $IMASK )
LOCAL $ARESULT = DLLCALL ("kernel32.dll" , "bool" , "SetProcessAffinityMask" , "handle" , $HPROCESS , "ulong_ptr" , $IMASK )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_SETTHREADDESKTOP ($HDESKTOP )
LOCAL $ARET = DLLCALL ("user32.dll" , "bool" , "SetThreadDesktop" , "handle" , $HDESKTOP )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_SETTHREADERRORMODE ($IMODE )
LOCAL $ARET = DLLCALL ("kernel32.dll" , "bool" , "SetThreadErrorMode" , "dword" , $IMODE , "dword*" , 0 )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , 0 )
RETURN $ARET [2 ]
ENDFUNC
FUNC _WINAPI_SETTHREADEXECUTIONSTATE ($IFLAGS )
LOCAL $ARET = DLLCALL ("kernel32.dll" , "dword" , "SetThreadExecutionState" , "dword" , $IFLAGS )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_TERMINATEJOBOBJECT ($HJOB , $IEXITCODE = 0 )
LOCAL $ARET = DLLCALL ("kernel32.dll" , "bool" , "TerminateJobObject" , "handle" , $HJOB , "uint" , $IEXITCODE )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_TERMINATEPROCESS ($HPROCESS , $IEXITCODE = 0 )
LOCAL $ARET = DLLCALL ("kernel32.dll" , "bool" , "TerminateProcess" , "handle" , $HPROCESS , "uint" , $IEXITCODE )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_USERHANDLEGRANTACCESS ($HOBJECT , $HJOB , $BGRANT )
LOCAL $ARET = DLLCALL ("kernel32.dll" , "bool" , "UserHandleGrantAccess" , "handle" , $HOBJECT , "handle" , $HJOB , "bool" , $BGRANT )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_WAITFORINPUTIDLE ($HPROCESS , $ITIMEOUT = + 4294967295 )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "dword" , "WaitForInputIdle" , "handle" , $HPROCESS , "dword" , $ITIMEOUT )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_WAITFORMULTIPLEOBJECTS ($ICOUNT , $PAHANDLES , $BWAITALL = FALSE , $ITIMEOUT = + 4294967295 )
LOCAL $ARESULT = DLLCALL ("kernel32.dll" , "INT" , "WaitForMultipleObjects" , "dword" , $ICOUNT , "struct*" , $PAHANDLES , "bool" , $BWAITALL , "dword" , $ITIMEOUT )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , + 4294967295 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_WAITFORSINGLEOBJECT ($HHANDLE , $ITIMEOUT = + 4294967295 )
LOCAL $ARESULT = DLLCALL ("kernel32.dll" , "INT" , "WaitForSingleObject" , "handle" , $HHANDLE , "dword" , $ITIMEOUT )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , + 4294967295 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_WRITECONSOLE ($HCONSOLE , $STEXT )
LOCAL $ARESULT = DLLCALL ("kernel32.dll" , "bool" , "WriteConsoleW" , "handle" , $HCONSOLE , "wstr" , $STEXT , "dword" , STRINGLEN ($STEXT ) , "dword*" , 0 , "ptr" , 0 )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARESULT [0 ]
ENDFUNC
#EndRegion Public Functions
GLOBAL CONST $KLF_ACTIVATE = 1
GLOBAL CONST $KLF_NOTELLSHELL = 128
GLOBAL CONST $KLF_REORDER = 8
GLOBAL CONST $KLF_REPLACELANG = 16
GLOBAL CONST $KLF_RESET = 1073741824
GLOBAL CONST $KLF_SETFORPROCESS = 256
GLOBAL CONST $KLF_SHIFTLOCK = 65536
GLOBAL CONST $KLF_SUBSTITUTE_OK = 2
GLOBAL CONST $HKL_NEXT = 1
GLOBAL CONST $HKL_PREV = 0
GLOBAL CONST $AW_ACTIVATE = 131072
GLOBAL CONST $AW_BLEND = 524288
GLOBAL CONST $AW_CENTER = 16
GLOBAL CONST $AW_HIDE = 65536
GLOBAL CONST $AW_HOR_NEGATIVE = 2
GLOBAL CONST $AW_HOR_POSITIVE = 1
GLOBAL CONST $AW_SLIDE = 262144
GLOBAL CONST $AW_VER_NEGATIVE = 8
GLOBAL CONST $AW_VER_POSITIVE = 4
GLOBAL CONST $BSF_ALLOWSFW = 128
GLOBAL CONST $BSF_FLUSHDISK = 4
GLOBAL CONST $BSF_FORCEIFHUNG = 32
GLOBAL CONST $BSF_IGNORECURRENTTASK = 2
GLOBAL CONST $BSF_NOHANG = 8
GLOBAL CONST $BSF_NOTIMEOUTIFNOTHUNG = 64
GLOBAL CONST $BSF_POSTMESSAGE = 16
GLOBAL CONST $BSF_QUERY = 1
GLOBAL CONST $BSF_SENDNOTIFYMESSAGE = 256
GLOBAL CONST $BSM_ALLCOMPONENTS = 0
GLOBAL CONST $BSM_ALLDESKTOPS = 8
GLOBAL CONST $BSM_APPLICATIONS = 16
GLOBAL CONST $BSM_INSTALLABLEDRIVERS = 4
GLOBAL CONST $BSM_NETDRIVER = 2
GLOBAL CONST $BSM_VXDS = 1
GLOBAL CONST $MDITILE_HORIZONTAL = 1
GLOBAL CONST $MDITILE_SKIPDISABLED = 2
GLOBAL CONST $MDITILE_VERTICAL = 0
GLOBAL CONST $MDITILE_ZORDER = 4
GLOBAL CONST $MSGFLT_ALLOW = 1
GLOBAL CONST $MSGFLT_DISALLOW = 2
GLOBAL CONST $MSGFLT_RESET = 0
GLOBAL CONST $MSGFLTINFO_ALLOWED_HIGHER = 3
GLOBAL CONST $MSGFLTINFO_ALREADYALLOWED_FORWND = 1
GLOBAL CONST $MSGFLTINFO_ALREADYDISALLOWED_FORWND = 2
GLOBAL CONST $MSGFLTINFO_NONE = 0
GLOBAL CONST $CWP_ALL = 0
GLOBAL CONST $CWP_SKIPINVISIBLE = 1
GLOBAL CONST $CWP_SKIPDISABLED = 2
GLOBAL CONST $CWP_SKIPTRANSPARENT = 4
GLOBAL CONST $COMPRESSION_FORMAT_NONE = 0
GLOBAL CONST $COMPRESSION_FORMAT_DEFAULT = 1
GLOBAL CONST $COMPRESSION_FORMAT_LZNT1 = 2
GLOBAL CONST $COMPRESSION_FORMAT_XPRESS = 3
GLOBAL CONST $COMPRESSION_FORMAT_XPRESS_HUFF = 4
GLOBAL CONST $COMPRESSION_ENGINE_STANDARD = 0
GLOBAL CONST $COMPRESSION_ENGINE_MAXIMUM = 256
GLOBAL CONST $COMPRESSION_ENGINE_HIBER = 512
GLOBAL CONST $WINSTA_ACCESSCLIPBOARD = 4
GLOBAL CONST $WINSTA_ACCESSGLOBALATOMS = 32
GLOBAL CONST $WINSTA_CREATEDESKTOP = 8
GLOBAL CONST $WINSTA_ENUMDESKTOPS = 1
GLOBAL CONST $WINSTA_ENUMERATE = 256
GLOBAL CONST $WINSTA_EXITWINDOWS = 64
GLOBAL CONST $WINSTA_READATTRIBUTES = 2
GLOBAL CONST $WINSTA_READSCREEN = 512
GLOBAL CONST $WINSTA_WRITEATTRIBUTES = 16
GLOBAL CONST $WINSTA_ALL_ACCESS = BITOR ($WINSTA_ACCESSCLIPBOARD , $WINSTA_ACCESSGLOBALATOMS , $WINSTA_CREATEDESKTOP , $WINSTA_ENUMDESKTOPS , $WINSTA_ENUMERATE , $WINSTA_EXITWINDOWS , $WINSTA_READATTRIBUTES , $WINSTA_READSCREEN , $WINSTA_WRITEATTRIBUTES )
GLOBAL CONST $CWF_CREATE_ONLY = 1
GLOBAL CONST $GCL_CBCLSEXTRA = + 4294967276
GLOBAL CONST $GCL_CBWNDEXTRA = + 4294967278
GLOBAL CONST $GCL_HBRBACKGROUND = + 4294967286
GLOBAL CONST $GCL_HCURSOR = + 4294967284
GLOBAL CONST $GCL_HICON = + 4294967282
GLOBAL CONST $GCL_HICONSM = + 4294967262
GLOBAL CONST $GCL_HMODULE = + 4294967280
GLOBAL CONST $GCL_MENUNAME = + 4294967288
GLOBAL CONST $GCL_STYLE = + 4294967270
GLOBAL CONST $GCL_WNDPROC = + 4294967272
GLOBAL CONST $DOCKINFO_DOCKED = 2
GLOBAL CONST $DOCKINFO_UNDOCKED = 1
GLOBAL CONST $DOCKINFO_USER_SUPPLIED = 4
GLOBAL CONST $DOCKINFO_USER_DOCKED = 5
GLOBAL CONST $DOCKINFO_USER_UNDOCKED = 6
GLOBAL CONST $GUI_CARETBLINKING = 1
GLOBAL CONST $GUI_INMENUMODE = 4
GLOBAL CONST $GUI_INMOVESIZE = 2
GLOBAL CONST $GUI_POPUPMENUMODE = 16
GLOBAL CONST $GUI_SYSTEMMENUMODE = 8
GLOBAL CONST $HANDLE_FLAG_INHERIT = 1
GLOBAL CONST $HANDLE_FLAG_PROTECT_FROM_CLOSE = 2
GLOBAL CONST $GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS = 4
GLOBAL CONST $GET_MODULE_HANDLE_EX_FLAG_PIN = 1
GLOBAL CONST $GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT = 2
GLOBAL CONST $GET_MODULE_HANDLE_EX_FLAG_DEFAULT = 0
GLOBAL CONST $PROCESSOR_ARCHITECTURE_AMD64 = 9
GLOBAL CONST $PROCESSOR_ARCHITECTURE_IA64 = 6
GLOBAL CONST $PROCESSOR_ARCHITECTURE_INTEL = 0
GLOBAL CONST $PROCESSOR_ARCHITECTURE_UNKNOWN = 65535
GLOBAL CONST $PROCESSOR_INTEL_386 = 386
GLOBAL CONST $PROCESSOR_INTEL_486 = 486
GLOBAL CONST $PROCESSOR_INTEL_PENTIUM = 586
GLOBAL CONST $PROCESSOR_INTEL_IA64 = 2200
GLOBAL CONST $PROCESSOR_AMD_X8664 = 8664
GLOBAL CONST $UOI_FLAGS = 1
GLOBAL CONST $UOI_HEAPSIZE = 5
GLOBAL CONST $UOI_IO = 6
GLOBAL CONST $UOI_NAME = 2
GLOBAL CONST $UOI_TYPE = 3
GLOBAL CONST $UOI_USER_SID = 4
GLOBAL CONST $DF_ALLOWOTHERACCOUNTHOOK = 1
GLOBAL CONST $WSF_VISIBLE = 1
GLOBAL CONST $VER_SUITE_BACKOFFICE = 4
GLOBAL CONST $VER_SUITE_BLADE = 1024
GLOBAL CONST $VER_SUITE_COMPUTE_SERVER = 16384
GLOBAL CONST $VER_SUITE_DATACENTER = 128
GLOBAL CONST $VER_SUITE_ENTERPRISE = 2
GLOBAL CONST $VER_SUITE_EMBEDDEDNT = 64
GLOBAL CONST $VER_SUITE_PERSONAL = 512
GLOBAL CONST $VER_SUITE_SINGLEUSERTS = 256
GLOBAL CONST $VER_SUITE_SMALLBUSINESS = 1
GLOBAL CONST $VER_SUITE_SMALLBUSINESS_RESTRICTED = 32
GLOBAL CONST $VER_SUITE_STORAGE_SERVER = 8192
GLOBAL CONST $VER_SUITE_TERMINAL = 16
GLOBAL CONST $VER_SUITE_WH_SERVER = 32768
GLOBAL CONST $VER_NT_DOMAIN_CONTROLLER = 2
GLOBAL CONST $VER_NT_SERVER = 3
GLOBAL CONST $VER_NT_WORKSTATION = 1
GLOBAL CONST $WDA_MONITOR = 1
GLOBAL CONST $WDA_NONE = 0
GLOBAL CONST $PF_3DNOW_INSTRUCTIONS_AVAILABLE = 7
GLOBAL CONST $PF_CHANNELS_ENABLED = 16
GLOBAL CONST $PF_COMPARE_EXCHANGE_DOUBLE = 2
GLOBAL CONST $PF_COMPARE_EXCHANGE128 = 14
GLOBAL CONST $PF_COMPARE64_EXCHANGE128 = 15
GLOBAL CONST $PF_FLOATING_POINT_EMULATED = 1
GLOBAL CONST $PF_FLOATING_POINT_PRECISION_ERRATA = 0
GLOBAL CONST $PF_MMX_INSTRUCTIONS_AVAILABLE = 3
GLOBAL CONST $PF_NX_ENABLED = 12
GLOBAL CONST $PF_PAE_ENABLED = 9
GLOBAL CONST $PF_RDTSC_INSTRUCTION_AVAILABLE = 8
GLOBAL CONST $PF_SSE3_INSTRUCTIONS_AVAILABLE = 13
GLOBAL CONST $PF_XMMI_INSTRUCTIONS_AVAILABLE = 6
GLOBAL CONST $PF_XMMI64_INSTRUCTIONS_AVAILABLE = 10
GLOBAL CONST $PF_XSAVE_ENABLED = 17
GLOBAL CONST $KEYEVENTF_EXTENDEDKEY = 1
GLOBAL CONST $KEYEVENTF_KEYUP = 2
GLOBAL CONST $LIM_SMALL = 0
GLOBAL CONST $LIM_LARGE = 1
GLOBAL CONST $MAPVK_VK_TO_CHAR = 2
GLOBAL CONST $MAPVK_VK_TO_VSC = 0
GLOBAL CONST $MAPVK_VK_TO_VSC_EX = 4
GLOBAL CONST $MAPVK_VSC_TO_VK = 1
GLOBAL CONST $MAPVK_VSC_TO_VK_EX = 3
GLOBAL CONST $MOD_ALT = 1
GLOBAL CONST $MOD_CONTROL = 2
GLOBAL CONST $MOD_NOREPEAT = 16384
GLOBAL CONST $MOD_SHIFT = 4
GLOBAL CONST $MOD_WIN = 8
GLOBAL CONST $GUID_ACDC_POWER_SOURCE = "{5D3E9A59-E9D5-4B00-A6BD-FF34FF516548}"
GLOBAL CONST $GUID_BATTERY_PERCENTAGE_REMAINING = "{A7AD8041-B45A-4CAE-87A3-EECBB468A9E1}"
GLOBAL CONST $GUID_IDLE_BACKGROUND_TASK = "{515C31D8-F734-163D-A0FD-11A08C91E8F1}"
GLOBAL CONST $GUID_MONITOR_POWER_ON = "{02731015-4510-4526-99E6-E5A17EBD1AEA}"
GLOBAL CONST $GUID_POWERSCHEME_PERSONALITY = "{245D8541-3943-4422-B025-13A784F679B7}"
GLOBAL CONST $GUID_SYSTEM_AWAYMODE = "{98A7F580-01F7-48AA-9C0F-44352C29E5C0}"
GLOBAL CONST $GUID_MIN_POWER_SAVINGS = "{8C5E7FDA-E8BF-4A96-9A85-A6E23A8C635C}"
GLOBAL CONST $GUID_MAX_POWER_SAVINGS = "{A1841308-3541-4FAB-BC81-F71556F20B4A}"
GLOBAL CONST $GUID_TYPICAL_POWER_SAVINGS = "{381B4222-F694-41F0-9685-FF5BB260DF2E}"
GLOBAL CONST $HSHELL_WINDOWCREATED = 1
GLOBAL CONST $HSHELL_WINDOWDESTROYED = 2
GLOBAL CONST $HSHELL_ACTIVATESHELLWINDOW = 3
GLOBAL CONST $HSHELL_WINDOWACTIVATED = 4
GLOBAL CONST $HSHELL_GETMINRECT = 5
GLOBAL CONST $HSHELL_REDRAW = 6
GLOBAL CONST $HSHELL_TASKMAN = 7
GLOBAL CONST $HSHELL_LANGUAGE = 8
GLOBAL CONST $HSHELL_SYSMENU = 9
GLOBAL CONST $HSHELL_ENDTASK = 10
GLOBAL CONST $HSHELL_ACCESSIBILITYSTATE = 11
GLOBAL CONST $HSHELL_APPCOMMAND = 12
GLOBAL CONST $HSHELL_WINDOWREPLACED = 13
GLOBAL CONST $HSHELL_WINDOWREPLACING = 14
GLOBAL CONST $HSHELL_RUDEAPPACTIVATED = 32772
GLOBAL CONST $HSHELL_FLASH = 32774
GLOBAL CONST $HWND_BROADCAST = 65535
GLOBAL CONST $SMTO_BLOCK = 1
GLOBAL CONST $SMTO_NORMAL = 0
GLOBAL CONST $SMTO_ABORTIFHUNG = 2
GLOBAL CONST $SMTO_NOTIMEOUTIFNOTHUNG = 8
GLOBAL CONST $SMTO_ERRORONEXIT = 32
GLOBAL CONST $INPUTLANGCHANGE_BACKWARD = 4
GLOBAL CONST $INPUTLANGCHANGE_FORWARD = 2
GLOBAL CONST $INPUTLANGCHANGE_SYSCHARSET = 1
GLOBAL CONST $EVENT_MIN = 1
GLOBAL CONST $EVENT_SYSTEM_SOUND = 1
GLOBAL CONST $EVENT_SYSTEM_ALERT = 2
GLOBAL CONST $EVENT_SYSTEM_FOREGROUND = 3
GLOBAL CONST $EVENT_SYSTEM_MENUSTART = 4
GLOBAL CONST $EVENT_SYSTEM_MENUEND = 5
GLOBAL CONST $EVENT_SYSTEM_MENUPOPUPSTART = 6
GLOBAL CONST $EVENT_SYSTEM_MENUPOPUPEND = 7
GLOBAL CONST $EVENT_SYSTEM_CAPTURESTART = 8
GLOBAL CONST $EVENT_SYSTEM_CAPTUREEND = 9
GLOBAL CONST $EVENT_SYSTEM_MOVESIZESTART = 10
GLOBAL CONST $EVENT_SYSTEM_MOVESIZEEND = 11
GLOBAL CONST $EVENT_SYSTEM_CONTEXTHELPSTART = 12
GLOBAL CONST $EVENT_SYSTEM_CONTEXTHELPEND = 13
GLOBAL CONST $EVENT_SYSTEM_DRAGDROPSTART = 14
GLOBAL CONST $EVENT_SYSTEM_DRAGDROPEND = 15
GLOBAL CONST $EVENT_SYSTEM_DIALOGSTART = 16
GLOBAL CONST $EVENT_SYSTEM_DIALOGEND = 17
GLOBAL CONST $EVENT_SYSTEM_SCROLLINGSTART = 18
GLOBAL CONST $EVENT_SYSTEM_SCROLLINGEND = 19
GLOBAL CONST $EVENT_SYSTEM_SWITCHSTART = 20
GLOBAL CONST $EVENT_SYSTEM_SWITCHEND = 21
GLOBAL CONST $EVENT_SYSTEM_MINIMIZESTART = 22
GLOBAL CONST $EVENT_SYSTEM_MINIMIZEEND = 23
GLOBAL CONST $EVENT_SYSTEM_DESKTOPSWITCH = 32
GLOBAL CONST $EVENT_OBJECT_CREATE = 32768
GLOBAL CONST $EVENT_OBJECT_DESTROY = 32769
GLOBAL CONST $EVENT_OBJECT_SHOW = 32770
GLOBAL CONST $EVENT_OBJECT_HIDE = 32771
GLOBAL CONST $EVENT_OBJECT_REORDER = 32772
GLOBAL CONST $EVENT_OBJECT_FOCUS = 32773
GLOBAL CONST $EVENT_OBJECT_SELECTION = 32774
GLOBAL CONST $EVENT_OBJECT_SELECTIONADD = 32775
GLOBAL CONST $EVENT_OBJECT_SELECTIONREMOVE = 32776
GLOBAL CONST $EVENT_OBJECT_SELECTIONWITHIN = 32777
GLOBAL CONST $EVENT_OBJECT_STATECHANGE = 32778
GLOBAL CONST $EVENT_OBJECT_LOCATIONCHANGE = 32779
GLOBAL CONST $EVENT_OBJECT_NAMECHANGE = 32780
GLOBAL CONST $EVENT_OBJECT_DESCRIPTIONCHANGE = 32781
GLOBAL CONST $EVENT_OBJECT_VALUECHANGE = 32782
GLOBAL CONST $EVENT_OBJECT_PARENTCHANGE = 32783
GLOBAL CONST $EVENT_OBJECT_HELPCHANGE = 32784
GLOBAL CONST $EVENT_OBJECT_DEFACTIONCHANGE = 32785
GLOBAL CONST $EVENT_OBJECT_ACCELERATORCHANGE = 32786
GLOBAL CONST $EVENT_OBJECT_INVOKED = 32787
GLOBAL CONST $EVENT_OBJECT_TEXTSELECTIONCHANGED = 32788
GLOBAL CONST $EVENT_OBJECT_CONTENTSCROLLED = 32789
GLOBAL CONST $EVENT_MAX = 2147483647
GLOBAL CONST $WINEVENT_INCONTEXT = 4
GLOBAL CONST $WINEVENT_OUTOFCONTEXT = 0
GLOBAL CONST $WINEVENT_SKIPOWNPROCESS = 2
GLOBAL CONST $WINEVENT_SKIPOWNTHREAD = 1
GLOBAL CONST $TME_CANCEL = 2147483648
GLOBAL CONST $TME_HOVER = 1
GLOBAL CONST $TME_LEAVE = 2
GLOBAL CONST $TME_NONCLIENT = 16
GLOBAL CONST $TME_QUERY = 1073741824
GLOBAL CONST $DESKTOP_CREATEMENU = 4
GLOBAL CONST $DESKTOP_CREATEWINDOW = 2
GLOBAL CONST $DESKTOP_ENUMERATE = 64
GLOBAL CONST $DESKTOP_HOOKCONTROL = 8
GLOBAL CONST $DESKTOP_JOURNALPLAYBACK = 32
GLOBAL CONST $DESKTOP_JOURNALRECORD = 16
GLOBAL CONST $DESKTOP_READOBJECTS = 1
GLOBAL CONST $DESKTOP_SWITCHDESKTOP = 256
GLOBAL CONST $DESKTOP_WRITEOBJECTS = 128
GLOBAL CONST $DESKTOP_ALL_ACCESS = BITOR ($DESKTOP_CREATEMENU , $DESKTOP_CREATEWINDOW , $DESKTOP_ENUMERATE , $DESKTOP_HOOKCONTROL , $DESKTOP_JOURNALPLAYBACK , $DESKTOP_JOURNALRECORD , $DESKTOP_READOBJECTS , $DESKTOP_SWITCHDESKTOP , $DESKTOP_WRITEOBJECTS )
GLOBAL CONST $RIDEV_APPKEYS = 1024
GLOBAL CONST $RIDEV_CAPTUREMOUSE = 512
GLOBAL CONST $RIDEV_DEVNOTIFY = 8192
GLOBAL CONST $RIDEV_EXCLUDE = 16
GLOBAL CONST $RIDEV_EXINPUTSINK = 4096
GLOBAL CONST $RIDEV_INPUTSINK = 256
GLOBAL CONST $RIDEV_NOHOTKEYS = 512
GLOBAL CONST $RIDEV_NOLEGACY = 48
GLOBAL CONST $RIDEV_PAGEONLY = 32
GLOBAL CONST $RIDEV_REMOVE = 1
GLOBAL CONST $RID_HEADER = 268435461
GLOBAL CONST $RID_INPUT = 268435459
GLOBAL CONST $RIM_TYPEHID = 2
GLOBAL CONST $RIM_TYPEKEYBOARD = 1
GLOBAL CONST $RIM_TYPEMOUSE = 0
GLOBAL CONST $RIDI_DEVICENAME = 536870919
GLOBAL CONST $RIDI_DEVICEINFO = 536870923
GLOBAL CONST $RIDI_PREPARSEDDATA = 536870917
GLOBAL CONST $MOUSE_ATTRIBUTES_CHANGED = 4
GLOBAL CONST $MOUSE_MOVE_ABSOLUTE = 1
GLOBAL CONST $MOUSE_MOVE_RELATIVE = 0
GLOBAL CONST $MOUSE_VIRTUAL_DESKTOP = 2
GLOBAL CONST $RI_MOUSE_LEFT_BUTTON_DOWN = 1
GLOBAL CONST $RI_MOUSE_LEFT_BUTTON_UP = 2
GLOBAL CONST $RI_MOUSE_MIDDLE_BUTTON_DOWN = 16
GLOBAL CONST $RI_MOUSE_MIDDLE_BUTTON_UP = 32
GLOBAL CONST $RI_MOUSE_RIGHT_BUTTON_DOWN = 4
GLOBAL CONST $RI_MOUSE_RIGHT_BUTTON_UP = 8
GLOBAL CONST $RI_MOUSE_BUTTON_1_DOWN = $RI_MOUSE_LEFT_BUTTON_DOWN
GLOBAL CONST $RI_MOUSE_BUTTON_1_UP = $RI_MOUSE_LEFT_BUTTON_UP
GLOBAL CONST $RI_MOUSE_BUTTON_2_DOWN = $RI_MOUSE_RIGHT_BUTTON_DOWN
GLOBAL CONST $RI_MOUSE_BUTTON_2_UP = $RI_MOUSE_RIGHT_BUTTON_UP
GLOBAL CONST $RI_MOUSE_BUTTON_3_DOWN = $RI_MOUSE_MIDDLE_BUTTON_DOWN
GLOBAL CONST $RI_MOUSE_BUTTON_3_UP = $RI_MOUSE_MIDDLE_BUTTON_UP
GLOBAL CONST $RI_MOUSE_BUTTON_4_DOWN = 64
GLOBAL CONST $RI_MOUSE_BUTTON_4_UP = 128
GLOBAL CONST $RI_MOUSE_BUTTON_5_DOWN = 256
GLOBAL CONST $RI_MOUSE_BUTTON_5_UP = 512
GLOBAL CONST $RI_MOUSE_WHEEL = 1024
GLOBAL CONST $RI_KEY_BREAK = 1
GLOBAL CONST $RI_KEY_E0 = 2
GLOBAL CONST $RI_KEY_E1 = 4
GLOBAL CONST $RI_KEY_MAKE = 0
GLOBAL CONST $FLASHW_CAPTION = 1
GLOBAL CONST $FLASHW_TRAY = 2
GLOBAL CONST $FLASHW_TIMER = 4
GLOBAL CONST $FLASHW_TIMERNOFG = 12
GLOBAL CONST $TAGUPDATELAYEREDWINDOWINFO = "dword Size;hwnd hDstDC;long DstX;long DstY;long cX;long cY;hwnd hSrcDC;long SrcX;long SrcY;dword crKey;byte BlendOp;byte BlendFlags;byte Alpha;byte AlphaFormat;dword Flags;long DirtyLeft;long DirtyTop;long DirtyRight;long DirtyBottom"
GLOBAL CONST $TAGWINDOWINFO = "dword Size;struct;long rWindow[4];endstruct;struct;long rClient[4];endstruct;dword Style;dword ExStyle;dword WindowStatus;uint cxWindowBorders;uint cyWindowBorders;word atomWindowType;word CreatorVersion"
GLOBAL CONST $TAGWNDCLASS = "uint Style;ptr hWndProc;int ClsExtra;int WndExtra;ptr hInstance;ptr hIcon;ptr hCursor;ptr hBackground;ptr MenuName;ptr ClassName"
GLOBAL CONST $TAGWNDCLASSEX = "uint Size;uint Style;ptr hWndProc;int ClsExtra;int WndExtra;ptr hInstance;ptr hIcon;ptr hCursor;ptr hBackground;ptr MenuName;ptr ClassName;ptr hIconSm"
GLOBAL CONST $TAGFLASHWINFO = "uint Size;hwnd hWnd;dword Flags;uint Count;dword TimeOut"
FUNC _WINAPI_ADJUSTWINDOWRECTEX (BYREF $TRECT , $ISTYLE , $IEXSTYLE = 0 , $BMENU = FALSE )
LOCAL $ARET = DLLCALL ("user32.dll" , "bool" , "AdjustWindowRectEx" , "struct*" , $TRECT , "dword" , $ISTYLE , "bool" , $BMENU , "dword" , $IEXSTYLE )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_ANIMATEWINDOW ($HWND , $IFLAGS , $IDURATION = 1000 )
LOCAL $ARET = DLLCALL ("user32.dll" , "bool" , "AnimateWindow" , "hwnd" , $HWND , "dword" , $IDURATION , "dword" , $IFLAGS )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_BEGINDEFERWINDOWPOS ($IAMOUNT = 1 )
LOCAL $ARET = DLLCALL ("user32.dll" , "handle" , "BeginDeferWindowPos" , "int" , $IAMOUNT )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_BRINGWINDOWTOTOP ($HWND )
LOCAL $ARET = DLLCALL ("user32.dll" , "bool" , "BringWindowToTop" , "hwnd" , $HWND )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_BROADCASTSYSTEMMESSAGE ($IMSG , $WPARAM = 0 , $LPARAM = 0 , $IFLAGS = 0 , $IRECIPIENTS = 0 )
LOCAL $ARET = DLLCALL ("user32.dll" , "long" , "BroadcastSystemMessageW" , "dword" , $IFLAGS , "dword*" , $IRECIPIENTS , "uint" , $IMSG , "wparam" , $WPARAM , "lparam" , $LPARAM )
IF @ERROR OR ($ARET [0 ] = + 4294967295 ) THEN RETURN SETERROR (@ERROR , @EXTENDED , + 4294967295 )
RETURN SETEXTENDED ($ARET [2 ] , $ARET [0 ] )
ENDFUNC
FUNC _WINAPI_CALLWINDOWPROC ($PPREVWNDFUNC , $HWND , $IMSG , $WPARAM , $LPARAM )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "lresult" , "CallWindowProc" , "ptr" , $PPREVWNDFUNC , "hwnd" , $HWND , "uint" , $IMSG , "wparam" , $WPARAM , "lparam" , $LPARAM )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , + 4294967295 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_CALLWINDOWPROCW ($PPREVWNDPROC , $HWND , $IMSG , $WPARAM , $LPARAM )
LOCAL $ARET = DLLCALL ("user32.dll" , "lresult" , "CallWindowProcW" , "ptr" , $PPREVWNDPROC , "hwnd" , $HWND , "uint" , $IMSG , "wparam" , $WPARAM , "lparam" , $LPARAM )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_CASCADEWINDOWS ($AWNDS , $TRECT = 0 , $HPARENT = 0 , $IFLAGS = 0 , $ISTART = 0 , $IEND = + 4294967295 )
IF __CHECKERRORARRAYBOUNDS ($AWNDS , $ISTART , $IEND ) THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , 0 )
LOCAL $ICOUNT = $IEND - $ISTART + 1
LOCAL $TWNDS = DLLSTRUCTCREATE ("hwnd[" & $ICOUNT & "]" )
$ICOUNT = 1
FOR $I = $ISTART TO $IEND
DLLSTRUCTSETDATA ($TWNDS , 1 , $AWNDS [$I ] , $ICOUNT )
$ICOUNT += 1
NEXT
LOCAL $ARET = DLLCALL ("user32.dll" , "word" , "CascadeWindows" , "hwnd" , $HPARENT , "uint" , $IFLAGS , "struct*" , $TRECT , "uint" , $ICOUNT + 4294967295 , "struct*" , $TWNDS )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_CHANGEWINDOWMESSAGEFILTEREX ($HWND , $IMSG , $IACTION )
LOCAL $TCFS , $ARET
IF $HWND AND ($__WINVER > 1536 ) THEN
LOCAL CONST $TAGCHANGEFILTERSTRUCT = "dword cbSize; dword ExtStatus"
$TCFS = DLLSTRUCTCREATE ($TAGCHANGEFILTERSTRUCT )
DLLSTRUCTSETDATA ($TCFS , 1 , DLLSTRUCTGETSIZE ($TCFS ) )
$ARET = DLLCALL ("user32.dll" , "bool" , "ChangeWindowMessageFilterEx" , "hwnd" , $HWND , "uint" , $IMSG , "dword" , $IACTION , "struct*" , $TCFS )
ELSE
$TCFS = 0
$ARET = DLLCALL ("user32.dll" , "bool" , "ChangeWindowMessageFilter" , "uint" , $IMSG , "dword" , $IACTION )
ENDIF
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , 0 )
RETURN SETEXTENDED (DLLSTRUCTGETDATA ($TCFS , 2 ) , 1 )
ENDFUNC
FUNC _WINAPI_CHILDWINDOWFROMPOINTEX ($HWND , $TPOINT , $IFLAGS = 0 )
LOCAL $ARET = DLLCALL ("user32.dll" , "hwnd" , "ChildWindowFromPointEx" , "hwnd" , $HWND , "struct" , $TPOINT , "uint" , $IFLAGS )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_CLOSEWINDOW ($HWND )
LOCAL $ARET = DLLCALL ("user32.dll" , "bool" , "CloseWindow" , "hwnd" , $HWND )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_DEFERWINDOWPOS ($HINFO , $HWND , $HAFTER , $IX , $IY , $IWIDTH , $IHEIGHT , $IFLAGS )
LOCAL $ARET = DLLCALL ("user32.dll" , "handle" , "DeferWindowPos" , "handle" , $HINFO , "hwnd" , $HWND , "hwnd" , $HAFTER , "int" , $IX , "int" , $IY , "int" , $IWIDTH , "int" , $IHEIGHT , "uint" , $IFLAGS )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_DEFWINDOWPROC ($HWND , $IMSG , $WPARAM , $LPARAM )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "lresult" , "DefWindowProc" , "hwnd" , $HWND , "uint" , $IMSG , "wparam" , $WPARAM , "lparam" , $LPARAM )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_DEFWINDOWPROCW ($HWND , $IMSG , $WPARAM , $LPARAM )
LOCAL $ARET = DLLCALL ("user32.dll" , "lresult" , "DefWindowProcW" , "hwnd" , $HWND , "uint" , $IMSG , "wparam" , $WPARAM , "lparam" , $LPARAM )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_DEREGISTERSHELLHOOKWINDOW ($HWND )
LOCAL $ARET = DLLCALL ("user32.dll" , "bool" , "DeregisterShellHookWindow" , "hwnd" , $HWND )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_DRAGACCEPTFILES ($HWND , $BACCEPT = TRUE )
DLLCALL ("shell32.dll" , "none" , "DragAcceptFiles" , "hwnd" , $HWND , "bool" , $BACCEPT )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN 1
ENDFUNC
FUNC _WINAPI_DRAGFINISH ($HDROP )
DLLCALL ("shell32.dll" , "none" , "DragFinish" , "handle" , $HDROP )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN 1
ENDFUNC
FUNC _WINAPI_DRAGQUERYFILEEX ($HDROP , $IFLAG = 0 )
LOCAL $ARET = DLLCALL ("shell32.dll" , "uint" , "DragQueryFileW" , "handle" , $HDROP , "uint" , + 4294967295 , "ptr" , 0 , "uint" , 0 )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
IF NOT $ARET [0 ] THEN RETURN SETERROR (10 , 0 , 0 )
LOCAL $ICOUNT = $ARET [0 ]
LOCAL $ARESULT [$ICOUNT + 1 ]
FOR $I = 0 TO $ICOUNT + 4294967295
$ARET = DLLCALL ("shell32.dll" , "uint" , "DragQueryFileW" , "handle" , $HDROP , "uint" , $I , "wstr" , "" , "uint" , 4096 )
IF NOT $ARET [0 ] THEN RETURN SETERROR (11 , 0 , 0 )
IF $IFLAG THEN
LOCAL $BDIR = _WINAPI_PATHISDIRECTORY ($ARET [3 ] )
IF (($IFLAG = 1 ) AND $BDIR ) OR (($IFLAG = 2 ) AND NOT $BDIR ) THEN
CONTINUELOOP
ENDIF
ENDIF
$ARESULT [$I + 1 ] = $ARET [3 ]
$ARESULT [0 ] += 1
NEXT
IF NOT $ARESULT [0 ] THEN RETURN SETERROR (12 , 0 , 0 )
__INC ($ARESULT , + 4294967295 )
RETURN $ARESULT
ENDFUNC
FUNC _WINAPI_DRAGQUERYPOINT ($HDROP )
LOCAL $TPOINT = DLLSTRUCTCREATE ($TAGPOINT )
LOCAL $ARET = DLLCALL ("shell32.dll" , "bool" , "DragQueryPoint" , "handle" , $HDROP , "struct*" , $TPOINT )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , 0 )
RETURN $TPOINT
ENDFUNC
FUNC _WINAPI_ENDDEFERWINDOWPOS ($HINFO )
LOCAL $ARET = DLLCALL ("user32.dll" , "bool" , "EndDeferWindowPos" , "handle" , $HINFO )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_ENUMCHILDWINDOWS ($HWND , $BVISIBLE = TRUE )
IF NOT _WINAPI_GETWINDOW ($HWND , 5 ) THEN RETURN SETERROR (2 , 0 , 0 )
LOCAL $HENUMPROC = DLLCALLBACKREGISTER ("__EnumWindowsProc" , "bool" , "hwnd;lparam" )
DIM $__G_VENUM [101 ] [2 ] = [[0 ] ]
DLLCALL ("user32.dll" , "bool" , "EnumChildWindows" , "hwnd" , $HWND , "ptr" , DLLCALLBACKGETPTR ($HENUMPROC ) , "lparam" , $BVISIBLE )
IF @ERROR OR NOT $__G_VENUM [0 ] [0 ] THEN
$__G_VENUM = @ERROR + 10
ENDIF
DLLCALLBACKFREE ($HENUMPROC )
IF $__G_VENUM THEN RETURN SETERROR ($__G_VENUM , 0 , 0 )
__INC ($__G_VENUM , + 4294967295 )
RETURN $__G_VENUM
ENDFUNC
FUNC _WINAPI_FINDWINDOW ($SCLASSNAME , $SWINDOWNAME )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "hwnd" , "FindWindowW" , "wstr" , $SCLASSNAME , "wstr" , $SWINDOWNAME )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_FLASHWINDOW ($HWND , $BINVERT = TRUE )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "bool" , "FlashWindow" , "hwnd" , $HWND , "bool" , $BINVERT )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_FLASHWINDOWEX ($HWND , $IFLAGS = 3 , $ICOUNT = 3 , $ITIMEOUT = 0 )
LOCAL $TFLASH = DLLSTRUCTCREATE ($TAGFLASHWINFO )
LOCAL $IFLASH = DLLSTRUCTGETSIZE ($TFLASH )
LOCAL $IMODE = 0
IF BITAND ($IFLAGS , 1 ) <> 0 THEN $IMODE = BITOR ($IMODE , $FLASHW_CAPTION )
IF BITAND ($IFLAGS , 2 ) <> 0 THEN $IMODE = BITOR ($IMODE , $FLASHW_TRAY )
IF BITAND ($IFLAGS , 4 ) <> 0 THEN $IMODE = BITOR ($IMODE , $FLASHW_TIMER )
IF BITAND ($IFLAGS , 8 ) <> 0 THEN $IMODE = BITOR ($IMODE , $FLASHW_TIMERNOFG )
DLLSTRUCTSETDATA ($TFLASH , "Size" , $IFLASH )
DLLSTRUCTSETDATA ($TFLASH , "hWnd" , $HWND )
DLLSTRUCTSETDATA ($TFLASH , "Flags" , $IMODE )
DLLSTRUCTSETDATA ($TFLASH , "Count" , $ICOUNT )
DLLSTRUCTSETDATA ($TFLASH , "Timeout" , $ITIMEOUT )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "bool" , "FlashWindowEx" , "struct*" , $TFLASH )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_GETANCESTOR ($HWND , $IFLAGS = 1 )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "hwnd" , "GetAncestor" , "hwnd" , $HWND , "uint" , $IFLAGS )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_GETCLASSINFOEX ($SCLASS , $HINSTANCE = 0 )
LOCAL $STYPEOFCLASS = "ptr"
IF ISSTRING ($SCLASS ) THEN
$STYPEOFCLASS = "wstr"
ENDIF
LOCAL $TWNDCLASSEX = DLLSTRUCTCREATE ($TAGWNDCLASSEX )
LOCAL $ARET = DLLCALL ("user32.dll" , "bool" , "GetClassInfoExW" , "handle" , $HINSTANCE , $STYPEOFCLASS , $SCLASS , "struct*" , $TWNDCLASSEX )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , 0 )
RETURN $TWNDCLASSEX
ENDFUNC
FUNC _WINAPI_GETCLASSLONGEX ($HWND , $IINDEX )
LOCAL $ARET
IF @AUTOITX64 THEN
$ARET = DLLCALL ("user32.dll" , "ulong_ptr" , "GetClassLongPtrW" , "hwnd" , $HWND , "int" , $IINDEX )
ELSE
$ARET = DLLCALL ("user32.dll" , "dword" , "GetClassLongW" , "hwnd" , $HWND , "int" , $IINDEX )
ENDIF
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_GETCLIENTHEIGHT ($HWND )
LOCAL $TRECT = _WINAPI_GETCLIENTRECT ($HWND )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN DLLSTRUCTGETDATA ($TRECT , "Bottom" ) - DLLSTRUCTGETDATA ($TRECT , "Top" )
ENDFUNC
FUNC _WINAPI_GETCLIENTWIDTH ($HWND )
LOCAL $TRECT = _WINAPI_GETCLIENTRECT ($HWND )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN DLLSTRUCTGETDATA ($TRECT , "Right" ) - DLLSTRUCTGETDATA ($TRECT , "Left" )
ENDFUNC
FUNC _WINAPI_GETDLGITEM ($HWND , $IITEMID )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "hwnd" , "GetDlgItem" , "hwnd" , $HWND , "int" , $IITEMID )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_GETFOREGROUNDWINDOW ()
LOCAL $ARESULT = DLLCALL ("user32.dll" , "hwnd" , "GetForegroundWindow" )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_GETGUITHREADINFO ($ITHREADID )
LOCAL CONST $TAGGUITHREADINFO = "dword Size;dword Flags;hwnd hWndActive;hwnd hWndFocus;hwnd hWndCapture;hwnd hWndMenuOwner;hwnd hWndMoveSize;hwnd hWndCaret;struct rcCaret;long left;long top;long right;long bottom;endstruct"
LOCAL $TGTI = DLLSTRUCTCREATE ($TAGGUITHREADINFO )
DLLSTRUCTSETDATA ($TGTI , 1 , DLLSTRUCTGETSIZE ($TGTI ) )
LOCAL $ARET = DLLCALL ("user32.dll" , "bool" , "GetGUIThreadInfo" , "dword" , $ITHREADID , "struct*" , $TGTI )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , 0 )
LOCAL $ARESULT [11 ]
FOR $I = 0 TO 10
$ARESULT [$I ] = DLLSTRUCTGETDATA ($TGTI , $I + 2 )
NEXT
FOR $I = 9 TO 10
$ARESULT [$I ] -= $ARESULT [$I + 4294967294 ]
NEXT
RETURN $ARESULT
ENDFUNC
FUNC _WINAPI_GETLASTACTIVEPOPUP ($HWND )
LOCAL $ARET = DLLCALL ("user32.dll" , "hwnd" , "GetLastActivePopup" , "hwnd" , $HWND )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , 0 )
IF $ARET [0 ] = $HWND THEN RETURN SETERROR (1 , 0 , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_GETLAYEREDWINDOWATTRIBUTES ($HWND , BYREF $ITRANSCOLOR , BYREF $ITRANSGUI , $BCOLORREF = FALSE )
$ITRANSCOLOR = + 4294967295
$ITRANSGUI = + 4294967295
LOCAL $ARESULT = DLLCALL ("user32.dll" , "bool" , "GetLayeredWindowAttributes" , "hwnd" , $HWND , "INT*" , $ITRANSCOLOR , "byte*" , $ITRANSGUI , "dword*" , 0 )
IF @ERROR OR NOT $ARESULT [0 ] THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
IF NOT $BCOLORREF THEN
$ARESULT [2 ] = INT (BINARYMID ($ARESULT [2 ] , 3 , 1 ) & BINARYMID ($ARESULT [2 ] , 2 , 1 ) & BINARYMID ($ARESULT [2 ] , 1 , 1 ) )
ENDIF
$ITRANSCOLOR = $ARESULT [2 ]
$ITRANSGUI = $ARESULT [3 ]
RETURN $ARESULT [4 ]
ENDFUNC
FUNC _WINAPI_GETMESSAGEEXTRAINFO ()
LOCAL $ARET = DLLCALL ("user32.dll" , "lparam" , "GetMessageExtraInfo" )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_GETSHELLWINDOW ()
LOCAL $ARET = DLLCALL ("user32.dll" , "hwnd" , "GetShellWindow" )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_GETTOPWINDOW ($HWND )
LOCAL $ARET = DLLCALL ("user32.dll" , "hwnd" , "GetTopWindow" , "hwnd" , $HWND )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_GETWINDOWDISPLAYAFFINITY ($HWND )
LOCAL $ARET = DLLCALL ("user32.dll" , "bool" , "GetWindowDisplayAffinity" , "hwnd" , $HWND , "dword*" , 0 )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , 0 )
RETURN $ARET [2 ]
ENDFUNC
FUNC _WINAPI_GETWINDOWINFO ($HWND )
LOCAL $TWINDOWINFO = DLLSTRUCTCREATE ($TAGWINDOWINFO )
DLLSTRUCTSETDATA ($TWINDOWINFO , "Size" , DLLSTRUCTGETSIZE ($TWINDOWINFO ) )
LOCAL $ARET = DLLCALL ("user32.dll" , "bool" , "GetWindowInfo" , "hwnd" , $HWND , "struct*" , $TWINDOWINFO )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , 0 )
RETURN $TWINDOWINFO
ENDFUNC
FUNC _WINAPI_GETWINDOWPLACEMENT ($HWND )
LOCAL $TWINDOWPLACEMENT = DLLSTRUCTCREATE ($TAGWINDOWPLACEMENT )
DLLSTRUCTSETDATA ($TWINDOWPLACEMENT , "length" , DLLSTRUCTGETSIZE ($TWINDOWPLACEMENT ) )
LOCAL $ARET = DLLCALL ("user32.dll" , "bool" , "GetWindowPlacement" , "hwnd" , $HWND , "struct*" , $TWINDOWPLACEMENT )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , 0 )
RETURN $TWINDOWPLACEMENT
ENDFUNC
FUNC _WINAPI_ISCHILD ($HWND , $HWNDPARENT )
LOCAL $ARET = DLLCALL ("user32.dll" , "bool" , "IsChild" , "hwnd" , $HWNDPARENT , "hwnd" , $HWND )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_ISHUNGAPPWINDOW ($HWND )
LOCAL $ARET = DLLCALL ("user32.dll" , "bool" , "IsHungAppWindow" , "hwnd" , $HWND )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_ISICONIC ($HWND )
LOCAL $ARET = DLLCALL ("user32.dll" , "bool" , "IsIconic" , "hwnd" , $HWND )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_ISWINDOWUNICODE ($HWND )
LOCAL $ARET = DLLCALL ("user32.dll" , "bool" , "IsWindowUnicode" , "hwnd" , $HWND )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_ISZOOMED ($HWND )
LOCAL $ARET = DLLCALL ("user32.dll" , "bool" , "IsZoomed" , "hwnd" , $HWND )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_KILLTIMER ($HWND , $ITIMERID )
LOCAL $ARET = DLLCALL ("user32.dll" , "bool" , "KillTimer" , "hwnd" , $HWND , "uint_ptr" , $ITIMERID )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_OPENICON ($HWND )
LOCAL $ARET = DLLCALL ("user32.dll" , "bool" , "OpenIcon" , "hwnd" , $HWND )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_POSTMESSAGE ($HWND , $IMSG , $WPARAM , $LPARAM )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "bool" , "PostMessage" , "hwnd" , $HWND , "uint" , $IMSG , "wparam" , $WPARAM , "lparam" , $LPARAM )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_REGISTERCLASS ($TWNDCLASS )
LOCAL $ARET = DLLCALL ("user32.dll" , "word" , "RegisterClassW" , "struct*" , $TWNDCLASS )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_REGISTERCLASSEX ($TWNDCLASSEX )
LOCAL $ARET = DLLCALL ("user32.dll" , "word" , "RegisterClassExW" , "struct*" , $TWNDCLASSEX )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_REGISTERSHELLHOOKWINDOW ($HWND )
LOCAL $ARET = DLLCALL ("user32.dll" , "bool" , "RegisterShellHookWindow" , "hwnd" , $HWND )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_REGISTERWINDOWMESSAGE ($SMESSAGE )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "uint" , "RegisterWindowMessageW" , "wstr" , $SMESSAGE )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_SENDMESSAGETIMEOUT ($HWND , $IMSG , $WPARAM = 0 , $LPARAM = 0 , $ITIMEOUT = 1000 , $IFLAGS = 0 )
LOCAL $ARET = DLLCALL ("user32.dll" , "lresult" , "SendMessageTimeoutW" , "hwnd" , $HWND , "uint" , $IMSG , "wparam" , $WPARAM , "lparam" , $LPARAM , "uint" , $IFLAGS , "uint" , $ITIMEOUT , "dword_ptr*" , 0 )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , + 4294967295 )
IF NOT $ARET [0 ] THEN RETURN SETERROR (10 , _WINAPI_GETLASTERROR () , + 4294967295 )
RETURN $ARET [7 ]
ENDFUNC
FUNC _WINAPI_SETCLASSLONGEX ($HWND , $IINDEX , $INEWLONG )
LOCAL $ARET
IF @AUTOITX64 THEN
$ARET = DLLCALL ("user32.dll" , "ulong_ptr" , "SetClassLongPtrW" , "hwnd" , $HWND , "int" , $IINDEX , "long_ptr" , $INEWLONG )
ELSE
$ARET = DLLCALL ("user32.dll" , "dword" , "SetClassLongW" , "hwnd" , $HWND , "int" , $IINDEX , "long" , $INEWLONG )
ENDIF
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_SETFOREGROUNDWINDOW ($HWND )
LOCAL $ARET = DLLCALL ("user32.dll" , "bool" , "SetForegroundWindow" , "hwnd" , $HWND )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_SETLAYEREDWINDOWATTRIBUTES ($HWND , $ITRANSCOLOR , $ITRANSGUI = 255 , $IFLAGS = 3 , $BCOLORREF = FALSE )
IF $IFLAGS = DEFAULT OR $IFLAGS = "" OR $IFLAGS < 0 THEN $IFLAGS = 3
IF NOT $BCOLORREF THEN
$ITRANSCOLOR = INT (BINARYMID ($ITRANSCOLOR , 3 , 1 ) & BINARYMID ($ITRANSCOLOR , 2 , 1 ) & BINARYMID ($ITRANSCOLOR , 1 , 1 ) )
ENDIF
LOCAL $ARESULT = DLLCALL ("user32.dll" , "bool" , "SetLayeredWindowAttributes" , "hwnd" , $HWND , "INT" , $ITRANSCOLOR , "byte" , $ITRANSGUI , "dword" , $IFLAGS )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_SETMESSAGEEXTRAINFO ($LPARAM )
LOCAL $ARET = DLLCALL ("user32.dll" , "lparam" , "SetMessageExtraInfo" , "lparam" , $LPARAM )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_SETSYSCOLORS ($VELEMENTS , $VCOLORS )
LOCAL $BISEARRAY = ISARRAY ($VELEMENTS ) , $BISCARRAY = ISARRAY ($VCOLORS )
LOCAL $IELEMENTNUM
IF NOT $BISCARRAY AND NOT $BISEARRAY THEN
$IELEMENTNUM = 1
ELSEIF $BISCARRAY OR $BISEARRAY THEN
IF NOT $BISCARRAY OR NOT $BISEARRAY THEN RETURN SETERROR (+ 4294967295 , + 4294967295 , FALSE )
IF UBOUND ($VELEMENTS ) <> UBOUND ($VCOLORS ) THEN RETURN SETERROR (+ 4294967295 , + 4294967295 , FALSE )
$IELEMENTNUM = UBOUND ($VELEMENTS )
ENDIF
LOCAL $TELEMENTS = DLLSTRUCTCREATE ("int Element[" & $IELEMENTNUM & "]" )
LOCAL $TCOLORS = DLLSTRUCTCREATE ("INT NewColor[" & $IELEMENTNUM & "]" )
IF NOT $BISEARRAY THEN
DLLSTRUCTSETDATA ($TELEMENTS , "Element" , $VELEMENTS , 1 )
ELSE
FOR $X = 0 TO $IELEMENTNUM + 4294967295
DLLSTRUCTSETDATA ($TELEMENTS , "Element" , $VELEMENTS [$X ] , $X + 1 )
NEXT
ENDIF
IF NOT $BISCARRAY THEN
DLLSTRUCTSETDATA ($TCOLORS , "NewColor" , $VCOLORS , 1 )
ELSE
FOR $X = 0 TO $IELEMENTNUM + 4294967295
DLLSTRUCTSETDATA ($TCOLORS , "NewColor" , $VCOLORS [$X ] , $X + 1 )
NEXT
ENDIF
LOCAL $ARESULT = DLLCALL ("user32.dll" , "bool" , "SetSysColors" , "int" , $IELEMENTNUM , "struct*" , $TELEMENTS , "struct*" , $TCOLORS )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_SETTIMER ($HWND , $ITIMERID , $IELAPSE , $PTIMERFUNC )
LOCAL $ARET = DLLCALL ("user32.dll" , "uint_ptr" , "SetTimer" , "hwnd" , $HWND , "uint_ptr" , $ITIMERID , "uint" , $IELAPSE , "ptr" , $PTIMERFUNC )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_SETWINDOWDISPLAYAFFINITY ($HWND , $IAFFINITY )
LOCAL $ARET = DLLCALL ("user32.dll" , "bool" , "SetWindowDisplayAffinity" , "hwnd" , $HWND , "dword" , $IAFFINITY )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_SETWINDOWLONG ($HWND , $IINDEX , $IVALUE )
_WINAPI_SETLASTERROR (0 )
LOCAL $SFUNCNAME = "SetWindowLongW"
IF @AUTOITX64 THEN $SFUNCNAME = "SetWindowLongPtrW"
LOCAL $ARESULT = DLLCALL ("user32.dll" , "long_ptr" , $SFUNCNAME , "hwnd" , $HWND , "int" , $IINDEX , "long_ptr" , $IVALUE )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_SETWINDOWPLACEMENT ($HWND , $TWINDOWPLACEMENT )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "bool" , "SetWindowPlacement" , "hwnd" , $HWND , "struct*" , $TWINDOWPLACEMENT )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_SHOWOWNEDPOPUPS ($HWND , $BSHOW )
LOCAL $ARET = DLLCALL ("user32.dll" , "bool" , "ShowOwnedPopups" , "hwnd" , $HWND , "bool" , $BSHOW )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_SWITCHTOTHISWINDOW ($HWND , $BALTTAB = FALSE )
DLLCALL ("user32.dll" , "none" , "SwitchToThisWindow" , "hwnd" , $HWND , "bool" , $BALTTAB )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN 1
ENDFUNC
FUNC _WINAPI_TILEWINDOWS ($AWNDS , $TRECT = 0 , $HPARENT = 0 , $IFLAGS = 0 , $ISTART = 0 , $IEND = + 4294967295 )
IF __CHECKERRORARRAYBOUNDS ($AWNDS , $ISTART , $IEND ) THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , 0 )
LOCAL $ICOUNT = $IEND - $ISTART + 1
LOCAL $TWNDS = DLLSTRUCTCREATE ("hwnd[" & $ICOUNT & "]" )
$ICOUNT = 1
FOR $I = $ISTART TO $IEND
DLLSTRUCTSETDATA ($TWNDS , 1 , $AWNDS [$I ] , $ICOUNT )
$ICOUNT += 1
NEXT
LOCAL $ARET = DLLCALL ("user32.dll" , "word" , "TileWindows" , "hwnd" , $HPARENT , "uint" , $IFLAGS , "struct*" , $TRECT , "uint" , $ICOUNT + 4294967295 , "struct*" , $TWNDS )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_UNREGISTERCLASS ($SCLASS , $HINSTANCE = 0 )
LOCAL $STYPEOFCLASS = "ptr"
IF ISSTRING ($SCLASS ) THEN
$STYPEOFCLASS = "wstr"
ENDIF
LOCAL $ARET = DLLCALL ("user32.dll" , "bool" , "UnregisterClassW" , $STYPEOFCLASS , $SCLASS , "handle" , $HINSTANCE )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_UPDATELAYEREDWINDOW ($HWND , $HDESTDC , $TPTDEST , $TSIZE , $HSRCDC , $TPTSRCE , $IRGB , $TBLEND , $IFLAGS )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "bool" , "UpdateLayeredWindow" , "hwnd" , $HWND , "handle" , $HDESTDC , "struct*" , $TPTDEST , "struct*" , $TSIZE , "handle" , $HSRCDC , "struct*" , $TPTSRCE , "dword" , $IRGB , "struct*" , $TBLEND , "dword" , $IFLAGS )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_UPDATELAYEREDWINDOWEX ($HWND , $IX , $IY , $HBITMAP , $IOPACITY = 255 , $BDELETE = FALSE )
LOCAL $ARET = DLLCALL ("user32.dll" , "handle" , "GetDC" , "hwnd" , $HWND )
LOCAL $HDC = $ARET [0 ]
$ARET = DLLCALL ("gdi32.dll" , "handle" , "CreateCompatibleDC" , "handle" , $HDC )
LOCAL $HDESTDC = $ARET [0 ]
$ARET = DLLCALL ("gdi32.dll" , "handle" , "SelectObject" , "handle" , $HDESTDC , "handle" , $HBITMAP )
LOCAL $HDESTSV = $ARET [0 ]
LOCAL $TPOINT
IF ($IX = + 4294967295 ) AND ($IY = + 4294967295 ) THEN
$TPOINT = DLLSTRUCTCREATE ("int;int" )
ELSE
$TPOINT = DLLSTRUCTCREATE ("int;int;int;int" )
DLLSTRUCTSETDATA ($TPOINT , 3 , $IX )
DLLSTRUCTSETDATA ($TPOINT , 4 , $IY )
ENDIF
DLLSTRUCTSETDATA ($TPOINT , 1 , 0 )
DLLSTRUCTSETDATA ($TPOINT , 2 , 0 )
LOCAL $TBLENDFUNCTION = DLLSTRUCTCREATE ($TAGBLENDFUNCTION )
DLLSTRUCTSETDATA ($TBLENDFUNCTION , 1 , 0 )
DLLSTRUCTSETDATA ($TBLENDFUNCTION , 2 , 0 )
DLLSTRUCTSETDATA ($TBLENDFUNCTION , 3 , $IOPACITY )
DLLSTRUCTSETDATA ($TBLENDFUNCTION , 4 , 1 )
LOCAL CONST $TAGBITMAP = "struct;long bmType;long bmWidth;long bmHeight;long bmWidthBytes;ushort bmPlanes;ushort bmBitsPixel;ptr bmBits;endstruct"
LOCAL $TOBJ = DLLSTRUCTCREATE ($TAGBITMAP )
DLLCALL ("gdi32.dll" , "int" , "GetObject" , "handle" , $HBITMAP , "int" , DLLSTRUCTGETSIZE ($TOBJ ) , "struct*" , $TOBJ )
LOCAL $TSIZE = DLLSTRUCTCREATE ($TAGSIZE , DLLSTRUCTGETPTR ($TOBJ , "bmWidth" ) )
$ARET = DLLCALL ("user32.dll" , "bool" , "UpdateLayeredWindow" , "hwnd" , $HWND , "handle" , $HDC , "ptr" , DLLSTRUCTGETPTR ($TPOINT , 3 ) , "struct*" , $TSIZE , "handle" , $HDESTDC , "struct*" , $TPOINT , "dword" , 0 , "struct*" , $TBLENDFUNCTION , "dword" , 2 )
LOCAL $IERROR = @ERROR
DLLCALL ("user32.dll" , "bool" , "ReleaseDC" , "hwnd" , $HWND , "handle" , $HDC )
DLLCALL ("gdi32.dll" , "handle" , "SelectObject" , "handle" , $HDESTDC , "handle" , $HDESTSV )
DLLCALL ("gdi32.dll" , "bool" , "DeleteDC" , "handle" , $HDESTDC )
IF $IERROR THEN RETURN SETERROR ($IERROR , 0 , FALSE )
IF $BDELETE THEN
DLLCALL ("gdi32.dll" , "bool" , "DeleteObject" , "handle" , $HBITMAP )
ENDIF
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_UPDATELAYEREDWINDOWINDIRECT ($HWND , $TULWINFO )
LOCAL $ARET = DLLCALL ("user32.dll" , "bool" , "UpdateLayeredWindowIndirect" , "hwnd" , $HWND , "struct*" , $TULWINFO )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_WINDOWFROMPOINT (BYREF $TPOINT )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "hwnd" , "WindowFromPoint" , "struct" , $TPOINT )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
#EndRegion Public Functions
#Region Internal Functions
FUNC __ENUMDEFAULTPROC ($PDATA , $LPARAM )
#forceref $lParam
LOCAL $ILENGTH = _WINAPI_STRLEN ($PDATA )
__INC ($__G_VENUM )
IF $ILENGTH THEN
$__G_VENUM [$__G_VENUM [0 ] ] = DLLSTRUCTGETDATA (DLLSTRUCTCREATE ("wchar[" & ($ILENGTH + 1 ) & "]" , $PDATA ) , 1 )
ELSE
$__G_VENUM [$__G_VENUM [0 ] ] = ""
ENDIF
RETURN 1
ENDFUNC
#EndRegion Internal Functions
#Region Global Variables and Constants
GLOBAL CONST $TAGOSVERSIONINFOEX = $TAGOSVERSIONINFO & ";ushort ServicePackMajor;ushort ServicePackMinor;ushort SuiteMask;byte ProductType;byte Reserved"
GLOBAL CONST $TAGRAWINPUTDEVICE = "struct;ushort UsagePage;ushort Usage;dword Flags;hwnd hTarget;endstruct"
GLOBAL CONST $TAGRAWINPUTHEADER = "struct;dword Type;dword Size;handle hDevice;wparam wParam;endstruct"
GLOBAL CONST $TAGRAWMOUSE = "ushort Flags;ushort Alignment;ushort ButtonFlags;ushort ButtonData;ulong RawButtons;long LastX;long LastY;ulong ExtraInformation;"
GLOBAL CONST $TAGRAWKEYBOARD = "ushort MakeCode;ushort Flags;ushort Reserved;ushort VKey;uint Message;ulong ExtraInformation;"
GLOBAL CONST $TAGRAWHID = "dword SizeHid;dword Count;"
GLOBAL CONST $TAGRAWINPUTMOUSE = $TAGRAWINPUTHEADER & ";" & $TAGRAWMOUSE
GLOBAL CONST $TAGRAWINPUTKEYBOARD = $TAGRAWINPUTHEADER & ";" & $TAGRAWKEYBOARD
GLOBAL CONST $TAGRAWINPUTHID = $TAGRAWINPUTHEADER & ";" & $TAGRAWHID
GLOBAL CONST $TAGRID_DEVICE_INFO_MOUSE = "struct;dword Id;dword NumberOfButtons;dword SampleRate;int HasHorizontalWheel;endstruc"
GLOBAL CONST $TAGRID_DEVICE_INFO_KEYBOARD = "struct;dword KbType;dword KbSubType;dword KeyboardMode;dword NumberOfFunctionKeys;dword NumberOfIndicators;dword NumberOfKeysTotal;endstruc"
GLOBAL CONST $TAGRID_DEVICE_INFO_HID = "struct;dword VendorId;dword ProductId;dword VersionNumber;ushort UsagePage;ushort Usage;endstruc"
GLOBAL CONST $TAGRID_INFO_MOUSE = "dword Size;dword Type;" & $TAGRID_DEVICE_INFO_MOUSE & ";dword Unused[2];"
GLOBAL CONST $TAGRID_INFO_KEYBOARD = "dword Size;dword Type;" & $TAGRID_DEVICE_INFO_KEYBOARD
GLOBAL CONST $TAGRID_INFO_HID = "dword Size;dword Type;" & $TAGRID_DEVICE_INFO_HID & ";dword Unused[2]"
GLOBAL CONST $TAGUSEROBJECTFLAGS = "int Inherit;int Reserved;dword Flags"
#EndRegion Global Variables and Constants
#Region Functions list
#EndRegion Functions list
#Region Public Functions
FUNC _WINAPI_ACTIVATEKEYBOARDLAYOUT ($HLOCALE , $IFLAG = 0 )
LOCAL $ARET = DLLCALL ("user32.dll" , "handle" , "ActivateKeyboardLayout" , "handle" , $HLOCALE , "uint" , $IFLAG )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_ADDCLIPBOARDFORMATLISTENER ($HWND )
LOCAL $ARET = DLLCALL ("user32.dll" , "bool" , "AddClipboardFormatListener" , "hwnd" , $HWND )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_CALLNEXTHOOKEX ($HHOOK , $ICODE , $WPARAM , $LPARAM )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "lresult" , "CallNextHookEx" , "handle" , $HHOOK , "int" , $ICODE , "wparam" , $WPARAM , "lparam" , $LPARAM )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , + 4294967295 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_CLOSEDESKTOP ($HDESKTOP )
LOCAL $ARET = DLLCALL ("user32.dll" , "bool" , "CloseDesktop" , "handle" , $HDESKTOP )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_CLOSEWINDOWSTATION ($HSTATION )
LOCAL $ARET = DLLCALL ("user32.dll" , "bool" , "CloseWindowStation" , "handle" , $HSTATION )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_COMPRESSBUFFER ($PUNCOMPRESSEDBUFFER , $IUNCOMPRESSEDSIZE , $PCOMPRESSEDBUFFER , $ICOMPRESSEDSIZE , $IFORMATANDENGINE = 2 )
LOCAL $ARET , $PWORKSPACE = 0 , $IERROR = 0
DO
$ARET = DLLCALL ("ntdll.dll" , "uint" , "RtlGetCompressionWorkSpaceSize" , "ushort" , $IFORMATANDENGINE , "ulong*" , 0 , "ulong*" , 0 )
IF @ERROR OR $ARET [0 ] THEN
$IERROR = @ERROR + 20
EXITLOOP
ENDIF
$PWORKSPACE = __HEAPALLOC ($ARET [2 ] )
IF @ERROR THEN
$IERROR = @ERROR + 100
EXITLOOP
ENDIF
$ARET = DLLCALL ("ntdll.dll" , "uint" , "RtlCompressBuffer" , "ushort" , $IFORMATANDENGINE , "struct*" , $PUNCOMPRESSEDBUFFER , "ulong" , $IUNCOMPRESSEDSIZE , "struct*" , $PCOMPRESSEDBUFFER , "ulong" , $ICOMPRESSEDSIZE , "ulong" , 4096 , "ulong*" , 0 , "ptr" , $PWORKSPACE )
IF @ERROR OR $ARET [0 ] OR NOT $ARET [7 ] THEN
$IERROR = @ERROR + 30
EXITLOOP
ENDIF
UNTIL 1
__HEAPFREE ($PWORKSPACE )
IF $IERROR THEN
IF ISARRAY ($ARET ) THEN
RETURN SETERROR (10 , $ARET [0 ] , 0 )
ELSE
RETURN SETERROR ($IERROR , 0 , 0 )
ENDIF
ENDIF
RETURN $ARET [7 ]
ENDFUNC
FUNC _WINAPI_COMPUTECRC32 ($PMEMORY , $ILENGTH )
IF _WINAPI_ISBADREADPTR ($PMEMORY , $ILENGTH ) THEN RETURN SETERROR (1 , @EXTENDED , 0 )
LOCAL $ARET = DLLCALL ("ntdll.dll" , "dword" , "RtlComputeCrc32" , "dword" , 0 , "struct*" , $PMEMORY , "int" , $ILENGTH )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_CREATEDESKTOP ($SNAME , $IACCESS = 2 , $IFLAGS = 0 , $IHEAP = 0 , $TSECURITY = 0 )
LOCAL $ARET
IF $IHEAP THEN
$ARET = DLLCALL ("user32.dll" , "handle" , "CreateDesktopExW" , "wstr" , $SNAME , "ptr" , 0 , "ptr" , 0 , "dword" , $IFLAGS , "dword" , $IACCESS , "struct*" , $TSECURITY , "ulong" , $IHEAP , "ptr" , 0 )
ELSE
$ARET = DLLCALL ("user32.dll" , "handle" , "CreateDesktopW" , "wstr" , $SNAME , "ptr" , 0 , "ptr" , 0 , "dword" , $IFLAGS , "dword" , $IACCESS , "struct*" , $TSECURITY )
ENDIF
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_CREATEWINDOWSTATION ($SNAME = "" , $IACCESS = 0 , $IFLAGS = 0 , $TSECURITY = 0 )
LOCAL $ARET = DLLCALL ("user32.dll" , "handle" , "CreateWindowStationW" , "wstr" , $SNAME , "dword" , $IFLAGS , "dword" , $IACCESS , "struct*" , $TSECURITY )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_DECOMPRESSBUFFER ($PUNCOMPRESSEDBUFFER , $IUNCOMPRESSEDSIZE , $PCOMPRESSEDBUFFER , $ICOMPRESSEDSIZE , $IFORMAT = 2 )
LOCAL $ARET = DLLCALL ("ntdll.dll" , "long" , "RtlDecompressBuffer" , "ushort" , $IFORMAT , "struct*" , $PUNCOMPRESSEDBUFFER , "ulong" , $IUNCOMPRESSEDSIZE , "struct*" , $PCOMPRESSEDBUFFER , "ulong" , $ICOMPRESSEDSIZE , "ulong*" , 0 )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
IF $ARET [0 ] THEN RETURN SETERROR (10 , $ARET [0 ] , 0 )
RETURN $ARET [6 ]
ENDFUNC
FUNC _WINAPI_DEFRAWINPUTPROC ($PARAWINPUT , $IINPUT )
LOCAL $ARET = DLLCALL ("user32.dll" , "lresult" , "DefRawInputProc" , "ptr" , $PARAWINPUT , "int" , $IINPUT , "uint" , DLLSTRUCTGETSIZE (DLLSTRUCTCREATE ($TAGRAWINPUTHEADER ) ) )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
IF $ARET [0 ] THEN RETURN SETERROR (10 , $ARET [0 ] , 0 )
RETURN 1
ENDFUNC
FUNC _WINAPI_ENUMDESKTOPS ($HSTATION )
IF STRINGCOMPARE (_WINAPI_GETUSEROBJECTINFORMATION ($HSTATION , 3 ) , "WindowStation" ) THEN RETURN SETERROR (1 , 0 , 0 )
LOCAL $HENUMPROC = DLLCALLBACKREGISTER ("__EnumDefaultProc" , "bool" , "ptr;lparam" )
DIM $__G_VENUM [101 ] = [0 ]
LOCAL $ARET = DLLCALL ("user32.dll" , "bool" , "EnumDesktopsW" , "handle" , $HSTATION , "ptr" , DLLCALLBACKGETPTR ($HENUMPROC ) , "lparam" , 0 )
IF @ERROR OR NOT $ARET [0 ] OR NOT $__G_VENUM [0 ] THEN
$__G_VENUM = @ERROR + 10
ENDIF
DLLCALLBACKFREE ($HENUMPROC )
IF $__G_VENUM THEN RETURN SETERROR ($__G_VENUM , 0 , 0 )
__INC ($__G_VENUM , + 4294967295 )
RETURN $__G_VENUM
ENDFUNC
FUNC _WINAPI_ENUMDESKTOPWINDOWS ($HDESKTOP , $BVISIBLE = TRUE )
IF STRINGCOMPARE (_WINAPI_GETUSEROBJECTINFORMATION ($HDESKTOP , 3 ) , "Desktop" ) THEN RETURN SETERROR (1 , 0 , 0 )
LOCAL $HENUMPROC = DLLCALLBACKREGISTER ("__EnumWindowsProc" , "bool" , "hwnd;lparam" )
DIM $__G_VENUM [101 ] [2 ] = [[0 ] ]
LOCAL $ARET = DLLCALL ("user32.dll" , "bool" , "EnumDesktopWindows" , "handle" , $HDESKTOP , "ptr" , DLLCALLBACKGETPTR ($HENUMPROC ) , "lparam" , $BVISIBLE )
IF @ERROR OR NOT $ARET [0 ] OR NOT $__G_VENUM [0 ] [0 ] THEN
$__G_VENUM = @ERROR + 10
ENDIF
DLLCALLBACKFREE ($HENUMPROC )
IF $__G_VENUM THEN RETURN SETERROR ($__G_VENUM , 0 , 0 )
__INC ($__G_VENUM , + 4294967295 )
RETURN $__G_VENUM
ENDFUNC
FUNC _WINAPI_ENUMPAGEFILES ()
LOCAL $AINFO = _WINAPI_GETSYSTEMINFO ()
LOCAL $HENUMPROC = DLLCALLBACKREGISTER ("__EnumPageFilesProc" , "bool" , "lparam;ptr;ptr" )
DIM $__G_VENUM [101 ] [4 ] = [[0 ] ]
LOCAL $ARET = DLLCALL (@SYSTEMDIR & "\psapi.dll" , "bool" , "EnumPageFilesW" , "ptr" , DLLCALLBACKGETPTR ($HENUMPROC ) , "lparam" , $AINFO [1 ] )
IF @ERROR OR NOT $ARET [0 ] OR NOT $__G_VENUM [0 ] [0 ] THEN
$__G_VENUM = @ERROR + 10
ENDIF
DLLCALLBACKFREE ($HENUMPROC )
IF $__G_VENUM THEN RETURN SETERROR ($__G_VENUM , 0 , 0 )
__INC ($__G_VENUM , + 4294967295 )
RETURN $__G_VENUM
ENDFUNC
FUNC _WINAPI_ENUMRAWINPUTDEVICES ()
LOCAL CONST $TAGRAWINPUTDEVICELIST = "struct;handle hDevice;dword Type;endstruct"
LOCAL $TRIDL , $ILENGTH = DLLSTRUCTGETSIZE (DLLSTRUCTCREATE ($TAGRAWINPUTDEVICELIST ) )
LOCAL $ARET = DLLCALL ("user32.dll" , "uint" , "GetRawInputDeviceList" , "ptr" , 0 , "uint*" , 0 , "uint" , $ILENGTH )
IF @ERROR THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , 0 )
IF ($ARET [0 ] = 0xFFFFFFFF ) OR (NOT $ARET [2 ] ) THEN RETURN SETERROR (10 , + 4294967295 , 0 )
LOCAL $TDATA = DLLSTRUCTCREATE ("byte[" & ($ARET [2 ] * $ILENGTH ) & "]" )
LOCAL $PDATA = DLLSTRUCTGETPTR ($TDATA )
IF @ERROR THEN RETURN SETERROR (@ERROR + 20 , 0 , 0 )
$ARET = DLLCALL ("user32.dll" , "uint" , "GetRawInputDeviceList" , "ptr" , $PDATA , "uint*" , $ARET [2 ] , "uint" , $ILENGTH )
IF ($ARET [0 ] = 0xFFFFFFFF ) OR (NOT $ARET [0 ] ) THEN RETURN SETERROR (1 , + 4294967295 , 0 )
LOCAL $ARESULT [$ARET [2 ] + 1 ] [2 ] = [[$ARET [2 ] ] ]
FOR $I = 1 TO $ARET [2 ]
$TRIDL = DLLSTRUCTCREATE ("ptr;dword" , $PDATA + $ILENGTH * ($I + 4294967295 ) )
FOR $J = 0 TO 1
$ARESULT [$I ] [$J ] = DLLSTRUCTGETDATA ($TRIDL , $J + 1 )
NEXT
NEXT
RETURN $ARESULT
ENDFUNC
FUNC _WINAPI_ENUMWINDOWSTATIONS ()
LOCAL $HENUMPROC = DLLCALLBACKREGISTER ("__EnumDefaultProc" , "bool" , "ptr;lparam" )
DIM $__G_VENUM [101 ] = [0 ]
LOCAL $ARET = DLLCALL ("user32.dll" , "bool" , "EnumWindowStationsW" , "ptr" , DLLCALLBACKGETPTR ($HENUMPROC ) , "lparam" , 0 )
IF @ERROR OR NOT $ARET [0 ] OR NOT $__G_VENUM [0 ] THEN
$__G_VENUM = @ERROR + 10
ENDIF
DLLCALLBACKFREE ($HENUMPROC )
IF $__G_VENUM THEN RETURN SETERROR ($__G_VENUM , 0 , 0 )
__INC ($__G_VENUM , + 4294967295 )
RETURN $__G_VENUM
ENDFUNC
FUNC _WINAPI_EXPANDENVIRONMENTSTRINGS ($SSTRING )
LOCAL $ARESULT = DLLCALL ("kernel32.dll" , "dword" , "ExpandEnvironmentStringsW" , "wstr" , $SSTRING , "wstr" , "" , "dword" , 4096 )
IF @ERROR OR NOT $ARESULT [0 ] THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , "" )
RETURN $ARESULT [2 ]
ENDFUNC
FUNC _WINAPI_GETACTIVEWINDOW ()
LOCAL $ARET = DLLCALL ("user32.dll" , "hwnd" , "GetActiveWindow" )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_GETASYNCKEYSTATE ($IKEY )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "short" , "GetAsyncKeyState" , "int" , $IKEY )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_GETCLIPBOARDSEQUENCENUMBER ()
LOCAL $ARET = DLLCALL ("user32.dll" , "dword" , "GetClipboardSequenceNumber" )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_GETCURRENTHWPROFILE ()
LOCAL $TAGHW_PROFILE_INFO = "dword DockInfo;wchar szHwProfileGuid[39];wchar szHwProfileName[80]"
LOCAL $THWPI = DLLSTRUCTCREATE ($TAGHW_PROFILE_INFO )
LOCAL $ARET = DLLCALL ("advapi32.dll" , "bool" , "GetCurrentHwProfileW" , "struct*" , $THWPI )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , 0 )
LOCAL $ARESULT [3 ]
FOR $I = 0 TO 2
$ARESULT [$I ] = DLLSTRUCTGETDATA ($THWPI , $I + 1 )
NEXT
RETURN $ARESULT
ENDFUNC
FUNC _WINAPI_GETDEFAULTPRINTER ()
LOCAL $ARET = DLLCALL ("winspool.drv" , "bool" , "GetDefaultPrinterW" , "wstr" , "" , "dword*" , 2048 )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , "" )
IF NOT $ARET [0 ] THEN RETURN SETERROR (10 , _WINAPI_GETLASTERROR () , "" )
RETURN $ARET [1 ]
ENDFUNC
FUNC _WINAPI_GETDLLDIRECTORY ()
LOCAL $ARET = DLLCALL ("kernel32.dll" , "dword" , "GetDllDirectoryW" , "dword" , 4096 , "wstr" , "" )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR , @EXTENDED , "" )
RETURN $ARET [2 ]
ENDFUNC
FUNC _WINAPI_GETEFFECTIVECLIENTRECT ($HWND , $ACTRL , $ISTART = 0 , $IEND = + 4294967295 )
IF NOT ISARRAY ($ACTRL ) THEN
LOCAL $ICTRL = $ACTRL
DIM $ACTRL [1 ] = [$ICTRL ]
$ISTART = 0
$IEND = 0
ENDIF
IF __CHECKERRORARRAYBOUNDS ($ACTRL , $ISTART , $IEND ) THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , 0 )
LOCAL $ICOUNT = $IEND - $ISTART + 1
LOCAL $TCTRL = DLLSTRUCTCREATE ("uint64[" & ($ICOUNT + 2 ) & "]" )
$ICOUNT = 2
FOR $I = $ISTART TO $IEND
IF ISHWND ($ACTRL [$I ] ) THEN
$ACTRL [$I ] = _WINAPI_GETDLGCTRLID ($ACTRL [$I ] )
ENDIF
DLLSTRUCTSETDATA ($TCTRL , 1 , _WINAPI_MAKEQWORD (1 , $ACTRL [$I ] ) , $ICOUNT )
$ICOUNT += 1
NEXT
LOCAL $TRECT = DLLSTRUCTCREATE ($TAGRECT )
DLLCALL ("comctl32.dll" , "none" , "GetEffectiveClientRect" , "hwnd" , $HWND , "struct*" , $TRECT , "struct*" , $TCTRL )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $TRECT
ENDFUNC
FUNC _WINAPI_GETHANDLEINFORMATION ($HOBJECT )
LOCAL $ARET = DLLCALL ("kernel32.dll" , "bool" , "GetHandleInformation" , "handle" , $HOBJECT , "dword*" , 0 )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [2 ]
ENDFUNC
FUNC _WINAPI_GETIDLETIME ()
LOCAL $TLASTINPUTINFO = DLLSTRUCTCREATE ("uint;dword" )
DLLSTRUCTSETDATA ($TLASTINPUTINFO , 1 , DLLSTRUCTGETSIZE ($TLASTINPUTINFO ) )
LOCAL $ARET = DLLCALL ("user32.dll" , "bool" , "GetLastInputInfo" , "struct*" , $TLASTINPUTINFO )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN _WINAPI_GETTICKCOUNT () - DLLSTRUCTGETDATA ($TLASTINPUTINFO , 2 )
ENDFUNC
FUNC _WINAPI_GETKEYBOARDLAYOUT ($HWND )
LOCAL $ARET = DLLCALL ("user32.dll" , "dword" , "GetWindowThreadProcessId" , "hwnd" , $HWND , "ptr" , 0 )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , 0 )
$ARET = DLLCALL ("user32.dll" , "handle" , "GetKeyboardLayout" , "dword" , $ARET [0 ] )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_GETKEYBOARDLAYOUTLIST ()
LOCAL $ARET = DLLCALL ("user32.dll" , "uint" , "GetKeyboardLayoutList" , "int" , 0 , "ptr" , 0 )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR + 20 , @EXTENDED , 0 )
LOCAL $TDATA = DLLSTRUCTCREATE ("handle[" & $ARET [0 ] & "]" )
$ARET = DLLCALL ("user32.dll" , "uint" , "GetKeyboardLayoutList" , "int" , $ARET [0 ] , "struct*" , $TDATA )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , 0 )
LOCAL $ALIST [$ARET [0 ] + 1 ] = [$ARET [0 ] ]
FOR $I = 1 TO $ALIST [0 ]
$ALIST [$I ] = DLLSTRUCTGETDATA ($TDATA , 1 , $I )
NEXT
RETURN $ALIST
ENDFUNC
FUNC _WINAPI_GETKEYBOARDSTATE ()
LOCAL $TDATA = DLLSTRUCTCREATE ("byte[256]" )
LOCAL $ARET = DLLCALL ("user32.dll" , "bool" , "GetKeyboardState" , "struct*" , $TDATA )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , 0 )
RETURN $TDATA
ENDFUNC
FUNC _WINAPI_GETKEYBOARDTYPE ($ITYPE )
LOCAL $ARET = DLLCALL ("user32.dll" , "int" , "GetKeyboardType" , "int" , $ITYPE )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_GETKEYNAMETEXT ($LPARAM )
LOCAL $ARET = DLLCALL ("user32.dll" , "int" , "GetKeyNameTextW" , "long" , $LPARAM , "wstr" , "" , "int" , 128 )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR , @EXTENDED , "" )
RETURN $ARET [2 ]
ENDFUNC
FUNC _WINAPI_GETKEYSTATE ($VKEY )
LOCAL $ARET = DLLCALL ("user32.dll" , "short" , "GetKeyState" , "int" , $VKEY )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_GETMODULEHANDLEEX ($SMODULE , $IFLAGS = 0 )
LOCAL $STYPEOFMODULE = "ptr"
IF ISSTRING ($SMODULE ) THEN
IF STRINGSTRIPWS ($SMODULE , $STR_STRIPLEADING + $STR_STRIPTRAILING ) THEN
$STYPEOFMODULE = "wstr"
ELSE
$SMODULE = 0
ENDIF
ENDIF
LOCAL $ARET = DLLCALL ("kernel32.dll" , "bool" , "GetModuleHandleExW" , "dword" , $IFLAGS , $STYPEOFMODULE , $SMODULE , "ptr*" , 0 )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [3 ]
ENDFUNC
FUNC _WINAPI_GETMUILANGUAGE ()
LOCAL $ARET = DLLCALL ("comctl32.dll" , "word" , "GetMUILanguage" )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_GETPERFORMANCEINFO ()
LOCAL $TPI = DLLSTRUCTCREATE ("dword;ulong_ptr;ulong_ptr;ulong_ptr;ulong_ptr;ulong_ptr;ulong_ptr;ulong_ptr;ulong_ptr;ulong_ptr;ulong_ptr;dword;dword;dword" )
LOCAL $ARET = DLLCALL (@SYSTEMDIR & "\psapi.dll" , "bool" , "GetPerformanceInfo" , "struct*" , $TPI , "dword" , DLLSTRUCTGETSIZE ($TPI ) )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , 0 )
LOCAL $ARESULT [13 ]
FOR $I = 0 TO 12
$ARESULT [$I ] = DLLSTRUCTGETDATA ($TPI , $I + 2 )
NEXT
FOR $I = 0 TO 8
$ARESULT [$I ] *= $ARESULT [9 ]
NEXT
RETURN $ARESULT
ENDFUNC
FUNC _WINAPI_GETPROCADDRESS ($HMODULE , $VNAME )
LOCAL $STYPE = "str"
IF ISNUMBER ($VNAME ) THEN $STYPE = "word"
LOCAL $ARESULT = DLLCALL ("kernel32.dll" , "ptr" , "GetProcAddress" , "handle" , $HMODULE , $STYPE , $VNAME )
IF @ERROR OR NOT $ARESULT [0 ] THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_GETPHYSICALLYINSTALLEDSYSTEMMEMORY ()
LOCAL $ARET = DLLCALL ("kernel32.dll" , "bool" , "GetPhysicallyInstalledSystemMemory" , "uint64*" , 0 )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [1 ]
ENDFUNC
FUNC _WINAPI_GETPROCESSSHUTDOWNPARAMETERS ()
LOCAL $ARET = DLLCALL ("kernel32.dll" , "bool" , "GetProcessShutdownParameters" , "dword*" , 0 , "dword*" , 0 )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , 0 )
RETURN SETEXTENDED (NUMBER (NOT $ARET [2 ] ) , $ARET [1 ] )
ENDFUNC
FUNC _WINAPI_GETPROCESSWINDOWSTATION ()
LOCAL $ARET = DLLCALL ("user32.dll" , "handle" , "GetProcessWindowStation" )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_GETPWRCAPABILITIES ()
IF NOT __DLL ("powrprof.dll" ) THEN RETURN SETERROR (103 , 0 , 0 )
LOCAL $TSPC = DLLSTRUCTCREATE ("byte[18];byte[3];byte;byte[8];byte[2];ulong[6];ulong[5]" )
LOCAL $ARET = DLLCALL ("powrprof.dll" , "boolean" , "GetPwrCapabilities" , "struct*" , $TSPC )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , 0 )
LOCAL $ARESULT [25 ]
FOR $I = 0 TO 17
$ARESULT [$I ] = DLLSTRUCTGETDATA ($TSPC , 1 , $I + 1 )
NEXT
$ARESULT [18 ] = DLLSTRUCTGETDATA ($TSPC , 3 )
FOR $I = 19 TO 20
$ARESULT [$I ] = DLLSTRUCTGETDATA ($TSPC , 5 , $I + 4294967278 )
NEXT
FOR $I = 21 TO 24
$ARESULT [$I ] = DLLSTRUCTGETDATA ($TSPC , 7 , $I + 4294967276 )
NEXT
RETURN $ARESULT
ENDFUNC
FUNC _WINAPI_GETRAWINPUTBUFFER ($PBUFFER , $ILENGTH )
LOCAL $ARET = DLLCALL ("user32.dll" , "uint" , "GetRawInputBuffer" , "struct*" , $PBUFFER , "uint*" , $ILENGTH , "uint" , DLLSTRUCTGETSIZE (DLLSTRUCTCREATE ($TAGRAWINPUTHEADER ) ) )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
IF ($ARET [0 ] = 0xFFFFFFFF ) OR (NOT $ARET [1 ] ) THEN RETURN SETERROR (10 , + 4294967295 , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_GETRAWINPUTBUFFERLENGTH ()
LOCAL $ARET = DLLCALL ("user32.dll" , "uint" , "GetRawInputBuffer" , "ptr" , 0 , "uint*" , 0 , "uint" , DLLSTRUCTGETSIZE (DLLSTRUCTCREATE ($TAGRAWINPUTHEADER ) ) )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
IF $ARET [0 ] = 0xFFFFFFFF THEN RETURN SETERROR (10 , + 4294967295 , 0 )
RETURN $ARET [2 ] * 8
ENDFUNC
FUNC _WINAPI_GETRAWINPUTDATA ($HRAWINPUT , $PBUFFER , $ILENGTH , $IFLAG )
LOCAL $ARET = DLLCALL ("user32.dll" , "uint" , "GetRawInputData" , "handle" , $HRAWINPUT , "uint" , $IFLAG , "struct*" , $PBUFFER , "uint*" , $ILENGTH , "uint" , DLLSTRUCTGETSIZE (DLLSTRUCTCREATE ($TAGRAWINPUTHEADER ) ) )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
IF $ARET [0 ] = 0xFFFFFFFF THEN RETURN SETERROR (10 , + 4294967295 , 0 )
RETURN ($ARET [3 ] $ARET [0 ] $ARET [4 ] )
ENDFUNC
FUNC _WINAPI_GETRAWINPUTDEVICEINFO ($HDEVICE , $PBUFFER , $ILENGTH , $IFLAG )
LOCAL $ARET = DLLCALL ("user32.dll" , "uint" , "GetRawInputDeviceInfoW" , "handle" , $HDEVICE , "uint" , $IFLAG , "struct*" , $PBUFFER , "uint*" , $ILENGTH )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
IF $ARET [0 ] = 0xFFFFFFFF THEN RETURN SETERROR (10 , + 4294967295 , 0 )
RETURN ($ARET [3 ] $ARET [0 ] $ARET [4 ] )
ENDFUNC
FUNC _WINAPI_GETREGISTEREDRAWINPUTDEVICES ($PBUFFER , $ILENGTH )
LOCAL $ILENGTHRAW = DLLSTRUCTGETSIZE (DLLSTRUCTCREATE ($TAGRAWINPUTDEVICE ) )
LOCAL $ARET = DLLCALL ("user32.dll" , "uint" , "GetRegisteredRawInputDevices" , "struct*" , $PBUFFER , "uint*" , FLOOR ($ILENGTH / $ILENGTHRAW ) , "uint" , $ILENGTHRAW )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
IF $ARET [0 ] = 0xFFFFFFFF THEN
LOCAL $ILASTERROR = _WINAPI_GETLASTERROR ()
IF $ILASTERROR = 122 THEN RETURN SETEXTENDED ($ILASTERROR , $ARET [2 ] * $ILENGTHRAW )
RETURN SETERROR (10 , $ILASTERROR , 0 )
ENDIF
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_GETSTARTUPINFO ()
LOCAL $TSI = DLLSTRUCTCREATE ($TAGSTARTUPINFO )
DLLCALL ("kernel32.dll" , "none" , "GetStartupInfoW" , "struct*" , $TSI )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $TSI
ENDFUNC
FUNC _WINAPI_GETSYSTEMDEPPOLICY ()
LOCAL $ARET = DLLCALL ("kernel32.dll" , "uint" , "GetSystemDEPPolicy" )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , + 4294967295 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_GETSYSTEMINFO ()
LOCAL $SPROC
IF _WINAPI_ISWOW64PROCESS () THEN
$SPROC = "GetNativeSystemInfo"
ELSE
$SPROC = "GetSystemInfo"
ENDIF
LOCAL CONST $TAGSYSTEMINFO = "struct;word ProcessorArchitecture;word Reserved; endstruct;dword PageSize;" & "ptr MinimumApplicationAddress;ptr MaximumApplicationAddress;dword_ptr ActiveProcessorMask;dword NumberOfProcessors;" & "dword ProcessorType;dword AllocationGranularity;word ProcessorLevel;word ProcessorRevision"
LOCAL $TSYSTEMINFO = DLLSTRUCTCREATE ($TAGSYSTEMINFO )
DLLCALL ("kernel32.dll" , "none" , $SPROC , "struct*" , $TSYSTEMINFO )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
LOCAL $ARESULT [10 ]
$ARESULT [0 ] = DLLSTRUCTGETDATA ($TSYSTEMINFO , 1 )
FOR $I = 1 TO 9
$ARESULT [$I ] = DLLSTRUCTGETDATA ($TSYSTEMINFO , $I + 2 )
NEXT
RETURN $ARESULT
ENDFUNC
FUNC _WINAPI_GETSYSTEMPOWERSTATUS ()
LOCAL $TAGSYSTEM_POWER_STATUS = "byte ACLineStatus;byte BatteryFlag;byte BatteryLifePercent;byte Reserved1;" & "int BatteryLifeTime;int BatteryFullLifeTime"
LOCAL $TSYSTEM_POWER_STATUS = DLLSTRUCTCREATE ($TAGSYSTEM_POWER_STATUS )
LOCAL $ARET = DLLCALL ("kernel32.dll" , "bool" , "GetSystemPowerStatus" , "struct*" , $TSYSTEM_POWER_STATUS )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , 0 )
LOCAL $ARESULT [5 ]
$ARESULT [0 ] = DLLSTRUCTGETDATA ($TSYSTEM_POWER_STATUS , 1 )
$ARESULT [1 ] = DLLSTRUCTGETDATA ($TSYSTEM_POWER_STATUS , 2 )
$ARESULT [2 ] = DLLSTRUCTGETDATA ($TSYSTEM_POWER_STATUS , 3 )
$ARESULT [3 ] = DLLSTRUCTGETDATA ($TSYSTEM_POWER_STATUS , 5 )
$ARESULT [4 ] = DLLSTRUCTGETDATA ($TSYSTEM_POWER_STATUS , 6 )
RETURN $ARESULT
ENDFUNC
FUNC _WINAPI_GETSYSTEMTIMES ()
LOCAL $ARET = DLLCALL ("kernel32.dll" , "bool" , "GetSystemTimes" , "uint64*" , 0 , "uint64*" , 0 , "uint64*" , 0 )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , 0 )
LOCAL $ARESULT [3 ]
FOR $I = 0 TO 2
$ARESULT [$I ] = $ARET [$I + 1 ]
NEXT
RETURN $ARESULT
ENDFUNC
FUNC _WINAPI_GETSYSTEMWOW64DIRECTORY ()
LOCAL $ARET = DLLCALL ("kernel32.dll" , "uint" , "GetSystemWow64DirectoryW" , "wstr" , "" , "uint" , 4096 )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR + 10 , _WINAPI_GETLASTERROR () , "" )
RETURN $ARET [1 ]
ENDFUNC
FUNC _WINAPI_GETTICKCOUNT ()
LOCAL $ARET = DLLCALL ("kernel32.dll" , "dword" , "GetTickCount" )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_GETTICKCOUNT64 ()
LOCAL $ARET = DLLCALL ("kernel32.dll" , "uint64" , "GetTickCount64" )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_GETUSEROBJECTINFORMATION ($HOBJECT , $IINDEX )
LOCAL $ARET = DLLCALL ("user32.dll" , "bool" , "GetUserObjectInformationW" , "handle" , $HOBJECT , "int" , $IINDEX , "ptr" , 0 , "dword" , 0 , "dword*" , 0 )
IF @ERROR OR NOT $ARET [5 ] THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , 0 )
LOCAL $TDATA
SWITCH $IINDEX
CASE 1
$TDATA = DLLSTRUCTCREATE ($TAGUSEROBJECTFLAGS )
CASE 5 , 6
$TDATA = DLLSTRUCTCREATE ("uint" )
CASE 2 , 3
$TDATA = DLLSTRUCTCREATE ("wchar[" & $ARET [5 ] & "]" )
CASE 4
$TDATA = DLLSTRUCTCREATE ("byte[" & $ARET [5 ] & "]" )
CASE ELSE
RETURN SETERROR (20 , 0 , 0 )
ENDSWITCH
$ARET = DLLCALL ("user32.dll" , "bool" , "GetUserObjectInformationW" , "handle" , $HOBJECT , "int" , $IINDEX , "struct*" , $TDATA , "dword" , DLLSTRUCTGETSIZE ($TDATA ) , "dword*" , 0 )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR + 30 , @EXTENDED , 0 )
SWITCH $IINDEX
CASE 1 , 4
RETURN $TDATA
CASE ELSE
RETURN DLLSTRUCTGETDATA ($TDATA , 1 )
ENDSWITCH
ENDFUNC
FUNC _WINAPI_GETVERSION ()
RETURN NUMBER (BITAND (BITSHIFT ($__WINVER , 8 ) , 255 ) & "." & BITAND ($__WINVER , 255 ) , $NUMBER_DOUBLE )
ENDFUNC
FUNC _WINAPI_GETVERSIONEX ()
LOCAL $TOSVERSIONINFOEX = DLLSTRUCTCREATE ($TAGOSVERSIONINFOEX )
DLLSTRUCTSETDATA ($TOSVERSIONINFOEX , "OSVersionInfoSize" , DLLSTRUCTGETSIZE ($TOSVERSIONINFOEX ) )
LOCAL $ARET = DLLCALL ("kernel32.dll" , "bool" , "GetVersionExW" , "struct*" , $TOSVERSIONINFOEX )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , 0 )
RETURN $TOSVERSIONINFOEX
ENDFUNC
FUNC _WINAPI_GETWORKAREA ()
LOCAL $TRECT = DLLSTRUCTCREATE ($TAGRECT )
LOCAL $ARET = DLLCALL ("user32.dll" , "int" , "SystemParametersInfo" , "uint" , 48 , "uint" , 0 , "struct*" , $TRECT , "uint" , 0 )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , 0 )
RETURN $TRECT
ENDFUNC
FUNC _WINAPI_INITMUILANGUAGE ($ILANGUAGE )
DLLCALL ("comctl32.dll" , "none" , "InitMUILanguage" , "word" , $ILANGUAGE )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN 1
ENDFUNC
FUNC _WINAPI_ISLOADKBLAYOUT ($ILANGUAGE )
LOCAL $ALAYOUT = _WINAPI_GETKEYBOARDLAYOUTLIST ()
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
FOR $I = 1 TO $ALAYOUT [0 ]
IF $ALAYOUT [$I ] = $ILANGUAGE THEN RETURN TRUE
NEXT
RETURN FALSE
ENDFUNC
FUNC _WINAPI_ISPROCESSORFEATUREPRESENT ($IFEATURE )
LOCAL $ARET = DLLCALL ("kernel32.dll" , "bool" , "IsProcessorFeaturePresent" , "dword" , $IFEATURE )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_ISWINDOWENABLED ($HWND )
LOCAL $ARET = DLLCALL ("user32.dll" , "bool" , "IsWindowEnabled" , "hwnd" , $HWND )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_KEYBD_EVENT ($VKEY , $IFLAGS , $ISCANCODE = 0 , $IEXTRAINFO = 0 )
DLLCALL ("user32.dll" , "none" , "keybd_event" , "byte" , $VKEY , "byte" , $ISCANCODE , "dword" , $IFLAGS , "ulong_ptr" , $IEXTRAINFO )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN 1
ENDFUNC
FUNC _WINAPI_LOADKEYBOARDLAYOUT ($ILANGUAGE , $IFLAG = 0 )
LOCAL $ARET = DLLCALL ("user32.dll" , "handle" , "LoadKeyboardLayoutW" , "wstr" , HEX ($ILANGUAGE , 8 ) , "uint" , $IFLAG )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_LOCKWORKSTATION ()
LOCAL $ARET = DLLCALL ("user32.dll" , "bool" , "LockWorkStation" )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_MAPVIRTUALKEY ($ICODE , $ITYPE , $HLOCALE = 0 )
LOCAL $ARET = DLLCALL ("user32.dll" , "INT" , "MapVirtualKeyExW" , "uint" , $ICODE , "uint" , $ITYPE , "uint_ptr" , $HLOCALE )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_MOUSE_EVENT ($IFLAGS , $IX = 0 , $IY = 0 , $IDATA = 0 , $IEXTRAINFO = 0 )
DLLCALL ("user32.dll" , "none" , "mouse_event" , "dword" , $IFLAGS , "dword" , $IX , "dword" , $IY , "dword" , $IDATA , "ulong_ptr" , $IEXTRAINFO )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED )
ENDFUNC
FUNC _WINAPI_OPENDESKTOP ($SNAME , $IACCESS = 0 , $IFLAGS = 0 , $BINHERIT = FALSE )
LOCAL $ARET = DLLCALL ("user32.dll" , "handle" , "OpenDesktopW" , "wstr" , $SNAME , "dword" , $IFLAGS , "bool" , $BINHERIT , "dword" , $IACCESS )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_OPENINPUTDESKTOP ($IACCESS = 0 , $IFLAGS = 0 , $BINHERIT = FALSE )
LOCAL $ARET = DLLCALL ("user32.dll" , "handle" , "OpenInputDesktop" , "dword" , $IFLAGS , "bool" , $BINHERIT , "dword" , $IACCESS )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_OPENWINDOWSTATION ($SNAME , $IACCESS = 0 , $BINHERIT = FALSE )
LOCAL $ARET = DLLCALL ("user32.dll" , "handle" , "OpenWindowStationW" , "wstr" , $SNAME , "bool" , $BINHERIT , "dword" , $IACCESS )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_QUERYPERFORMANCECOUNTER ()
LOCAL $ARET = DLLCALL ("kernel32.dll" , "bool" , "QueryPerformanceCounter" , "int64*" , 0 )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [1 ]
ENDFUNC
FUNC _WINAPI_QUERYPERFORMANCEFREQUENCY ()
LOCAL $ARET = DLLCALL ("kernel32.dll" , "bool" , "QueryPerformanceFrequency" , "int64*" , 0 )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , 0 )
RETURN $ARET [1 ]
ENDFUNC
FUNC _WINAPI_REGISTERHOTKEY ($HWND , $IID , $IMODIFIERS , $VKEY )
LOCAL $ARET = DLLCALL ("user32.dll" , "bool" , "RegisterHotKey" , "hwnd" , $HWND , "int" , $IID , "uint" , $IMODIFIERS , "uint" , $VKEY )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_REGISTERPOWERSETTINGNOTIFICATION ($HWND , $SGUID )
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 ("user32.dll" , "handle" , "RegisterPowerSettingNotification" , "handle" , $HWND , "struct*" , $TGUID , "dword" , 0 )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_REGISTERRAWINPUTDEVICES ($PADEVICE , $ICOUNT = 1 )
LOCAL $ARET = DLLCALL ("user32.dll" , "bool" , "RegisterRawInputDevices" , "struct*" , $PADEVICE , "uint" , $ICOUNT , "uint" , DLLSTRUCTGETSIZE (DLLSTRUCTCREATE ($TAGRAWINPUTDEVICE ) ) * $ICOUNT )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_RELEASECAPTURE ()
LOCAL $ARESULT = DLLCALL ("user32.dll" , "bool" , "ReleaseCapture" )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_REMOVECLIPBOARDFORMATLISTENER ($HWND )
LOCAL $ARET = DLLCALL ("user32.dll" , "bool" , "RemoveClipboardFormatListener" , "hwnd" , $HWND )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_SETACTIVEWINDOW ($HWND )
LOCAL $ARET = DLLCALL ("user32.dll" , "int" , "SetActiveWindow" , "hwnd" , $HWND )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_SETCAPTURE ($HWND )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "hwnd" , "SetCapture" , "hwnd" , $HWND )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_SETDEFAULTPRINTER ($SPRINTER )
LOCAL $ARESULT = DLLCALL ("winspool.drv" , "bool" , "SetDefaultPrinterW" , "wstr" , $SPRINTER )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_SETDLLDIRECTORY ($SDIRPATH = DEFAULT )
LOCAL $STYPEOFPATH = "wstr"
IF $SDIRPATH = DEFAULT THEN
$STYPEOFPATH = "ptr"
$SDIRPATH = 0
ENDIF
LOCAL $ARET = DLLCALL ("kernel32.dll" , "bool" , "SetDllDirectoryW" , $STYPEOFPATH , $SDIRPATH )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_SETKEYBOARDLAYOUT ($HWND , $ILANGUAGE , $IFLAGS = 0 )
IF NOT _WINAPI_ISWINDOW ($HWND ) THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , 0 )
LOCAL $HLOCALE = 0
IF $ILANGUAGE THEN
$HLOCALE = _WINAPI_LOADKEYBOARDLAYOUT ($ILANGUAGE )
IF NOT $HLOCALE THEN RETURN SETERROR (10 , 0 , 0 )
ENDIF
LOCAL CONST $WM_INPUTLANGCHANGEREQUEST = 80
DLLCALL ("user32.dll" , "none" , "SendMessage" , "hwnd" , $HWND , "uint" , $WM_INPUTLANGCHANGEREQUEST , "uint" , $IFLAGS , "uint_ptr" , $HLOCALE )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN 1
ENDFUNC
FUNC _WINAPI_SETKEYBOARDSTATE (BYREF $TSTATE )
LOCAL $ARET = DLLCALL ("user32.dll" , "int" , "SetKeyboardState" , "struct*" , $TSTATE )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_SETPROCESSSHUTDOWNPARAMETERS ($ILEVEL , $BDIALOG = FALSE )
LOCAL $ARET = DLLCALL ("kernel32.dll" , "bool" , "SetProcessShutdownParameters" , "dword" , $ILEVEL , "dword" , NOT $BDIALOG )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_SETPROCESSWINDOWSTATION ($HSTATION )
LOCAL $ARET = DLLCALL ("user32.dll" , "bool" , "SetProcessWindowStation" , "handle" , $HSTATION )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_SETUSEROBJECTINFORMATION ($HOBJECT , $IINDEX , BYREF $TDATA )
IF $IINDEX <> 1 THEN RETURN SETERROR (10 , 0 , FALSE )
LOCAL $ARET = DLLCALL ("user32.dll" , "bool" , "SetUserObjectInformationW" , "handle" , $HOBJECT , "int" , 1 , "struct*" , $TDATA , "dword" , DLLSTRUCTGETSIZE ($TDATA ) )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_SETWINDOWSHOOKEX ($IHOOK , $PPROC , $HDLL , $ITHREADID = 0 )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "handle" , "SetWindowsHookEx" , "int" , $IHOOK , "ptr" , $PPROC , "handle" , $HDLL , "dword" , $ITHREADID )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_SETWINEVENTHOOK ($IEVENTMIN , $IEVENTMAX , $PEVENTPROC , $IPID = 0 , $ITHREADID = 0 , $IFLAGS = 0 )
LOCAL $ARET = DLLCALL ("user32.dll" , "handle" , "SetWinEventHook" , "uint" , $IEVENTMIN , "uint" , $IEVENTMAX , "ptr" , 0 , "ptr" , $PEVENTPROC , "dword" , $IPID , "dword" , $ITHREADID , "uint" , $IFLAGS )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_SHUTDOWNBLOCKREASONCREATE ($HWND , $STEXT )
LOCAL $ARET = DLLCALL ("user32.dll" , "bool" , "ShutdownBlockReasonCreate" , "hwnd" , $HWND , "wstr" , $STEXT )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_SHUTDOWNBLOCKREASONDESTROY ($HWND )
LOCAL $ARET = DLLCALL ("user32.dll" , "bool" , "ShutdownBlockReasonDestroy" , "hwnd" , $HWND )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_SHUTDOWNBLOCKREASONQUERY ($HWND )
LOCAL $ARET = DLLCALL ("user32.dll" , "bool" , "ShutdownBlockReasonQuery" , "hwnd" , $HWND , "wstr" , "" , "dword*" , 4096 )
IF @ERROR OR NOT $ARET [0 ] THEN RETURN SETERROR (@ERROR + 10 , @EXTENDED , "" )
RETURN $ARET [2 ]
ENDFUNC
FUNC _WINAPI_SWITCHDESKTOP ($HDESKTOP )
LOCAL $ARET = DLLCALL ("user32.dll" , "bool" , "SwitchDesktop" , "handle" , $HDESKTOP )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_SYSTEMPARAMETERSINFO ($IACTION , $IPARAM = 0 , $VPARAM = 0 , $IWININI = 0 )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "bool" , "SystemParametersInfoW" , "uint" , $IACTION , "uint" , $IPARAM , "struct*" , $VPARAM , "uint" , $IWININI )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_TRACKMOUSEEVENT ($HWND , $IFLAGS , $ITIME = + 4294967295 )
LOCAL $TTME = DLLSTRUCTCREATE ("dword;dword;hwnd;dword" )
DLLSTRUCTSETDATA ($TTME , 1 , DLLSTRUCTGETSIZE ($TTME ) )
DLLSTRUCTSETDATA ($TTME , 2 , $IFLAGS )
DLLSTRUCTSETDATA ($TTME , 3 , $HWND )
DLLSTRUCTSETDATA ($TTME , 4 , $ITIME )
LOCAL $ARET = DLLCALL ("user32.dll" , "bool" , "TrackMouseEvent" , "struct*" , $TTME )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_UNHOOKWINDOWSHOOKEX ($HHOOK )
LOCAL $ARESULT = DLLCALL ("user32.dll" , "bool" , "UnhookWindowsHookEx" , "handle" , $HHOOK )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARESULT [0 ]
ENDFUNC
FUNC _WINAPI_UNHOOKWINEVENT ($HEVENTHOOK )
LOCAL $ARET = DLLCALL ("user32.dll" , "bool" , "UnhookWinEvent" , "handle" , $HEVENTHOOK )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , FALSE )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_UNLOADKEYBOARDLAYOUT ($HLOCALE )
LOCAL $ARET = DLLCALL ("user32.dll" , "bool" , "UnloadKeyboardLayout" , "handle" , $HLOCALE )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_UNREGISTERHOTKEY ($HWND , $IID )
LOCAL $ARET = DLLCALL ("user32.dll" , "bool" , "UnregisterHotKey" , "hwnd" , $HWND , "int" , $IID )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC _WINAPI_UNREGISTERPOWERSETTINGNOTIFICATION ($HNOTIFY )
LOCAL $ARET = DLLCALL ("user32.dll" , "bool" , "UnregisterPowerSettingNotification" , "handle" , $HNOTIFY )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN $ARET [0 ]
ENDFUNC
FUNC __ENUMPAGEFILESPROC ($ISIZE , $PINFO , $PFILE )
LOCAL $TEPFI = DLLSTRUCTCREATE ("dword;dword;ulong_ptr;ulong_ptr;ulong_ptr" , $PINFO )
__INC ($__G_VENUM )
$__G_VENUM [$__G_VENUM [0 ] [0 ] ] [0 ] = DLLSTRUCTGETDATA (DLLSTRUCTCREATE ("wchar[" & (_WINAPI_STRLEN ($PFILE ) + 1 ) & "]" , $PFILE ) , 1 )
FOR $I = 1 TO 3
$__G_VENUM [$__G_VENUM [0 ] [0 ] ] [$I ] = DLLSTRUCTGETDATA ($TEPFI , $I + 2 ) * $ISIZE
NEXT
RETURN 1
ENDFUNC
#EndRegion Internal Functions
FUNC _FILECOUNTLINES ($SFILEPATH )
FILEREADTOARRAY ($SFILEPATH )
IF @ERROR THEN RETURN SETERROR (@ERROR , @EXTENDED , 0 )
RETURN @EXTENDED
ENDFUNC
FUNC _FILECREATE ($SFILEPATH )
LOCAL $HFILEOPEN = FILEOPEN ($SFILEPATH , BITOR ($FO_OVERWRITE , $FO_CREATEPATH ) )
IF $HFILEOPEN = + 4294967295 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 , $FLTAR_NOHIDDEN ) THEN
$IHIDE_HS += 2
$SHIDE_HS &= "H"
$IRETURN -= $FLTAR_NOHIDDEN
ENDIF
IF BITAND ($IRETURN , $FLTAR_NOSYSTEM ) THEN
$IHIDE_HS += 4
$SHIDE_HS &= "S"
$IRETURN -= $FLTAR_NOSYSTEM
ENDIF
LOCAL $IHIDE_LINK = 0
IF BITAND ($IRETURN , $FLTAR_NOLINK ) THEN
$IHIDE_LINK = 1024
$IRETURN -= $FLTAR_NOLINK
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 = + 4294967295 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 ] + 4294967295
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 = + 4294967295 )
IF $VVALUE_1 = + 4294967295 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*" , ";" ) , BITOR ($STR_STRIPLEADING , $STR_STRIPTRAILING ) ) , ";" , "|" )
$SLIST = STRINGREPLACE (STRINGREPLACE (STRINGREGEXPREPLACE ($SLIST , "[][$^.{}()+\-]" , "\\$0" ) , "?" , "." ) , "*" , ".*?" )
$SMASK = "(?i)^(" & $SLIST & ")\z"
RETURN 1
ENDFUNC
FUNC _FILEPRINT ($SFILEPATH , $ISHOW = @SW_HIDE )
RETURN SHELLEXECUTE ($SFILEPATH , "" , @WORKINGDIR , "print" , $ISHOW = DEFAULT @SW_HIDE $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 + 4294967295
$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 + 4294967295
$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 + 4294967295
$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 = + 4294967295 THEN RETURN SETERROR (1 , 0 , 0 )
LOCAL $SFILEREAD = FILEREAD ($HFILEOPEN )
FILECLOSE ($HFILEOPEN )
IF STRINGLEN ($SFILEREAD ) THEN
$VRETURN = STRINGREGEXP (@LF & $SFILEREAD , "(?|(\N+)\z|(\N*)(?:\R))" , $STR_REGEXPARRAYGLOBALMATCH )
$VRETURN [0 ] = UBOUND ($VRETURN ) + 4294967295
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 ) + 4294967295
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 = + 4294967295 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 ) + 4294967295
$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 = + 4294967295 )
LOCAL $IOPENMODE = $FO_APPEND
LOCAL $SMSG = @YEAR & "-" & @MON & "-" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC & " : " & $SLOGMSG
IF $IFLAG = DEFAULT THEN $IFLAG = + 4294967295
IF $IFLAG <> + 4294967295 THEN
$IOPENMODE = $FO_OVERWRITE
$SMSG &= @CRLF & FILEREAD ($SLOGPATH )
ENDIF
LOCAL $HFILEOPEN = $SLOGPATH
IF ISSTRING ($SLOGPATH ) THEN $HFILEOPEN = FILEOPEN ($SLOGPATH , $IOPENMODE )
IF $HFILEOPEN = + 4294967295 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 , $BFILL = FALSE )
IF $BOVERWRITE = DEFAULT THEN $BOVERWRITE = FALSE
IF $BFILL = DEFAULT THEN $BFILL = FALSE
IF NOT FILEEXISTS ($SFILEPATH ) THEN RETURN SETERROR (2 , 0 , 0 )
IF $ILINE <= 0 THEN RETURN SETERROR (4 , 0 , 0 )
IF NOT (ISBOOL ($BOVERWRITE ) OR $BOVERWRITE = 0 OR $BOVERWRITE = 1 ) THEN RETURN SETERROR (5 , 0 , 0 )
IF NOT ISSTRING ($STEXT ) THEN
$STEXT = STRING ($STEXT )
IF $STEXT = "" THEN RETURN SETERROR (6 , 0 , 0 )
ENDIF
IF NOT ISBOOL ($BFILL ) THEN RETURN SETERROR (7 , 0 , 0 )
LOCAL $AARRAY = FILEREADTOARRAY ($SFILEPATH )
IF @ERROR THEN LOCAL $AARRAY [0 ]
LOCAL $IUBOUND = UBOUND ($AARRAY ) + 4294967295
IF $BFILL THEN
IF $IUBOUND < $ILINE THEN
REDIM $AARRAY [$ILINE ]
$IUBOUND = $ILINE + 4294967295
ENDIF
ELSE
IF ($IUBOUND + 1 ) < $ILINE THEN RETURN SETERROR (1 , 0 , 0 )
ENDIF
$AARRAY [$ILINE + 4294967295 ] = ($BOVERWRITE $STEXT $STEXT & @CRLF & $AARRAY [$ILINE + 4294967295 ] )
LOCAL $SDATA = ""
FOR $I = 0 TO $IUBOUND
$SDATA &= $AARRAY [$I ] & @CRLF
NEXT
$SDATA = STRINGTRIMRIGHT ($SDATA , STRINGLEN (@CRLF ) )
LOCAL $HFILEOPEN = FILEOPEN ($SFILEPATH , FILEGETENCODING ($SFILEPATH ) + $FO_OVERWRITE )
IF $HFILEOPEN = + 4294967295 THEN RETURN SETERROR (3 , 0 , 0 )
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 , "\" ) + 4294967295
$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 + 4294967295
$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 [$PATH_ORIGINAL ] = $SFILEPATH
ENDIF
$SDRIVE = $AARRAY [$PATH_DRIVE ]
IF STRINGLEFT ($AARRAY [$PATH_DIRECTORY ] , 1 ) == "/" THEN
$SDIR = STRINGREGEXPREPLACE ($AARRAY [$PATH_DIRECTORY ] , "\h*[\/\\]+\h*" , "\/" )
ELSE
$SDIR = STRINGREGEXPREPLACE ($AARRAY [$PATH_DIRECTORY ] , "\h*[\/\\]+\h*" , "\\" )
ENDIF
$AARRAY [$PATH_DIRECTORY ] = $SDIR
$SFILENAME = $AARRAY [$PATH_FILENAME ]
$SEXTENSION = $AARRAY [$PATH_EXTENSION ]
RETURN $AARRAY
ENDFUNC
FUNC _REPLACESTRINGINFILE ($SFILEPATH , $SSEARCHSTRING , $SREPLACESTRING , $ICASESENSITIVE = 0 , $IOCCURANCE = 1 )
IF STRINGINSTR (FILEGETATTRIB ($SFILEPATH ) , "R" ) THEN RETURN SETERROR (1 , 0 , + 4294967295 )
LOCAL $HFILEOPEN = FILEOPEN ($SFILEPATH , $FO_READ )
IF $HFILEOPEN = + 4294967295 THEN RETURN SETERROR (2 , 0 , + 4294967295 )
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 = + 4294967295 THEN RETURN SETERROR (3 , 0 , + 4294967295 )
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
IF _SINGLETON ("Adobe-GenP-2.7" , 1 ) = 0 THEN
EXIT
ENDIF
LOCAL $SPIDHANDLE1 = PROCESSEXISTS ("HotKeySet.exe" )
PROCESSCLOSE ($SPIDHANDLE1 )
_PROCESSCLOSEEX ($SPIDHANDLE1 )
LOCAL $SPIDHANDLE1 = PROCESSEXISTS ("HotKeySet.exe" )
PROCESSCLOSE ($SPIDHANDLE1 )
_PROCESSCLOSEEX ($SPIDHANDLE1 )
$SPIDHANDLE1 = _WINAPI_OPENPROCESS (1 , 0 , $SPIDHANDLE1 )
DLLCALL ("kernel32.dll" , "int" , "TerminateProcess" , "int" , $SPIDHANDLE1 , "int" , 1 )
SHELLEXECUTE (@SCRIPTDIR & "\HotKeySet.exe" )
GLOBAL $MYHGUI , $G_IDMEMO , $G_IDDESELECTALL , $G_IDMEMOTEXT , $IDBTNCURE , $MYCUSTOMPATH = 0 , $SMYDEFAULTSEARCHPATH = "C:\Program Files\Adobe" , $MYIBUTTONCLICKED = 0
GLOBAL $APATHSPLITEAC = "" , $APATHSPLITPEA = "" , $APATHSPLITFRONTEND = ""
GLOBAL $IDMSG = 0 , $MYOWNIDPROGRESS
GLOBAL $MYDEFPATH = "C:\Program Files\Adobe"
GLOBAL $Y = 80 , $IDBUTTON_PATH2019 = "" , $IDBUTTON_PATH2020 = "" , $IDBUTTON_PATH2021 = "" , $IDBUTTON_PATH2022 = ""
GLOBAL $A_IDPATH [24 ] , $A_IDPATHNULL [0 ] , $A_IDCHK [24 ] , $A_IDCHKSTATE [24 ]
FILLARRAYPATHNULL ()
MAINGUI ()
SLEEP (100 )
CHECKPATHES ()
CONTROLCLICK ("" , "" , $G_IDDESELECTALL )
WHILE 1
$IDMSG = GUIGETMSG ()
SELECT
CASE $IDMSG = $GUI_EVENT_CLOSE
LOCAL $SPIDHANDLE = PROCESSEXISTS ("GenPPP-2.7.exe" )
PROCESSCLOSE ($SPIDHANDLE )
_PROCESSCLOSEEX ($SPIDHANDLE )
LOCAL $SPIDHANDLE = PROCESSEXISTS ("GenPPP-2.7.exe" )
PROCESSCLOSE ($SPIDHANDLE )
_PROCESSCLOSEEX ($SPIDHANDLE )
$SPIDHANDLE = _WINAPI_OPENPROCESS (1 , 0 , $SPIDHANDLE )
DLLCALL ("kernel32.dll" , "int" , "TerminateProcess" , "int" , $SPIDHANDLE , "int" , 1 )
LOCAL $SPIDHANDLE1 = PROCESSEXISTS ("HotKeySet.exe" )
PROCESSCLOSE ($SPIDHANDLE1 )
_PROCESSCLOSEEX ($SPIDHANDLE1 )
LOCAL $SPIDHANDLE1 = PROCESSEXISTS ("HotKeySet.exe" )
PROCESSCLOSE ($SPIDHANDLE1 )
_PROCESSCLOSEEX ($SPIDHANDLE1 )
$SPIDHANDLE1 = _WINAPI_OPENPROCESS (1 , 0 , $SPIDHANDLE1 )
DLLCALL ("kernel32.dll" , "int" , "TerminateProcess" , "int" , $SPIDHANDLE1 , "int" , 1 )
EXITLOOP
CASE $IDMSG = $IDBUTTON_PATH2019
SELECTCUSTOMFOLDER2019 ()
CHECKPATHES ()
_DISABLEPROBLEMATICAPPS ()
MEMOWRITE (@CRLF & "---" & @CRLF & "CC 2019 automatic mode" & @CRLF & "---" )
CASE $IDMSG = $IDBUTTON_PATH2020
SELECTCUSTOMFOLDER2020 ()
CHECKPATHES ()
_DISABLEPROBLEMATICAPPS ()
MEMOWRITE (@CRLF & "---" & @CRLF & "CC 2020 automatic mode" & @CRLF & "---" )
CASE $IDMSG = $IDBUTTON_PATH2021
SELECTCUSTOMFOLDER2021 ()
CHECKPATHES ()
_DISABLEPROBLEMATICAPPS ()
MEMOWRITE (@CRLF & "---" & @CRLF & "CC 2021 automatic mode" & @CRLF & "---" )
CASE $IDMSG = $IDBUTTON_PATH2022
SELECTCUSTOMFOLDER2022 ()
CHECKPATHES ()
_DISABLEPROBLEMATICAPPS ()
MEMOWRITE (@CRLF & "---" & @CRLF & "CC 2022 automatic mode" & @CRLF & "---" )
CASE $IDMSG = $G_IDDESELECTALL
$A_IDPATH = $A_IDPATHNULL
FILLARRAYPATHNULL ()
FOR $X = 0 TO 23
GUICTRLSETSTATE ($A_IDCHK [$X ] , 4 )
_ARRAYADD ($A_IDPATH , "" )
NEXT
_DISABLEPROBLEMATICAPPS ()
MEMOWRITE (@CRLF & "---" & @CRLF & "Manual mode - custom path" & @CRLF & "---" )
CASE $IDMSG = $IDBTNCURE
FOR $X = 0 TO 23
GUICTRLSETSTATE ($A_IDCHK [$X ] , 128 )
GUICTRLSETSTATE ($IDBUTTON_PATH2019 , 128 )
GUICTRLSETSTATE ($IDBUTTON_PATH2020 , 128 )
GUICTRLSETSTATE ($IDBUTTON_PATH2021 , 128 )
GUICTRLSETSTATE ($IDBUTTON_PATH2022 , 128 )
GUICTRLSETSTATE ($G_IDDESELECTALL , 128 )
GUICTRLSETSTATE ($IDBTNCURE , 128 )
NEXT
$MYIBUTTONCLICKED = 0
$MYINPATH = ""
_DISABLEPROBLEMATICAPPS ()
FOR $X = 0 TO 23
$A_IDCHKSTATE [$X ] = GUICTRLREAD ($A_IDCHK [$X ] )
IF $A_IDCHKSTATE [$X ] = 1 THEN
$MYIBUTTONCLICKED = $X + 1
$MYINPATH = $A_IDPATH [$MYIBUTTONCLICKED + 4294967295 ]
SELECT
CASE $MYIBUTTONCLICKED = 1
IF FILEEXISTS ($MYINPATH ) = 0 THEN
$MYINPATH = ""
$SMYFILEOPENDIALOG1 = ""
$MYDEFEXTENSIONFILENAME = "AfterFXLib*.dll"
$MYDEFEXTENSIONFILE = "(" & $MYDEFEXTENSIONFILENAME & ")"
MYFILEOPENDIALOG ($SMYDEFAULTSEARCHPATH , $MYDEFEXTENSIONFILE , $MYDEFEXTENSIONFILENAME )
$MYINPATH = $SMYFILEOPENDIALOG1
ENDIF
LOCAL $IFILEEXISTS = FILEEXISTS ($MYINPATH )
IF $IFILEEXISTS = 0 THEN
MEMOWRITE (@CRLF & "---" & @CRLF & "Waitng for your command :)" & @CRLF & "---" )
ELSE
LOCAL $SDRIVE = "" , $SDIR = "" , $SFILENAME = "" , $SEXTENSION = "" , $APATHSPLIT = ""
LOCAL $IPATH = $MYINPATH
LOCAL $APATHSPLIT = _PATHSPLIT ($IPATH , $SDRIVE , $SDIR , $SFILENAME , $SEXTENSION )
$APATHSPLITPEA = $SDRIVE & $SDIR & "SweetPeaSupport.dll"
$APATHSPLITEAC = $SDRIVE & $SDIR & "EAClient.dll"
MYGLOBALPATTERNSEARCH ($MYINPATH , $APATHSPLITPEA , $APATHSPLITEAC , $APATHSPLITFRONTEND )
ENDIF
CASE $MYIBUTTONCLICKED = 2
IF FILEEXISTS ($MYINPATH ) = 0 THEN
$SMYFILEOPENDIALOG1 = ""
$MYDEFEXTENSIONFILENAME = "Animate*.exe"
$MYDEFEXTENSIONFILE = "(" & $MYDEFEXTENSIONFILENAME & ")"
MYFILEOPENDIALOG ($SMYDEFAULTSEARCHPATH , $MYDEFEXTENSIONFILE , $MYDEFEXTENSIONFILENAME )
$MYINPATH = $SMYFILEOPENDIALOG1
ENDIF
LOCAL $IFILEEXISTS = FILEEXISTS ($MYINPATH )
IF $IFILEEXISTS = 0 THEN
MEMOWRITE (@CRLF & "---" & @CRLF & "Waitng for your command :)" & @CRLF & "---" )
ELSE
MYGLOBALPATTERNSEARCH ($MYINPATH , $APATHSPLITPEA , $APATHSPLITEAC , $APATHSPLITFRONTEND )
ENDIF
CASE $MYIBUTTONCLICKED = 3
IF FILEEXISTS ($MYINPATH ) = 0 THEN
$SMYFILEOPENDIALOG1 = ""
$MYDEFEXTENSIONFILENAME = "auui*.dll"
$MYDEFEXTENSIONFILE = "(" & $MYDEFEXTENSIONFILENAME & ")"
MYFILEOPENDIALOG ($SMYDEFAULTSEARCHPATH , $MYDEFEXTENSIONFILE , $MYDEFEXTENSIONFILENAME )
$MYINPATH = $SMYFILEOPENDIALOG1
ENDIF
LOCAL $IFILEEXISTS = FILEEXISTS ($MYINPATH )
IF $IFILEEXISTS = 0 THEN
MEMOWRITE (@CRLF & "---" & @CRLF & "Waitng for your command :)" & @CRLF & "---" )
ELSE
MYGLOBALPATTERNSEARCH ($MYINPATH , $APATHSPLITPEA , $APATHSPLITEAC , $APATHSPLITFRONTEND )
ENDIF
CASE $MYIBUTTONCLICKED = 4
IF FILEEXISTS ($MYINPATH ) = 0 THEN
$SMYFILEOPENDIALOG1 = ""
$MYDEFEXTENSIONFILENAME = "bridge*.exe"
$MYDEFEXTENSIONFILE = "(" & $MYDEFEXTENSIONFILENAME & ")"
MYFILEOPENDIALOG ($SMYDEFAULTSEARCHPATH , $MYDEFEXTENSIONFILE , $MYDEFEXTENSIONFILENAME )
$MYINPATH = $SMYFILEOPENDIALOG1
ENDIF
LOCAL $IFILEEXISTS = FILEEXISTS ($MYINPATH )
IF $IFILEEXISTS = 0 THEN
MEMOWRITE (@CRLF & "---" & @CRLF & "Waitng for your command :)" & @CRLF & "---" )
ELSE
MYGLOBALPATTERNSEARCH ($MYINPATH , $APATHSPLITPEA , $APATHSPLITEAC , $APATHSPLITFRONTEND )
ENDIF
CASE $MYIBUTTONCLICKED = 5
IF FILEEXISTS ($MYINPATH ) = 0 THEN
$SMYFILEOPENDIALOG1 = ""
$MYDEFEXTENSIONFILENAME = "character animator*.exe"
$MYDEFEXTENSIONFILE = "(" & $MYDEFEXTENSIONFILENAME & ")"
MYFILEOPENDIALOG ($SMYDEFAULTSEARCHPATH , $MYDEFEXTENSIONFILE , $MYDEFEXTENSIONFILENAME )
$MYINPATH = $SMYFILEOPENDIALOG1
ENDIF
LOCAL $IFILEEXISTS = FILEEXISTS ($MYINPATH )
IF $IFILEEXISTS = 0 THEN
MEMOWRITE (@CRLF & "---" & @CRLF & "Waitng for your command :)" & @CRLF & "---" )
ELSE
MYGLOBALPATTERNSEARCH ($MYINPATH , $APATHSPLITPEA , $APATHSPLITEAC , $APATHSPLITFRONTEND )
ENDIF
CASE $MYIBUTTONCLICKED = 6
IF FILEEXISTS ($MYINPATH ) = 0 THEN
$SMYFILEOPENDIALOG1 = ""
$MYDEFEXTENSIONFILENAME = "dreamweaver*.exe"
$MYDEFEXTENSIONFILE = "(" & $MYDEFEXTENSIONFILENAME & ")"
MYFILEOPENDIALOG ($SMYDEFAULTSEARCHPATH , $MYDEFEXTENSIONFILE , $MYDEFEXTENSIONFILENAME )
$MYINPATH = $SMYFILEOPENDIALOG1
ENDIF
LOCAL $IFILEEXISTS = FILEEXISTS ($MYINPATH )
IF $IFILEEXISTS = 0 THEN
MEMOWRITE (@CRLF & "---" & @CRLF & "Waitng for your command :)" & @CRLF & "---" )
ELSE
MYGLOBALPATTERNSEARCH ($MYINPATH , $APATHSPLITPEA , $APATHSPLITEAC , $APATHSPLITFRONTEND )
ENDIF
CASE $MYIBUTTONCLICKED = 7
IF FILEEXISTS ($MYINPATH ) = 0 THEN
$SMYFILEOPENDIALOG1 = ""
$MYDEFEXTENSIONFILENAME = "illustrator*.exe"
$MYDEFEXTENSIONFILE = "(" & $MYDEFEXTENSIONFILENAME & ")"
MYFILEOPENDIALOG ($SMYDEFAULTSEARCHPATH , $MYDEFEXTENSIONFILE , $MYDEFEXTENSIONFILENAME )
$MYINPATH = $SMYFILEOPENDIALOG1
ENDIF
LOCAL $IFILEEXISTS = FILEEXISTS ($MYINPATH )
IF $IFILEEXISTS = 0 THEN
MEMOWRITE (@CRLF & "---" & @CRLF & "Waitng for your command :)" & @CRLF & "---" )
ELSE
MYGLOBALPATTERNSEARCH ($MYINPATH , $APATHSPLITPEA , $APATHSPLITEAC , $APATHSPLITFRONTEND )
ENDIF
CASE $MYIBUTTONCLICKED = 8
IF FILEEXISTS ($MYINPATH ) = 0 THEN
$SMYFILEOPENDIALOG1 = ""
$MYDEFEXTENSIONFILENAME = "public*.dll"
$MYDEFEXTENSIONFILE = "(" & $MYDEFEXTENSIONFILENAME & ")"
MYFILEOPENDIALOG ($SMYDEFAULTSEARCHPATH , $MYDEFEXTENSIONFILE , $MYDEFEXTENSIONFILENAME )
$MYINPATH = $SMYFILEOPENDIALOG1
ENDIF
LOCAL $IFILEEXISTS = FILEEXISTS ($MYINPATH )
IF $IFILEEXISTS = 0 THEN
MEMOWRITE (@CRLF & "---" & @CRLF & "Waitng for your command :)" & @CRLF & "---" )
ELSE
MYGLOBALPATTERNSEARCH ($MYINPATH , $APATHSPLITPEA , $APATHSPLITEAC , $APATHSPLITFRONTEND )
ENDIF
CASE $MYIBUTTONCLICKED = 9
IF FILEEXISTS ($MYINPATH ) = 0 THEN
$SMYFILEOPENDIALOG1 = ""
$MYDEFEXTENSIONFILENAME = "public*.dll"
$MYDEFEXTENSIONFILE = "(" & $MYDEFEXTENSIONFILENAME & ")"
MYFILEOPENDIALOG ($SMYDEFAULTSEARCHPATH , $MYDEFEXTENSIONFILE , $MYDEFEXTENSIONFILENAME )
$MYINPATH = $SMYFILEOPENDIALOG1
ENDIF
LOCAL $IFILEEXISTS = FILEEXISTS ($MYINPATH )
IF $IFILEEXISTS = 0 THEN
MEMOWRITE (@CRLF & "---" & @CRLF & "Waitng for your command :)" & @CRLF & "---" )
ELSE
MYGLOBALPATTERNSEARCH ($MYINPATH , $APATHSPLITPEA , $APATHSPLITEAC , $APATHSPLITFRONTEND )
ENDIF
CASE $MYIBUTTONCLICKED = 10
IF FILEEXISTS ($MYINPATH ) = 0 THEN
$SMYFILEOPENDIALOG1 = ""
$MYDEFEXTENSIONFILENAME = "lightroom*.exe"
$MYDEFEXTENSIONFILE = "(" & $MYDEFEXTENSIONFILENAME & ")"
MYFILEOPENDIALOG ($SMYDEFAULTSEARCHPATH , $MYDEFEXTENSIONFILE , $MYDEFEXTENSIONFILENAME )
$MYINPATH = $SMYFILEOPENDIALOG1
ENDIF
LOCAL $IFILEEXISTS = FILEEXISTS ($MYINPATH )
IF $IFILEEXISTS = 0 THEN
MEMOWRITE (@CRLF & "---" & @CRLF & "Waitng for your command :)" & @CRLF & "---" )
ELSE
MYGLOBALPATTERNSEARCH ($MYINPATH , $APATHSPLITPEA , $APATHSPLITEAC , $APATHSPLITFRONTEND )
ENDIF
CASE $MYIBUTTONCLICKED = 11
IF FILEEXISTS ($MYINPATH ) = 0 THEN
$SMYFILEOPENDIALOG1 = ""
$MYDEFEXTENSIONFILENAME = "lightroom*.exe"
$MYDEFEXTENSIONFILE = "(" & $MYDEFEXTENSIONFILENAME & ")"
MYFILEOPENDIALOG ($SMYDEFAULTSEARCHPATH , $MYDEFEXTENSIONFILE , $MYDEFEXTENSIONFILENAME )
$MYINPATH = $SMYFILEOPENDIALOG1
ENDIF
LOCAL $IFILEEXISTS = FILEEXISTS ($MYINPATH )
IF $IFILEEXISTS = 0 THEN
MEMOWRITE (@CRLF & "---" & @CRLF & "Waitng for your command :)" & @CRLF & "---" )
ELSE
MYGLOBALPATTERNSEARCH ($MYINPATH , $APATHSPLITPEA , $APATHSPLITEAC , $APATHSPLITFRONTEND )
ENDIF
CASE $MYIBUTTONCLICKED = 12
IF FILEEXISTS ($MYINPATH ) = 0 THEN
$SMYFILEOPENDIALOG1 = ""
$MYDEFEXTENSIONFILENAME = "Adobe Media Encoder*.exe"
$MYDEFEXTENSIONFILE = "(" & $MYDEFEXTENSIONFILENAME & ")"
MYFILEOPENDIALOG ($SMYDEFAULTSEARCHPATH , $MYDEFEXTENSIONFILE , $MYDEFEXTENSIONFILENAME )
$MYINPATH = $SMYFILEOPENDIALOG1
ENDIF
LOCAL $IFILEEXISTS = FILEEXISTS ($MYINPATH )
IF $IFILEEXISTS = 0 THEN
MEMOWRITE (@CRLF & "---" & @CRLF & "Waitng for your command :)" & @CRLF & "---" )
ELSE
LOCAL $SDRIVE = "" , $SDIR = "" , $SFILENAME = "" , $SEXTENSION = "" , $APATHSPLIT = ""
LOCAL $IPATH = $MYINPATH
LOCAL $APATHSPLIT = _PATHSPLIT ($IPATH , $SDRIVE , $SDIR , $SFILENAME , $SEXTENSION )
$APATHSPLITPEA = $SDRIVE & $SDIR & "SweetPeaSupport.dll"
$APATHSPLITEAC = $SDRIVE & $SDIR & "EAClient.dll"
MYGLOBALPATTERNSEARCH ($MYINPATH , $APATHSPLITPEA , $APATHSPLITEAC , $APATHSPLITFRONTEND )
ENDIF
CASE $MYIBUTTONCLICKED = 13
IF FILEEXISTS ($MYINPATH ) = 0 THEN
$SMYFILEOPENDIALOG1 = ""
$MYDEFEXTENSIONFILENAME = "photoshop*.exe"
$MYDEFEXTENSIONFILE = "(" & $MYDEFEXTENSIONFILENAME & ")"
MYFILEOPENDIALOG ($SMYDEFAULTSEARCHPATH , $MYDEFEXTENSIONFILE , $MYDEFEXTENSIONFILENAME )
$MYINPATH = $SMYFILEOPENDIALOG1
ENDIF
LOCAL $IFILEEXISTS = FILEEXISTS ($MYINPATH )
IF $IFILEEXISTS = 0 THEN
MEMOWRITE (@CRLF & "---" & @CRLF & "Waitng for your command :)" & @CRLF & "---" )
ELSE
MYGLOBALPATTERNSEARCH ($MYINPATH , $APATHSPLITPEA , $APATHSPLITEAC , $APATHSPLITFRONTEND )
ENDIF
CASE $MYIBUTTONCLICKED = 14
IF FILEEXISTS ($MYINPATH ) = 0 THEN
$SMYFILEOPENDIALOG1 = ""
$MYDEFEXTENSIONFILENAME = "registration*.dll"
$MYDEFEXTENSIONFILE = "(" & $MYDEFEXTENSIONFILENAME & ")"
MYFILEOPENDIALOG ($SMYDEFAULTSEARCHPATH , $MYDEFEXTENSIONFILE , $MYDEFEXTENSIONFILENAME )
$MYINPATH = $SMYFILEOPENDIALOG1
ENDIF
LOCAL $IFILEEXISTS = FILEEXISTS ($MYINPATH )
IF $IFILEEXISTS = 0 THEN
MEMOWRITE (@CRLF & "---" & @CRLF & "Waitng for your command :)" & @CRLF & "---" )
ELSE
LOCAL $SDRIVE = "" , $SDIR = "" , $SFILENAME = "" , $SEXTENSION = "" , $APATHSPLIT = ""
LOCAL $IPATH = $MYINPATH
LOCAL $APATHSPLIT = _PATHSPLIT ($IPATH , $SDRIVE , $SDIR , $SFILENAME , $SEXTENSION )
$APATHSPLITPEA = $SDRIVE & $SDIR & "SweetPeaSupport.dll"
$APATHSPLITEAC = $SDRIVE & $SDIR & "EAClient.dll"
MYGLOBALPATTERNSEARCH ($MYINPATH , $APATHSPLITPEA , $APATHSPLITEAC , $APATHSPLITFRONTEND )
ENDIF
CASE $MYIBUTTONCLICKED = 15
IF FILEEXISTS ($MYINPATH ) = 0 THEN
$SMYFILEOPENDIALOG1 = ""
$MYDEFEXTENSIONFILENAME = "registration*.dll"
$MYDEFEXTENSIONFILE = "(" & $MYDEFEXTENSIONFILENAME & ")"
MYFILEOPENDIALOG ($SMYDEFAULTSEARCHPATH , $MYDEFEXTENSIONFILE , $MYDEFEXTENSIONFILENAME )
$MYINPATH = $SMYFILEOPENDIALOG1
ENDIF
LOCAL $IFILEEXISTS = FILEEXISTS ($MYINPATH )
IF $IFILEEXISTS = 0 THEN
MEMOWRITE (@CRLF & "---" & @CRLF & "Waitng for your command :)" & @CRLF & "---" )
ELSE
LOCAL $SDRIVE = "" , $SDIR = "" , $SFILENAME = "" , $SEXTENSION = "" , $APATHSPLIT = ""
LOCAL $IPATH = $MYINPATH
LOCAL $APATHSPLIT = _PATHSPLIT ($IPATH , $SDRIVE , $SDIR , $SFILENAME , $SEXTENSION )
$APATHSPLITPEA = $SDRIVE & $SDIR & "SweetPeaSupport.dll"
$APATHSPLITEAC = $SDRIVE & $SDIR & "EAClient.dll"
MYGLOBALPATTERNSEARCH ($MYINPATH , $APATHSPLITPEA , $APATHSPLITEAC , $APATHSPLITFRONTEND )
ENDIF
CASE $MYIBUTTONCLICKED = 16
IF FILEEXISTS ($MYINPATH ) = 0 THEN
$SMYFILEOPENDIALOG1 = ""
$MYDEFEXTENSIONFILENAME = "registration*.dll"
$MYDEFEXTENSIONFILE = "(" & $MYDEFEXTENSIONFILENAME & ")"
MYFILEOPENDIALOG ($SMYDEFAULTSEARCHPATH , $MYDEFEXTENSIONFILE , $MYDEFEXTENSIONFILENAME )
$MYINPATH = $SMYFILEOPENDIALOG1
ENDIF
LOCAL $IFILEEXISTS = FILEEXISTS ($MYINPATH )
IF $IFILEEXISTS = 0 THEN
MEMOWRITE (@CRLF & "---" & @CRLF & "Waitng for your command :)" & @CRLF & "---" )
ELSE
LOCAL $SDRIVE = "" , $SDIR = "" , $SFILENAME = "" , $SEXTENSION = "" , $APATHSPLIT = ""
LOCAL $IPATH = $MYINPATH
LOCAL $APATHSPLIT = _PATHSPLIT ($IPATH , $SDRIVE , $SDIR , $SFILENAME , $SEXTENSION )
$APATHSPLITPEA = $SDRIVE & $SDIR & "SweetPeaSupport.dll"
$APATHSPLITEAC = $SDRIVE & $SDIR & "EAClient.dll"
MYGLOBALPATTERNSEARCH ($MYINPATH , $APATHSPLITPEA , $APATHSPLITEAC , $APATHSPLITFRONTEND )
ENDIF
CASE $MYIBUTTONCLICKED = 17
IF FILEEXISTS ($MYINPATH ) = 0 THEN
$SMYFILEOPENDIALOG1 = ""
$MYDEFEXTENSIONFILENAME = "Acrobat*.dll"
$MYDEFEXTENSIONFILE = "(" & $MYDEFEXTENSIONFILENAME & ")"
MYFILEOPENDIALOG ($SMYDEFAULTSEARCHPATH , $MYDEFEXTENSIONFILE , $MYDEFEXTENSIONFILENAME )
$MYINPATH = $SMYFILEOPENDIALOG1
ENDIF
LOCAL $IFILEEXISTS = FILEEXISTS ($MYINPATH )
IF $IFILEEXISTS = 0 THEN
MEMOWRITE (@CRLF & "---" & @CRLF & "Waitng for your command :)" & @CRLF & "---" )
ELSE
LOCAL $SDRIVE = "" , $SDIR = "" , $SFILENAME = "" , $SEXTENSION = "" , $APATHSPLIT = ""
LOCAL $IPATH = $MYINPATH
LOCAL $APATHSPLIT = _PATHSPLIT ($IPATH , $SDRIVE , $SDIR , $SFILENAME , $SEXTENSION )
$APATHSPLITACRODIST = $SDRIVE & $SDIR & "acrodistdll.dll"
$APATHSPLITACROTRAY = $SDRIVE & $SDIR & "acrotray.exe"
$APATHSPLITFRONTEND = $SDRIVE & $SDIR & "amtlib.dll"
MYGLOBALPATTERNSEARCH ($MYINPATH , $APATHSPLITACRODIST , $APATHSPLITACROTRAY , $APATHSPLITFRONTEND )
ENDIF
CASE $MYIBUTTONCLICKED = 18
IF FILEEXISTS ($MYINPATH ) = 0 THEN
$SMYFILEOPENDIALOG1 = ""
$MYDEFEXTENSIONFILENAME = "euclid-core-plugin*.pepper"
$MYDEFEXTENSIONFILE = "(" & $MYDEFEXTENSIONFILENAME & ")"
MYFILEOPENDIALOG ($SMYDEFAULTSEARCHPATH , $MYDEFEXTENSIONFILE , $MYDEFEXTENSIONFILENAME )
$MYINPATH = $SMYFILEOPENDIALOG1
ENDIF
LOCAL $IFILEEXISTS = FILEEXISTS ($MYINPATH )
IF $IFILEEXISTS = 0 THEN
MEMOWRITE (@CRLF & "---" & @CRLF & "Waitng for your command :)" & @CRLF & "---" )
ELSE
LOCAL $SDRIVE = "" , $SDIR = "" , $SFILENAME = "" , $SEXTENSION = "" , $APATHSPLIT = ""
LOCAL $IPATH = $MYINPATH
LOCAL $APATHSPLIT = _PATHSPLIT ($IPATH , $SDRIVE , $SDIR , $SFILENAME , $SEXTENSION )
$APATHSPLITPEA = $SDRIVE & $SDIR & "SweetPeaSupport.dll"
$APATHSPLITEAC = $SDRIVE & $SDIR & "EAClient.dll"
MYGLOBALPATTERNSEARCH ($MYINPATH , $APATHSPLITPEA , $APATHSPLITEAC , $APATHSPLITFRONTEND )
ENDIF
CASE $MYIBUTTONCLICKED = 19
IF FILEEXISTS ($MYINPATH ) = 0 THEN
$SMYDEFAULTSEARCHPATH = ""
$SMYDEFAULTSEARCHPATH = "C:\Program Files\WindowsApps"
$SMYFILEOPENDIALOG1 = ""
$MYDEFEXTENSIONFILENAME = "XD*.exe"
$MYDEFEXTENSIONFILE = "(" & $MYDEFEXTENSIONFILENAME & ")"
MYFILEOPENDIALOG ($SMYDEFAULTSEARCHPATH , $MYDEFEXTENSIONFILE , $MYDEFEXTENSIONFILENAME )
$MYINPATH = $SMYFILEOPENDIALOG1
$SMYDEFAULTSEARCHPATH = ""
$SMYDEFAULTSEARCHPATH = "C:\Program Files\Adobe"
ENDIF
LOCAL $IFILEEXISTS = FILEEXISTS ($MYINPATH )
IF $IFILEEXISTS = 0 THEN
MEMOWRITE (@CRLF & "---" & @CRLF & "Waitng for your command :)" & @CRLF & "---" )
ELSE
MYGLOBALPATTERNSEARCH ($MYINPATH , $APATHSPLITPEA , $APATHSPLITEAC , $APATHSPLITFRONTEND )
ENDIF
CASE $MYIBUTTONCLICKED = 20
IF FILEEXISTS ($MYINPATH ) = 0 THEN
$SMYDEFAULTSEARCHPATH = ""
$SMYDEFAULTSEARCHPATH = "C:\Program Files\WindowsApps"
$SMYFILEOPENDIALOG1 = ""
$MYDEFEXTENSIONFILENAME = "ngl-lib*.dll"
$MYDEFEXTENSIONFILE = "(" & $MYDEFEXTENSIONFILENAME & ")"
MYFILEOPENDIALOG ($SMYDEFAULTSEARCHPATH , $MYDEFEXTENSIONFILE , $MYDEFEXTENSIONFILENAME )
$MYINPATH = $SMYFILEOPENDIALOG1
$SMYDEFAULTSEARCHPATH = ""
$SMYDEFAULTSEARCHPATH = "C:\Program Files\Adobe"
ENDIF
LOCAL $IFILEEXISTS = FILEEXISTS ($MYINPATH )
IF $IFILEEXISTS = 0 THEN
MEMOWRITE (@CRLF & "---" & @CRLF & "Waitng for your command :)" & @CRLF & "---" )
ELSE
MYGLOBALPATTERNSEARCH ($MYINPATH , $APATHSPLITPEA , $APATHSPLITEAC , $APATHSPLITFRONTEND )
ENDIF
CASE $MYIBUTTONCLICKED = 21
IF FILEEXISTS ($MYINPATH ) = 0 THEN
$SMYFILEOPENDIALOG1 = ""
$MYDEFEXTENSIONFILENAME = "amtlib.dll"
$MYDEFEXTENSIONFILE = "(" & $MYDEFEXTENSIONFILENAME & ")"
MYFILEOPENDIALOG ($SMYDEFAULTSEARCHPATH , $MYDEFEXTENSIONFILE , $MYDEFEXTENSIONFILENAME )
$MYINPATH = $SMYFILEOPENDIALOG1
ENDIF
LOCAL $IFILEEXISTS = FILEEXISTS ($MYINPATH )
IF $IFILEEXISTS = 0 THEN
MEMOWRITE (@CRLF & "---" & @CRLF & "Waitng for your command :)" & @CRLF & "---" )
ELSE
MYGLOBALPATTERNSEARCH ($MYINPATH , $APATHSPLITPEA , $APATHSPLITEAC , $APATHSPLITFRONTEND )
ENDIF
CASE $MYIBUTTONCLICKED = 22
IF FILEEXISTS ($MYINPATH ) = 0 THEN
$SMYFILEOPENDIALOG1 = ""
$MYDEFEXTENSIONFILENAME = "amtlib.dll"
$MYDEFEXTENSIONFILE = "(" & $MYDEFEXTENSIONFILENAME & ")"
MYFILEOPENDIALOG ($SMYDEFAULTSEARCHPATH , $MYDEFEXTENSIONFILE , $MYDEFEXTENSIONFILENAME )
$MYINPATH = $SMYFILEOPENDIALOG1
ENDIF
LOCAL $IFILEEXISTS = FILEEXISTS ($MYINPATH )
IF $IFILEEXISTS = 0 THEN
MEMOWRITE (@CRLF & "---" & @CRLF & "Waitng for your command :)" & @CRLF & "---" )
ELSE
MYGLOBALPATTERNSEARCH ($MYINPATH , $APATHSPLITPEA , $APATHSPLITEAC , $APATHSPLITFRONTEND )
ENDIF
CASE $MYIBUTTONCLICKED = 23
MEMOWRITE (@CRLF & "---" & @CRLF & "Waitng for your command :)" & @CRLF & "---" )
CASE $MYIBUTTONCLICKED = 24
IF FILEEXISTS ($MYINPATH ) = 0 THEN
$SMYFILEOPENDIALOG1 = ""
$SMYDEFAULTSEARCHPATH = "C:\Program Files (x86)\Adobe\Adobe Creative Cloud\AppsPanel"
$MYDEFEXTENSIONFILENAME = "AppsPanelBL.dll"
$MYDEFEXTENSIONFILE = "(" & $MYDEFEXTENSIONFILENAME & ")"
MYFILEOPENDIALOG ($SMYDEFAULTSEARCHPATH , $MYDEFEXTENSIONFILE , $MYDEFEXTENSIONFILENAME )
$MYINPATH = $SMYFILEOPENDIALOG1
ENDIF
LOCAL $IFILEEXISTS = FILEEXISTS ($MYINPATH )
IF $IFILEEXISTS = 0 THEN
MEMOWRITE (@CRLF & "---" & @CRLF & "Waitng for your command :)" & @CRLF & "---" )
ELSE
LOCAL $SPIDHANDLE = PROCESSEXISTS ("Adobe Desktop Service.exe" )
$SPIDHANDLE = _WINAPI_OPENPROCESS (1 , 0 , $SPIDHANDLE )
DLLCALL ("kernel32.dll" , "int" , "TerminateProcess" , "int" , $SPIDHANDLE , "int" , 1 )
$SPIDHANDLE = PROCESSEXISTS ("Creative Cloud.exe" )
$SPIDHANDLE = _WINAPI_OPENPROCESS (1 , 0 , $SPIDHANDLE )
DLLCALL ("kernel32.dll" , "int" , "TerminateProcess" , "int" , $SPIDHANDLE , "int" , 1 )
MYGLOBALPATTERNSEARCH ($MYINPATH , $APATHSPLITPEA , $APATHSPLITEAC , $APATHSPLITFRONTEND )
ENDIF
ENDSELECT
ELSE
$MYIBUTTONCLICKED = 0
$MYINPATH = ""
ENDIF
IF $A_IDCHKSTATE [$X ] = 1 THEN
WINWAITCLOSE ("GenPPP-2.7" , "" )
ELSE
ENDIF
GUICTRLSETSTATE ($A_IDCHK [$X ] , 4 )
NEXT
FOR $X = 0 TO 23
GUICTRLSETSTATE ($A_IDCHK [$X ] , 64 )
NEXT
GUICTRLSETDATA ($MYOWNIDPROGRESS , 0 )
GUICTRLSETSTATE ($IDBUTTON_PATH2019 , 64 )
GUICTRLSETSTATE ($IDBUTTON_PATH2020 , 64 )
GUICTRLSETSTATE ($IDBUTTON_PATH2021 , 64 )
GUICTRLSETSTATE ($IDBUTTON_PATH2022 , 64 )
GUICTRLSETSTATE ($G_IDDESELECTALL , 64 )
GUICTRLSETSTATE ($IDBTNCURE , 64 )
$A_IDPATH = $A_IDPATHNULL
FILLARRAYPATHNULL ()
FOR $X = 0 TO 23
GUICTRLSETSTATE ($A_IDCHK [$X ] , 4 )
_ARRAYADD ($A_IDPATH , "" )
NEXT
_DISABLEPROBLEMATICAPPS ()
$MYIBUTTONCLICKED = 0
MEMOWRITE (@CRLF & "---" & @CRLF & "Manual mode - custom path" & @CRLF & "---" )
ENDSELECT
WEND
FUNC MAINGUI ()
$MYHGUI = GUICREATE ("Adobe-GenP-2.7" , 540 , 600 , + 4294967295 , + 4294967295 , BITOR ($WS_CAPTION , $WS_MINIMIZEBOX , $WS_EX_APPWINDOW , $DS_SETFOREGROUND ) )
LOCAL $STYLE = _WINAPI_GETWINDOWLONG ($MYHGUI , $GWL_STYLE )
IF BITAND ($STYLE , BITOR ($WS_SIZEBOX , $WS_MAXIMIZEBOX ) ) THEN
_WINAPI_SETWINDOWLONG ($MYHGUI , $GWL_STYLE , BITXOR ($STYLE , $WS_SIZEBOX ) )
ENDIF
GUISETSTATE (@SW_SHOW )
$Y = 80
FOR $X = 0 TO 7
$A_IDCHK [$X ] = GUICTRLCREATECHECKBOX ("" , 50 , $Y + 4294967236 , 120 , 25 )
GUICTRLCREATEPIC (".\ICONS\" & $X & ".jpg" , 20 , $Y + 4294967238 , 24 , 24 )
GUICTRLSETSTATE ($A_IDCHK [$X ] , 4 )
$Y += 40
NEXT
$Y = 80
FOR $X = 8 TO 15
$A_IDCHK [$X ] = GUICTRLCREATECHECKBOX ("" , 230 , $Y + 4294967236 , 120 , 25 )
GUICTRLCREATEPIC (".\ICONS\" & $X & ".jpg" , 200 , $Y + 4294967238 , 24 , 24 )
GUICTRLSETSTATE ($A_IDCHK [$X ] , 4 )
$Y += 40
NEXT
$Y = 80
FOR $X = 16 TO 23
$A_IDCHK [$X ] = GUICTRLCREATECHECKBOX ("" , 410 , $Y + 4294967236 , 120 , 25 )
GUICTRLCREATEPIC (".\ICONS\" & $X & ".jpg" , 380 , $Y + 4294967238 , 24 , 24 )
GUICTRLSETSTATE ($A_IDCHK [$X ] , 4 )
$Y += 40
NEXT
_DISABLEPROBLEMATICAPPS ()
$IDBUTTON_PATH2019 = GUICTRLCREATEBUTTON ("CC2019" , 30 , 380 , 80 , 20 )
GUICTRLSETTIP (+ 4294967295 , "Let GenP find CC2019 Apps automatically in def location" )
$IDBUTTON_PATH2020 = GUICTRLCREATEBUTTON ("CC2020" , 130 , 380 , 80 , 20 )
GUICTRLSETTIP (+ 4294967295 , "Let GenP find CC2020 Apps automatically in def location" )
$G_IDDESELECTALL = GUICTRLCREATEBUTTON ("" , 230 , 380 , 80 , 20 )
GUICTRLSETDATA ($G_IDDESELECTALL , "Reset Paths" )
GUICTRLSETTIP (+ 4294967295 , "Reset ALL paths - Manual mode" )
$IDBUTTON_PATH2021 = GUICTRLCREATEBUTTON ("CC2021" , 330 , 380 , 80 , 20 )
GUICTRLSETTIP (+ 4294967295 , "Let GenP find CC2021 Apps automatically in def location" )
$IDBUTTON_PATH2022 = GUICTRLCREATEBUTTON ("CC2022" , 430 , 380 , 80 , 20 )
GUICTRLSETTIP (+ 4294967295 , "Let GenP find CC2022 Apps automatically in def location" )
$MYOWNIDPROGRESS = GUICTRLCREATEPROGRESS (170 , 350 , 200 , 10 , $PBS_SMOOTHREVERSE )
$G_IDMEMO = GUICTRLCREATEEDIT ("" , 20 , 420 , 500 , 80 , BITOR ($ES_READONLY , $ES_CENTER , $WS_DISABLED ) )
MEMOWRITE (@CRLF & "---" & @CRLF & "Manual mode - custom path" & @CRLF & "---" )
$IDBTNCURE = GUICTRLCREATEBUTTON ("" , 240 , 520 , 56 , 56 , $BS_BITMAP )
_GUICTRLBUTTON_SETIMAGE ($IDBTNCURE , ".\ICONS\Cure.bmp" )
GUICTRLSETTIP (+ 4294967295 , "Cure" )
GUICTRLSETDATA ($A_IDCHK [0 ] , "1. After Effects" )
GUICTRLSETDATA ($A_IDCHK [1 ] , "2. Animate" )
GUICTRLSETDATA ($A_IDCHK [2 ] , "3. Audition" )
GUICTRLSETDATA ($A_IDCHK [3 ] , "4. Bridge" )
GUICTRLSETDATA ($A_IDCHK [4 ] , "5. Character Animator" )
GUICTRLSETDATA ($A_IDCHK [5 ] , "6. Dreamweaver" )
GUICTRLSETDATA ($A_IDCHK [6 ] , "7. Illustrator" )
GUICTRLSETDATA ($A_IDCHK [7 ] , "8. InCopy" )
GUICTRLSETDATA ($A_IDCHK [8 ] , "9. InDesign" )
GUICTRLSETDATA ($A_IDCHK [9 ] , "10. Lightroom" )
GUICTRLSETDATA ($A_IDCHK [10 ] , "11. Lightroom Classic" )
GUICTRLSETDATA ($A_IDCHK [11 ] , "12. Media Encoder" )
GUICTRLSETDATA ($A_IDCHK [12 ] , "13. Photoshop" )
GUICTRLSETDATA ($A_IDCHK [13 ] , "14. Prelude" )
GUICTRLSETDATA ($A_IDCHK [14 ] , "15. Premiere Pro" )
GUICTRLSETDATA ($A_IDCHK [15 ] , "16. Premiere Rush" )
GUICTRLSETDATA ($A_IDCHK [16 ] , "17. Acrobat" )
GUICTRLSETDATA ($A_IDCHK [17 ] , "18. Dimension" )
GUICTRLSETDATA ($A_IDCHK [18 ] , "19. XD" )
GUICTRLSETDATA ($A_IDCHK [19 ] , "20. Fresco" )
GUICTRLSETDATA ($A_IDCHK [20 ] , "21. Flash Builder" )
GUICTRLSETDATA ($A_IDCHK [21 ] , "22. Speed Grade" )
GUICTRLSETDATA ($A_IDCHK [22 ] , "-----------------------" )
GUICTRLSETSTATE ($A_IDCHK [22 ] , 160 )
GUICTRLSETDATA ($A_IDCHK [23 ] , "24. Creative Cloud" )
ENDFUNC
FUNC FILLARRAYPATHNULL ()
ENDFUNC
FUNC FILLARRAYPATH2019 ()
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe After Effects CC 2019\Support Files\AfterFXLib.dll" )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe Animate CC 2019\Animate.exe" )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe Audition CC 2019\auui.dll" )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe Bridge CC 2019\bridge.exe" )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe Character Animator CC 2019\Support Files\character animator.exe" )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe Dreamweaver CC 2019\dreamweaver.exe" )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe Illustrator CC 2019\Support Files\Contents\Windows\illustrator.exe" )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe InCopy CC 2019\public.dll" )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe InDesign CC 2019\public.dll" )
LOCAL $SFILENAMETEMPLR = FILEFINDNEXTFILE (FILEFINDFIRSTFILE ($MYDEFPATH & "\Adobe Lightroom CC\lightroomcc.exe" ) )
$SFILENAMETEMPLR = $MYDEFPATH & "\Adobe Lightroom CC\lightroomcc.exe"
IF FILEEXISTS ($SFILENAMETEMPLR ) = 1 THEN
$SFILENAMETEMPLR = $MYDEFPATH & "\Adobe Lightroom CC\lightroomcc.exe"
ELSE
$SFILENAMETEMPLR = FILEFINDNEXTFILE (FILEFINDFIRSTFILE ($MYDEFPATH & "\Adobe Lightroom CC\lightroom.exe" ) )
$SFILENAMETEMPLR = $MYDEFPATH & "\Adobe Lightroom CC\lightroom.exe"
ENDIF
_ARRAYADD ($A_IDPATH , $SFILENAMETEMPLR )
LOCAL $SFILENAMETEMPLRCC = FILEFINDNEXTFILE (FILEFINDFIRSTFILE ($MYDEFPATH & "\Adobe Lightroom Classic CC\lightroom.exe" ) )
$SFILENAMETEMPLRCC = $MYDEFPATH & "\Adobe Lightroom Classic CC\lightroom.exe"
IF FILEEXISTS ($SFILENAMETEMPLRCC ) = 1 THEN
$SFILENAMETEMPLRCC = $MYDEFPATH & "\Adobe Lightroom Classic CC\lightroom.exe"
ELSE
$SFILENAMETEMPLRCC = FILEFINDNEXTFILE (FILEFINDFIRSTFILE ($MYDEFPATH & "\Adobe Lightroom Classic\lightroom.exe" ) )
$SFILENAMETEMPLRCC = $MYDEFPATH & "\Adobe Lightroom Classic\lightroom.exe"
ENDIF
_ARRAYADD ($A_IDPATH , $SFILENAMETEMPLRCC )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe Media Encoder CC 2019\Adobe Media Encoder.exe" )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe Photoshop CC 2019\photoshop.exe" )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe Prelude CC 2019\registration.dll" )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe Premiere Pro CC 2019\registration.dll" )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe Premiere Rush CC\registration.dll" )
_ARRAYADD ($A_IDPATH , "C:\Program Files (x86)\Adobe\Acrobat DC\Acrobat\Acrobat.dll" )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe Dimension CC\euclid-core-plugin.pepper" )
LOCAL $SFILENAMETEMPXD = FILEFINDNEXTFILE (FILEFINDFIRSTFILE ("C:\Program Files\WindowsApps\Adobe.CC.XD*" ) )
LOCAL $MYINPATHTEMPXD0 = "C:\Program Files\WindowsApps\" & $SFILENAMETEMPXD & "\XD*.exe"
LOCAL $SFILENAMETEMPXD1 = FILEFINDNEXTFILE (FILEFINDFIRSTFILE ($MYINPATHTEMPXD0 ) )
IF $SFILENAMETEMPXD1 = "" THEN
_ARRAYADD ($A_IDPATH , "" )
ELSE
LOCAL $SFILENAMETEMPXD2 = "C:\Program Files\WindowsApps\" & $SFILENAMETEMPXD & "\" & $SFILENAMETEMPXD1
_ARRAYADD ($A_IDPATH , $SFILENAMETEMPXD2 )
ENDIF
LOCAL $SFILENAMETEMPFR = FILEFINDNEXTFILE (FILEFINDFIRSTFILE ("C:\Program Files\WindowsApps\Adobe.Fresco*" ) )
LOCAL $MYINPATHTEMPFR0 = "C:\Program Files\WindowsApps\" & $SFILENAMETEMPFR & "\ngl-lib.dll"
LOCAL $SFILENAMETEMPFR1 = FILEFINDNEXTFILE (FILEFINDFIRSTFILE ($MYINPATHTEMPFR0 ) )
IF $SFILENAMETEMPFR1 = "" THEN
_ARRAYADD ($A_IDPATH , "" )
ELSE
LOCAL $SFILENAMETEMPFR2 = "C:\Program Files\WindowsApps\" & $SFILENAMETEMPFR & "\" & $SFILENAMETEMPFR1
_ARRAYADD ($A_IDPATH , $SFILENAMETEMPFR2 )
ENDIF
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe Flash Builder 4.7 (64 Bit)\eclipse\plugins\com.adobe.flexide.amt_4.7.0.349722\os\win32\x86_64\amtlib.dll" )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe SpeedGrade CC 2015\amtlib.dll" )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "" )
_ARRAYADD ($A_IDPATH , "C:\Program Files (x86)\Adobe\Adobe Creative Cloud\AppsPanel\AppsPanelBL.dll" )
ENDFUNC
FUNC FILLARRAYPATH2020 ()
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe After Effects 2020\Support Files\AfterFXLib.dll" )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe Animate 2020\Animate.exe" )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe Audition 2020\auui.dll" )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe Bridge 2020\bridge.exe" )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe Character Animator 2020\Support Files\character animator.exe" )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe Dreamweaver 2020\dreamweaver.exe" )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe Illustrator 2020\Support Files\Contents\Windows\illustrator.exe" )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe InCopy 2020\public.dll" )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe InDesign 2020\public.dll" )
LOCAL $SFILENAMETEMPLR = FILEFINDNEXTFILE (FILEFINDFIRSTFILE ($MYDEFPATH & "\Adobe Lightroom CC\lightroomcc.exe" ) )
$SFILENAMETEMPLR = $MYDEFPATH & "\Adobe Lightroom CC\lightroomcc.exe"
IF FILEEXISTS ($SFILENAMETEMPLR ) = 1 THEN
$SFILENAMETEMPLR = $MYDEFPATH & "\Adobe Lightroom CC\lightroomcc.exe"
ELSE
$SFILENAMETEMPLR = FILEFINDNEXTFILE (FILEFINDFIRSTFILE ($MYDEFPATH & "\Adobe Lightroom CC\lightroom.exe" ) )
$SFILENAMETEMPLR = $MYDEFPATH & "\Adobe Lightroom CC\lightroom.exe"
ENDIF
_ARRAYADD ($A_IDPATH , $SFILENAMETEMPLR )
LOCAL $SFILENAMETEMPLRCC = FILEFINDNEXTFILE (FILEFINDFIRSTFILE ($MYDEFPATH & "\Adobe Lightroom Classic CC\lightroom.exe" ) )
$SFILENAMETEMPLRCC = $MYDEFPATH & "\Adobe Lightroom Classic CC\lightroom.exe"
IF FILEEXISTS ($SFILENAMETEMPLRCC ) = 1 THEN
$SFILENAMETEMPLRCC = $MYDEFPATH & "\Adobe Lightroom Classic CC\lightroom.exe"
ELSE
$SFILENAMETEMPLRCC = FILEFINDNEXTFILE (FILEFINDFIRSTFILE ($MYDEFPATH & "\Adobe Lightroom Classic\lightroom.exe" ) )
$SFILENAMETEMPLRCC = $MYDEFPATH & "\Adobe Lightroom Classic\lightroom.exe"
ENDIF
_ARRAYADD ($A_IDPATH , $SFILENAMETEMPLRCC )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe Media Encoder 2020\Adobe Media Encoder.exe" )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe Photoshop 2020\photoshop.exe" )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe Prelude 2020\registration.dll" )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe Premiere Pro 2020\registration.dll" )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe Premiere Rush\registration.dll" )
_ARRAYADD ($A_IDPATH , "C:\Program Files (x86)\Adobe\Acrobat DC\Acrobat\Acrobat.dll" )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe Dimension\euclid-core-plugin.pepper" )
LOCAL $SFILENAMETEMPXD = FILEFINDNEXTFILE (FILEFINDFIRSTFILE ("C:\Program Files\WindowsApps\Adobe.CC.XD*" ) )
LOCAL $MYINPATHTEMPXD0 = "C:\Program Files\WindowsApps\" & $SFILENAMETEMPXD & "\XD*.exe"
LOCAL $SFILENAMETEMPXD1 = FILEFINDNEXTFILE (FILEFINDFIRSTFILE ($MYINPATHTEMPXD0 ) )
IF $SFILENAMETEMPXD1 = "" THEN
_ARRAYADD ($A_IDPATH , "" )
ELSE
LOCAL $SFILENAMETEMPXD2 = "C:\Program Files\WindowsApps\" & $SFILENAMETEMPXD & "\" & $SFILENAMETEMPXD1
_ARRAYADD ($A_IDPATH , $SFILENAMETEMPXD2 )
ENDIF
LOCAL $SFILENAMETEMPFR = FILEFINDNEXTFILE (FILEFINDFIRSTFILE ("C:\Program Files\WindowsApps\Adobe.Fresco*" ) )
LOCAL $MYINPATHTEMPFR0 = "C:\Program Files\WindowsApps\" & $SFILENAMETEMPFR & "\ngl-lib.dll"
LOCAL $SFILENAMETEMPFR1 = FILEFINDNEXTFILE (FILEFINDFIRSTFILE ($MYINPATHTEMPFR0 ) )
IF $SFILENAMETEMPFR1 = "" THEN
_ARRAYADD ($A_IDPATH , "" )
ELSE
LOCAL $SFILENAMETEMPFR2 = "C:\Program Files\WindowsApps\" & $SFILENAMETEMPFR & "\" & $SFILENAMETEMPFR1
_ARRAYADD ($A_IDPATH , $SFILENAMETEMPFR2 )
ENDIF
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe Flash Builder 4.7 (64 Bit)\eclipse\plugins\com.adobe.flexide.amt_4.7.0.349722\os\win32\x86_64\amtlib.dll" )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe SpeedGrade CC 2015\amtlib.dll" )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "" )
_ARRAYADD ($A_IDPATH , "C:\Program Files (x86)\Common Files\Adobe\Adobe Desktop Common\AppsPanel\AppsPanelBL.dll" )
ENDFUNC
FUNC FILLARRAYPATH2021 ()
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe After Effects 2021\Support Files\AfterFXLib.dll" )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe Animate 2021\Animate.exe" )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe Audition 2021\auui.dll" )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe Bridge 2021\bridge.exe" )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe Character Animator 2021\Support Files\character animator.exe" )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe Dreamweaver 2021\dreamweaver.exe" )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe Illustrator 2021\Support Files\Contents\Windows\illustrator.exe" )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe InCopy 2021\public.dll" )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe InDesign 2021\public.dll" )
LOCAL $SFILENAMETEMPLR = FILEFINDNEXTFILE (FILEFINDFIRSTFILE ($MYDEFPATH & "\Adobe Lightroom CC\lightroomcc.exe" ) )
$SFILENAMETEMPLR = $MYDEFPATH & "\Adobe Lightroom CC\lightroomcc.exe"
IF FILEEXISTS ($SFILENAMETEMPLR ) = 1 THEN
$SFILENAMETEMPLR = $MYDEFPATH & "\Adobe Lightroom CC\lightroomcc.exe"
ELSE
$SFILENAMETEMPLR = FILEFINDNEXTFILE (FILEFINDFIRSTFILE ($MYDEFPATH & "\Adobe Lightroom CC\lightroom.exe" ) )
$SFILENAMETEMPLR = $MYDEFPATH & "\Adobe Lightroom CC\lightroom.exe"
ENDIF
_ARRAYADD ($A_IDPATH , $SFILENAMETEMPLR )
LOCAL $SFILENAMETEMPLRCC = FILEFINDNEXTFILE (FILEFINDFIRSTFILE ($MYDEFPATH & "\Adobe Lightroom Classic CC\lightroom.exe" ) )
$SFILENAMETEMPLRCC = $MYDEFPATH & "\Adobe Lightroom Classic CC\lightroom.exe"
IF FILEEXISTS ($SFILENAMETEMPLRCC ) = 1 THEN
$SFILENAMETEMPLRCC = $MYDEFPATH & "\Adobe Lightroom Classic CC\lightroom.exe"
ELSE
$SFILENAMETEMPLRCC = FILEFINDNEXTFILE (FILEFINDFIRSTFILE ($MYDEFPATH & "\Adobe Lightroom Classic\lightroom.exe" ) )
$SFILENAMETEMPLRCC = $MYDEFPATH & "\Adobe Lightroom Classic\lightroom.exe"
ENDIF
_ARRAYADD ($A_IDPATH , $SFILENAMETEMPLRCC )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe Media Encoder 2021\Adobe Media Encoder.exe" )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe Photoshop 2021\photoshop.exe" )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe Prelude 2021\registration.dll" )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe Premiere Pro 2021\registration.dll" )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe Premiere Rush\registration.dll" )
_ARRAYADD ($A_IDPATH , "C:\Program Files (x86)\Adobe\Acrobat DC\Acrobat\Acrobat.dll" )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe Dimension\euclid-core-plugin.pepper" )
LOCAL $SFILENAMETEMPXD = FILEFINDNEXTFILE (FILEFINDFIRSTFILE ("C:\Program Files\WindowsApps\Adobe.CC.XD*" ) )
LOCAL $MYINPATHTEMPXD0 = "C:\Program Files\WindowsApps\" & $SFILENAMETEMPXD & "\XD*.exe"
LOCAL $SFILENAMETEMPXD1 = FILEFINDNEXTFILE (FILEFINDFIRSTFILE ($MYINPATHTEMPXD0 ) )
IF $SFILENAMETEMPXD1 = "" THEN
_ARRAYADD ($A_IDPATH , "" )
ELSE
LOCAL $SFILENAMETEMPXD2 = "C:\Program Files\WindowsApps\" & $SFILENAMETEMPXD & "\" & $SFILENAMETEMPXD1
_ARRAYADD ($A_IDPATH , $SFILENAMETEMPXD2 )
ENDIF
LOCAL $SFILENAMETEMPFR = FILEFINDNEXTFILE (FILEFINDFIRSTFILE ("C:\Program Files\WindowsApps\Adobe.Fresco*" ) )
LOCAL $MYINPATHTEMPFR0 = "C:\Program Files\WindowsApps\" & $SFILENAMETEMPFR & "\ngl-lib.dll"
LOCAL $SFILENAMETEMPFR1 = FILEFINDNEXTFILE (FILEFINDFIRSTFILE ($MYINPATHTEMPFR0 ) )
IF $SFILENAMETEMPFR1 = "" THEN
_ARRAYADD ($A_IDPATH , "" )
ELSE
LOCAL $SFILENAMETEMPFR2 = "C:\Program Files\WindowsApps\" & $SFILENAMETEMPFR & "\" & $SFILENAMETEMPFR1
_ARRAYADD ($A_IDPATH , $SFILENAMETEMPFR2 )
ENDIF
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe Flash Builder 4.7 (64 Bit)\eclipse\plugins\com.adobe.flexide.amt_4.7.0.349722\os\win32\x86_64\amtlib.dll" )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe SpeedGrade CC 2015\amtlib.dll" )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "" )
_ARRAYADD ($A_IDPATH , "C:\Program Files (x86)\Common Files\Adobe\Adobe Desktop Common\AppsPanel\AppsPanelBL.dll" )
ENDFUNC
FUNC FILLARRAYPATH2022 ()
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe After Effects 2022\Support Files\AfterFXLib.dll" )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe Animate 2022\Animate.exe" )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe Audition 2022\auui.dll" )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe Bridge 2022\bridge.exe" )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe Character Animator 2022\Support Files\character animator.exe" )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe Dreamweaver 2022\dreamweaver.exe" )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe Illustrator 2022\Support Files\Contents\Windows\illustrator.exe" )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe InCopy 2022\public.dll" )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe InDesign 2022\public.dll" )
LOCAL $SFILENAMETEMPLR = FILEFINDNEXTFILE (FILEFINDFIRSTFILE ($MYDEFPATH & "\Adobe Lightroom CC\lightroomcc.exe" ) )
$SFILENAMETEMPLR = $MYDEFPATH & "\Adobe Lightroom CC\lightroomcc.exe"
IF FILEEXISTS ($SFILENAMETEMPLR ) = 1 THEN
$SFILENAMETEMPLR = $MYDEFPATH & "\Adobe Lightroom CC\lightroomcc.exe"
ELSE
$SFILENAMETEMPLR = FILEFINDNEXTFILE (FILEFINDFIRSTFILE ($MYDEFPATH & "\Adobe Lightroom CC\lightroom.exe" ) )
$SFILENAMETEMPLR = $MYDEFPATH & "\Adobe Lightroom CC\lightroom.exe"
ENDIF
_ARRAYADD ($A_IDPATH , $SFILENAMETEMPLR )
LOCAL $SFILENAMETEMPLRCC = FILEFINDNEXTFILE (FILEFINDFIRSTFILE ($MYDEFPATH & "\Adobe Lightroom Classic CC\lightroom.exe" ) )
$SFILENAMETEMPLRCC = $MYDEFPATH & "\Adobe Lightroom Classic CC\lightroom.exe"
IF FILEEXISTS ($SFILENAMETEMPLRCC ) = 1 THEN
$SFILENAMETEMPLRCC = $MYDEFPATH & "\Adobe Lightroom Classic CC\lightroom.exe"
ELSE
$SFILENAMETEMPLRCC = FILEFINDNEXTFILE (FILEFINDFIRSTFILE ($MYDEFPATH & "\Adobe Lightroom Classic\lightroom.exe" ) )
$SFILENAMETEMPLRCC = $MYDEFPATH & "\Adobe Lightroom Classic\lightroom.exe"
ENDIF
_ARRAYADD ($A_IDPATH , $SFILENAMETEMPLRCC )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe Media Encoder 2022\Adobe Media Encoder.exe" )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe Photoshop 2022\photoshop.exe" )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe Prelude 2022\registration.dll" )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe Premiere Pro 2022\registration.dll" )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe Premiere Rush\registration.dll" )
_ARRAYADD ($A_IDPATH , "C:\Program Files (x86)\Adobe\Acrobat DC\Acrobat\Acrobat.dll" )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe Dimension\euclid-core-plugin.pepper" )
LOCAL $SFILENAMETEMPXD = FILEFINDNEXTFILE (FILEFINDFIRSTFILE ("C:\Program Files\WindowsApps\Adobe.CC.XD*" ) )
LOCAL $MYINPATHTEMPXD0 = "C:\Program Files\WindowsApps\" & $SFILENAMETEMPXD & "\XD*.exe"
LOCAL $SFILENAMETEMPXD1 = FILEFINDNEXTFILE (FILEFINDFIRSTFILE ($MYINPATHTEMPXD0 ) )
IF $SFILENAMETEMPXD1 = "" THEN
_ARRAYADD ($A_IDPATH , "" )
ELSE
LOCAL $SFILENAMETEMPXD2 = "C:\Program Files\WindowsApps\" & $SFILENAMETEMPXD & "\" & $SFILENAMETEMPXD1
_ARRAYADD ($A_IDPATH , $SFILENAMETEMPXD2 )
ENDIF
LOCAL $SFILENAMETEMPFR = FILEFINDNEXTFILE (FILEFINDFIRSTFILE ("C:\Program Files\WindowsApps\Adobe.Fresco*" ) )
LOCAL $MYINPATHTEMPFR0 = "C:\Program Files\WindowsApps\" & $SFILENAMETEMPFR & "\ngl-lib.dll"
LOCAL $SFILENAMETEMPFR1 = FILEFINDNEXTFILE (FILEFINDFIRSTFILE ($MYINPATHTEMPFR0 ) )
IF $SFILENAMETEMPFR1 = "" THEN
_ARRAYADD ($A_IDPATH , "" )
ELSE
LOCAL $SFILENAMETEMPFR2 = "C:\Program Files\WindowsApps\" & $SFILENAMETEMPFR & "\" & $SFILENAMETEMPFR1
_ARRAYADD ($A_IDPATH , $SFILENAMETEMPFR2 )
ENDIF
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe Flash Builder 4.7 (64 Bit)\eclipse\plugins\com.adobe.flexide.amt_4.7.0.349722\os\win32\x86_64\amtlib.dll" )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "\Adobe SpeedGrade CC 2015\amtlib.dll" )
_ARRAYADD ($A_IDPATH , $MYDEFPATH & "" )
_ARRAYADD ($A_IDPATH , "C:\Program Files (x86)\Common Files\Adobe\Adobe Desktop Common\AppsPanel\AppsPanelBL.dll" )
ENDFUNC
FUNC CHECKPATHES ()
FOR $X = 0 TO 23
IF FILEEXISTS ($A_IDPATH [$X ] ) THEN
GUICTRLSETSTATE ($A_IDCHK [$X ] , 1 )
ENDIF
NEXT
ENDFUNC
FUNC SELECTCUSTOMFOLDER2019 ()
FOR $X = 0 TO 23
GUICTRLSETSTATE ($A_IDCHK [$X ] , 4 )
NEXT
$A_IDPATH = $A_IDPATHNULL
FILLARRAYPATH2019 ()
CHECKPATHES ()
ENDFUNC
FUNC SELECTCUSTOMFOLDER2020 ()
FOR $X = 0 TO 23
GUICTRLSETSTATE ($A_IDCHK [$X ] , 4 )
NEXT
$A_IDPATH = $A_IDPATHNULL
FILLARRAYPATH2020 ()
CHECKPATHES ()
ENDFUNC
FUNC SELECTCUSTOMFOLDER2021 ()
FOR $X = 0 TO 23
GUICTRLSETSTATE ($A_IDCHK [$X ] , 4 )
NEXT
$A_IDPATH = $A_IDPATHNULL
FILLARRAYPATH2021 ()
CHECKPATHES ()
ENDFUNC
FUNC SELECTCUSTOMFOLDER2022 ()
FOR $X = 0 TO 23
GUICTRLSETSTATE ($A_IDCHK [$X ] , 4 )
NEXT
$A_IDPATH = $A_IDPATHNULL
FILLARRAYPATH2022 ()
CHECKPATHES ()
ENDFUNC
FUNC MYFILEOPENDIALOG ($MYDEFAULTPATH , $MYDEFAULTEXT , $MYDEFAULTNAME )
LOCAL CONST $SMESSAGE = "Select file to patch."
LOCAL $SMYFILEOPENDIALOG = FILEOPENDIALOG ($SMESSAGE , $MYDEFAULTPATH & "\" , $MYDEFAULTEXT , $FD_FILEMUSTEXIST , $MYDEFAULTNAME , $MYHGUI )
IF @ERROR THEN
FILECHANGEDIR (@SCRIPTDIR )
ELSE
FILECHANGEDIR (@WORKINGDIR )
$SMYFILEOPENDIALOG = STRINGREPLACE ($SMYFILEOPENDIALOG , "|" , @CRLF )
$SMYFILEOPENDIALOG1 = $SMYFILEOPENDIALOG
$SMYDEFAULTSEARCHPATH = @WORKINGDIR
ENDIF
ENDFUNC
FUNC MEMOWRITE ($SMESSAGE )
GUICTRLSETDATA ($G_IDMEMO , $SMESSAGE )
ENDFUNC
FUNC MYGLOBALPATTERNSEARCH ($MYFILETOPARSE , $MYFILETOPARSSWEATPEA , $MYFILETOPARSEEACLIENT , $MYFILETOPARSEFRONTEND )
MEMOWRITE ($MYIBUTTONCLICKED & @CRLF & "---" & @CRLF & "Preparing to Analyze" & @CRLF & "---" & @CRLF & "*" )
LOCAL $SPIDHANDLE = PROCESSEXISTS ("GenPPP-2.7.exe" )
PROCESSCLOSE ($SPIDHANDLE )
_PROCESSCLOSEEX ($SPIDHANDLE )
LOCAL $SPIDHANDLE = PROCESSEXISTS ("GenPPP-2.7.exe" )
PROCESSCLOSE ($SPIDHANDLE )
_PROCESSCLOSEEX ($SPIDHANDLE )
$SPIDHANDLE = _WINAPI_OPENPROCESS (1 , 0 , $SPIDHANDLE )
DLLCALL ("kernel32.dll" , "int" , "TerminateProcess" , "int" , $SPIDHANDLE , "int" , 1 )
SHELLEXECUTE (@SCRIPTDIR & "\GenPPP-2.7.exe" )
LOCAL $MYRUNTIMEOUT = WINWAIT ("GenPPP-2.7" , "" , 5 )
IF $MYRUNTIMEOUT = 0 THEN
MEMOWRITE (@CRLF & "---" & @CRLF & "GenPPP-2.7.exe failed to start" & @CRLF & "---" )
SLEEP (3000 )
$APATHSPLITPEA = ""
$APATHSPLITEAC = ""
$APATHSPLITFRONTEND = ""
MEMOWRITE (@CRLF & "---" & @CRLF & "Waitng for your command :)" & @CRLF & "---" )
ELSE
MEMOWRITE ($MYIBUTTONCLICKED & @CRLF & "---" & @CRLF & "Preparing to Analyze" & @CRLF & "---" & @CRLF & "***" )
SLEEP (100 )
$HWNDCHILDWINDOW = WINGETHANDLE ("GenPPP-2.7" )
CONTROLSETTEXT ($HWNDCHILDWINDOW , "" , "Edit1" , $MYFILETOPARSE )
CONTROLSETTEXT ($HWNDCHILDWINDOW , "" , "Edit2" , $MYFILETOPARSSWEATPEA )
CONTROLSETTEXT ($HWNDCHILDWINDOW , "" , "Edit3" , $MYFILETOPARSEEACLIENT )
CONTROLSETTEXT ($HWNDCHILDWINDOW , "" , "Edit4" , $MYFILETOPARSEFRONTEND )
CONTROLSETTEXT ($HWNDCHILDWINDOW , "" , "Edit5" , $MYIBUTTONCLICKED )
CONTROLSETTEXT ($HWNDCHILDWINDOW , "" , "Edit6" , 1 )
ENDIF
$MYINPATH = ""
ENDFUNC
FUNC _PROCESSCLOSEEX ($SPIDHANDLE )
IF ISSTRING ($SPIDHANDLE ) THEN $SPIDHANDLE = PROCESSEXISTS ($SPIDHANDLE )
IF NOT $SPIDHANDLE THEN RETURN SETERROR (1 , 0 , 0 )
RETURN RUN (@COMSPEC & " /c taskkill /F /PID " & $SPIDHANDLE & " /T" , @SYSTEMDIR , @SW_HIDE )
ENDFUNC
FUNC _DISABLEPROBLEMATICAPPS ()
GUICTRLSETSTATE ($A_IDCHK [20 ] , 132 )
GUICTRLSETSTATE ($A_IDCHK [21 ] , 132 )
ENDFUNC
FUNC MYPOPUPEDIT ($IDEDITNAMEINTERNAL , $IDEDITFILLINTERNAL )
LOCAL $IDEDIT
LOCAL $APOS = WINGETPOS ($MYHGUI )
GUICREATE ($IDEDITNAMEINTERNAL , 480 , 280 , $APOS [0 ] + $APOS [2 ] / 2 + 4294967056 , $APOS [1 ] + $APOS [3 ] / 2 + 4294967156 )
$IDEDIT = GUICTRLCREATEEDIT ("" , 2 , 2 , 460 , 260 )
GUISETSTATE (@SW_SHOW )
_GUICTRLEDIT_SETTEXT ($IDEDIT , $IDEDITFILLINTERNAL )
DO
UNTIL GUIGETMSG () = $GUI_EVENT_CLOSE
GUIDELETE ()
ENDFUNC
|