Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Region
- #AutoIt3Wrapper_OutFile=Crackme root-me.exe
- #AutoIt3Wrapper_Compression=4
- #AutoIt3Wrapper_UseUpx=n
- #AutoIt3Wrapper_UseX64=n
- #EndRegion
- Dim $wtf1 = "TVCWZQKOMDJBDYALUPZP"
- Global Const $fc_nooverwrite = 0
- Global Const $fc_overwrite = 1
- Global Const $ft_modified = 0
- Global Const $ft_created = 1
- Global Const $ft_accessed = 2
- Global Const $fo_read = 0
- Global Const $fo_append = 1
- Global Const $fo_overwrite = 2
- 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 $eof = -1
- Global Const $fd_filemustexist = 1
- Global Const $fd_pathmustexist = 2
- Global Const $fd_multiselect = 4
- Global Const $fd_promptcreatenew = 8
- Global Const $fd_promptoverwrite = 16
- Global Const $create_new = 1
- Global Const $create_always = 2
- Global Const $open_existing = 3
- Global Const $open_always = 4
- Global Const $truncate_existing = 5
- Global Const $invalid_set_file_pointer = -1
- Global Const $file_begin = 0
- Global Const $file_current = 1
- Global Const $file_end = 2
- Global Const $file_attribute_readonly = 1
- Global Const $file_attribute_hidden = 2
- Global Const $file_attribute_system = 4
- Global Const $file_attribute_directory = 16
- Global Const $file_attribute_archive = 32
- Global Const $file_attribute_device = 64
- Global Const $file_attribute_normal = 128
- Global Const $file_attribute_temporary = 256
- Global Const $file_attribute_sparse_file = 512
- Global Const $file_attribute_reparse_point = 1024
- Global Const $file_attribute_compressed = 2048
- Global Const $file_attribute_offline = 4096
- Global Const $file_attribute_not_content_indexed = 8192
- Global Const $file_attribute_encrypted = 16384
- Global Const $file_share_read = 1
- Global Const $file_share_write = 2
- Global Const $file_share_delete = 4
- Global Const $generic_all = 268435456
- Global Const $generic_execute = 536870912
- Global Const $generic_write = 1073741824
- Global Const $generic_read = -2147483648
- Func _filecountlines($sfilepath)
- Local $hfile = FileOpen($sfilepath, $fo_read)
- If $hfile = -1 Then Return SetError(1, 0, 0)
- Local $sfilecontent = StringStripWS(FileRead($hfile), 2)
- FileClose($hfile)
- Local $atmp
- If StringInStr($sfilecontent, @LF) Then
- $atmp = StringSplit(StringStripCR($sfilecontent), @LF)
- ElseIf StringInStr($sfilecontent, @CR) Then
- $atmp = StringSplit($sfilecontent, @CR)
- Else
- If StringLen($sfilecontent) Then
- Return 1
- Else
- Return SetError(2, 0, 0)
- EndIf
- EndIf
- Return $atmp[0]
- EndFunc
- Func _filecreate($sfilepath)
- Local $hopenfile = FileOpen($sfilepath, $fo_overwrite)
- If $hopenfile = -1 Then Return SetError(1, 0, 0)
- Local $hwritefile = FileWrite($hopenfile, "")
- FileClose($hopenfile)
- If $hwritefile = -1 Then Return SetError(2, 0, 0)
- Return 1
- EndFunc
- Func _filelisttoarray($spath, $sfilter = "*", $iflag = 0)
- Local $hsearch, $sfile, $sfilelist, $sdelim = "|"
- $spath = StringRegExpReplace($spath, "[\\/]+\z", "") & "\"
- If NOT FileExists($spath) Then Return SetError(1, 1, "")
- If StringRegExp($sfilter, "[\\/:><\|]|(?s)\A\s*\z") Then Return SetError(2, 2, "")
- If NOT ($iflag = 0 OR $iflag = 1 OR $iflag = 2) Then Return SetError(3, 3, "")
- $hsearch = FileFindFirstFile($spath & $sfilter)
- If @error Then Return SetError(4, 4, "")
- While 1
- $sfile = FileFindNextFile($hsearch)
- If @error Then ExitLoop
- If ($iflag + @extended = 2) Then ContinueLoop
- $sfilelist &= $sdelim & $sfile
- WEnd
- FileClose($hsearch)
- If NOT $sfilelist Then Return SetError(4, 4, "")
- Return StringSplit(StringTrimLeft($sfilelist, 1), "|")
- EndFunc
- Func _fileprint($s_file, $i_show = @SW_HIDE)
- Local $a_ret = DllCall("shell32.dll", "int", "ShellExecuteW", "hwnd", 0, "wstr", "print", "wstr", $s_file, "wstr", "", "wstr", "", "int", $i_show)
- If @error Then Return SetError(@error, @extended, 0)
- If $a_ret[0] <= 32 Then Return SetError(10, $a_ret[0], 0)
- Return 1
- EndFunc
- Func _filereadtoarray($sfilepath, ByRef $aarray)
- Local $hfile = FileOpen($sfilepath, $fo_read)
- If $hfile = -1 Then Return SetError(1, 0, 0)
- Local $afile = FileRead($hfile, FileGetSize($sfilepath))
- If StringRight($afile, 1) = @LF Then $afile = StringTrimRight($afile, 1)
- If StringRight($afile, 1) = @CR Then $afile = StringTrimRight($afile, 1)
- FileClose($hfile)
- If StringInStr($afile, @LF) Then
- $aarray = StringSplit(StringStripCR($afile), @LF)
- ElseIf StringInStr($afile, @CR) Then
- $aarray = StringSplit($afile, @CR)
- Else
- If StringLen($afile) Then
- Dim $aarray[2] = [1, $afile]
- Else
- Return SetError(2, 0, 0)
- EndIf
- EndIf
- Return 1
- EndFunc
- Func _filewritefromarray($file, $a_array, $i_base = 0, $i_ubound = 0)
- If NOT IsArray($a_array) Then Return SetError(2, 0, 0)
- Local $last = UBound($a_array) - 1
- If $i_ubound < 1 OR $i_ubound > $last Then $i_ubound = $last
- If $i_base < 0 OR $i_base > $last Then $i_base = 0
- Local $hfile
- If IsString($file) Then
- $hfile = FileOpen($file, $fo_overwrite)
- Else
- $hfile = $file
- EndIf
- If $hfile = -1 Then Return SetError(1, 0, 0)
- Local $errorsav = 0
- For $x = $i_base To $i_ubound
- If FileWrite($hfile, $a_array[$x] & @CRLF) = 0 Then
- $errorsav = 3
- ExitLoop
- EndIf
- Next
- If IsString($file) Then FileClose($hfile)
- If $errorsav Then Return SetError($errorsav, 0, 0)
- Return 1
- EndFunc
- Func _filewritelog($slogpath, $slogmsg, $iflag = -1)
- Local $iopenmode = $fo_append
- Local $sdatenow = @YEAR & "-" & @MON & "-" & @MDAY
- Local $stimenow = @HOUR & ":" & @MIN & ":" & @SEC
- Local $smsg = $sdatenow & " " & $stimenow & " : " & $slogmsg
- If $iflag <> -1 Then
- $smsg &= @CRLF & FileRead($slogpath)
- $iopenmode = $fo_overwrite
- EndIf
- Local $hopenfile = FileOpen($slogpath, $iopenmode)
- If $hopenfile = -1 Then Return SetError(1, 0, 0)
- Local $iwritefile = FileWriteLine($hopenfile, $smsg)
- Local $iret = FileClose($hopenfile)
- If $iwritefile = -1 Then Return SetError(2, $iret, 0)
- Return $iret
- EndFunc
- Func _filewritetoline($sfile, $iline, $stext, $foverwrite = 0)
- If $iline <= 0 Then Return SetError(4, 0, 0)
- If NOT IsString($stext) Then
- $stext = String($stext)
- If $stext = "" Then Return SetError(6, 0, 0)
- EndIf
- If $foverwrite <> 0 AND $foverwrite <> 1 Then Return SetError(5, 0, 0)
- If NOT FileExists($sfile) Then Return SetError(2, 0, 0)
- Local $sread_file = FileRead($sfile)
- Local $asplit_file = StringSplit(StringStripCR($sread_file), @LF)
- If UBound($asplit_file) < $iline Then Return SetError(1, 0, 0)
- Local $hfile = FileOpen($sfile, $fo_overwrite)
- If $hfile = -1 Then Return SetError(3, 0, 0)
- $sread_file = ""
- For $i = 1 To $asplit_file[0]
- If $i = $iline Then
- If $foverwrite = 1 Then
- If $stext <> "" Then $sread_file &= $stext & @CRLF
- Else
- $sread_file &= $stext & @CRLF & $asplit_file[$i] & @CRLF
- EndIf
- ElseIf $i < $asplit_file[0] Then
- $sread_file &= $asplit_file[$i] & @CRLF
- ElseIf $i = $asplit_file[0] Then
- $sread_file &= $asplit_file[$i]
- EndIf
- Next
- FileWrite($hfile, $sread_file)
- FileClose($hfile)
- 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) <> "\"
- For $i = 1 To 2
- $spath = StringLeft($sfullpath, 2)
- If $spath = "\\" Then
- $sfullpath = StringTrimLeft($sfullpath, 2)
- Local $nserverlen = StringInStr($sfullpath, "\") - 1
- $spath = "\\" & StringLeft($sfullpath, $nserverlen)
- $sfullpath = StringTrimLeft($sfullpath, $nserverlen)
- ExitLoop
- ElseIf StringRight($spath, 1) = ":" Then
- $sfullpath = StringTrimLeft($sfullpath, 2)
- ExitLoop
- Else
- $sfullpath = $sbasepath & "\" & $sfullpath
- EndIf
- Next
- If $i = 3 Then Return ""
- If StringLeft($sfullpath, 1) <> "\" Then
- If StringLeft($sfullpathconst, 2) = StringLeft($sbasepath, 2) Then
- $sfullpath = $sbasepath & "\" & $sfullpath
- Else
- $sfullpath = "\" & $sfullpath
- EndIf
- EndIf
- Local $atemp = StringSplit($sfullpath, "\")
- Local $apathparts[$atemp[0]], $j = 0
- For $i = 2 To $atemp[0]
- If $atemp[$i] = ".." Then
- If $j Then $j -= 1
- ElseIf NOT ($atemp[$i] = "" AND $i <> $atemp[0]) AND $atemp[$i] <> "." Then
- $apathparts[$j] = $atemp[$i]
- $j += 1
- EndIf
- Next
- $sfullpath = $spath
- If NOT $brootonly Then
- For $i = 0 To $j - 1
- $sfullpath &= "\" & $apathparts[$i]
- Next
- Else
- $sfullpath &= $sfullpathconst
- If StringInStr($sfullpath, "..") Then $sfullpath = _pathfull($sfullpath)
- EndIf
- While StringInStr($sfullpath, ".\")
- $sfullpath = StringReplace($sfullpath, ".\", "\")
- WEnd
- 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($szdrive, $szdir, $szfname, $szext)
- If StringLen($szdrive) Then
- If NOT (StringLeft($szdrive, 2) = "\\") Then $szdrive = StringLeft($szdrive, 1) & ":"
- EndIf
- If StringLen($szdir) Then
- If NOT (StringRight($szdir, 1) = "\") AND NOT (StringRight($szdir, 1) = "/") Then $szdir = $szdir & "\"
- EndIf
- If StringLen($szext) Then
- If NOT (StringLeft($szext, 1) = ".") Then $szext = "." & $szext
- EndIf
- Return $szdrive & $szdir & $szfname & $szext
- EndFunc
- Func _pathsplit($szpath, ByRef $szdrive, ByRef $szdir, ByRef $szfname, ByRef $szext)
- Local $drive = ""
- Local $dir = ""
- Local $fname = ""
- Local $ext = ""
- Local $pos
- Local $array[5]
- $array[0] = $szpath
- If StringMid($szpath, 2, 1) = ":" Then
- $drive = StringLeft($szpath, 2)
- $szpath = StringTrimLeft($szpath, 2)
- ElseIf StringLeft($szpath, 2) = "\\" Then
- $szpath = StringTrimLeft($szpath, 2)
- $pos = StringInStr($szpath, "\")
- If $pos = 0 Then $pos = StringInStr($szpath, "/")
- If $pos = 0 Then
- $drive = "\\" & $szpath
- $szpath = ""
- Else
- $drive = "\\" & StringLeft($szpath, $pos - 1)
- $szpath = StringTrimLeft($szpath, $pos - 1)
- EndIf
- EndIf
- Local $nposforward = StringInStr($szpath, "/", 0, -1)
- Local $nposbackward = StringInStr($szpath, "\", 0, -1)
- If $nposforward >= $nposbackward Then
- $pos = $nposforward
- Else
- $pos = $nposbackward
- EndIf
- $dir = StringLeft($szpath, $pos)
- $fname = StringRight($szpath, StringLen($szpath) - $pos)
- If StringLen($dir) = 0 Then $fname = $szpath
- $pos = StringInStr($fname, ".", 0, -1)
- If $pos Then
- $ext = StringRight($fname, StringLen($fname) - ($pos - 1))
- $fname = StringLeft($fname, $pos - 1)
- EndIf
- $szdrive = $drive
- $szdir = $dir
- $szfname = $fname
- $szext = $ext
- $array[1] = $drive
- $array[2] = $dir
- $array[3] = $fname
- $array[4] = $ext
- Return $array
- EndFunc
- Func _replacestringinfile($szfilename, $szsearchstring, $szreplacestring, $fcaseness = 0, $foccurance = 1)
- Local $iretval = 0
- Local $ncount, $sendswith
- If StringInStr(FileGetAttrib($szfilename), "R") Then Return SetError(6, 0, -1)
- Local $hfile = FileOpen($szfilename, $fo_read)
- If $hfile = -1 Then Return SetError(1, 0, -1)
- Local $s_totfile = FileRead($hfile, FileGetSize($szfilename))
- If StringRight($s_totfile, 2) = @CRLF Then
- $sendswith = @CRLF
- ElseIf StringRight($s_totfile, 1) = @CR Then
- $sendswith = @CR
- ElseIf StringRight($s_totfile, 1) = @LF Then
- $sendswith = @LF
- Else
- $sendswith = ""
- EndIf
- Local $afilelines = StringSplit(StringStripCR($s_totfile), @LF)
- FileClose($hfile)
- Local $hwritehandle = FileOpen($szfilename, $fo_overwrite)
- If $hwritehandle = -1 Then Return SetError(2, 0, -1)
- For $ncount = 1 To $afilelines[0]
- If StringInStr($afilelines[$ncount], $szsearchstring, $fcaseness) Then
- $afilelines[$ncount] = StringReplace($afilelines[$ncount], $szsearchstring, $szreplacestring, 1 - $foccurance, $fcaseness)
- $iretval = $iretval + 1
- If $foccurance = 0 Then
- $iretval = 1
- ExitLoop
- EndIf
- EndIf
- Next
- For $ncount = 1 To $afilelines[0] - 1
- If FileWriteLine($hwritehandle, $afilelines[$ncount]) = 0 Then
- FileClose($hwritehandle)
- Return SetError(3, 0, -1)
- EndIf
- Next
- If $afilelines[$ncount] <> "" Then FileWrite($hwritehandle, $afilelines[$ncount] & $sendswith)
- FileClose($hwritehandle)
- Return $iretval
- EndFunc
- Func _tempfile($s_directoryname = @TempDir, $s_fileprefix = "~", $s_fileextension = ".tmp", $i_randomlength = 7)
- If NOT FileExists($s_directoryname) Then $s_directoryname = @TempDir
- If NOT FileExists($s_directoryname) Then $s_directoryname = @ScriptDir
- If StringRight($s_directoryname, 1) <> "\" Then $s_directoryname = $s_directoryname & "\"
- Local $s_tempname
- Do
- $s_tempname = ""
- While StringLen($s_tempname) < $i_randomlength
- $s_tempname = $s_tempname & Chr(Random(97, 122, 1))
- WEnd
- $s_tempname = $s_directoryname & $s_fileprefix & $s_tempname & $s_fileextension
- Until NOT FileExists($s_tempname)
- Return $s_tempname
- EndFunc
- Global Const $__soundconstant_sndid_marker = 1229204781
- Func _soundopen($sfile)
- If NOT FileExists($sfile) Then Return SetError(2, 0, 0)
- Local $asndid[4]
- For $i = 1 To 10
- $asndid[0] &= Chr(Random(97, 122, 1))
- Next
- Local $szdrive, $szdir, $szfname, $szext
- _pathsplit($sfile, $szdrive, $szdir, $szfname, $szext)
- Local $ssnddirname
- If $szdrive = "" Then
- $ssnddirname = @WorkingDir & "\"
- Else
- $ssnddirname = $szdrive & $szdir
- EndIf
- Local $ssndfilename = $szfname & $szext
- Local $ssnddirshortname = FileGetShortName($ssnddirname, 1)
- __soundmcisendstring("open " & FileGetShortName($sfile) & " alias " & $asndid[0])
- If @error Then Return SetError(1, @error, 0)
- Local $stracklength, $ftrynextmethod = False
- Local $oshell = ObjCreate("shell.application")
- If IsObj($oshell) Then
- Local $oshelldir = $oshell.namespace($ssnddirshortname)
- If IsObj($oshelldir) Then
- Local $oshelldirfile = $oshelldir.parsename($ssndfilename)
- If IsObj($oshelldirfile) Then
- Local $sraw = $oshelldir.getdetailsof($oshelldirfile, -1)
- Local $ainfo = StringRegExp($sraw, ": ([0-9]{2}:[0-9]{2}:[0-9]{2})", 3)
- If NOT IsArray($ainfo) Then
- $ftrynextmethod = True
- Else
- $stracklength = $ainfo[0]
- EndIf
- Else
- $ftrynextmethod = True
- EndIf
- Else
- $ftrynextmethod = True
- EndIf
- Else
- $ftrynextmethod = True
- EndIf
- Local $stag
- If $ftrynextmethod Then
- $ftrynextmethod = False
- If $szext = ".mp3" Then
- Local $hfile = FileOpen(FileGetShortName($ssnddirname & $ssndfilename), 4)
- $stag = FileRead($hfile, 5156)
- FileClose($hfile)
- $stracklength = __soundreadxingfrommp3($stag)
- If @error Then $ftrynextmethod = True
- Else
- $ftrynextmethod = True
- EndIf
- EndIf
- If $ftrynextmethod Then
- $ftrynextmethod = False
- If $szext = ".mp3" Then
- $stracklength = __soundreadtlenfrommp3($stag)
- If @error Then $ftrynextmethod = True
- Else
- $ftrynextmethod = True
- EndIf
- EndIf
- If $ftrynextmethod Then
- $ftrynextmethod = False
- __soundmcisendstring("set " & $asndid[0] & " time format miliseconds")
- Local $isndlenms = __soundmcisendstring("status " & $asndid[0] & " length", 255)
- Local $isndlenmin, $isndlenhour, $isndlensecs
- __soundtickstotime($isndlenms, $isndlenhour, $isndlenmin, $isndlensecs)
- $stracklength = StringFormat("%02i:%02i:%02i", $isndlenhour, $isndlenmin, $isndlensecs)
- EndIf
- Local $aitime = StringSplit($stracklength, ":")
- Local $iactualticks = __soundtimetoticks($aitime[1], $aitime[2], $aitime[3])
- __soundmcisendstring("set " & $asndid[0] & " time format miliseconds")
- Local $isoundticks = __soundmcisendstring("status " & $asndid[0] & " length", 255)
- Local $ivbrratio
- If Abs($isoundticks - $iactualticks) < 1000 Then
- $ivbrratio = 0
- Else
- $ivbrratio = $isoundticks / $iactualticks
- EndIf
- $asndid[1] = $ivbrratio
- $asndid[2] = 0
- $asndid[3] = $__soundconstant_sndid_marker
- Return $asndid
- EndFunc
- Func _soundclose($asndid)
- If NOT IsArray($asndid) OR NOT __soundchksndid($asndid) Then Return SetError(3, 0, 0)
- __soundmcisendstring("close " & $asndid[0])
- If @error Then Return SetError(1, @error, 0)
- Return 1
- EndFunc
- Func _soundplay($asndid, $iwait = 0)
- If $iwait <> 0 AND $iwait <> 1 Then Return SetError(2, 0, 0)
- If NOT __soundchksndid($asndid) Then Return SetError(3, 0, 0)
- If _soundpos($asndid, 2) = _soundlength($asndid, 2) Then __soundmcisendstring("seek " & $asndid[0] & " to start")
- If $iwait = 1 Then
- __soundmcisendstring("play " & $asndid[0] & " wait")
- Else
- __soundmcisendstring("play " & $asndid[0])
- EndIf
- If @error Then Return SetError(1, @error, 0)
- Return 1
- EndFunc
- Func _soundstop(ByRef $asndid)
- Local $vtemp = $asndid
- If NOT __soundchksndid($vtemp) Then Return SetError(3, 0, 0)
- If IsArray($asndid) Then $asndid[2] = 0
- __soundmcisendstring("stop " & $vtemp[0])
- If @error Then Return SetError(2, @error, 0)
- __soundmcisendstring("seek " & $vtemp[0] & " to start")
- If @error Then Return SetError(1, @error, 0)
- Return 1
- EndFunc
- Func _soundpause($asndid)
- If NOT __soundchksndid($asndid) Then Return SetError(3, 0, 0)
- __soundmcisendstring("pause " & $asndid[0])
- If @error Then Return SetError(1, @error, 0)
- Return 1
- EndFunc
- Func _soundresume($asndid)
- If NOT __soundchksndid($asndid) Then Return SetError(3, 0, 0)
- __soundmcisendstring("resume " & $asndid[0])
- If @error Then Return SetError(1, @error, 0)
- Return 1
- EndFunc
- Func _soundlength($asndid, $imode = 1)
- If $imode <> 1 AND $imode <> 2 Then Return SetError(1, 0, 0)
- Local $bfile = False
- If NOT IsArray($asndid) Then
- If NOT FileExists($asndid) Then Return SetError(3, 0, 0)
- $bfile = True
- $asndid = _soundopen($asndid)
- Else
- If NOT __soundchksndid($asndid) Then Return SetError(3, 0, 0)
- EndIf
- __soundmcisendstring("set " & $asndid[0] & " time format miliseconds")
- Local $isndlenms = Number(__soundmcisendstring("status " & $asndid[0] & " length", 255))
- If $asndid[1] <> 0 Then $isndlenms = Round($isndlenms / $asndid[1])
- If $bfile Then _soundclose($asndid)
- If $imode = 2 Then Return $isndlenms
- Local $isndlenmin, $isndlenhour, $isndlensecs
- __soundtickstotime($isndlenms, $isndlenhour, $isndlenmin, $isndlensecs)
- Local $ssndlenformat = StringFormat("%02i:%02i:%02i", $isndlenhour, $isndlenmin, $isndlensecs)
- Return $ssndlenformat
- EndFunc
- Func _soundseek(ByRef $asndid, $ihour, $imin, $isec)
- If NOT IsArray($asndid) OR NOT __soundchksndid($asndid) Then Return SetError(3, 0, 0)
- __soundmcisendstring("set " & $asndid[0] & " time format miliseconds")
- Local $ims = $isec * 1000
- $ims += $imin * 60 * 1000
- $ims += $ihour * 60 * 60 * 1000
- If $asndid[1] <> 0 Then
- $asndid[2] = Round($ims * $asndid[1]) - $ims
- $ims = Round($ims * $asndid[1])
- EndIf
- __soundmcisendstring("seek " & $asndid[0] & " to " & $ims)
- Local $ierror = @error
- If _soundpos($asndid, 2) < 0 Then $asndid[2] = 0
- If $ierror Then Return SetError(1, $ierror, 0)
- Return 1
- EndFunc
- Func _soundstatus($asndid)
- If NOT __soundchksndid($asndid) Then Return SetError(3, 0, 0)
- Return __soundmcisendstring("status " & $asndid[0] & " mode", 255)
- EndFunc
- Func _soundpos($asndid, $imode = 1)
- If $imode <> 1 AND $imode <> 2 Then Return SetError(1, 0, 0)
- If NOT __soundchksndid($asndid) Then Return SetError(3, 0, 0)
- __soundmcisendstring("set " & $asndid[0] & " time format miliseconds")
- Local $isndposms = Number(__soundmcisendstring("status " & $asndid[0] & " position", 255))
- If $asndid[1] <> 0 Then
- $isndposms -= $asndid[2]
- EndIf
- If $imode = 2 Then Return $isndposms
- Local $isndposmin, $isndposhour, $isndpossecs
- __soundtickstotime($isndposms, $isndposhour, $isndposmin, $isndpossecs)
- Local $ssndposhms = StringFormat("%02i:%02i:%02i", $isndposhour, $isndposmin, $isndpossecs)
- Return $ssndposhms
- EndFunc
- Func __soundchksndid(ByRef $asndid)
- If NOT IsArray($asndid) Then
- If NOT FileExists($asndid) Then Return 0
- Local $vtemp = FileGetShortName($asndid)
- Dim $asndid[4] = [$vtemp, 0, 0, $__soundconstant_sndid_marker]
- Else
- If UBound($asndid) <> 4 AND $asndid[3] <> $__soundconstant_sndid_marker Then Return 0
- EndIf
- Return 1
- EndFunc
- Func __soundmcisendstring($string, $ilen = 0)
- Local $iret = DllCall("winmm.dll", "dword", "mciSendStringW", "wstr", $string, "wstr", "", "uint", $ilen, "ptr", 0)
- If @error Then Return SetError(@error, @extended, "")
- If $iret[0] Then Return SetError(10, $iret[0], $iret[2])
- Return $iret[2]
- EndFunc
- Func __soundreadtlenfrommp3($stag)
- If StringLeft($stag, 10) <> "0x49443303" Then Return SetError(1, 0, 0)
- Local $itemp = StringInStr($stag, "544C454E") + 21
- $stag = StringTrimLeft($stag, $itemp)
- Local $stemp = ""
- For $i = 1 To 32 Step 2
- If StringMid($stag, $i, 2) = "00" Then
- ExitLoop
- Else
- $stemp &= StringMid($stag, $i, 2)
- EndIf
- Next
- Local $ilengthms = Number(BinaryToString("0x" & $stemp))
- If $ilengthms <= 0 Then Return SetError(1, 0, 0)
- Local $ilengthhour, $ilengthmin, $ilengthsecs
- __soundtickstotime($ilengthms, $ilengthhour, $ilengthmin, $ilengthsecs)
- Return StringFormat("%02i:%02i:%02i", $ilengthhour, $ilengthmin, $ilengthsecs)
- EndFunc
- Func __soundreadxingfrommp3($stag)
- Local $ixingpos = StringInStr($stag, "58696E67")
- If $ixingpos = 0 Then Return SetError(1, 0, 0)
- Local $iframes, $iflags = Number("0x" & StringMid($stag, $ixingpos + 14, 2))
- If BitAND($iflags, 1) = 1 Then
- $iframes = Number("0x" & StringMid($stag, $ixingpos + 16, 8))
- Else
- Return SetError(1, 0, 0)
- EndIf
- Local $sheader = StringMid($stag, $ixingpos - 72, 8)
- Local $impegbyte = Number("0x" & StringMid($sheader, 4, 1))
- Local $ifreqbyte = Number("0x" & StringMid($sheader, 6, 1))
- Local $impegver = BitAND($impegbyte, 8)
- Local $ilayernum = BitAND($impegbyte, 6)
- Local $isamples
- Switch $ilayernum
- Case 6
- $isamples = 384
- Case 4
- $isamples = 1152
- Case 2
- Switch $impegver
- Case 8
- $isamples = 1152
- Case 0
- $isamples = 576
- Case Else
- $isamples = 0
- EndSwitch
- Case Else
- $isamples = 0
- EndSwitch
- If $isamples = 0 Then Return SetError(1, 0, 0)
- Local $ifrequency, $ifreqnum = BitAND($ifreqbyte, 12)
- Switch $ifreqnum
- Case 0
- $ifrequency = 44100
- Case 4
- $ifrequency = 48000
- Case 8
- $ifrequency = 32000
- Case Else
- $ifrequency = 0
- EndSwitch
- If $ifrequency = 0 Then Return SetError(1, 0, 0)
- If $impegver = 0 Then $ifrequency = $ifrequency / 2
- Local $ilengthms = Int(($iframes * $isamples / $ifrequency) * 1000)
- Local $ilengthhours, $ilengthmins, $ilengthsecs
- __soundtickstotime($ilengthms, $ilengthhours, $ilengthmins, $ilengthsecs)
- Return StringFormat("%02i:%02i:%02i", $ilengthhours, $ilengthmins, $ilengthsecs)
- EndFunc
- Func __soundtickstotime($iticks, ByRef $ihours, ByRef $imins, ByRef $isecs)
- If Number($iticks) < 0 Then Return SetError(1, 0, 0)
- If Number($iticks) = 0 Then
- $ihours = 0
- $iticks = 0
- $imins = 0
- $isecs = 0
- Return 1
- EndIf
- $iticks = Round($iticks / 1000)
- $ihours = Int($iticks / 3600)
- $iticks = Mod($iticks, 3600)
- $imins = Int($iticks / 60)
- $isecs = Round(Mod($iticks, 60))
- Return 1
- EndFunc
- Func __soundtimetoticks($ihours = @HOUR, $imins = @MIN, $isecs = @SEC)
- If NOT (StringIsInt($ihours) AND StringIsInt($imins) AND StringIsInt($isecs)) Then Return SetError(1, 0, 0)
- Return 1000 * ((3600 * $ihours) + (60 * $imins) + $isecs)
- EndFunc
- #Region Includes et déclaration des globales
- Func _arrayadd(ByRef $avarray, $vvalue)
- If NOT IsArray($avarray) Then Return SetError(1, 0, -1)
- If UBound($avarray, 0) <> 1 Then Return SetError(2, 0, -1)
- Local $iubound = UBound($avarray)
- ReDim $avarray[$iubound + 1]
- $avarray[$iubound] = $vvalue
- Return $iubound
- EndFunc
- Func _arraybinarysearch(Const ByRef $avarray, $vvalue, $istart = 0, $iend = 0)
- If NOT IsArray($avarray) Then Return SetError(1, 0, -1)
- If UBound($avarray, 0) <> 1 Then Return SetError(5, 0, -1)
- Local $iubound = UBound($avarray) - 1
- If $iend < 1 OR $iend > $iubound Then $iend = $iubound
- If $istart < 0 Then $istart = 0
- If $istart > $iend Then Return SetError(4, 0, -1)
- Local $imid = Int(($iend + $istart) / 2)
- If $avarray[$istart] > $vvalue OR $avarray[$iend] < $vvalue Then Return SetError(2, 0, -1)
- While $istart <= $imid AND $vvalue <> $avarray[$imid]
- If $vvalue < $avarray[$imid] Then
- $iend = $imid - 1
- Else
- $istart = $imid + 1
- EndIf
- $imid = Int(($iend + $istart) / 2)
- WEnd
- If $istart > $iend Then Return SetError(3, 0, -1)
- Return $imid
- EndFunc
- Func _arraycombinations(ByRef $avarray, $iset, $sdelim = "")
- If NOT IsArray($avarray) Then Return SetError(1, 0, 0)
- If UBound($avarray, 0) <> 1 Then Return SetError(2, 0, 0)
- Local $in = UBound($avarray)
- Local $ir = $iset
- Local $aidx[$ir]
- For $i = 0 To $ir - 1
- $aidx[$i] = $i
- Next
- Local $itotal = __array_combinations($in, $ir)
- Local $ileft = $itotal
- Local $aresult[$itotal + 1]
- $aresult[0] = $itotal
- Local $icount = 1
- While $ileft > 0
- __array_getnext($in, $ir, $ileft, $itotal, $aidx)
- For $i = 0 To $iset - 1
- $aresult[$icount] &= $avarray[$aidx[$i]] & $sdelim
- Next
- If $sdelim <> "" Then $aresult[$icount] = StringTrimRight($aresult[$icount], 1)
- $icount += 1
- WEnd
- Return $aresult
- EndFunc
- Func _arrayconcatenate(ByRef $avarraytarget, Const ByRef $avarraysource, $istart = 0)
- If NOT IsArray($avarraytarget) Then Return SetError(1, 0, 0)
- If NOT IsArray($avarraysource) Then Return SetError(2, 0, 0)
- If UBound($avarraytarget, 0) <> 1 Then
- If UBound($avarraysource, 0) <> 1 Then Return SetError(5, 0, 0)
- Return SetError(3, 0, 0)
- EndIf
- If UBound($avarraysource, 0) <> 1 Then Return SetError(4, 0, 0)
- Local $iuboundtarget = UBound($avarraytarget) - $istart, $iuboundsource = UBound($avarraysource)
- ReDim $avarraytarget[$iuboundtarget + $iuboundsource]
- For $i = $istart To $iuboundsource - 1
- $avarraytarget[$iuboundtarget + $i] = $avarraysource[$i]
- Next
- Return $iuboundtarget + $iuboundsource
- EndFunc
- Func _arraycreate($v_0, $v_1 = 0, $v_2 = 0, $v_3 = 0, $v_4 = 0, $v_5 = 0, $v_6 = 0, $v_7 = 0, $v_8 = 0, $v_9 = 0, $v_10 = 0, $v_11 = 0, $v_12 = 0, $v_13 = 0, $v_14 = 0, $v_15 = 0, $v_16 = 0, $v_17 = 0, $v_18 = 0, $v_19 = 0, $v_20 = 0)
- Local $av_array[21] = [$v_0, $v_1, $v_2, $v_3, $v_4, $v_5, $v_6, $v_7, $v_8, $v_9, $v_10, $v_11, $v_12, $v_13, $v_14, $v_15, $v_16, $v_17, $v_18, $v_19, $v_20]
- ReDim $av_array[@NumParams]
- Return $av_array
- EndFunc
- Func _arraydelete(ByRef $avarray, $ielement)
- If NOT IsArray($avarray) Then Return SetError(1, 0, 0)
- Local $iubound = UBound($avarray, 1) - 1
- If NOT $iubound Then
- $avarray = ""
- Return 0
- EndIf
- If $ielement < 0 Then $ielement = 0
- If $ielement > $iubound Then $ielement = $iubound
- Switch UBound($avarray, 0)
- Case 1
- For $i = $ielement To $iubound - 1
- $avarray[$i] = $avarray[$i + 1]
- Next
- ReDim $avarray[$iubound]
- Case 2
- Local $isubmax = UBound($avarray, 2) - 1
- For $i = $ielement To $iubound - 1
- For $j = 0 To $isubmax
- $avarray[$i][$j] = $avarray[$i + 1][$j]
- Next
- Next
- ReDim $avarray[$iubound][$isubmax + 1]
- Case Else
- Return SetError(3, 0, 0)
- EndSwitch
- Return $iubound
- EndFunc
- Func _arraydisplay(Const ByRef $avarray, $stitle = "Array: ListView Display", $iitemlimit = -1, $itranspose = 0, $sseparator = "", $sreplace = "|", $sheader = "")
- If NOT IsArray($avarray) Then Return SetError(1, 0, 0)
- Local $idimension = UBound($avarray, 0), $iubound = UBound($avarray, 1) - 1, $isubmax = UBound($avarray, 2) - 1
- If $idimension > 2 Then Return SetError(2, 0, 0)
- If $sseparator = "" Then $sseparator = Chr(124)
- If _arraysearch($avarray, $sseparator, 0, 0, 0, 1) <> -1 Then
- For $x = 1 To 255
- If $x >= 32 AND $x <= 127 Then ContinueLoop
- Local $sfind = _arraysearch($avarray, Chr($x), 0, 0, 0, 1)
- If $sfind = -1 Then
- $sseparator = Chr($x)
- ExitLoop
- EndIf
- Next
- EndIf
- Local $vtmp, $ibuffer = 64
- Local $icollimit = 250
- Local $ioneventmode = Opt("GUIOnEventMode", 0), $sdataseparatorchar = Opt("GUIDataSeparatorChar", $sseparator)
- If $isubmax < 0 Then $isubmax = 0
- If $itranspose Then
- $vtmp = $iubound
- $iubound = $isubmax
- $isubmax = $vtmp
- EndIf
- If $isubmax > $icollimit Then $isubmax = $icollimit
- If $iitemlimit < 1 Then $iitemlimit = $iubound
- If $iubound > $iitemlimit Then $iubound = $iitemlimit
- If $sheader = "" Then
- $sheader = "Row "
- For $i = 0 To $isubmax
- $sheader &= $sseparator & "Col " & $i
- Next
- EndIf
- Local $avarraytext[$iubound + 1]
- For $i = 0 To $iubound
- $avarraytext[$i] = "[" & $i & "]"
- For $j = 0 To $isubmax
- If $idimension = 1 Then
- If $itranspose Then
- $vtmp = $avarray[$j]
- Else
- $vtmp = $avarray[$i]
- EndIf
- Else
- If $itranspose Then
- $vtmp = $avarray[$j][$i]
- Else
- $vtmp = $avarray[$i][$j]
- EndIf
- EndIf
- $vtmp = StringReplace($vtmp, $sseparator, $sreplace, 0, 1)
- $avarraytext[$i] &= $sseparator & $vtmp
- $vtmp = StringLen($vtmp)
- If $vtmp > $ibuffer Then $ibuffer = $vtmp
- Next
- Next
- $ibuffer += 1
- Local Const $_arrayconstant_gui_dockborders = 102
- Local Const $_arrayconstant_gui_dockbottom = 64
- Local Const $_arrayconstant_gui_dockheight = 512
- Local Const $_arrayconstant_gui_dockleft = 2
- Local Const $_arrayconstant_gui_dockright = 4
- Local Const $_arrayconstant_gui_event_close = -3
- Local Const $_arrayconstant_lvif_param = 4
- Local Const $_arrayconstant_lvif_text = 1
- Local Const $_arrayconstant_lvm_getcolumnwidth = (4096 + 29)
- Local Const $_arrayconstant_lvm_getitemcount = (4096 + 4)
- Local Const $_arrayconstant_lvm_getitemstate = (4096 + 44)
- Local Const $_arrayconstant_lvm_insertitemw = (4096 + 77)
- Local Const $_arrayconstant_lvm_setextendedlistviewstyle = (4096 + 54)
- Local Const $_arrayconstant_lvm_setitemw = (4096 + 76)
- Local Const $_arrayconstant_lvs_ex_fullrowselect = 32
- Local Const $_arrayconstant_lvs_ex_gridlines = 1
- Local Const $_arrayconstant_lvs_showselalways = 8
- 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_taglvitem = "int Mask;int Item;int SubItem;int State;int StateMask;ptr Text;int TextMax;int Image;int Param;int Indent;int GroupID;int Columns;ptr pColumns"
- Local $iaddmask = BitOR($_arrayconstant_lvif_text, $_arrayconstant_lvif_param)
- Local $tbuffer = DllStructCreate("wchar Text[" & $ibuffer & "]"), $pbuffer = DllStructGetPtr($tbuffer)
- Local $titem = DllStructCreate($_arrayconstant_taglvitem), $pitem = DllStructGetPtr($titem)
- DllStructSetData($titem, "Param", 0)
- DllStructSetData($titem, "Text", $pbuffer)
- DllStructSetData($titem, "TextMax", $ibuffer)
- Local $iwidth = 640, $iheight = 480
- Local $hgui = GUICreate($stitle, $iwidth, $iheight, Default, Default, BitOR($_arrayconstant_ws_sizebox, $_arrayconstant_ws_minimizebox, $_arrayconstant_ws_maximizebox))
- Local $aiguisize = WinGetClientSize($hgui)
- Local $hlistview = GUICtrlCreateListView($sheader, 0, 0, $aiguisize[0], $aiguisize[1] - 26, $_arrayconstant_lvs_showselalways)
- Local $hcopy = GUICtrlCreateButton("Copy Selected", 3, $aiguisize[1] - 23, $aiguisize[0] - 6, 20)
- GUICtrlSetResizing($hlistview, $_arrayconstant_gui_dockborders)
- GUICtrlSetResizing($hcopy, $_arrayconstant_gui_dockleft + $_arrayconstant_gui_dockright + $_arrayconstant_gui_dockbottom + $_arrayconstant_gui_dockheight)
- GUICtrlSendMsg($hlistview, $_arrayconstant_lvm_setextendedlistviewstyle, $_arrayconstant_lvs_ex_gridlines, $_arrayconstant_lvs_ex_gridlines)
- GUICtrlSendMsg($hlistview, $_arrayconstant_lvm_setextendedlistviewstyle, $_arrayconstant_lvs_ex_fullrowselect, $_arrayconstant_lvs_ex_fullrowselect)
- GUICtrlSendMsg($hlistview, $_arrayconstant_lvm_setextendedlistviewstyle, $_arrayconstant_ws_ex_clientedge, $_arrayconstant_ws_ex_clientedge)
- Local $aitem
- For $i = 0 To $iubound
- If GUICtrlCreateListViewItem($avarraytext[$i], $hlistview) = 0 Then
- $aitem = StringSplit($avarraytext[$i], $sseparator)
- DllStructSetData($tbuffer, "Text", $aitem[1])
- DllStructSetData($titem, "Item", $i)
- DllStructSetData($titem, "SubItem", 0)
- DllStructSetData($titem, "Mask", $iaddmask)
- GUICtrlSendMsg($hlistview, $_arrayconstant_lvm_insertitemw, 0, $pitem)
- DllStructSetData($titem, "Mask", $_arrayconstant_lvif_text)
- For $j = 2 To $aitem[0]
- DllStructSetData($tbuffer, "Text", $aitem[$j])
- DllStructSetData($titem, "SubItem", $j - 1)
- GUICtrlSendMsg($hlistview, $_arrayconstant_lvm_setitemw, 0, $pitem)
- Next
- EndIf
- Next
- $iwidth = 0
- For $i = 0 To $isubmax + 1
- $iwidth += GUICtrlSendMsg($hlistview, $_arrayconstant_lvm_getcolumnwidth, $i, 0)
- Next
- If $iwidth < 250 Then $iwidth = 230
- $iwidth += 20
- If $iwidth > @DesktopWidth Then $iwidth = @DesktopWidth - 100
- WinMove($hgui, "", (@DesktopWidth - $iwidth) / 2, Default, $iwidth)
- GUISetState(@SW_SHOW, $hgui)
- While 1
- Switch GUIGetMsg()
- Case $_arrayconstant_gui_event_close
- ExitLoop
- Case $hcopy
- Local $sclip = ""
- Local $aicuritems[1] = [0]
- For $i = 0 To GUICtrlSendMsg($hlistview, $_arrayconstant_lvm_getitemcount, 0, 0)
- If GUICtrlSendMsg($hlistview, $_arrayconstant_lvm_getitemstate, $i, 2) Then
- $aicuritems[0] += 1
- ReDim $aicuritems[$aicuritems[0] + 1]
- $aicuritems[$aicuritems[0]] = $i
- EndIf
- Next
- If NOT $aicuritems[0] Then
- For $sitem In $avarraytext
- $sclip &= $sitem & @CRLF
- Next
- Else
- For $i = 1 To UBound($aicuritems) - 1
- $sclip &= $avarraytext[$aicuritems[$i]] & @CRLF
- Next
- EndIf
- ClipPut($sclip)
- EndSwitch
- WEnd
- GUIDelete($hgui)
- Opt("GUIOnEventMode", $ioneventmode)
- Opt("GUIDataSeparatorChar", $sdataseparatorchar)
- Return 1
- EndFunc
- Func _arrayfindall(Const ByRef $avarray, $vvalue, $istart = 0, $iend = 0, $icase = 0, $ipartial = 0, $isubitem = 0)
- $istart = _arraysearch($avarray, $vvalue, $istart, $iend, $icase, $ipartial, 1, $isubitem)
- If @error Then Return SetError(@error, 0, -1)
- Local $iindex = 0, $avresult[UBound($avarray)]
- Do
- $avresult[$iindex] = $istart
- $iindex += 1
- $istart = _arraysearch($avarray, $vvalue, $istart + 1, $iend, $icase, $ipartial, 1, $isubitem)
- Until @error
- ReDim $avresult[$iindex]
- Return $avresult
- EndFunc
- Func _arrayinsert(ByRef $avarray, $ielement, $vvalue = "")
- If NOT IsArray($avarray) Then Return SetError(1, 0, 0)
- If UBound($avarray, 0) <> 1 Then Return SetError(2, 0, 0)
- Local $iubound = UBound($avarray) + 1
- ReDim $avarray[$iubound]
- For $i = $iubound - 1 To $ielement + 1 Step -1
- $avarray[$i] = $avarray[$i - 1]
- Next
- $avarray[$ielement] = $vvalue
- Return $iubound
- EndFunc
- Func _arraymax(Const ByRef $avarray, $icompnumeric = 0, $istart = 0, $iend = 0)
- Local $iresult = _arraymaxindex($avarray, $icompnumeric, $istart, $iend)
- If @error Then Return SetError(@error, 0, "")
- Return $avarray[$iresult]
- EndFunc
- Func _arraymaxindex(Const ByRef $avarray, $icompnumeric = 0, $istart = 0, $iend = 0)
- If NOT IsArray($avarray) OR UBound($avarray, 0) <> 1 Then Return SetError(1, 0, -1)
- If UBound($avarray, 0) <> 1 Then Return SetError(3, 0, -1)
- Local $iubound = UBound($avarray) - 1
- If $iend < 1 OR $iend > $iubound Then $iend = $iubound
- If $istart < 0 Then $istart = 0
- If $istart > $iend Then Return SetError(2, 0, -1)
- Local $imaxindex = $istart
- If $icompnumeric Then
- For $i = $istart To $iend
- If Number($avarray[$imaxindex]) < Number($avarray[$i]) Then $imaxindex = $i
- Next
- Else
- For $i = $istart To $iend
- If $avarray[$imaxindex] < $avarray[$i] Then $imaxindex = $i
- Next
- EndIf
- Return $imaxindex
- EndFunc
- Func _arraymin(Const ByRef $avarray, $icompnumeric = 0, $istart = 0, $iend = 0)
- Local $iresult = _arrayminindex($avarray, $icompnumeric, $istart, $iend)
- If @error Then Return SetError(@error, 0, "")
- Return $avarray[$iresult]
- EndFunc
- Func _arrayminindex(Const ByRef $avarray, $icompnumeric = 0, $istart = 0, $iend = 0)
- If NOT IsArray($avarray) Then Return SetError(1, 0, -1)
- If UBound($avarray, 0) <> 1 Then Return SetError(3, 0, -1)
- Local $iubound = UBound($avarray) - 1
- If $iend < 1 OR $iend > $iubound Then $iend = $iubound
- If $istart < 0 Then $istart = 0
- If $istart > $iend Then Return SetError(2, 0, -1)
- Local $iminindex = $istart
- If $icompnumeric Then
- For $i = $istart To $iend
- If Number($avarray[$iminindex]) > Number($avarray[$i]) Then $iminindex = $i
- Next
- Else
- For $i = $istart To $iend
- If $avarray[$iminindex] > $avarray[$i] Then $iminindex = $i
- Next
- EndIf
- Return $iminindex
- EndFunc
- Func _arraypermute(ByRef $avarray, $sdelim = "")
- If NOT IsArray($avarray) Then Return SetError(1, 0, 0)
- If UBound($avarray, 0) <> 1 Then Return SetError(2, 0, 0)
- Local $isize = UBound($avarray), $ifactorial = 1, $aidx[$isize], $aresult[1], $icount = 1
- For $i = 0 To $isize - 1
- $aidx[$i] = $i
- Next
- For $i = $isize To 1 Step -1
- $ifactorial *= $i
- Next
- ReDim $aresult[$ifactorial + 1]
- $aresult[0] = $ifactorial
- __array_exeterinternal($avarray, 0, $isize, $sdelim, $aidx, $aresult, $icount)
- Return $aresult
- EndFunc
- Func _arraypop(ByRef $avarray)
- If (NOT IsArray($avarray)) Then Return SetError(1, 0, "")
- If UBound($avarray, 0) <> 1 Then Return SetError(2, 0, "")
- Local $iubound = UBound($avarray) - 1, $slastval = $avarray[$iubound]
- If NOT $iubound Then
- $avarray = ""
- Else
- ReDim $avarray[$iubound]
- EndIf
- Return $slastval
- EndFunc
- Func _arraypush(ByRef $avarray, $vvalue, $idirection = 0)
- If (NOT IsArray($avarray)) Then Return SetError(1, 0, 0)
- If UBound($avarray, 0) <> 1 Then Return SetError(3, 0, 0)
- Local $iubound = UBound($avarray) - 1
- If IsArray($vvalue) Then
- Local $iubounds = UBound($vvalue)
- If ($iubounds - 1) > $iubound Then Return SetError(2, 0, 0)
- If $idirection Then
- For $i = $iubound To $iubounds Step -1
- $avarray[$i] = $avarray[$i - $iubounds]
- Next
- For $i = 0 To $iubounds - 1
- $avarray[$i] = $vvalue[$i]
- Next
- Else
- For $i = 0 To $iubound - $iubounds
- $avarray[$i] = $avarray[$i + $iubounds]
- Next
- For $i = 0 To $iubounds - 1
- $avarray[$i + $iubound - $iubounds + 1] = $vvalue[$i]
- Next
- EndIf
- Else
- If $idirection Then
- For $i = $iubound To 1 Step -1
- $avarray[$i] = $avarray[$i - 1]
- Next
- $avarray[0] = $vvalue
- Else
- For $i = 0 To $iubound - 1
- $avarray[$i] = $avarray[$i + 1]
- Next
- $avarray[$iubound] = $vvalue
- EndIf
- EndIf
- Return 1
- EndFunc
- Func _arrayreverse(ByRef $avarray, $istart = 0, $iend = 0)
- If NOT IsArray($avarray) Then Return SetError(1, 0, 0)
- If UBound($avarray, 0) <> 1 Then Return SetError(3, 0, 0)
- Local $vtmp, $iubound = UBound($avarray) - 1
- If $iend < 1 OR $iend > $iubound Then $iend = $iubound
- If $istart < 0 Then $istart = 0
- If $istart > $iend Then Return SetError(2, 0, 0)
- For $i = $istart To Int(($istart + $iend - 1) / 2)
- $vtmp = $avarray[$i]
- $avarray[$i] = $avarray[$iend]
- $avarray[$iend] = $vtmp
- $iend -= 1
- Next
- Return 1
- EndFunc
- Func _arraysearch(Const ByRef $avarray, $vvalue, $istart = 0, $iend = 0, $icase = 0, $ipartial = 0, $iforward = 1, $isubitem = -1)
- If NOT IsArray($avarray) Then Return SetError(1, 0, -1)
- If UBound($avarray, 0) > 2 OR UBound($avarray, 0) < 1 Then Return SetError(2, 0, -1)
- Local $iubound = UBound($avarray) - 1
- If $iend < 1 OR $iend > $iubound Then $iend = $iubound
- If $istart < 0 Then $istart = 0
- If $istart > $iend Then Return SetError(4, 0, -1)
- Local $istep = 1
- If NOT $iforward Then
- Local $itmp = $istart
- $istart = $iend
- $iend = $itmp
- $istep = -1
- EndIf
- Switch UBound($avarray, 0)
- Case 1
- If NOT $ipartial Then
- If NOT $icase Then
- For $i = $istart To $iend Step $istep
- If $avarray[$i] = $vvalue Then Return $i
- Next
- Else
- For $i = $istart To $iend Step $istep
- If $avarray[$i] == $vvalue Then Return $i
- Next
- EndIf
- Else
- For $i = $istart To $iend Step $istep
- If StringInStr($avarray[$i], $vvalue, $icase) > 0 Then Return $i
- Next
- EndIf
- Case 2
- Local $iuboundsub = UBound($avarray, 2) - 1
- If $isubitem > $iuboundsub Then $isubitem = $iuboundsub
- If $isubitem < 0 Then
- $isubitem = 0
- Else
- $iuboundsub = $isubitem
- EndIf
- For $j = $isubitem To $iuboundsub
- If NOT $ipartial Then
- If NOT $icase Then
- For $i = $istart To $iend Step $istep
- If $avarray[$i][$j] = $vvalue Then Return $i
- Next
- Else
- For $i = $istart To $iend Step $istep
- If $avarray[$i][$j] == $vvalue Then Return $i
- Next
- EndIf
- Else
- For $i = $istart To $iend Step $istep
- If StringInStr($avarray[$i][$j], $vvalue, $icase) > 0 Then Return $i
- Next
- EndIf
- Next
- Case Else
- Return SetError(7, 0, -1)
- EndSwitch
- Return SetError(6, 0, -1)
- EndFunc
- Func _arraysort(ByRef $avarray, $idescending = 0, $istart = 0, $iend = 0, $isubitem = 0)
- If NOT IsArray($avarray) Then Return SetError(1, 0, 0)
- Local $iubound = UBound($avarray) - 1
- If $iend < 1 OR $iend > $iubound Then $iend = $iubound
- If $istart < 0 Then $istart = 0
- If $istart > $iend Then Return SetError(2, 0, 0)
- Switch UBound($avarray, 0)
- Case 1
- __arrayquicksort1d($avarray, $istart, $iend)
- If $idescending Then _arrayreverse($avarray, $istart, $iend)
- Case 2
- Local $isubmax = UBound($avarray, 2) - 1
- If $isubitem > $isubmax Then Return SetError(3, 0, 0)
- If $idescending Then
- $idescending = -1
- Else
- $idescending = 1
- EndIf
- __arrayquicksort2d($avarray, $idescending, $istart, $iend, $isubitem, $isubmax)
- Case Else
- Return SetError(4, 0, 0)
- EndSwitch
- Return 1
- EndFunc
- Func __arrayquicksort1d(ByRef $avarray, ByRef $istart, ByRef $iend)
- If $iend <= $istart Then Return
- Local $vtmp
- If ($iend - $istart) < 15 Then
- Local $vcur
- For $i = $istart + 1 To $iend
- $vtmp = $avarray[$i]
- If IsNumber($vtmp) Then
- For $j = $i - 1 To $istart Step -1
- $vcur = $avarray[$j]
- If ($vtmp >= $vcur AND IsNumber($vcur)) OR (NOT IsNumber($vcur) AND StringCompare($vtmp, $vcur) >= 0) Then ExitLoop
- $avarray[$j + 1] = $vcur
- Next
- Else
- For $j = $i - 1 To $istart Step -1
- If (StringCompare($vtmp, $avarray[$j]) >= 0) Then ExitLoop
- $avarray[$j + 1] = $avarray[$j]
- Next
- EndIf
- $avarray[$j + 1] = $vtmp
- Next
- Return
- EndIf
- Local $l = $istart, $r = $iend, $vpivot = $avarray[Int(($istart + $iend) / 2)], $fnum = IsNumber($vpivot)
- Do
- If $fnum Then
- While ($avarray[$l] < $vpivot AND IsNumber($avarray[$l])) OR (NOT IsNumber($avarray[$l]) AND StringCompare($avarray[$l], $vpivot) < 0)
- $l += 1
- WEnd
- While ($avarray[$r] > $vpivot AND IsNumber($avarray[$r])) OR (NOT IsNumber($avarray[$r]) AND StringCompare($avarray[$r], $vpivot) > 0)
- $r -= 1
- WEnd
- Else
- While (StringCompare($avarray[$l], $vpivot) < 0)
- $l += 1
- WEnd
- While (StringCompare($avarray[$r], $vpivot) > 0)
- $r -= 1
- WEnd
- EndIf
- If $l <= $r Then
- $vtmp = $avarray[$l]
- $avarray[$l] = $avarray[$r]
- $avarray[$r] = $vtmp
- $l += 1
- $r -= 1
- EndIf
- Until $l > $r
- __arrayquicksort1d($avarray, $istart, $r)
- __arrayquicksort1d($avarray, $l, $iend)
- EndFunc
- Func __arrayquicksort2d(ByRef $avarray, ByRef $istep, ByRef $istart, ByRef $iend, ByRef $isubitem, ByRef $isubmax)
- If $iend <= $istart Then Return
- Local $vtmp, $l = $istart, $r = $iend, $vpivot = $avarray[Int(($istart + $iend) / 2)][$isubitem], $fnum = IsNumber($vpivot)
- Do
- If $fnum Then
- While ($istep * ($avarray[$l][$isubitem] - $vpivot) < 0 AND IsNumber($avarray[$l][$isubitem])) OR (NOT IsNumber($avarray[$l][$isubitem]) AND $istep * StringCompare($avarray[$l][$isubitem], $vpivot) < 0)
- $l += 1
- WEnd
- While ($istep * ($avarray[$r][$isubitem] - $vpivot) > 0 AND IsNumber($avarray[$r][$isubitem])) OR (NOT IsNumber($avarray[$r][$isubitem]) AND $istep * StringCompare($avarray[$r][$isubitem], $vpivot) > 0)
- $r -= 1
- WEnd
- Else
- While ($istep * StringCompare($avarray[$l][$isubitem], $vpivot) < 0)
- $l += 1
- WEnd
- While ($istep * StringCompare($avarray[$r][$isubitem], $vpivot) > 0)
- $r -= 1
- WEnd
- EndIf
- If $l <= $r Then
- For $i = 0 To $isubmax
- $vtmp = $avarray[$l][$i]
- $avarray[$l][$i] = $avarray[$r][$i]
- $avarray[$r][$i] = $vtmp
- Next
- $l += 1
- $r -= 1
- EndIf
- Until $l > $r
- __arrayquicksort2d($avarray, $istep, $istart, $r, $isubitem, $isubmax)
- __arrayquicksort2d($avarray, $istep, $l, $iend, $isubitem, $isubmax)
- EndFunc
- Func _arrayswap(ByRef $vitem1, ByRef $vitem2)
- Local $vtmp = $vitem1
- $vitem1 = $vitem2
- $vitem2 = $vtmp
- EndFunc
- Func _arraytoclip(Const ByRef $avarray, $istart = 0, $iend = 0)
- Local $sresult = _arraytostring($avarray, @CR, $istart, $iend)
- If @error Then Return SetError(@error, 0, 0)
- Return ClipPut($sresult)
- EndFunc
- Func _arraytostring(Const ByRef $avarray, $sdelim = "|", $istart = 0, $iend = 0)
- If NOT IsArray($avarray) Then Return SetError(1, 0, "")
- If UBound($avarray, 0) <> 1 Then Return SetError(3, 0, "")
- Local $sresult, $iubound = UBound($avarray) - 1
- If $iend < 1 OR $iend > $iubound Then $iend = $iubound
- If $istart < 0 Then $istart = 0
- If $istart > $iend Then Return SetError(2, 0, "")
- For $i = $istart To $iend
- $sresult &= $avarray[$i] & $sdelim
- Next
- Return StringTrimRight($sresult, StringLen($sdelim))
- EndFunc
- Func _arraytrim(ByRef $avarray, $itrimnum, $idirection = 0, $istart = 0, $iend = 0)
- If NOT IsArray($avarray) Then Return SetError(1, 0, 0)
- If UBound($avarray, 0) <> 1 Then Return SetError(2, 0, 0)
- Local $iubound = UBound($avarray) - 1
- If $iend < 1 OR $iend > $iubound Then $iend = $iubound
- If $istart < 0 Then $istart = 0
- If $istart > $iend Then Return SetError(5, 0, 0)
- If $idirection Then
- For $i = $istart To $iend
- $avarray[$i] = StringTrimRight($avarray[$i], $itrimnum)
- Next
- Else
- For $i = $istart To $iend
- $avarray[$i] = StringTrimLeft($avarray[$i], $itrimnum)
- Next
- EndIf
- Return 1
- EndFunc
- Func _arrayunique($aarray, $idimension = 1, $ibase = 0, $icase = 0, $vdelim = "|")
- Local $iubounddim
- If $vdelim = "|" Then $vdelim = Chr(1)
- If NOT IsArray($aarray) Then Return SetError(1, 0, 0)
- If NOT $idimension > 0 Then
- Return SetError(3, 0, 0)
- Else
- $iubounddim = UBound($aarray, 1)
- If @error Then Return SetError(3, 0, 0)
- If $idimension > 1 Then
- Local $aarraytmp[1]
- For $i = 0 To $iubounddim - 1
- _arrayadd($aarraytmp, $aarray[$i][$idimension - 1])
- Next
- _arraydelete($aarraytmp, 0)
- Else
- If UBound($aarray, 0) = 1 Then
- Dim $aarraytmp[1]
- For $i = 0 To $iubounddim - 1
- _arrayadd($aarraytmp, $aarray[$i])
- Next
- _arraydelete($aarraytmp, 0)
- Else
- Dim $aarraytmp[1]
- For $i = 0 To $iubounddim - 1
- _arrayadd($aarraytmp, $aarray[$i][$idimension - 1])
- Next
- _arraydelete($aarraytmp, 0)
- EndIf
- EndIf
- EndIf
- Local $shold
- For $icc = $ibase To UBound($aarraytmp) - 1
- If NOT StringInStr($vdelim & $shold, $vdelim & $aarraytmp[$icc] & $vdelim, $icase) Then $shold &= $aarraytmp[$icc] & $vdelim
- Next
- If $shold Then
- $aarraytmp = StringSplit(StringTrimRight($shold, StringLen($vdelim)), $vdelim, 1)
- Return $aarraytmp
- EndIf
- Return SetError(2, 0, 0)
- EndFunc
- Func __array_exeterinternal(ByRef $avarray, $istart, $isize, $sdelim, ByRef $aidx, ByRef $aresult, ByRef $icount)
- If $istart == $isize - 1 Then
- For $i = 0 To $isize - 1
- $aresult[$icount] &= $avarray[$aidx[$i]] & $sdelim
- Next
- If $sdelim <> "" Then $aresult[$icount] = StringTrimRight($aresult[$icount], 1)
- $icount += 1
- Else
- Local $itemp
- For $i = $istart To $isize - 1
- $itemp = $aidx[$i]
- $aidx[$i] = $aidx[$istart]
- $aidx[$istart] = $itemp
- __array_exeterinternal($avarray, $istart + 1, $isize, $sdelim, $aidx, $aresult, $icount)
- $aidx[$istart] = $aidx[$i]
- $aidx[$i] = $itemp
- Next
- EndIf
- EndFunc
- Func __array_combinations($in, $ir)
- Local $i_total = 1
- For $i = $ir To 1 Step -1
- $i_total *= ($in / $i)
- $in -= 1
- Next
- Return Round($i_total)
- EndFunc
- Func __array_getnext($in, $ir, ByRef $ileft, $itotal, ByRef $aidx)
- If $ileft == $itotal Then
- $ileft -= 1
- Return
- EndIf
- Local $i = $ir - 1
- While $aidx[$i] == $in - $ir + $i
- $i -= 1
- WEnd
- $aidx[$i] += 1
- For $j = $i + 1 To $ir - 1
- $aidx[$j] = $aidx[$i] + $j - $i
- Next
- $ileft -= 1
- EndFunc
- Global Const $bs_groupbox = 7
- Global Const $bs_bottom = 2048
- Global Const $bs_center = 768
- Global Const $bs_defpushbutton = 1
- Global Const $bs_left = 256
- Global Const $bs_multiline = 8192
- Global Const $bs_pushbox = 10
- Global Const $bs_pushlike = 4096
- Global Const $bs_right = 512
- Global Const $bs_rightbutton = 32
- Global Const $bs_top = 1024
- Global Const $bs_vcenter = 3072
- Global Const $bs_flat = 32768
- Global Const $bs_icon = 64
- Global Const $bs_bitmap = 128
- Global Const $bs_notify = 16384
- Global Const $bs_splitbutton = 12
- Global Const $bs_defsplitbutton = 13
- Global Const $bs_commandlink = 14
- Global Const $bs_defcommandlink = 15
- Global Const $bcsif_glyph = 1
- Global Const $bcsif_image = 2
- Global Const $bcsif_style = 4
- Global Const $bcsif_size = 8
- Global Const $bcss_nosplit = 1
- Global Const $bcss_stretch = 2
- Global Const $bcss_alignleft = 4
- Global Const $bcss_image = 8
- Global Const $button_imagelist_align_left = 0
- Global Const $button_imagelist_align_right = 1
- Global Const $button_imagelist_align_top = 2
- Global Const $button_imagelist_align_bottom = 3
- Global Const $button_imagelist_align_center = 4
- Global Const $bs_3state = 5
- Global Const $bs_auto3state = 6
- Global Const $bs_autocheckbox = 3
- Global Const $bs_checkbox = 2
- Global Const $bs_radiobutton = 4
- Global Const $bs_autoradiobutton = 9
- Global Const $bs_ownerdraw = 11
- Global Const $gui_ss_default_button = 0
- Global Const $gui_ss_default_checkbox = 0
- Global Const $gui_ss_default_group = 0
- Global Const $gui_ss_default_radio = 0
- Global Const $bcm_first = 5632
- Global Const $bcm_getidealsize = ($bcm_first + 1)
- Global Const $bcm_getimagelist = ($bcm_first + 3)
- Global Const $bcm_getnote = ($bcm_first + 10)
- Global Const $bcm_getnotelength = ($bcm_first + 11)
- Global Const $bcm_getsplitinfo = ($bcm_first + 8)
- Global Const $bcm_gettextmargin = ($bcm_first + 5)
- Global Const $bcm_setdropdownstate = ($bcm_first + 6)
- Global Const $bcm_setimagelist = ($bcm_first + 2)
- Global Const $bcm_setnote = ($bcm_first + 9)
- Global Const $bcm_setshield = ($bcm_first + 12)
- Global Const $bcm_setsplitinfo = ($bcm_first + 7)
- Global Const $bcm_settextmargin = ($bcm_first + 4)
- Global Const $bm_click = 245
- Global Const $bm_getcheck = 240
- Global Const $bm_getimage = 246
- Global Const $bm_getstate = 242
- Global Const $bm_setcheck = 241
- Global Const $bm_setdontclick = 248
- Global Const $bm_setimage = 247
- Global Const $bm_setstate = 243
- Global Const $bm_setstyle = 244
- Global Const $bcn_first = -1250
- Global Const $bcn_dropdown = ($bcn_first + 2)
- Global Const $bcn_hotitemchange = ($bcn_first + 1)
- Global Const $bn_clicked = 0
- Global Const $bn_paint = 1
- Global Const $bn_hilite = 2
- Global Const $bn_unhilite = 3
- Global Const $bn_disable = 4
- Global Const $bn_doubleclicked = 5
- Global Const $bn_setfocus = 6
- Global Const $bn_killfocus = 7
- Global Const $bn_pushed = $bn_hilite
- Global Const $bn_unpushed = $bn_unhilite
- Global Const $bn_dblclk = $bn_doubleclicked
- Global Const $bst_checked = 1
- Global Const $bst_indeterminate = 2
- Global Const $bst_unchecked = 0
- Global Const $bst_focus = 8
- Global Const $bst_pushed = 4
- Global Const $bst_dontclick = 128
- Global Const $gdip_dashcapflat = 0
- Global Const $gdip_dashcapround = 2
- Global Const $gdip_dashcaptriangle = 3
- Global Const $gdip_dashstylesolid = 0
- Global Const $gdip_dashstyledash = 1
- Global Const $gdip_dashstyledot = 2
- Global Const $gdip_dashstyledashdot = 3
- Global Const $gdip_dashstyledashdotdot = 4
- Global Const $gdip_dashstylecustom = 5
- Global Const $gdip_epgchrominancetable = "{F2E455DC-09B3-4316-8260-676ADA32481C}"
- Global Const $gdip_epgcolordepth = "{66087055-AD66-4C7C-9A18-38A2310B8337}"
- Global Const $gdip_epgcompression = "{E09D739D-CCD4-44EE-8EBA-3FBF8BE4FC58}"
- Global Const $gdip_epgluminancetable = "{EDB33BCE-0266-4A77-B904-27216099E717}"
- Global Const $gdip_epgquality = "{1D5BE4B5-FA4A-452D-9CDD-5DB35105E7EB}"
- Global Const $gdip_epgrendermethod = "{6D42C53A-229A-4825-8BB7-5C99E2B9A8B8}"
- Global Const $gdip_epgsaveflag = "{292266FC-AC40-47BF-8CFC-A85B89A655DE}"
- Global Const $gdip_epgscanmethod = "{3A4E2661-3109-4E56-8536-42C156E7DCFA}"
- Global Const $gdip_epgtransformation = "{8D0EB2D1-A58E-4EA8-AA14-108074B7B6F9}"
- Global Const $gdip_epgversion = "{24D18C76-814A-41A4-BF53-1C219CCCF797}"
- Global Const $gdip_eptbyte = 1
- Global Const $gdip_eptascii = 2
- Global Const $gdip_eptshort = 3
- Global Const $gdip_eptlong = 4
- Global Const $gdip_eptrational = 5
- Global Const $gdip_eptlongrange = 6
- Global Const $gdip_eptundefined = 7
- Global Const $gdip_eptrationalrange = 8
- Global Const $gdip_errok = 0
- Global Const $gdip_errgenericerror = 1
- Global Const $gdip_errinvalidparameter = 2
- Global Const $gdip_erroutofmemory = 3
- Global Const $gdip_errobjectbusy = 4
- Global Const $gdip_errinsufficientbuffer = 5
- Global Const $gdip_errnotimplemented = 6
- Global Const $gdip_errwin32error = 7
- Global Const $gdip_errwrongstate = 8
- Global Const $gdip_erraborted = 9
- Global Const $gdip_errfilenotfound = 10
- Global Const $gdip_errvalueoverflow = 11
- Global Const $gdip_erraccessdenied = 12
- Global Const $gdip_errunknownimageformat = 13
- Global Const $gdip_errfontfamilynotfound = 14
- Global Const $gdip_errfontstylenotfound = 15
- Global Const $gdip_errnottruetypefont = 16
- Global Const $gdip_errunsupportedgdiversion = 17
- Global Const $gdip_errgdiplusnotinitialized = 18
- Global Const $gdip_errpropertynotfound = 19
- Global Const $gdip_errpropertynotsupported = 20
- Global Const $gdip_evtcompressionlzw = 2
- Global Const $gdip_evtcompressionccitt3 = 3
- Global Const $gdip_evtcompressionccitt4 = 4
- Global Const $gdip_evtcompressionrle = 5
- Global Const $gdip_evtcompressionnone = 6
- Global Const $gdip_evttransformrotate90 = 13
- Global Const $gdip_evttransformrotate180 = 14
- Global Const $gdip_evttransformrotate270 = 15
- Global Const $gdip_evttransformfliphorizontal = 16
- Global Const $gdip_evttransformflipvertical = 17
- Global Const $gdip_evtmultiframe = 18
- Global Const $gdip_evtlastframe = 19
- Global Const $gdip_evtflush = 20
- Global Const $gdip_evtframedimensionpage = 23
- Global Const $gdip_icfencoder = 1
- Global Const $gdip_icfdecoder = 2
- Global Const $gdip_icfsupportbitmap = 4
- Global Const $gdip_icfsupportvector = 8
- Global Const $gdip_icfseekableencode = 16
- Global Const $gdip_icfblockingdecode = 32
- Global Const $gdip_icfbuiltin = 65536
- Global Const $gdip_icfsystem = 131072
- Global Const $gdip_icfuser = 262144
- Global Const $gdip_ilmread = 1
- Global Const $gdip_ilmwrite = 2
- Global Const $gdip_ilmuserinputbuf = 4
- Global Const $gdip_linecapflat = 0
- Global Const $gdip_linecapsquare = 1
- Global Const $gdip_linecapround = 2
- Global Const $gdip_linecaptriangle = 3
- Global Const $gdip_linecapnoanchor = 16
- Global Const $gdip_linecapsquareanchor = 17
- Global Const $gdip_linecaproundanchor = 18
- Global Const $gdip_linecapdiamondanchor = 19
- Global Const $gdip_linecaparrowanchor = 20
- Global Const $gdip_linecapcustom = 255
- Global Const $gdip_pxf01indexed = 196865
- Global Const $gdip_pxf04indexed = 197634
- Global Const $gdip_pxf08indexed = 198659
- Global Const $gdip_pxf16grayscale = 1052676
- Global Const $gdip_pxf16rgb555 = 135173
- Global Const $gdip_pxf16rgb565 = 135174
- Global Const $gdip_pxf16argb1555 = 397319
- Global Const $gdip_pxf24rgb = 137224
- Global Const $gdip_pxf32rgb = 139273
- Global Const $gdip_pxf32argb = 2498570
- Global Const $gdip_pxf32pargb = 860171
- Global Const $gdip_pxf48rgb = 1060876
- Global Const $gdip_pxf64argb = 3424269
- Global Const $gdip_pxf64pargb = 1851406
- Global Const $gdip_imageformat_undefined = "{B96B3CA9-0728-11D3-9D7B-0000F81EF32E}"
- Global Const $gdip_imageformat_memorybmp = "{B96B3CAA-0728-11D3-9D7B-0000F81EF32E}"
- Global Const $gdip_imageformat_bmp = "{B96B3CAB-0728-11D3-9D7B-0000F81EF32E}"
- Global Const $gdip_imageformat_emf = "{B96B3CAC-0728-11D3-9D7B-0000F81EF32E}"
- Global Const $gdip_imageformat_wmf = "{B96B3CAD-0728-11D3-9D7B-0000F81EF32E}"
- Global Const $gdip_imageformat_jpeg = "{B96B3CAE-0728-11D3-9D7B-0000F81EF32E}"
- Global Const $gdip_imageformat_png = "{B96B3CAF-0728-11D3-9D7B-0000F81EF32E}"
- Global Const $gdip_imageformat_gif = "{B96B3CB0-0728-11D3-9D7B-0000F81EF32E}"
- Global Const $gdip_imageformat_tiff = "{B96B3CB1-0728-11D3-9D7B-0000F81EF32E}"
- Global Const $gdip_imageformat_exif = "{B96B3CB2-0728-11D3-9D7B-0000F81EF32E}"
- Global Const $gdip_imageformat_icon = "{B96B3CB5-0728-11D3-9D7B-0000F81EF32E}"
- Global Const $gdip_imagetype_unknown = 0
- Global Const $gdip_imagetype_bitmap = 1
- Global Const $gdip_imagetype_metafile = 2
- Global Const $gdip_imageflags_none = 0
- Global Const $gdip_imageflags_scalable = 1
- Global Const $gdip_imageflags_hasalpha = 2
- Global Const $gdip_imageflags_hastranslucent = 4
- Global Const $gdip_imageflags_partiallyscalable = 8
- Global Const $gdip_imageflags_colorspace_rgb = 16
- Global Const $gdip_imageflags_colorspace_cmyk = 32
- Global Const $gdip_imageflags_colorspace_gray = 64
- Global Const $gdip_imageflags_colorspace_ycbcr = 128
- Global Const $gdip_imageflags_colorspace_ycck = 256
- Global Const $gdip_imageflags_hasrealdpi = 4096
- Global Const $gdip_imageflags_hasrealpixelsize = 8192
- Global Const $gdip_imageflags_readonly = 65536
- Global Const $gdip_imageflags_caching = 131072
- Global Const $tagpoint = "long X;long Y"
- Global Const $tagrect = "long Left;long Top;long Right;long Bottom"
- Global Const $tagsize = "long X;long Y"
- Global Const $tagmargins = "int cxLeftWidth;int cxRightWidth;int cyTopHeight;int cyBottomHeight"
- Global Const $tagfiletime = "dword Lo;dword Hi"
- Global Const $tagsystemtime = "word Year;word Month;word Dow;word Day;word Hour;word Minute;word Second;word MSeconds"
- Global Const $tagtime_zone_information = "long Bias;wchar StdName[32];word StdDate[8];long StdBias;wchar DayName[32];word DayDate[8];long DayBias"
- Global Const $tagnmhdr = "hwnd hWndFrom;uint_ptr IDFrom;INT Code"
- 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;ptr szText"
- Global Const $tagnmcbeendedit = $tagnmhdr & ";bool fChanged;int NewSelection;ptr szText;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;long SizeX;long SizeY"
- 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 $taggdipbitmapdata = "uint Width;uint Height;int Stride;int Format;ptr Scan0;uint_ptr Reserved"
- Global Const $taggdipencoderparam = "byte GUID[16];dword Count;dword Type;ptr Values"
- Global Const $taggdipencoderparams = "dword Count;byte Params[0]"
- Global Const $taggdiprectf = "float X;float Y;float Width;float Height"
- 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 = "dword Count;byte Params[0]"
- 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 = "uint Flags;ptr Text;lparam Param;" & $tagpoint & ";uint Direction"
- Global Const $taglvhittestinfo = $tagpoint & ";uint Flags;int Item;int SubItem"
- Global Const $taglvitem = "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"
- Global Const $tagnmlistview = $tagnmhdr & ";int Item;int SubItem;uint NewState;uint OldState;uint Changed;" & "long ActionX;long ActionY;lparam Param"
- Global Const $tagnmlvcustomdraw = $tagnmhdr & ";dword dwDrawStage;handle hdc;long Left;long Top;long Right;long Bottom;" & "dword_ptr dwItemSpec;uint uItemState;lparam lItemlParam" & ";dword clrText;dword clrTextBk;int iSubItem;dword dwItemType;dword clrFace;int iIconEffect;" & "int iIconPhase;int iPartId;int iStateId;long TextLeft;long TextTop;long TextRight;long TextBottom;uint uAlign"
- Global Const $tagnmlvdispinfo = $tagnmhdr & ";" & $taglvitem
- Global Const $tagnmlvfinditem = $tagnmhdr & ";" & $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 = $tagnmhdr & ";align 1;word VKey;uint Flags"
- Global Const $tagnmlvscroll = $tagnmhdr & ";int DX;int DY"
- Global Const $tagmchittestinfo = "uint Size;" & $tagpoint & ";uint Hit;" & $tagsystemtime
- 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 & ";word BegYear;word BegMonth;word BegDOW;word BegDay;" & "word BegHour;word BegMinute;word BegSecond;word BegMSeconds;word EndYear;word EndMonth;word EndDOW;" & "word EndDay;word EndHour;word EndMinute;word EndSecond;word EndMSeconds"
- Global Const $tagnmobjectnotify = $tagnmhdr & ";int Item;ptr piid;ptr pObject;long Result"
- Global Const $tagnmtckeydown = $tagnmhdr & ";word VKey;uint Flags"
- Global Const $tagtvitem = "uint Mask;handle hItem;uint State;uint StateMask;ptr Text;int TextMax;int Image;int SelectedImage;" & "int Children;lparam Param"
- Global Const $tagtvitemex = $tagtvitem & ";int Integral"
- Global Const $tagnmtreeview = $tagnmhdr & ";uint Action;uint OldMask;handle OldhItem;uint OldState;uint OldStateMask;" & "ptr OldText;int OldTextMax;int OldImage;int OldSelectedImage;int OldChildren;lparam OldParam;uint NewMask;handle NewhItem;" & "uint NewState;uint NewStateMask;ptr NewText;int NewTextMax;int NewImage;int NewSelectedImage;int NewChildren;" & "lparam NewParam;long PointX;long PointY"
- Global Const $tagnmtvcustomdraw = $tagnmhdr & ";dword DrawStage;handle HDC;long Left;long Top;long Right;long Bottom;" & "dword_ptr ItemSpec;uint ItemState;lparam ItemParam;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 $tagtvhittestinfo = $tagpoint & ";uint Flags;handle Item"
- Global Const $tagnmtvkeydown = $tagnmhdr & ";word VKey;uint Flags"
- Global Const $tagnmmouse = $tagnmhdr & ";dword_ptr ItemSpec;dword_ptr ItemData;" & $tagpoint & ";lparam HitInfo"
- Global Const $tagtoken_privileges = "dword Count;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"
- Global Const $tagnmrebarautobreak = $tagnmhdr & ";uint uBand;uint wID;lparam lParam;uint uMsg;uint fStyleCurrent;bool fAutoBreak"
- Global Const $tagnmrbautosize = $tagnmhdr & ";bool fChanged;long TargetLeft;long TargetTop;long TargetRight;long TargetBottom;" & "long ActualLeft;long ActualTop;long ActualRight;long ActualBottom"
- Global Const $tagnmrebar = $tagnmhdr & ";dword dwMask;uint uBand;uint fStyle;uint wID;laram lParam"
- Global Const $tagnmrebarchevron = $tagnmhdr & ";uint uBand;uint wID;lparam lParam;" & $tagrect & ";lparam lParamNM"
- Global Const $tagnmrebarchildsize = $tagnmhdr & ";uint uBand;uint wID;long CLeft;long CTop;long CRight;long CBottom;" & "long BLeft;long BTop;long BRight;long BBottom"
- Global Const $tagcolorscheme = "dword Size;dword BtnHighlight;dword BtnShadow"
- Global Const $tagnmtoolbar = $tagnmhdr & ";int iItem;" & "int iBitmap;int idCommand;byte fsState;byte fsStyle;align;dword_ptr dwData;int_ptr iString" & ";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;align;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;dword Offset;dword OffsetHigh;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 $tagbitmapinfo = "dword Size;long Width;long Height;word Planes;word BitCount;dword Compression;dword SizeImage;" & "long XPelsPerMeter;long YPelsPerMeter;dword ClrUsed;dword ClrImportant;dword RGBQuad"
- Global Const $tagblendfunction = "byte Op;byte Flags;byte Alpha;byte Format"
- Global Const $tagguid = "dword Data1;word Data2;word Data3;byte Data4[8]"
- 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 = "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]"
- 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 $error_no_token = 1008
- 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_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_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_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_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 $tokenuser = 1
- Global Const $tokengroups = 2
- Global Const $tokenprivileges = 3
- Global Const $tokenowner = 4
- Global Const $tokenprimarygroup = 5
- Global Const $tokendefaultdacl = 6
- Global Const $tokensource = 7
- Global Const $tokentype = 8
- Global Const $tokenimpersonationlevel = 9
- Global Const $tokenstatistics = 10
- Global Const $tokenrestrictedsids = 11
- Global Const $tokensessionid = 12
- Global Const $tokengroupsandprivileges = 13
- Global Const $tokensessionreference = 14
- Global Const $tokensandboxinert = 15
- Global Const $tokenauditpolicy = 16
- Global Const $tokenorigin = 17
- Global Const $tokenelevationtype = 18
- Global Const $tokenlinkedtoken = 19
- Global Const $tokenelevation = 20
- Global Const $tokenhasrestrictions = 21
- Global Const $tokenaccessinformation = 22
- Global Const $tokenvirtualizationallowed = 23
- Global Const $tokenvirtualizationenabled = 24
- Global Const $tokenintegritylevel = 25
- Global Const $tokenuiaccess = 26
- Global Const $tokenmandatorypolicy = 27
- Global Const $tokenlogonsid = 28
- 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
- Func _winapi_getlasterror($curerr = @error, $curext = @extended)
- Local $aresult = DllCall("kernel32.dll", "dword", "GetLastError")
- Return SetError($curerr, $curext, $aresult[0])
- EndFunc
- Func _winapi_setlasterror($ierrcode, $curerr = @error, $curext = @extended)
- DllCall("kernel32.dll", "none", "SetLastError", "dword", $ierrcode)
- Return SetError($curerr, $curext)
- EndFunc
- Func _security__adjusttokenprivileges($htoken, $fdisableall, $pnewstate, $ibufferlen, $pprevstate = 0, $prequired = 0)
- Local $aresult = DllCall("advapi32.dll", "bool", "AdjustTokenPrivileges", "handle", $htoken, "bool", $fdisableall, "ptr", $pnewstate, "dword", $ibufferlen, "ptr", $pprevstate, "ptr", $prequired)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _security__getaccountsid($saccount, $ssystem = "")
- Local $aacct = _security__lookupaccountname($saccount, $ssystem)
- If @error Then Return SetError(@error, 0, 0)
- Return _security__stringsidtosid($aacct[0])
- EndFunc
- Func _security__getlengthsid($psid)
- If NOT _security__isvalidsid($psid) Then Return SetError(-1, 0, 0)
- Local $aresult = DllCall("advapi32.dll", "dword", "GetLengthSid", "ptr", $psid)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _security__gettokeninformation($htoken, $iclass)
- Local $aresult = DllCall("advapi32.dll", "bool", "GetTokenInformation", "handle", $htoken, "int", $iclass, "ptr", 0, "dword", 0, "dword*", 0)
- If @error Then Return SetError(@error, @extended, 0)
- If NOT $aresult[0] Then Return 0
- Local $tbuffer = DllStructCreate("byte[" & $aresult[5] & "]")
- Local $pbuffer = DllStructGetPtr($tbuffer)
- $aresult = DllCall("advapi32.dll", "bool", "GetTokenInformation", "handle", $htoken, "int", $iclass, "ptr", $pbuffer, "dword", $aresult[5], "dword*", 0)
- If @error Then Return SetError(@error, @extended, 0)
- If NOT $aresult[0] Then Return 0
- Return $tbuffer
- EndFunc
- Func _security__impersonateself($ilevel = 2)
- Local $aresult = DllCall("advapi32.dll", "bool", "ImpersonateSelf", "int", $ilevel)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _security__isvalidsid($psid)
- Local $aresult = DllCall("advapi32.dll", "bool", "IsValidSid", "ptr", $psid)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _security__lookupaccountname($saccount, $ssystem = "")
- Local $tdata = DllStructCreate("byte SID[256]")
- Local $psid = DllStructGetPtr($tdata, "SID")
- Local $aresult = DllCall("advapi32.dll", "bool", "LookupAccountNameW", "wstr", $ssystem, "wstr", $saccount, "ptr", $psid, "dword*", 256, "wstr", "", "dword*", 256, "int*", 0)
- If @error Then Return SetError(@error, @extended, 0)
- If NOT $aresult[0] Then Return 0
- Local $aacct[3]
- $aacct[0] = _security__sidtostringsid($psid)
- $aacct[1] = $aresult[5]
- $aacct[2] = $aresult[7]
- Return $aacct
- EndFunc
- Func _security__lookupaccountsid($vsid)
- Local $psid, $aacct[3]
- If IsString($vsid) Then
- Local $tsid = _security__stringsidtosid($vsid)
- $psid = DllStructGetPtr($tsid)
- Else
- $psid = $vsid
- EndIf
- If NOT _security__isvalidsid($psid) Then Return SetError(-1, 0, 0)
- Local $aresult = DllCall("advapi32.dll", "bool", "LookupAccountSidW", "ptr", 0, "ptr", $psid, "wstr", "", "dword*", 256, "wstr", "", "dword*", 256, "int*", 0)
- If @error Then Return SetError(@error, @extended, 0)
- If NOT $aresult[0] Then Return 0
- Local $aacct[3]
- $aacct[0] = $aresult[3]
- $aacct[1] = $aresult[5]
- $aacct[2] = $aresult[7]
- Return $aacct
- EndFunc
- Func _security__lookupprivilegevalue($ssystem, $sname)
- Local $aresult = DllCall("advapi32.dll", "int", "LookupPrivilegeValueW", "wstr", $ssystem, "wstr", $sname, "int64*", 0)
- If @error Then Return SetError(@error, @extended, 0)
- Return SetError(0, $aresult[0], $aresult[3])
- EndFunc
- Func _security__openprocesstoken($hprocess, $iaccess)
- Local $aresult = DllCall("advapi32.dll", "int", "OpenProcessToken", "handle", $hprocess, "dword", $iaccess, "ptr", 0)
- If @error Then Return SetError(@error, @extended, 0)
- Return SetError(0, $aresult[0], $aresult[3])
- EndFunc
- Func _security__openthreadtoken($iaccess, $hthread = 0, $fopenasself = False)
- If $hthread = 0 Then $hthread = DllCall("kernel32.dll", "handle", "GetCurrentThread")
- If @error Then Return SetError(@error, @extended, 0)
- Local $aresult = DllCall("advapi32.dll", "bool", "OpenThreadToken", "handle", $hthread[0], "dword", $iaccess, "int", $fopenasself, "ptr*", 0)
- If @error Then Return SetError(@error, @extended, 0)
- Return SetError(0, $aresult[0], $aresult[4])
- EndFunc
- Func _security__openthreadtokenex($iaccess, $hthread = 0, $fopenasself = False)
- Local $htoken = _security__openthreadtoken($iaccess, $hthread, $fopenasself)
- If $htoken = 0 Then
- If _winapi_getlasterror() <> $error_no_token Then Return SetError(-3, _winapi_getlasterror(), 0)
- If NOT _security__impersonateself() Then Return SetError(-1, _winapi_getlasterror(), 0)
- $htoken = _security__openthreadtoken($iaccess, $hthread, $fopenasself)
- If $htoken = 0 Then Return SetError(-2, _winapi_getlasterror(), 0)
- EndIf
- Return $htoken
- EndFunc
- Func _security__setprivilege($htoken, $sprivilege, $fenable)
- Local $iluid = _security__lookupprivilegevalue("", $sprivilege)
- If $iluid = 0 Then Return SetError(-1, 0, False)
- Local $tcurrstate = DllStructCreate($tagtoken_privileges)
- Local $pcurrstate = DllStructGetPtr($tcurrstate)
- Local $icurrstate = DllStructGetSize($tcurrstate)
- Local $tprevstate = DllStructCreate($tagtoken_privileges)
- Local $pprevstate = DllStructGetPtr($tprevstate)
- Local $iprevstate = DllStructGetSize($tprevstate)
- Local $trequired = DllStructCreate("int Data")
- Local $prequired = DllStructGetPtr($trequired)
- DllStructSetData($tcurrstate, "Count", 1)
- DllStructSetData($tcurrstate, "LUID", $iluid)
- If NOT _security__adjusttokenprivileges($htoken, False, $pcurrstate, $icurrstate, $pprevstate, $prequired) Then Return SetError(-2, @error, False)
- DllStructSetData($tprevstate, "Count", 1)
- DllStructSetData($tprevstate, "LUID", $iluid)
- Local $iattributes = DllStructGetData($tprevstate, "Attributes")
- If $fenable 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, $pprevstate, $iprevstate, $pcurrstate, $prequired) Then Return SetError(-3, @error, False)
- Return True
- EndFunc
- Func _security__sidtostringsid($psid)
- If NOT _security__isvalidsid($psid) Then Return SetError(-1, 0, "")
- Local $aresult = DllCall("advapi32.dll", "int", "ConvertSidToStringSidW", "ptr", $psid, "ptr*", 0)
- If @error Then Return SetError(@error, @extended, "")
- If NOT $aresult[0] Then Return ""
- Local $tbuffer = DllStructCreate("wchar Text[256]", $aresult[2])
- Local $ssid = DllStructGetData($tbuffer, "Text")
- DllCall("Kernel32.dll", "ptr", "LocalFree", "ptr", $aresult[2])
- Return $ssid
- EndFunc
- Func _security__sidtypestr($itype)
- Switch $itype
- Case 1
- Return "User"
- Case 2
- Return "Group"
- Case 3
- Return "Domain"
- Case 4
- Return "Alias"
- Case 5
- Return "Well Known Group"
- Case 6
- Return "Deleted Account"
- Case 7
- Return "Invalid"
- Case 8
- Return "Invalid"
- Case 9
- Return "Computer"
- Case Else
- Return "Unknown SID Type"
- EndSwitch
- EndFunc
- Func _security__stringsidtosid($ssid)
- Local $aresult = DllCall("advapi32.dll", "bool", "ConvertStringSidToSidW", "wstr", $ssid, "ptr*", 0)
- If @error Then Return SetError(@error, @extended, 0)
- If NOT $aresult[0] Then Return 0
- Local $isize = _security__getlengthsid($aresult[2])
- Local $tbuffer = DllStructCreate("byte Data[" & $isize & "]", $aresult[2])
- Local $tsid = DllStructCreate("byte Data[" & $isize & "]")
- DllStructSetData($tsid, "Data", DllStructGetData($tbuffer, "Data"))
- DllCall("kernel32.dll", "ptr", "LocalFree", "ptr", $aresult[2])
- Return $tsid
- 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 $__gainprocess_winapi[64][2] = [[0, 0]]
- Global $__gawinlist_winapi[64][2] = [[0, 0]]
- Global Const $__winapiconstant_wm_setfont = 48
- 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
- Global Const $__winapiconstant_format_message_allocate_buffer = 256
- Global Const $__winapiconstant_format_message_from_system = 4096
- Global Const $__winapiconstant_logpixelsx = 88
- Global Const $__winapiconstant_logpixelsy = 90
- Global Const $hgdi_error = Ptr(-1)
- Global Const $invalid_handle_value = Ptr(-1)
- Global Const $clr_invalid = -1
- Global Const $__winapiconstant_flashw_caption = 1
- Global Const $__winapiconstant_flashw_tray = 2
- Global Const $__winapiconstant_flashw_timer = 4
- Global Const $__winapiconstant_flashw_timernofg = 12
- Global Const $__winapiconstant_gw_hwndnext = 2
- Global Const $__winapiconstant_gw_child = 5
- Global Const $__winapiconstant_di_mask = 1
- Global Const $__winapiconstant_di_image = 2
- Global Const $__winapiconstant_di_normal = 3
- Global Const $__winapiconstant_di_compat = 4
- Global Const $__winapiconstant_di_defaultsize = 8
- Global Const $__winapiconstant_di_nomirror = 16
- Global Const $__winapiconstant_display_device_attached_to_desktop = 1
- Global Const $__winapiconstant_display_device_primary_device = 4
- Global Const $__winapiconstant_display_device_mirroring_driver = 8
- Global Const $__winapiconstant_display_device_vga_compatible = 16
- Global Const $__winapiconstant_display_device_removable = 32
- Global Const $__winapiconstant_display_device_modespruned = 134217728
- 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
- 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 $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 = -1
- 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 $tagcursorinfo = "dword Size;dword Flags;handle hCursor;" & $tagpoint
- Global Const $tagdisplay_device = "dword Size;wchar Name[32];wchar String[128];dword Flags;wchar ID[128];wchar Key[128]"
- Global Const $tagflashwinfo = "uint Size;hwnd hWnd;dword Flags;uint Count;dword TimeOut"
- Global Const $tagiconinfo = "bool Icon;dword XHotSpot;dword YHotSpot;handle hMask;handle hColor"
- Global Const $tagmemorystatusex = "dword Length;dword MemoryLoad;" & "uint64 TotalPhys;uint64 AvailPhys;uint64 TotalPageFile;uint64 AvailPageFile;" & "uint64 TotalVirtual;uint64 AvailVirtual;uint64 AvailExtendedVirtual"
- Func _winapi_attachconsole($iprocessid = -1)
- Local $aresult = DllCall("kernel32.dll", "bool", "AttachConsole", "dword", $iprocessid)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_attachthreadinput($iattach, $iattachto, $fattach)
- Local $aresult = DllCall("user32.dll", "bool", "AttachThreadInput", "dword", $iattach, "dword", $iattachto, "bool", $fattach)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- 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_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_callnexthookex($hhk, $icode, $wparam, $lparam)
- Local $aresult = DllCall("user32.dll", "lresult", "CallNextHookEx", "handle", $hhk, "int", $icode, "wparam", $wparam, "lparam", $lparam)
- If @error Then Return SetError(@error, @extended, -1)
- Return $aresult[0]
- EndFunc
- Func _winapi_callwindowproc($lpprevwndfunc, $hwnd, $msg, $wparam, $lparam)
- Local $aresult = DllCall("user32.dll", "lresult", "CallWindowProc", "ptr", $lpprevwndfunc, "hwnd", $hwnd, "uint", $msg, "wparam", $wparam, "lparam", $lparam)
- If @error Then Return SetError(@error, @extended, -1)
- Return $aresult[0]
- EndFunc
- Func _winapi_clienttoscreen($hwnd, ByRef $tpoint)
- Local $ppoint = DllStructGetPtr($tpoint)
- DllCall("user32.dll", "bool", "ClientToScreen", "hwnd", $hwnd, "ptr", $ppoint)
- Return SetError(@error, @extended, $tpoint)
- EndFunc
- 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_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_commdlgextendederror()
- Local Const $cderr_dialogfailure = 65535
- Local Const $cderr_findresfailure = 6
- Local Const $cderr_initialization = 2
- Local Const $cderr_loadresfailure = 7
- Local Const $cderr_loadstrfailure = 5
- Local Const $cderr_lockresfailure = 8
- Local Const $cderr_memallocfailure = 9
- Local Const $cderr_memlockfailure = 10
- Local Const $cderr_nohinstance = 4
- Local Const $cderr_nohook = 11
- Local Const $cderr_notemplate = 3
- Local Const $cderr_registermsgfail = 12
- Local Const $cderr_structsize = 1
- Local Const $fnerr_buffertoosmall = 12291
- Local Const $fnerr_invalidfilename = 12290
- Local Const $fnerr_subclassfailure = 12289
- Local $aresult = DllCall("comdlg32.dll", "dword", "CommDlgExtendedError")
- If @error Then Return SetError(@error, @extended, 0)
- Switch $aresult[0]
- Case $cderr_dialogfailure
- Return SetError($aresult[0], 0, "The dialog box could not be created." & @LF & "The common dialog box function's call to the DialogBox function failed." & @LF & "For example, this error occurs if the common dialog box call specifies an invalid window handle.")
- Case $cderr_findresfailure
- Return SetError($aresult[0], 0, "The common dialog box function failed to find a specified resource.")
- Case $cderr_initialization
- Return SetError($aresult[0], 0, "The common dialog box function failed during initialization." & @LF & "This error often occurs when sufficient memory is not available.")
- Case $cderr_loadresfailure
- Return SetError($aresult[0], 0, "The common dialog box function failed to load a specified resource.")
- Case $cderr_loadstrfailure
- Return SetError($aresult[0], 0, "The common dialog box function failed to load a specified string.")
- Case $cderr_lockresfailure
- Return SetError($aresult[0], 0, "The common dialog box function failed to lock a specified resource.")
- Case $cderr_memallocfailure
- Return SetError($aresult[0], 0, "The common dialog box function was unable to allocate memory for internal structures.")
- Case $cderr_memlockfailure
- Return SetError($aresult[0], 0, "The common dialog box function was unable to lock the memory associated with a handle.")
- Case $cderr_nohinstance
- Return SetError($aresult[0], 0, "The ENABLETEMPLATE flag was set in the Flags member of the initialization structure for the corresponding common dialog box," & @LF & "but you failed to provide a corresponding instance handle.")
- Case $cderr_nohook
- Return SetError($aresult[0], 0, "The ENABLEHOOK flag was set in the Flags member of the initialization structure for the corresponding common dialog box," & @LF & "but you failed to provide a pointer to a corresponding hook procedure.")
- Case $cderr_notemplate
- Return SetError($aresult[0], 0, "The ENABLETEMPLATE flag was set in the Flags member of the initialization structure for the corresponding common dialog box," & @LF & "but you failed to provide a corresponding template.")
- Case $cderr_registermsgfail
- Return SetError($aresult[0], 0, "The RegisterWindowMessage function returned an error code when it was called by the common dialog box function.")
- Case $cderr_structsize
- Return SetError($aresult[0], 0, "The lStructSize member of the initialization structure for the corresponding common dialog box is invalid")
- Case $fnerr_buffertoosmall
- Return SetError($aresult[0], 0, "The buffer pointed to by the lpstrFile member of the OPENFILENAME structure is too small for the file name specified by the user." & @LF & "The first two bytes of the lpstrFile buffer contain an integer value specifying the size, in TCHARs, required to receive the full name.")
- Case $fnerr_invalidfilename
- Return SetError($aresult[0], 0, "A file name is invalid.")
- Case $fnerr_subclassfailure
- Return SetError($aresult[0], 0, "An attempt to subclass a list box failed because sufficient memory was not available.")
- EndSwitch
- Return Hex($aresult[0])
- 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_createbitmap($iwidth, $iheight, $iplanes = 1, $ibitsperpel = 1, $pbits = 0)
- Local $aresult = DllCall("gdi32.dll", "handle", "CreateBitmap", "int", $iwidth, "int", $iheight, "uint", $iplanes, "uint", $ibitsperpel, "ptr", $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_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_createevent($pattributes = 0, $fmanualreset = True, $finitialstate = True, $sname = "")
- Local $snametype = "wstr"
- If $sname = "" Then
- $sname = 0
- $snametype = "ptr"
- EndIf
- Local $aresult = DllCall("kernel32.dll", "handle", "CreateEventW", "ptr", $pattributes, "bool", $fmanualreset, "bool", $finitialstate, $snametype, $sname)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_createfile($sfilename, $icreation, $iaccess = 4, $ishare = 0, $iattributes = 0, $psecurity = 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, "ptr", $psecurity, "dword", $icd, "dword", $ifa, "ptr", 0)
- If @error OR $aresult[0] = Ptr(-1) Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_createfont($nheight, $nwidth, $nescape = 0, $norientn = 0, $fnweight = $__winapiconstant_fw_normal, $bitalic = False, $bunderline = False, $bstrikeout = False, $ncharset = $__winapiconstant_default_charset, $noutputprec = $__winapiconstant_out_default_precis, $nclipprec = $__winapiconstant_clip_default_precis, $nquality = $__winapiconstant_default_quality, $npitch = 0, $szface = "Arial")
- Local $aresult = DllCall("gdi32.dll", "handle", "CreateFontW", "int", $nheight, "int", $nwidth, "int", $nescape, "int", $norientn, "int", $fnweight, "dword", $bitalic, "dword", $bunderline, "dword", $bstrikeout, "dword", $ncharset, "dword", $noutputprec, "dword", $nclipprec, "dword", $nquality, "dword", $npitch, "wstr", $szface)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_createfontindirect($tlogfont)
- Local $aresult = DllCall("gdi32.dll", "handle", "CreateFontIndirectW", "ptr", DllStructGetPtr($tlogfont))
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_createpen($ipenstyle, $iwidth, $ncolor)
- Local $aresult = DllCall("gdi32.dll", "handle", "CreatePen", "int", $ipenstyle, "int", $iwidth, "dword", $ncolor)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_createprocess($sappname, $scommand, $psecurity, $pthread, $finherit, $iflags, $penviron, $sdir, $pstartupinfo, $pprocess)
- Local $pcommand = 0
- Local $sappnametype = "wstr", $sdirtype = "wstr"
- If $sappname = "" Then
- $sappnametype = "ptr"
- $sappname = 0
- EndIf
- If $scommand <> "" Then
- Local $tcommand = DllStructCreate("wchar Text[" & 260 + 1 & "]")
- $pcommand = DllStructGetPtr($tcommand)
- DllStructSetData($tcommand, "Text", $scommand)
- EndIf
- If $sdir = "" Then
- $sdirtype = "ptr"
- $sdir = 0
- EndIf
- Local $aresult = DllCall("kernel32.dll", "bool", "CreateProcessW", $sappnametype, $sappname, "ptr", $pcommand, "ptr", $psecurity, "ptr", $pthread, "bool", $finherit, "dword", $iflags, "ptr", $penviron, $sdirtype, $sdir, "ptr", $pstartupinfo, "ptr", $pprocess)
- If @error Then Return SetError(@error, @extended, False)
- 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_createsolidbitmap($hwnd, $icolor, $iwidth, $iheight, $brgb = 1)
- Local $hdc = _winapi_getdc($hwnd)
- Local $hdestdc = _winapi_createcompatibledc($hdc)
- Local $hbitmap = _winapi_createcompatiblebitmap($hdc, $iwidth, $iheight)
- Local $hold = _winapi_selectobject($hdestdc, $hbitmap)
- Local $trect = DllStructCreate($tagrect)
- DllStructSetData($trect, 1, 0)
- DllStructSetData($trect, 2, 0)
- DllStructSetData($trect, 3, $iwidth)
- DllStructSetData($trect, 4, $iheight)
- If $brgb Then
- $icolor = BitOR(BitAND($icolor, 65280), BitShift(BitAND($icolor, 255), -16), BitShift(BitAND($icolor, 16711680), 16))
- EndIf
- Local $hbrush = _winapi_createsolidbrush($icolor)
- _winapi_fillrect($hdestdc, DllStructGetPtr($trect), $hbrush)
- If @error Then
- _winapi_deleteobject($hbitmap)
- $hbitmap = 0
- EndIf
- _winapi_deleteobject($hbrush)
- _winapi_releasedc($hwnd, $hdc)
- _winapi_selectobject($hdestdc, $hold)
- _winapi_deletedc($hdestdc)
- If NOT $hbitmap Then Return SetError(1, 0, 0)
- Return $hbitmap
- EndFunc
- Func _winapi_createsolidbrush($ncolor)
- Local $aresult = DllCall("gdi32.dll", "handle", "CreateSolidBrush", "dword", $ncolor)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- 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, "ptr", $pparam)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_defwindowproc($hwnd, $imsg, $iwparam, $ilparam)
- Local $aresult = DllCall("user32.dll", "lresult", "DefWindowProc", "hwnd", $hwnd, "uint", $imsg, "wparam", $iwparam, "lparam", $ilparam)
- 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_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_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_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_drawedge($hdc, $ptrrect, $nedgetype, $grfflags)
- Local $aresult = DllCall("user32.dll", "bool", "DrawEdge", "handle", $hdc, "ptr", $ptrrect, "uint", $nedgetype, "uint", $grfflags)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_drawframecontrol($hdc, $ptrrect, $ntype, $nstate)
- Local $aresult = DllCall("user32.dll", "bool", "DrawFrameControl", "handle", $hdc, "ptr", $ptrrect, "uint", $ntype, "uint", $nstate)
- 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 = $__winapiconstant_di_mask
- Case 2
- $ioptions = $__winapiconstant_di_image
- Case 3
- $ioptions = $__winapiconstant_di_normal
- Case 4
- $ioptions = $__winapiconstant_di_compat
- Case 5
- $ioptions = $__winapiconstant_di_defaultsize
- Case Else
- $ioptions = $__winapiconstant_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_drawline($hdc, $ix1, $iy1, $ix2, $iy2)
- _winapi_moveto($hdc, $ix1, $iy1)
- If @error Then Return SetError(@error, @extended, False)
- _winapi_lineto($hdc, $ix2, $iy2)
- If @error Then Return SetError(@error, @extended, False)
- Return True
- EndFunc
- Func _winapi_drawtext($hdc, $stext, ByRef $trect, $iflags)
- Local $aresult = DllCall("user32.dll", "int", "DrawTextW", "handle", $hdc, "wstr", $stext, "int", -1, "ptr", DllStructGetPtr($trect), "uint", $iflags)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_enablewindow($hwnd, $fenable = True)
- Local $aresult = DllCall("user32.dll", "bool", "EnableWindow", "hwnd", $hwnd, "bool", $fenable)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_enumdisplaydevices($sdevice, $idevnum)
- Local $pname = 0, $iflags = 0, $adevice[5]
- If $sdevice <> "" Then
- Local $tname = DllStructCreate("wchar Text[" & StringLen($sdevice) + 1 & "]")
- $pname = DllStructGetPtr($tname)
- DllStructSetData($tname, "Text", $sdevice)
- EndIf
- Local $tdevice = DllStructCreate($tagdisplay_device)
- Local $pdevice = DllStructGetPtr($tdevice)
- Local $idevice = DllStructGetSize($tdevice)
- DllStructSetData($tdevice, "Size", $idevice)
- DllCall("user32.dll", "bool", "EnumDisplayDevicesW", "ptr", $pname, "dword", $idevnum, "ptr", $pdevice, "dword", 1)
- If @error Then Return SetError(@error, @extended, 0)
- Local $in = DllStructGetData($tdevice, "Flags")
- If BitAND($in, $__winapiconstant_display_device_attached_to_desktop) <> 0 Then $iflags = BitOR($iflags, 1)
- If BitAND($in, $__winapiconstant_display_device_primary_device) <> 0 Then $iflags = BitOR($iflags, 2)
- If BitAND($in, $__winapiconstant_display_device_mirroring_driver) <> 0 Then $iflags = BitOR($iflags, 4)
- If BitAND($in, $__winapiconstant_display_device_vga_compatible) <> 0 Then $iflags = BitOR($iflags, 8)
- If BitAND($in, $__winapiconstant_display_device_removable) <> 0 Then $iflags = BitOR($iflags, 16)
- If BitAND($in, $__winapiconstant_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_enumwindows($fvisible = True, $hwnd = Default)
- __winapi_enumwindowsinit()
- If $hwnd = Default Then $hwnd = _winapi_getdesktopwindow()
- __winapi_enumwindowschild($hwnd, $fvisible)
- Return $__gawinlist_winapi
- EndFunc
- Func __winapi_enumwindowsadd($hwnd, $sclass = "")
- If $sclass = "" Then $sclass = _winapi_getclassname($hwnd)
- $__gawinlist_winapi[0][0] += 1
- Local $icount = $__gawinlist_winapi[0][0]
- If $icount >= $__gawinlist_winapi[0][1] Then
- ReDim $__gawinlist_winapi[$icount + 64][2]
- $__gawinlist_winapi[0][1] += 64
- EndIf
- $__gawinlist_winapi[$icount][0] = $hwnd
- $__gawinlist_winapi[$icount][1] = $sclass
- EndFunc
- Func __winapi_enumwindowschild($hwnd, $fvisible = True)
- $hwnd = _winapi_getwindow($hwnd, $__winapiconstant_gw_child)
- While $hwnd <> 0
- If (NOT $fvisible) OR _winapi_iswindowvisible($hwnd) Then
- __winapi_enumwindowschild($hwnd, $fvisible)
- __winapi_enumwindowsadd($hwnd)
- EndIf
- $hwnd = _winapi_getwindow($hwnd, $__winapiconstant_gw_hwndnext)
- WEnd
- EndFunc
- Func __winapi_enumwindowsinit()
- ReDim $__gawinlist_winapi[64][2]
- $__gawinlist_winapi[0][0] = 0
- $__gawinlist_winapi[0][1] = 64
- EndFunc
- Func _winapi_enumwindowspopup()
- __winapi_enumwindowsinit()
- Local $hwnd = _winapi_getwindow(_winapi_getdesktopwindow(), $__winapiconstant_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, $__winapiconstant_gw_hwndnext)
- WEnd
- Return $__gawinlist_winapi
- EndFunc
- Func _winapi_enumwindowstop()
- __winapi_enumwindowsinit()
- Local $hwnd = _winapi_getwindow(_winapi_getdesktopwindow(), $__winapiconstant_gw_child)
- While $hwnd <> 0
- If _winapi_iswindowvisible($hwnd) Then __winapi_enumwindowsadd($hwnd)
- $hwnd = _winapi_getwindow($hwnd, $__winapiconstant_gw_hwndnext)
- WEnd
- Return $__gawinlist_winapi
- EndFunc
- Func _winapi_expandenvironmentstrings($sstring)
- Local $aresult = DllCall("kernel32.dll", "dword", "ExpandEnvironmentStringsW", "wstr", $sstring, "wstr", "", "dword", 4096)
- If @error Then Return SetError(@error, @extended, "")
- Return $aresult[2]
- EndFunc
- Func _winapi_extracticonex($sfile, $iindex, $plarge, $psmall, $iicons)
- Local $aresult = DllCall("shell32.dll", "uint", "ExtractIconExW", "wstr", $sfile, "int", $iindex, "handle", $plarge, "handle", $psmall, "uint", $iicons)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_fatalappexit($smessage)
- DllCall("kernel32.dll", "none", "FatalAppExitW", "uint", 0, "wstr", $smessage)
- If @error Then Return SetError(@error, @extended)
- EndFunc
- Func _winapi_fillrect($hdc, $ptrrect, $hbrush)
- Local $aresult
- If IsPtr($hbrush) Then
- $aresult = DllCall("user32.dll", "int", "FillRect", "handle", $hdc, "ptr", $ptrrect, "handle", $hbrush)
- Else
- $aresult = DllCall("user32.dll", "int", "FillRect", "handle", $hdc, "ptr", $ptrrect, "dword", $hbrush)
- EndIf
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_findexecutable($sfilename, $sdirectory = "")
- Local $aresult = DllCall("shell32.dll", "INT", "FindExecutableW", "wstr", $sfilename, "wstr", $sdirectory, "wstr", "")
- If @error Then Return SetError(@error, @extended, 0)
- Return SetExtended($aresult[0], $aresult[3])
- 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, $finvert = True)
- Local $aresult = DllCall("user32.dll", "bool", "FlashWindow", "hwnd", $hwnd, "bool", $finvert)
- 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 $pflash = DllStructGetPtr($tflash)
- Local $iflash = DllStructGetSize($tflash)
- Local $imode = 0
- If BitAND($iflags, 1) <> 0 Then $imode = BitOR($imode, $__winapiconstant_flashw_caption)
- If BitAND($iflags, 2) <> 0 Then $imode = BitOR($imode, $__winapiconstant_flashw_tray)
- If BitAND($iflags, 4) <> 0 Then $imode = BitOR($imode, $__winapiconstant_flashw_timer)
- If BitAND($iflags, 8) <> 0 Then $imode = BitOR($imode, $__winapiconstant_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", "ptr", $pflash)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- 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_flushfilebuffers($hfile)
- Local $aresult = DllCall("kernel32.dll", "bool", "FlushFileBuffers", "handle", $hfile)
- 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 = "ptr"
- If IsString($pbuffer) Then $sbuffertype = "wstr"
- Local $aresult = DllCall("Kernel32.dll", "dword", "FormatMessageW", "dword", $iflags, "ptr", $psource, "dword", $imessageid, "dword", $ilanguageid, $sbuffertype, $pbuffer, "dword", $isize, "ptr", $varguments)
- If @error Then Return SetError(@error, @extended, 0)
- If $sbuffertype = "wstr" Then $pbuffer = $aresult[5]
- Return $aresult[0]
- EndFunc
- Func _winapi_framerect($hdc, $ptrrect, $hbrush)
- Local $aresult = DllCall("user32.dll", "int", "FrameRect", "handle", $hdc, "ptr", $ptrrect, "handle", $hbrush)
- If @error Then Return SetError(@error, @extended, False)
- 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_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_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_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_getclassname($hwnd)
- If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
- Local $aresult = DllCall("user32.dll", "int", "GetClassNameW", "hwnd", $hwnd, "wstr", "", "int", 4096)
- If @error Then Return SetError(@error, @extended, False)
- Return SetExtended($aresult[0], $aresult[2])
- 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_getclientrect($hwnd)
- Local $trect = DllStructCreate($tagrect)
- DllCall("user32.dll", "bool", "GetClientRect", "hwnd", $hwnd, "ptr", DllStructGetPtr($trect))
- If @error Then Return SetError(@error, @extended, 0)
- Return $trect
- 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_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_getcursorinfo()
- Local $tcursor = DllStructCreate($tagcursorinfo)
- Local $icursor = DllStructGetSize($tcursor)
- DllStructSetData($tcursor, "Size", $icursor)
- DllCall("user32.dll", "bool", "GetCursorInfo", "ptr", DllStructGetPtr($tcursor))
- If @error Then Return SetError(@error, @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_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_getdesktopwindow()
- Local $aresult = DllCall("user32.dll", "hwnd", "GetDesktopWindow")
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[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_getdibits($hdc, $hbmp, $istartscan, $iscanlines, $pbits, $pbi, $iusage)
- Local $aresult = DllCall("gdi32.dll", "int", "GetDIBits", "handle", $hdc, "handle", $hbmp, "uint", $istartscan, "uint", $iscanlines, "ptr", $pbits, "ptr", $pbi, "uint", $iusage)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- 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_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_getfocus()
- Local $aresult = DllCall("user32.dll", "hwnd", "GetFocus")
- 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_getguiresources($iflag = 0, $hprocess = -1)
- If $hprocess = -1 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_geticoninfo($hicon)
- Local $tinfo = DllStructCreate($tagiconinfo)
- DllCall("user32.dll", "bool", "GetIconInfo", "handle", $hicon, "ptr", DllStructGetPtr($tinfo))
- If @error Then Return SetError(@error, @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_getfilesizeex($hfile)
- Local $aresult = DllCall("kernel32.dll", "bool", "GetFileSizeEx", "handle", $hfile, "int64*", 0)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[2]
- EndFunc
- Func _winapi_getlasterrormessage()
- Local $tbufferptr = DllStructCreate("ptr")
- Local $pbufferptr = DllStructGetPtr($tbufferptr)
- Local $ncount = _winapi_formatmessage(BitOR($__winapiconstant_format_message_allocate_buffer, $__winapiconstant_format_message_from_system), 0, _winapi_getlasterror(), 0, $pbufferptr, 0, 0)
- If @error Then Return SetError(@error, 0, "")
- 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)
- EndIf
- _winapi_localfree($pbuffer)
- EndIf
- Return $stext
- EndFunc
- Func _winapi_getlayeredwindowattributes($hwnd, ByRef $i_transcolor, ByRef $transparency, $ascolorref = False)
- $i_transcolor = -1
- $transparency = -1
- Local $aresult = DllCall("user32.dll", "bool", "GetLayeredWindowAttributes", "hwnd", $hwnd, "dword*", $i_transcolor, "byte*", $transparency, "dword*", 0)
- If @error Then Return SetError(@error, @extended, 0)
- If NOT $ascolorref Then
- $aresult[2] = Hex(String($aresult[2]), 6)
- $aresult[2] = "0x" & StringMid($aresult[2], 5, 2) & StringMid($aresult[2], 3, 2) & StringMid($aresult[2], 1, 2)
- EndIf
- $i_transcolor = $aresult[2]
- $transparency = $aresult[3]
- Return $aresult[4]
- 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_getmousepos($ftoclient = 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 $ftoclient Then
- _winapi_screentoclient($hwnd, $tpoint)
- If @error Then Return SetError(@error, @extended, 0)
- EndIf
- Return $tpoint
- EndFunc
- Func _winapi_getmouseposx($ftoclient = False, $hwnd = 0)
- Local $tpoint = _winapi_getmousepos($ftoclient, $hwnd)
- If @error Then Return SetError(@error, @extended, 0)
- Return DllStructGetData($tpoint, "X")
- EndFunc
- Func _winapi_getmouseposy($ftoclient = False, $hwnd = 0)
- Local $tpoint = _winapi_getmousepos($ftoclient, $hwnd)
- If @error Then Return SetError(@error, @extended, 0)
- Return DllStructGetData($tpoint, "Y")
- EndFunc
- Func _winapi_getobject($hobject, $isize, $pobject)
- Local $aresult = DllCall("gdi32.dll", "int", "GetObject", "handle", $hobject, "int", $isize, "ptr", $pobject)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_getopenfilename($stitle = "", $sfilter = "All files (*.*)", $sinitaldir = ".", $sdefaultfile = "", $sdefaultext = "", $ifilterindex = 1, $iflags = 0, $iflagsex = 0, $hwndowner = 0)
- Local $ipathlen = 4096
- Local $inulls = 0
- Local $tofn = DllStructCreate($tagopenfilename)
- Local $afiles[1] = [0]
- Local $iflag = $iflags
- Local $asflines = StringSplit($sfilter, "|")
- Local $asfilter[$asflines[0] * 2 + 1]
- Local $istart, $ifinal, $stfilter
- $asfilter[0] = $asflines[0] * 2
- For $i = 1 To $asflines[0]
- $istart = StringInStr($asflines[$i], "(", 0, 1)
- $ifinal = StringInStr($asflines[$i], ")", 0, -1)
- $asfilter[$i * 2 - 1] = StringStripWS(StringLeft($asflines[$i], $istart - 1), 3)
- $asfilter[$i * 2] = StringStripWS(StringTrimRight(StringTrimLeft($asflines[$i], $istart), StringLen($asflines[$i]) - $ifinal + 1), 3)
- $stfilter &= "wchar[" & StringLen($asfilter[$i * 2 - 1]) + 1 & "];wchar[" & StringLen($asfilter[$i * 2]) + 1 & "];"
- Next
- Local $ttitle = DllStructCreate("wchar Title[" & StringLen($stitle) + 1 & "]")
- Local $tinitialdir = DllStructCreate("wchar InitDir[" & StringLen($sinitaldir) + 1 & "]")
- Local $tfilter = DllStructCreate($stfilter & "wchar")
- Local $tpath = DllStructCreate("wchar Path[" & $ipathlen & "]")
- Local $textn = DllStructCreate("wchar Extension[" & StringLen($sdefaultext) + 1 & "]")
- For $i = 1 To $asfilter[0]
- DllStructSetData($tfilter, $i, $asfilter[$i])
- Next
- DllStructSetData($ttitle, "Title", $stitle)
- DllStructSetData($tinitialdir, "InitDir", $sinitaldir)
- DllStructSetData($tpath, "Path", $sdefaultfile)
- DllStructSetData($textn, "Extension", $sdefaultext)
- DllStructSetData($tofn, "StructSize", DllStructGetSize($tofn))
- DllStructSetData($tofn, "hwndOwner", $hwndowner)
- DllStructSetData($tofn, "lpstrFilter", DllStructGetPtr($tfilter))
- DllStructSetData($tofn, "nFilterIndex", $ifilterindex)
- DllStructSetData($tofn, "lpstrFile", DllStructGetPtr($tpath))
- DllStructSetData($tofn, "nMaxFile", $ipathlen)
- DllStructSetData($tofn, "lpstrInitialDir", DllStructGetPtr($tinitialdir))
- DllStructSetData($tofn, "lpstrTitle", DllStructGetPtr($ttitle))
- DllStructSetData($tofn, "Flags", $iflag)
- DllStructSetData($tofn, "lpstrDefExt", DllStructGetPtr($textn))
- DllStructSetData($tofn, "FlagsEx", $iflagsex)
- DllCall("comdlg32.dll", "bool", "GetOpenFileNameW", "ptr", DllStructGetPtr($tofn))
- If @error Then Return SetError(@error, @extended, $afiles)
- If BitAND($iflags, $ofn_allowmultiselect) = $ofn_allowmultiselect AND BitAND($iflags, $ofn_explorer) = $ofn_explorer Then
- For $x = 1 To $ipathlen
- If DllStructGetData($tpath, "Path", $x) = Chr(0) Then
- DllStructSetData($tpath, "Path", "|", $x)
- $inulls += 1
- Else
- $inulls = 0
- EndIf
- If $inulls = 2 Then ExitLoop
- Next
- DllStructSetData($tpath, "Path", Chr(0), $x - 1)
- $afiles = StringSplit(DllStructGetData($tpath, "Path"), "|")
- If $afiles[0] = 1 Then Return __winapi_parsefiledialogpath(DllStructGetData($tpath, "Path"))
- Return StringSplit(DllStructGetData($tpath, "Path"), "|")
- ElseIf BitAND($iflags, $ofn_allowmultiselect) = $ofn_allowmultiselect Then
- $afiles = StringSplit(DllStructGetData($tpath, "Path"), " ")
- If $afiles[0] = 1 Then Return __winapi_parsefiledialogpath(DllStructGetData($tpath, "Path"))
- Return StringSplit(StringReplace(DllStructGetData($tpath, "Path"), " ", "|"), "|")
- Else
- Return __winapi_parsefiledialogpath(DllStructGetData($tpath, "Path"))
- EndIf
- EndFunc
- Func _winapi_getoverlappedresult($hfile, $poverlapped, ByRef $ibytes, $fwait = False)
- Local $aresult = DllCall("kernel32.dll", "bool", "GetOverlappedResult", "handle", $hfile, "ptr", $poverlapped, "dword*", 0, "bool", $fwait)
- If @error Then Return SetError(@error, @extended, False)
- $ibytes = $aresult[3]
- 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_getprocessaffinitymask($hprocess)
- Local $aresult = DllCall("kernel32.dll", "bool", "GetProcessAffinityMask", "handle", $hprocess, "dword_ptr*", 0, "dword_ptr*", 0)
- If @error Then Return SetError(@error, @extended, 0)
- Local $amask[3]
- $amask[0] = True
- $amask[1] = $aresult[2]
- $amask[2] = $aresult[3]
- Return $amask
- EndFunc
- Func _winapi_getsavefilename($stitle = "", $sfilter = "All files (*.*)", $sinitaldir = ".", $sdefaultfile = "", $sdefaultext = "", $ifilterindex = 1, $iflags = 0, $iflagsex = 0, $hwndowner = 0)
- Local $ipathlen = 4096
- Local $tofn = DllStructCreate($tagopenfilename)
- Local $afiles[1] = [0]
- Local $iflag = $iflags
- Local $asflines = StringSplit($sfilter, "|")
- Local $asfilter[$asflines[0] * 2 + 1]
- Local $istart, $ifinal, $stfilter
- $asfilter[0] = $asflines[0] * 2
- For $i = 1 To $asflines[0]
- $istart = StringInStr($asflines[$i], "(", 0, 1)
- $ifinal = StringInStr($asflines[$i], ")", 0, -1)
- $asfilter[$i * 2 - 1] = StringStripWS(StringLeft($asflines[$i], $istart - 1), 3)
- $asfilter[$i * 2] = StringStripWS(StringTrimRight(StringTrimLeft($asflines[$i], $istart), StringLen($asflines[$i]) - $ifinal + 1), 3)
- $stfilter &= "wchar[" & StringLen($asfilter[$i * 2 - 1]) + 1 & "];wchar[" & StringLen($asfilter[$i * 2]) + 1 & "];"
- Next
- Local $ttitle = DllStructCreate("wchar Title[" & StringLen($stitle) + 1 & "]")
- Local $tinitialdir = DllStructCreate("wchar InitDir[" & StringLen($sinitaldir) + 1 & "]")
- Local $tfilter = DllStructCreate($stfilter & "wchar")
- Local $tpath = DllStructCreate("wchar Path[" & $ipathlen & "]")
- Local $textn = DllStructCreate("wchar Extension[" & StringLen($sdefaultext) + 1 & "]")
- For $i = 1 To $asfilter[0]
- DllStructSetData($tfilter, $i, $asfilter[$i])
- Next
- DllStructSetData($ttitle, "Title", $stitle)
- DllStructSetData($tinitialdir, "InitDir", $sinitaldir)
- DllStructSetData($tpath, "Path", $sdefaultfile)
- DllStructSetData($textn, "Extension", $sdefaultext)
- DllStructSetData($tofn, "StructSize", DllStructGetSize($tofn))
- DllStructSetData($tofn, "hwndOwner", $hwndowner)
- DllStructSetData($tofn, "lpstrFilter", DllStructGetPtr($tfilter))
- DllStructSetData($tofn, "nFilterIndex", $ifilterindex)
- DllStructSetData($tofn, "lpstrFile", DllStructGetPtr($tpath))
- DllStructSetData($tofn, "nMaxFile", $ipathlen)
- DllStructSetData($tofn, "lpstrInitialDir", DllStructGetPtr($tinitialdir))
- DllStructSetData($tofn, "lpstrTitle", DllStructGetPtr($ttitle))
- DllStructSetData($tofn, "Flags", $iflag)
- DllStructSetData($tofn, "lpstrDefExt", DllStructGetPtr($textn))
- DllStructSetData($tofn, "FlagsEx", $iflagsex)
- DllCall("comdlg32.dll", "bool", "GetSaveFileNameW", "ptr", DllStructGetPtr($tofn))
- If @error Then Return SetError(@error, @extended, $afiles)
- Return __winapi_parsefiledialogpath(DllStructGetData($tpath, "Path"))
- 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_getstdhandle($istdhandle)
- If $istdhandle < 0 OR $istdhandle > 2 Then Return SetError(2, 0, -1)
- Local Const $ahandle[3] = [-10, -11, -12]
- Local $aresult = DllCall("kernel32.dll", "handle", "GetStdHandle", "dword", $ahandle[$istdhandle])
- If @error Then Return SetError(@error, @extended, -1)
- Return $aresult[0]
- EndFunc
- Func _winapi_getsyscolor($iindex)
- Local $aresult = DllCall("user32.dll", "dword", "GetSysColor", "int", $iindex)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- 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_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_gettextextentpoint32($hdc, $stext)
- Local $tsize = DllStructCreate($tagsize)
- Local $isize = StringLen($stext)
- DllCall("gdi32.dll", "bool", "GetTextExtentPoint32W", "handle", $hdc, "wstr", $stext, "int", $isize, "ptr", DllStructGetPtr($tsize))
- If @error Then Return SetError(@error, @extended, 0)
- Return $tsize
- 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_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_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 Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_getwindowplacement($hwnd)
- Local $twindowplacement = DllStructCreate($tagwindowplacement)
- DllStructSetData($twindowplacement, "length", DllStructGetSize($twindowplacement))
- Local $pwindowplacement = DllStructGetPtr($twindowplacement)
- DllCall("user32.dll", "bool", "GetWindowPlacement", "hwnd", $hwnd, "ptr", $pwindowplacement)
- If @error Then Return SetError(@error, @extended, 0)
- Return $twindowplacement
- EndFunc
- Func _winapi_getwindowrect($hwnd)
- Local $trect = DllStructCreate($tagrect)
- DllCall("user32.dll", "bool", "GetWindowRect", "hwnd", $hwnd, "ptr", DllStructGetPtr($trect))
- If @error Then Return SetError(@error, @extended, 0)
- Return $trect
- 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_getwindowtext($hwnd)
- Local $aresult = DllCall("user32.dll", "int", "GetWindowTextW", "hwnd", $hwnd, "wstr", "", "int", 4096)
- If @error Then Return SetError(@error, @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_getxyfrompoint(ByRef $tpoint, ByRef $ix, ByRef $iy)
- $ix = DllStructGetData($tpoint, "X")
- $iy = DllStructGetData($tpoint, "Y")
- EndFunc
- Func _winapi_globalmemorystatus()
- Local $tmem = DllStructCreate($tagmemorystatusex)
- Local $pmem = DllStructGetPtr($tmem)
- Local $imem = DllStructGetSize($tmem)
- DllStructSetData($tmem, 1, $imem)
- DllCall("kernel32.dll", "none", "GlobalMemoryStatusEx", "ptr", $pmem)
- If @error Then Return SetError(@error, @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_guidfromstring($sguid)
- Local $tguid = DllStructCreate($tagguid)
- _winapi_guidfromstringex($sguid, DllStructGetPtr($tguid))
- If @error Then Return SetError(@error, @extended, 0)
- Return $tguid
- EndFunc
- Func _winapi_guidfromstringex($sguid, $pguid)
- Local $aresult = DllCall("ole32.dll", "long", "CLSIDFromString", "wstr", $sguid, "ptr", $pguid)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_hiword($ilong)
- Return BitShift($ilong, 16)
- EndFunc
- Func _winapi_inprocess($hwnd, ByRef $hlastwnd)
- If $hwnd = $hlastwnd Then Return True
- For $ii = $__gainprocess_winapi[0][0] To 1 Step -1
- If $hwnd = $__gainprocess_winapi[$ii][0] Then
- If $__gainprocess_winapi[$ii][1] Then
- $hlastwnd = $hwnd
- Return True
- Else
- Return False
- EndIf
- EndIf
- Next
- Local $iprocessid
- _winapi_getwindowthreadprocessid($hwnd, $iprocessid)
- Local $icount = $__gainprocess_winapi[0][0] + 1
- If $icount >= 64 Then $icount = 1
- $__gainprocess_winapi[0][0] = $icount
- $__gainprocess_winapi[$icount][0] = $hwnd
- $__gainprocess_winapi[$icount][1] = ($iprocessid = @AutoItPID)
- Return $__gainprocess_winapi[$icount][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_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) - 1
- 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_invalidaterect($hwnd, $trect = 0, $ferase = True)
- Local $prect = 0
- If IsDllStruct($trect) Then $prect = DllStructGetPtr($trect)
- Local $aresult = DllCall("user32.dll", "bool", "InvalidateRect", "hwnd", $hwnd, "ptr", $prect, "bool", $ferase)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_lineto($hdc, $ix, $iy)
- Local $aresult = DllCall("gdi32.dll", "bool", "LineTo", "handle", $hdc, "int", $ix, "int", $iy)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_loadbitmap($hinstance, $sbitmap)
- Local $sbitmaptype = "int"
- If IsString($sbitmap) Then $sbitmaptype = "wstr"
- Local $aresult = DllCall("user32.dll", "handle", "LoadBitmapW", "handle", $hinstance, $sbitmaptype, $sbitmap)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- 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_loadlibraryex($sfilename, $iflags = 0)
- Local $aresult = DllCall("kernel32.dll", "handle", "LoadLibraryExW", "wstr", $sfilename, "ptr", 0, "dword", $iflags)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_loadshell32icon($iiconid)
- Local $ticons = DllStructCreate("ptr Data")
- Local $picons = DllStructGetPtr($ticons)
- Local $iicons = _winapi_extracticonex("shell32.dll", $iiconid, 0, $picons, 1)
- If @error Then Return SetError(@error, @extended, 0)
- If $iicons <= 0 Then Return SetError(1, 0, 0)
- Return DllStructGetData($ticons, "Data")
- EndFunc
- Func _winapi_loadstring($hinstance, $istringid)
- Local $aresult = DllCall("user32.dll", "int", "LoadStringW", "handle", $hinstance, "uint", $istringid, "wstr", "", "int", 4096)
- If @error Then Return SetError(@error, @extended, "")
- Return SetExtended($aresult[0], $aresult[3])
- EndFunc
- Func _winapi_localfree($hmem)
- Local $aresult = DllCall("kernel32.dll", "handle", "LocalFree", "handle", $hmem)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_loword($ilong)
- Return BitAND($ilong, 65535)
- EndFunc
- Func _winapi_makelangid($lgidprimary, $lgidsub)
- Return BitOR(BitShift($lgidsub, -10), $lgidprimary)
- EndFunc
- Func _winapi_makelcid($lgid, $srtid)
- Return BitOR(BitShift($srtid, -16), $lgid)
- EndFunc
- Func _winapi_makelong($ilo, $ihi)
- Return BitOR(BitShift($ihi, -16), BitAND($ilo, 65535))
- EndFunc
- Func _winapi_makeqword($lodword, $hidword)
- Local $tint64 = DllStructCreate("uint64")
- Local $tdwords = DllStructCreate("dword;dword", DllStructGetPtr($tint64))
- DllStructSetData($tdwords, 1, $lodword)
- DllStructSetData($tdwords, 2, $hidword)
- Return DllStructGetData($tint64, 1)
- 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 = -1
- 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_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_moveto($hdc, $ix, $iy)
- Local $aresult = DllCall("gdi32.dll", "bool", "MoveToEx", "handle", $hdc, "int", $ix, "int", $iy, "ptr", 0)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_movewindow($hwnd, $ix, $iy, $iwidth, $iheight, $frepaint = True)
- Local $aresult = DllCall("user32.dll", "bool", "MoveWindow", "hwnd", $hwnd, "int", $ix, "int", $iy, "int", $iwidth, "int", $iheight, "bool", $frepaint)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- 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, -1)
- Return $aresult[0]
- EndFunc
- Func _winapi_multibytetowidechar($stext, $icodepage = 0, $iflags = 0, $bretstring = False)
- Local $stexttype = "ptr", $ptext = $stext
- If IsDllStruct($stext) Then
- $ptext = DllStructGetPtr($stext)
- Else
- If NOT IsPtr($stext) Then $stexttype = "STR"
- EndIf
- Local $aresult = DllCall("kernel32.dll", "int", "MultiByteToWideChar", "uint", $icodepage, "dword", $iflags, $stexttype, $ptext, "int", -1, "ptr", 0, "int", 0)
- If @error Then Return SetError(@error, @extended, 0)
- Local $iout = $aresult[0]
- Local $tout = DllStructCreate("wchar[" & $iout & "]")
- Local $pout = DllStructGetPtr($tout)
- $aresult = DllCall("kernel32.dll", "int", "MultiByteToWideChar", "uint", $icodepage, "dword", $iflags, $stexttype, $ptext, "int", -1, "ptr", $pout, "int", $iout)
- If @error Then Return SetError(@error, @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", -1, "ptr", $ptext, "int", (StringLen($stext) + 1) * 2)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_openprocess($iaccess, $finherit, $iprocessid, $fdebugpriv = False)
- Local $aresult = DllCall("kernel32.dll", "handle", "OpenProcess", "dword", $iaccess, "bool", $finherit, "dword", $iprocessid)
- If @error Then Return SetError(@error, @extended, 0)
- If $aresult[0] Then Return $aresult[0]
- If NOT $fdebugpriv Then Return 0
- Local $htoken = _security__openthreadtokenex(BitOR($token_adjust_privileges, $token_query))
- If @error Then Return SetError(@error, @extended, 0)
- _security__setprivilege($htoken, "SeDebugPrivilege", True)
- Local $ierror = @error
- Local $ilasterror = @extended
- Local $iret = 0
- If NOT @error Then
- $aresult = DllCall("kernel32.dll", "handle", "OpenProcess", "dword", $iaccess, "bool", $finherit, "dword", $iprocessid)
- $ierror = @error
- $ilasterror = @extended
- If $aresult[0] Then $iret = $aresult[0]
- _security__setprivilege($htoken, "SeDebugPrivilege", False)
- If @error Then
- $ierror = @error
- $ilasterror = @extended
- EndIf
- EndIf
- _winapi_closehandle($htoken)
- Return SetError($ierror, $ilasterror, $iret)
- EndFunc
- Func __winapi_parsefiledialogpath($spath)
- Local $afiles[3]
- $afiles[0] = 2
- Local $stemp = StringMid($spath, 1, StringInStr($spath, "\", 0, -1) - 1)
- $afiles[1] = $stemp
- $afiles[2] = StringMid($spath, StringInStr($spath, "\", 0, -1) + 1)
- Return $afiles
- EndFunc
- Func _winapi_pathfindonpath(Const $szfile, $aextrapaths = "", Const $szpathdelimiter = @LF)
- Local $iextracount = 0
- If IsString($aextrapaths) Then
- If StringLen($aextrapaths) Then
- $aextrapaths = StringSplit($aextrapaths, $szpathdelimiter, 1 + 2)
- $iextracount = UBound($aextrapaths, 1)
- EndIf
- ElseIf IsArray($aextrapaths) Then
- $iextracount = UBound($aextrapaths)
- EndIf
- Local $tpaths, $tpathptrs
- If $iextracount Then
- Local $szstruct = ""
- For $path In $aextrapaths
- $szstruct &= "wchar[" & StringLen($path) + 1 & "];"
- Next
- $tpaths = DllStructCreate($szstruct)
- $tpathptrs = DllStructCreate("ptr[" & $iextracount + 1 & "]")
- For $i = 1 To $iextracount
- DllStructSetData($tpaths, $i, $aextrapaths[$i - 1])
- DllStructSetData($tpathptrs, 1, DllStructGetPtr($tpaths, $i), $i)
- Next
- DllStructSetData($tpathptrs, 1, Ptr(0), $iextracount + 1)
- EndIf
- Local $aresult = DllCall("shlwapi.dll", "bool", "PathFindOnPathW", "wstr", $szfile, "ptr", DllStructGetPtr($tpathptrs))
- If @error Then Return SetError(@error, @extended, False)
- If $aresult[0] = 0 Then Return SetError(1, 0, $szfile)
- Return $aresult[1]
- EndFunc
- Func _winapi_pointfromrect(ByRef $trect, $fcenter = True)
- Local $ix1 = DllStructGetData($trect, "Left")
- Local $iy1 = DllStructGetData($trect, "Top")
- Local $ix2 = DllStructGetData($trect, "Right")
- Local $iy2 = DllStructGetData($trect, "Bottom")
- If $fcenter 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_postmessage($hwnd, $imsg, $iwparam, $ilparam)
- Local $aresult = DllCall("user32.dll", "bool", "PostMessage", "hwnd", $hwnd, "uint", $imsg, "wparam", $iwparam, "lparam", $ilparam)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_primarylangid($lgid)
- Return BitAND($lgid, 1023)
- EndFunc
- Func _winapi_ptinrect(ByRef $trect, ByRef $tpoint)
- Local $ix = DllStructGetData($tpoint, "X")
- Local $iy = DllStructGetData($tpoint, "Y")
- Local $aresult = DllCall("user32.dll", "bool", "PtInRect", "ptr", DllStructGetPtr($trect), "long", $ix, "long", $iy)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_readfile($hfile, $pbuffer, $itoread, ByRef $iread, $poverlapped = 0)
- Local $aresult = DllCall("kernel32.dll", "bool", "ReadFile", "handle", $hfile, "ptr", $pbuffer, "dword", $itoread, "dword*", 0, "ptr", $poverlapped)
- If @error Then Return SetError(@error, @extended, False)
- $iread = $aresult[4]
- Return $aresult[0]
- EndFunc
- Func _winapi_readprocessmemory($hprocess, $pbaseaddress, $pbuffer, $isize, ByRef $iread)
- Local $aresult = DllCall("kernel32.dll", "bool", "ReadProcessMemory", "handle", $hprocess, "ptr", $pbaseaddress, "ptr", $pbuffer, "ulong_ptr", $isize, "ulong_ptr*", 0)
- If @error Then Return SetError(@error, @extended, False)
- $iread = $aresult[5]
- Return $aresult[0]
- EndFunc
- Func _winapi_rectisempty(ByRef $trect)
- Return (DllStructGetData($trect, "Left") = 0) AND (DllStructGetData($trect, "Top") = 0) AND (DllStructGetData($trect, "Right") = 0) AND (DllStructGetData($trect, "Bottom") = 0)
- EndFunc
- Func _winapi_redrawwindow($hwnd, $trect = 0, $hregion = 0, $iflags = 5)
- Local $prect = 0
- If $trect <> 0 Then $prect = DllStructGetPtr($trect)
- Local $aresult = DllCall("user32.dll", "bool", "RedrawWindow", "hwnd", $hwnd, "ptr", $prect, "handle", $hregion, "uint", $iflags)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[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_releasecapture()
- Local $aresult = DllCall("user32.dll", "bool", "ReleaseCapture")
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[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_screentoclient($hwnd, ByRef $tpoint)
- Local $aresult = DllCall("user32.dll", "bool", "ScreenToClient", "hwnd", $hwnd, "ptr", DllStructGetPtr($tpoint))
- If @error Then Return SetError(@error, @extended, False)
- 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_setbkcolor($hdc, $icolor)
- Local $aresult = DllCall("gdi32.dll", "INT", "SetBkColor", "handle", $hdc, "dword", $icolor)
- If @error Then Return SetError(@error, @extended, -1)
- 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_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_setcursor($hcursor)
- Local $aresult = DllCall("user32.dll", "handle", "SetCursor", "handle", $hcursor)
- 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_setdibits($hdc, $hbmp, $istartscan, $iscanlines, $pbits, $pbmi, $icoloruse = 0)
- Local $aresult = DllCall("gdi32.dll", "int", "SetDIBits", "handle", $hdc, "handle", $hbmp, "uint", $istartscan, "uint", $iscanlines, "ptr", $pbits, "ptr", $pbmi, "uint", $icoloruse)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_setendoffile($hfile)
- Local $aresult = DllCall("kernel32.dll", "bool", "SetEndOfFile", "handle", $hfile)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[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_setfilepointer($hfile, $ipos, $imethod = 0)
- Local $aresult = DllCall("kernel32.dll", "INT", "SetFilePointer", "handle", $hfile, "long", $ipos, "ptr", 0, "long", $imethod)
- If @error Then Return SetError(@error, @extended, -1)
- 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, $fredraw = True)
- _sendmessage($hwnd, $__winapiconstant_wm_setfont, $hfont, $fredraw, 0, "hwnd")
- 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
- Func _winapi_setlayeredwindowattributes($hwnd, $i_transcolor, $transparency = 255, $dwflags = 3, $iscolorref = False)
- If $dwflags = Default OR $dwflags = "" OR $dwflags < 0 Then $dwflags = 3
- If NOT $iscolorref Then
- $i_transcolor = Hex(String($i_transcolor), 6)
- $i_transcolor = Execute("0x00" & StringMid($i_transcolor, 5, 2) & StringMid($i_transcolor, 3, 2) & StringMid($i_transcolor, 1, 2))
- EndIf
- Local $aresult = DllCall("user32.dll", "bool", "SetLayeredWindowAttributes", "hwnd", $hwnd, "dword", $i_transcolor, "byte", $transparency, "dword", $dwflags)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- 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_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_setsyscolors($velements, $vcolors)
- Local $isearray = IsArray($velements), $iscarray = IsArray($vcolors)
- Local $ielementnum
- If NOT $iscarray AND NOT $isearray Then
- $ielementnum = 1
- ElseIf $iscarray OR $isearray Then
- If NOT $iscarray OR NOT $isearray Then Return SetError(-1, -1, False)
- If UBound($velements) <> UBound($vcolors) Then Return SetError(-1, -1, False)
- $ielementnum = UBound($velements)
- EndIf
- Local $telements = DllStructCreate("int Element[" & $ielementnum & "]")
- Local $tcolors = DllStructCreate("dword NewColor[" & $ielementnum & "]")
- Local $pelements = DllStructGetPtr($telements)
- Local $pcolors = DllStructGetPtr($tcolors)
- If NOT $isearray Then
- DllStructSetData($telements, "Element", $velements, 1)
- Else
- For $x = 0 To $ielementnum - 1
- DllStructSetData($telements, "Element", $velements[$x], $x + 1)
- Next
- EndIf
- If NOT $iscarray Then
- DllStructSetData($tcolors, "NewColor", $vcolors, 1)
- Else
- For $x = 0 To $ielementnum - 1
- DllStructSetData($tcolors, "NewColor", $vcolors[$x], $x + 1)
- Next
- EndIf
- Local $aresult = DllCall("user32.dll", "bool", "SetSysColors", "int", $ielementnum, "ptr", $pelements, "ptr", $pcolors)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_settextcolor($hdc, $icolor)
- Local $aresult = DllCall("gdi32.dll", "INT", "SetTextColor", "handle", $hdc, "dword", $icolor)
- If @error Then Return SetError(@error, @extended, -1)
- Return $aresult[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, $pwindowplacement)
- Local $aresult = DllCall("user32.dll", "bool", "SetWindowPlacement", "hwnd", $hwnd, "ptr", $pwindowplacement)
- If @error Then Return SetError(@error, @extended, False)
- 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_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
- Func _winapi_setwindowshookex($idhook, $lpfn, $hmod, $dwthreadid = 0)
- Local $aresult = DllCall("user32.dll", "handle", "SetWindowsHookEx", "int", $idhook, "ptr", $lpfn, "handle", $hmod, "dword", $dwthreadid)
- If @error Then Return SetError(@error, @extended, 0)
- 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_showcursor($fshow)
- Local $aresult = DllCall("user32.dll", "int", "ShowCursor", "bool", $fshow)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0]
- EndFunc
- Func _winapi_showerror($stext, $fexit = True)
- _winapi_msgbox(266256, "Error", $stext)
- If $fexit Then Exit
- EndFunc
- Func _winapi_showmsg($stext)
- _winapi_msgbox(64 + 4096, "Information", $stext)
- 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_stringfromguid($pguid)
- Local $aresult = DllCall("ole32.dll", "int", "StringFromGUID2", "ptr", $pguid, "wstr", "", "int", 40)
- If @error Then Return SetError(@error, @extended, "")
- Return SetExtended($aresult[0], $aresult[2])
- EndFunc
- Func _winapi_sublangid($lgid)
- Return BitShift($lgid, 10)
- EndFunc
- Func _winapi_systemparametersinfo($iaction, $iparam = 0, $vparam = 0, $iwinini = 0)
- Local $aresult = DllCall("user32.dll", "bool", "SystemParametersInfoW", "uint", $iaction, "uint", $iparam, "ptr", $vparam, "uint", $iwinini)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_twipsperpixelx()
- Local $lngdc, $twipsperpixelx
- $lngdc = _winapi_getdc(0)
- $twipsperpixelx = 1440 / _winapi_getdevicecaps($lngdc, $__winapiconstant_logpixelsx)
- _winapi_releasedc(0, $lngdc)
- Return $twipsperpixelx
- EndFunc
- Func _winapi_twipsperpixely()
- Local $lngdc, $twipsperpixely
- $lngdc = _winapi_getdc(0)
- $twipsperpixely = 1440 / _winapi_getdevicecaps($lngdc, $__winapiconstant_logpixelsy)
- _winapi_releasedc(0, $lngdc)
- Return $twipsperpixely
- EndFunc
- Func _winapi_unhookwindowshookex($hhk)
- Local $aresult = DllCall("user32.dll", "bool", "UnhookWindowsHookEx", "handle", $hhk)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0]
- EndFunc
- Func _winapi_updatelayeredwindow($hwnd, $hdcdest, $pptdest, $psize, $hdcsrce, $pptsrce, $irgb, $pblend, $iflags)
- Local $aresult = DllCall("user32.dll", "bool", "UpdateLayeredWindow", "hwnd", $hwnd, "handle", $hdcdest, "ptr", $pptdest, "ptr", $psize, "handle", $hdcsrce, "ptr", $pptsrce, "dword", $irgb, "ptr", $pblend, "dword", $iflags)
- 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
- Func _winapi_waitforinputidle($hprocess, $itimeout = -1)
- 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, $phandles, $fwaitall = False, $itimeout = -1)
- Local $aresult = DllCall("kernel32.dll", "INT", "WaitForMultipleObjects", "dword", $icount, "ptr", $phandles, "bool", $fwaitall, "dword", $itimeout)
- If @error Then Return SetError(@error, @extended, -1)
- Return $aresult[0]
- EndFunc
- Func _winapi_waitforsingleobject($hhandle, $itimeout = -1)
- Local $aresult = DllCall("kernel32.dll", "INT", "WaitForSingleObject", "handle", $hhandle, "dword", $itimeout)
- If @error Then Return SetError(@error, @extended, -1)
- Return $aresult[0]
- EndFunc
- Func _winapi_widechartomultibyte($punicode, $icodepage = 0, $bretstring = True)
- Local $sunicodetype = "ptr"
- If IsDllStruct($punicode) Then
- $punicode = DllStructGetPtr($punicode)
- Else
- If NOT IsPtr($punicode) Then $sunicodetype = "wstr"
- EndIf
- Local $aresult = DllCall("kernel32.dll", "int", "WideCharToMultiByte", "uint", $icodepage, "dword", 0, $sunicodetype, $punicode, "int", -1, "ptr", 0, "int", 0, "ptr", 0, "ptr", 0)
- If @error Then Return SetError(@error, @extended, "")
- Local $tmultibyte = DllStructCreate("char[" & $aresult[0] & "]")
- Local $pmultibyte = DllStructGetPtr($tmultibyte)
- $aresult = DllCall("kernel32.dll", "int", "WideCharToMultiByte", "uint", $icodepage, "dword", 0, $sunicodetype, $punicode, "int", -1, "ptr", $pmultibyte, "int", $aresult[0], "ptr", 0, "ptr", 0)
- If @error Then Return SetError(@error, @extended, "")
- If $bretstring Then Return DllStructGetData($tmultibyte, 1)
- Return $tmultibyte
- EndFunc
- Func _winapi_windowfrompoint(ByRef $tpoint)
- Local $tpointcast = DllStructCreate("int64", DllStructGetPtr($tpoint))
- Local $aresult = DllCall("user32.dll", "hwnd", "WindowFromPoint", "int64", DllStructGetData($tpointcast, 1))
- If @error Then Return SetError(@error, @extended, 0)
- 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
- Func _winapi_writefile($hfile, $pbuffer, $itowrite, ByRef $iwritten, $poverlapped = 0)
- Local $aresult = DllCall("kernel32.dll", "bool", "WriteFile", "handle", $hfile, "ptr", $pbuffer, "dword", $itowrite, "dword*", 0, "ptr", $poverlapped)
- If @error Then Return SetError(@error, @extended, False)
- $iwritten = $aresult[4]
- 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
- Global $ghgdipbrush = 0
- Global $ghgdipdll = 0
- Global $ghgdippen = 0
- Global $gigdipref = 0
- Global $gigdiptoken = 0
- Func _gdiplus_arrowcapcreate($fheight, $fwidth, $bfilled = True)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipCreateAdjustableArrowCap", "float", $fheight, "float", $fwidth, "bool", $bfilled, "ptr*", 0)
- If @error Then Return SetError(@error, @extended, 0)
- Return SetExtended($aresult[0], $aresult[4])
- EndFunc
- Func _gdiplus_arrowcapdispose($hcap)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipDeleteCustomLineCap", "handle", $hcap)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0] = 0
- EndFunc
- Func _gdiplus_arrowcapgetfillstate($harrowcap)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipGetAdjustableArrowCapFillState", "handle", $harrowcap, "bool*", 0)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0] = 0
- EndFunc
- Func _gdiplus_arrowcapgetheight($harrowcap)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipGetAdjustableArrowCapHeight", "handle", $harrowcap, "float*", 0)
- If @error Then Return SetError(@error, @extended, 0)
- Return SetExtended($aresult[0], $aresult[2])
- EndFunc
- Func _gdiplus_arrowcapgetmiddleinset($harrowcap)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipGetAdjustableArrowCapMiddleInset", "handle", $harrowcap, "float*", 0)
- If @error Then Return SetError(@error, @extended, 0)
- Return SetExtended($aresult[0], $aresult[2])
- EndFunc
- Func _gdiplus_arrowcapgetwidth($harrowcap)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipGetAdjustableArrowCapWidth", "handle", $harrowcap, "float*", 0)
- If @error Then Return SetError(@error, @extended, 0)
- Return SetExtended($aresult[0], $aresult[2])
- EndFunc
- Func _gdiplus_arrowcapsetfillstate($harrowcap, $bfilled = True)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipSetAdjustableArrowCapFillState", "handle", $harrowcap, "bool", $bfilled)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0] = 0
- EndFunc
- Func _gdiplus_arrowcapsetheight($harrowcap, $fheight)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipSetAdjustableArrowCapHeight", "handle", $harrowcap, "float", $fheight)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0] = 0
- EndFunc
- Func _gdiplus_arrowcapsetmiddleinset($harrowcap, $finset)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipSetAdjustableArrowCapMiddleInset", "handle", $harrowcap, "float", $finset)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0] = 0
- EndFunc
- Func _gdiplus_arrowcapsetwidth($harrowcap, $fwidth)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipSetAdjustableArrowCapWidth", "handle", $harrowcap, "float", $fwidth)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0] = 0
- EndFunc
- Func _gdiplus_bitmapclonearea($hbmp, $ileft, $itop, $iwidth, $iheight, $iformat = 137224)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipCloneBitmapAreaI", "int", $ileft, "int", $itop, "int", $iwidth, "int", $iheight, "int", $iformat, "handle", $hbmp, "ptr*", 0)
- If @error Then Return SetError(@error, @extended, 0)
- Return SetExtended($aresult[0], $aresult[7])
- EndFunc
- Func _gdiplus_bitmapcreatefromfile($sfilename)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipCreateBitmapFromFile", "wstr", $sfilename, "ptr*", 0)
- If @error Then Return SetError(@error, @extended, 0)
- Return SetExtended($aresult[0], $aresult[2])
- EndFunc
- Func _gdiplus_bitmapcreatefromgraphics($iwidth, $iheight, $hgraphics)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipCreateBitmapFromGraphics", "int", $iwidth, "int", $iheight, "handle", $hgraphics, "ptr*", 0)
- If @error Then Return SetError(@error, @extended, 0)
- Return SetExtended($aresult[0], $aresult[4])
- EndFunc
- Func _gdiplus_bitmapcreatefromhbitmap($hbmp, $hpal = 0)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipCreateBitmapFromHBITMAP", "handle", $hbmp, "handle", $hpal, "ptr*", 0)
- If @error Then Return SetError(@error, @extended, 0)
- Return SetExtended($aresult[0], $aresult[3])
- EndFunc
- Func _gdiplus_bitmapcreatehbitmapfrombitmap($hbitmap, $iargb = -16777216)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipCreateHBITMAPFromBitmap", "handle", $hbitmap, "ptr*", 0, "dword", $iargb)
- If @error Then Return SetError(@error, @extended, 0)
- Return SetExtended($aresult[0], $aresult[2])
- EndFunc
- Func _gdiplus_bitmapdispose($hbitmap)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipDisposeImage", "handle", $hbitmap)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0] = 0
- EndFunc
- Func _gdiplus_bitmaplockbits($hbitmap, $ileft, $itop, $iwidth, $iheight, $iflags = $gdip_ilmread, $iformat = $gdip_pxf32rgb)
- Local $tdata = DllStructCreate($taggdipbitmapdata)
- Local $pdata = DllStructGetPtr($tdata)
- Local $trect = DllStructCreate($tagrect)
- Local $prect = DllStructGetPtr($trect)
- DllStructSetData($trect, "Left", $ileft)
- DllStructSetData($trect, "Top", $itop)
- DllStructSetData($trect, "Right", $iwidth)
- DllStructSetData($trect, "Bottom", $iheight)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipBitmapLockBits", "handle", $hbitmap, "ptr", $prect, "uint", $iflags, "int", $iformat, "ptr", $pdata)
- If @error Then Return SetError(@error, @extended, 0)
- Return SetExtended($aresult[0], $tdata)
- EndFunc
- Func _gdiplus_bitmapunlockbits($hbitmap, $tbitmapdata)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipBitmapUnlockBits", "handle", $hbitmap, "ptr", DllStructGetPtr($tbitmapdata))
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0] = 0
- EndFunc
- Func _gdiplus_brushclone($hbrush)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipCloneBrush", "handle", $hbrush, "ptr*", 0)
- If @error Then Return SetError(@error, @extended, 0)
- Return SetExtended($aresult[0], $aresult[2])
- EndFunc
- Func _gdiplus_brushcreatesolid($iargb = -16777216)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipCreateSolidFill", "int", $iargb, "dword*", 0)
- If @error Then Return SetError(@error, @extended, 0)
- Return SetExtended($aresult[0], $aresult[2])
- EndFunc
- Func _gdiplus_brushdispose($hbrush)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipDeleteBrush", "handle", $hbrush)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0] = 0
- EndFunc
- Func _gdiplus_brushgetsolidcolor($hbrush)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipGetSolidFillColor", "handle", $hbrush, "dword*", 0)
- If @error Then Return SetError(@error, @extended, -1)
- Return SetExtended($aresult[0], $aresult[2])
- EndFunc
- Func _gdiplus_brushgettype($hbrush)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipGetBrushType", "handle", $hbrush, "int*", 0)
- If @error Then Return SetError(@error, @extended, -1)
- Return SetExtended($aresult[0], $aresult[2])
- EndFunc
- Func _gdiplus_brushsetsolidcolor($hbrush, $iargb = -16777216)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipSetSolidFillColor", "handle", $hbrush, "dword", $iargb)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0] = 0
- EndFunc
- Func _gdiplus_customlinecapdispose($hcap)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipDeleteCustomLineCap", "handle", $hcap)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0] = 0
- EndFunc
- Func _gdiplus_decoders()
- Local $icount = _gdiplus_decodersgetcount()
- Local $isize = _gdiplus_decodersgetsize()
- Local $tbuffer = DllStructCreate("byte[" & $isize & "]")
- Local $pbuffer = DllStructGetPtr($tbuffer)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipGetImageDecoders", "uint", $icount, "uint", $isize, "ptr", $pbuffer)
- If @error Then Return SetError(@error, @extended, 0)
- If $aresult[0] <> 0 Then Return SetError($aresult[0], 0, 0)
- Local $tcodec, $ainfo[$icount + 1][14]
- $ainfo[0][0] = $icount
- For $ii = 1 To $icount
- $tcodec = DllStructCreate($taggdipimagecodecinfo, $pbuffer)
- $ainfo[$ii][1] = _winapi_stringfromguid(DllStructGetPtr($tcodec, "CLSID"))
- $ainfo[$ii][2] = _winapi_stringfromguid(DllStructGetPtr($tcodec, "FormatID"))
- $ainfo[$ii][3] = _winapi_widechartomultibyte(DllStructGetData($tcodec, "CodecName"))
- $ainfo[$ii][4] = _winapi_widechartomultibyte(DllStructGetData($tcodec, "DllName"))
- $ainfo[$ii][5] = _winapi_widechartomultibyte(DllStructGetData($tcodec, "FormatDesc"))
- $ainfo[$ii][6] = _winapi_widechartomultibyte(DllStructGetData($tcodec, "FileExt"))
- $ainfo[$ii][7] = _winapi_widechartomultibyte(DllStructGetData($tcodec, "MimeType"))
- $ainfo[$ii][8] = DllStructGetData($tcodec, "Flags")
- $ainfo[$ii][9] = DllStructGetData($tcodec, "Version")
- $ainfo[$ii][10] = DllStructGetData($tcodec, "SigCount")
- $ainfo[$ii][11] = DllStructGetData($tcodec, "SigSize")
- $ainfo[$ii][12] = DllStructGetData($tcodec, "SigPattern")
- $ainfo[$ii][13] = DllStructGetData($tcodec, "SigMask")
- $pbuffer += DllStructGetSize($tcodec)
- Next
- Return $ainfo
- EndFunc
- Func _gdiplus_decodersgetcount()
- Local $aresult = DllCall($ghgdipdll, "int", "GdipGetImageDecodersSize", "uint*", 0, "uint*", 0)
- If @error Then Return SetError(@error, @extended, -1)
- Return SetExtended($aresult[0], $aresult[1])
- EndFunc
- Func _gdiplus_decodersgetsize()
- Local $aresult = DllCall($ghgdipdll, "int", "GdipGetImageDecodersSize", "uint*", 0, "uint*", 0)
- If @error Then Return SetError(@error, @extended, -1)
- Return SetExtended($aresult[0], $aresult[2])
- EndFunc
- Func _gdiplus_drawimagepoints($hgraphic, $himage, $nulx, $nuly, $nurx, $nury, $nllx, $nlly, $count = 3)
- Local $tpoint = DllStructCreate("float X;float Y;float X2;float Y2;float X3;float Y3")
- DllStructSetData($tpoint, "X", $nulx)
- DllStructSetData($tpoint, "Y", $nuly)
- DllStructSetData($tpoint, "X2", $nurx)
- DllStructSetData($tpoint, "Y2", $nury)
- DllStructSetData($tpoint, "X3", $nllx)
- DllStructSetData($tpoint, "Y3", $nlly)
- Local $ppoint = DllStructGetPtr($tpoint)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipDrawImagePoints", "handle", $hgraphic, "handle", $himage, "ptr", $ppoint, "int", $count)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0] = 0
- EndFunc
- Func _gdiplus_encoders()
- Local $icount = _gdiplus_encodersgetcount()
- Local $isize = _gdiplus_encodersgetsize()
- Local $tbuffer = DllStructCreate("byte[" & $isize & "]")
- Local $pbuffer = DllStructGetPtr($tbuffer)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipGetImageEncoders", "uint", $icount, "uint", $isize, "ptr", $pbuffer)
- If @error Then Return SetError(@error, @extended, 0)
- If $aresult[0] <> 0 Then Return SetError($aresult[0], 0, 0)
- Local $tcodec, $ainfo[$icount + 1][14]
- $ainfo[0][0] = $icount
- For $ii = 1 To $icount
- $tcodec = DllStructCreate($taggdipimagecodecinfo, $pbuffer)
- $ainfo[$ii][1] = _winapi_stringfromguid(DllStructGetPtr($tcodec, "CLSID"))
- $ainfo[$ii][2] = _winapi_stringfromguid(DllStructGetPtr($tcodec, "FormatID"))
- $ainfo[$ii][3] = _winapi_widechartomultibyte(DllStructGetData($tcodec, "CodecName"))
- $ainfo[$ii][4] = _winapi_widechartomultibyte(DllStructGetData($tcodec, "DllName"))
- $ainfo[$ii][5] = _winapi_widechartomultibyte(DllStructGetData($tcodec, "FormatDesc"))
- $ainfo[$ii][6] = _winapi_widechartomultibyte(DllStructGetData($tcodec, "FileExt"))
- $ainfo[$ii][7] = _winapi_widechartomultibyte(DllStructGetData($tcodec, "MimeType"))
- $ainfo[$ii][8] = DllStructGetData($tcodec, "Flags")
- $ainfo[$ii][9] = DllStructGetData($tcodec, "Version")
- $ainfo[$ii][10] = DllStructGetData($tcodec, "SigCount")
- $ainfo[$ii][11] = DllStructGetData($tcodec, "SigSize")
- $ainfo[$ii][12] = DllStructGetData($tcodec, "SigPattern")
- $ainfo[$ii][13] = DllStructGetData($tcodec, "SigMask")
- $pbuffer += DllStructGetSize($tcodec)
- Next
- Return $ainfo
- EndFunc
- Func _gdiplus_encodersgetclsid($sfileext)
- Local $aencoders = _gdiplus_encoders()
- For $ii = 1 To $aencoders[0][0]
- If StringInStr($aencoders[$ii][6], "*." & $sfileext) > 0 Then Return $aencoders[$ii][1]
- Next
- Return SetError(-1, -1, "")
- EndFunc
- Func _gdiplus_encodersgetcount()
- Local $aresult = DllCall($ghgdipdll, "int", "GdipGetImageEncodersSize", "uint*", 0, "uint*", 0)
- If @error Then Return SetError(@error, @extended, -1)
- Return SetExtended($aresult[0], $aresult[1])
- EndFunc
- Func _gdiplus_encodersgetparamlist($himage, $sencoder)
- Local $isize = _gdiplus_encodersgetparamlistsize($himage, $sencoder)
- If @error Then Return SetError(@error, -1, 0)
- Local $tguid = _winapi_guidfromstring($sencoder)
- Local $pguid = DllStructGetPtr($tguid)
- Local $tbuffer = DllStructCreate("dword Count;byte Params[" & $isize - 4 & "]")
- Local $pbuffer = DllStructGetPtr($tbuffer)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipGetEncoderParameterList", "handle", $himage, "ptr", $pguid, "uint", $isize, "ptr", $pbuffer)
- If @error Then Return SetError(@error, @extended, 0)
- Return SetExtended($aresult[0], $tbuffer)
- EndFunc
- Func _gdiplus_encodersgetparamlistsize($himage, $sencoder)
- Local $tguid = _winapi_guidfromstring($sencoder)
- Local $pguid = DllStructGetPtr($tguid)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipGetEncoderParameterListSize", "handle", $himage, "ptr", $pguid, "uint*", 0)
- If @error Then Return SetError(@error, @extended, 0)
- Return SetExtended($aresult[0], $aresult[3])
- EndFunc
- Func _gdiplus_encodersgetsize()
- Local $aresult = DllCall($ghgdipdll, "int", "GdipGetImageEncodersSize", "uint*", 0, "uint*", 0)
- If @error Then Return SetError(@error, @extended, -1)
- Return SetExtended($aresult[0], $aresult[2])
- EndFunc
- Func _gdiplus_fontcreate($hfamily, $fsize, $istyle = 0, $iunit = 3)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipCreateFont", "handle", $hfamily, "float", $fsize, "int", $istyle, "int", $iunit, "ptr*", 0)
- If @error Then Return SetError(@error, @extended, 0)
- Return SetExtended($aresult[0], $aresult[5])
- EndFunc
- Func _gdiplus_fontdispose($hfont)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipDeleteFont", "handle", $hfont)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0] = 0
- EndFunc
- Func _gdiplus_fontfamilycreate($sfamily)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipCreateFontFamilyFromName", "wstr", $sfamily, "ptr", 0, "handle*", 0)
- If @error Then Return SetError(@error, @extended, 0)
- Return SetExtended($aresult[0], $aresult[3])
- EndFunc
- Func _gdiplus_fontfamilydispose($hfamily)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipDeleteFontFamily", "handle", $hfamily)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0] = 0
- EndFunc
- Func _gdiplus_graphicsclear($hgraphics, $iargb = -16777216)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipGraphicsClear", "handle", $hgraphics, "dword", $iargb)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0] = 0
- EndFunc
- Func _gdiplus_graphicscreatefromhdc($hdc)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipCreateFromHDC", "handle", $hdc, "ptr*", 0)
- If @error Then Return SetError(@error, @extended, 0)
- Return SetExtended($aresult[0], $aresult[2])
- EndFunc
- Func _gdiplus_graphicscreatefromhwnd($hwnd)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipCreateFromHWND", "hwnd", $hwnd, "ptr*", 0)
- If @error Then Return SetError(@error, @extended, 0)
- Return SetExtended($aresult[0], $aresult[2])
- EndFunc
- Func _gdiplus_graphicsdispose($hgraphics)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipDeleteGraphics", "handle", $hgraphics)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0] = 0
- EndFunc
- Func _gdiplus_graphicsdrawarc($hgraphics, $ix, $iy, $iwidth, $iheight, $fstartangle, $fsweepangle, $hpen = 0)
- __gdiplus_pendefcreate($hpen)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipDrawArcI", "handle", $hgraphics, "handle", $hpen, "int", $ix, "int", $iy, "int", $iwidth, "int", $iheight, "float", $fstartangle, "float", $fsweepangle)
- Local $tmperror = @error, $tmpextended = @extended
- __gdiplus_pendefdispose()
- If $tmperror Then Return SetError($tmperror, $tmpextended, False)
- Return $aresult[0] = 0
- EndFunc
- Func _gdiplus_graphicsdrawbezier($hgraphics, $ix1, $iy1, $ix2, $iy2, $ix3, $iy3, $ix4, $iy4, $hpen = 0)
- __gdiplus_pendefcreate($hpen)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipDrawBezierI", "handle", $hgraphics, "handle", $hpen, "int", $ix1, "int", $iy1, "int", $ix2, "int", $iy2, "int", $ix3, "int", $iy3, "int", $ix4, "int", $iy4)
- Local $tmperror = @error, $tmpextended = @extended
- __gdiplus_pendefdispose()
- If $tmperror Then Return SetError($tmperror, $tmpextended, False)
- Return $aresult[0] = 0
- EndFunc
- Func _gdiplus_graphicsdrawclosedcurve($hgraphics, $apoints, $hpen = 0)
- Local $icount = $apoints[0][0]
- Local $tpoints = DllStructCreate("long[" & $icount * 2 & "]")
- Local $ppoints = DllStructGetPtr($tpoints)
- For $ii = 1 To $icount
- DllStructSetData($tpoints, 1, $apoints[$ii][0], (($ii - 1) * 2) + 1)
- DllStructSetData($tpoints, 1, $apoints[$ii][1], (($ii - 1) * 2) + 2)
- Next
- __gdiplus_pendefcreate($hpen)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipDrawClosedCurveI", "handle", $hgraphics, "handle", $hpen, "ptr", $ppoints, "int", $icount)
- Local $tmperror = @error, $tmpextended = @extended
- __gdiplus_pendefdispose()
- If $tmperror Then Return SetError($tmperror, $tmpextended, False)
- Return $aresult[0] = 0
- EndFunc
- Func _gdiplus_graphicsdrawcurve($hgraphics, $apoints, $hpen = 0)
- Local $icount = $apoints[0][0]
- Local $tpoints = DllStructCreate("long[" & $icount * 2 & "]")
- Local $ppoints = DllStructGetPtr($tpoints)
- For $ii = 1 To $icount
- DllStructSetData($tpoints, 1, $apoints[$ii][0], (($ii - 1) * 2) + 1)
- DllStructSetData($tpoints, 1, $apoints[$ii][1], (($ii - 1) * 2) + 2)
- Next
- __gdiplus_pendefcreate($hpen)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipDrawCurveI", "handle", $hgraphics, "handle", $hpen, "ptr", $ppoints, "int", $icount)
- Local $tmperror = @error, $tmpextended = @extended
- __gdiplus_pendefdispose()
- If $tmperror Then Return SetError($tmperror, $tmpextended, False)
- Return $aresult[0] = 0
- EndFunc
- Func _gdiplus_graphicsdrawellipse($hgraphics, $ix, $iy, $iwidth, $iheight, $hpen = 0)
- __gdiplus_pendefcreate($hpen)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipDrawEllipseI", "handle", $hgraphics, "handle", $hpen, "int", $ix, "int", $iy, "int", $iwidth, "int", $iheight)
- Local $tmperror = @error, $tmpextended = @extended
- __gdiplus_pendefdispose()
- If $tmperror Then Return SetError($tmperror, $tmpextended, False)
- Return $aresult[0] = 0
- EndFunc
- Func _gdiplus_graphicsdrawimage($hgraphics, $himage, $ix, $iy)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipDrawImageI", "handle", $hgraphics, "handle", $himage, "int", $ix, "int", $iy)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0] = 0
- EndFunc
- Func _gdiplus_graphicsdrawimagerect($hgraphics, $himage, $ix, $iy, $iw, $ih)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipDrawImageRectI", "handle", $hgraphics, "handle", $himage, "int", $ix, "int", $iy, "int", $iw, "int", $ih)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0] = 0
- EndFunc
- Func _gdiplus_graphicsdrawimagerectrect($hgraphics, $himage, $isrcx, $isrcy, $isrcwidth, $isrcheight, $idstx, $idsty, $idstwidth, $idstheight, $iunit = 2)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipDrawImageRectRectI", "handle", $hgraphics, "handle", $himage, "int", $idstx, "int", $idsty, "int", $idstwidth, "int", $idstheight, "int", $isrcx, "int", $isrcy, "int", $isrcwidth, "int", $isrcheight, "int", $iunit, "int", 0, "int", 0, "int", 0)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0] = 0
- EndFunc
- Func _gdiplus_graphicsdrawline($hgraphics, $ix1, $iy1, $ix2, $iy2, $hpen = 0)
- __gdiplus_pendefcreate($hpen)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipDrawLineI", "handle", $hgraphics, "handle", $hpen, "int", $ix1, "int", $iy1, "int", $ix2, "int", $iy2)
- Local $tmperror = @error, $tmpextended = @extended
- __gdiplus_pendefdispose()
- If $tmperror Then Return SetError($tmperror, $tmpextended, False)
- Return $aresult[0] = 0
- EndFunc
- Func _gdiplus_graphicsdrawpie($hgraphics, $ix, $iy, $iwidth, $iheight, $fstartangle, $fsweepangle, $hpen = 0)
- __gdiplus_pendefcreate($hpen)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipDrawPieI", "handle", $hgraphics, "handle", $hpen, "int", $ix, "int", $iy, "int", $iwidth, "int", $iheight, "float", $fstartangle, "float", $fsweepangle)
- Local $tmperror = @error, $tmpextended = @extended
- __gdiplus_pendefdispose()
- If $tmperror Then Return SetError($tmperror, $tmpextended, False)
- Return $aresult[0] = 0
- EndFunc
- Func _gdiplus_graphicsdrawpolygon($hgraphics, $apoints, $hpen = 0)
- Local $icount = $apoints[0][0]
- Local $tpoints = DllStructCreate("long[" & $icount * 2 & "]")
- Local $ppoints = DllStructGetPtr($tpoints)
- For $ii = 1 To $icount
- DllStructSetData($tpoints, 1, $apoints[$ii][0], (($ii - 1) * 2) + 1)
- DllStructSetData($tpoints, 1, $apoints[$ii][1], (($ii - 1) * 2) + 2)
- Next
- __gdiplus_pendefcreate($hpen)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipDrawPolygonI", "handle", $hgraphics, "handle", $hpen, "ptr", $ppoints, "int", $icount)
- Local $tmperror = @error, $tmpextended = @extended
- __gdiplus_pendefdispose()
- If $tmperror Then Return SetError($tmperror, $tmpextended, False)
- Return $aresult[0] = 0
- EndFunc
- Func _gdiplus_graphicsdrawrect($hgraphics, $ix, $iy, $iwidth, $iheight, $hpen = 0)
- __gdiplus_pendefcreate($hpen)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipDrawRectangleI", "handle", $hgraphics, "handle", $hpen, "int", $ix, "int", $iy, "int", $iwidth, "int", $iheight)
- Local $tmperror = @error, $tmpextended = @extended
- __gdiplus_pendefdispose()
- If $tmperror Then Return SetError($tmperror, $tmpextended, False)
- Return $aresult[0] = 0
- EndFunc
- Func _gdiplus_graphicsdrawstring($hgraphics, $sstring, $nx, $ny, $sfont = "Arial", $nsize = 10, $iformat = 0)
- Local $hbrush = _gdiplus_brushcreatesolid()
- Local $hformat = _gdiplus_stringformatcreate($iformat)
- Local $hfamily = _gdiplus_fontfamilycreate($sfont)
- Local $hfont = _gdiplus_fontcreate($hfamily, $nsize)
- Local $tlayout = _gdiplus_rectfcreate($nx, $ny, 0, 0)
- Local $ainfo = _gdiplus_graphicsmeasurestring($hgraphics, $sstring, $hfont, $tlayout, $hformat)
- Local $aresult = _gdiplus_graphicsdrawstringex($hgraphics, $sstring, $hfont, $ainfo[0], $hformat, $hbrush)
- Local $ierror = @error
- _gdiplus_fontdispose($hfont)
- _gdiplus_fontfamilydispose($hfamily)
- _gdiplus_stringformatdispose($hformat)
- _gdiplus_brushdispose($hbrush)
- Return SetError($ierror, 0, $aresult)
- EndFunc
- Func _gdiplus_graphicsdrawstringex($hgraphics, $sstring, $hfont, $tlayout, $hformat, $hbrush)
- Local $playout = DllStructGetPtr($tlayout)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipDrawString", "handle", $hgraphics, "wstr", $sstring, "int", -1, "handle", $hfont, "ptr", $playout, "handle", $hformat, "handle", $hbrush)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0] = 0
- EndFunc
- Func _gdiplus_graphicsfillclosedcurve($hgraphics, $apoints, $hbrush = 0)
- Local $icount = $apoints[0][0]
- Local $tpoints = DllStructCreate("long[" & $icount * 2 & "]")
- Local $ppoints = DllStructGetPtr($tpoints)
- For $ii = 1 To $icount
- DllStructSetData($tpoints, 1, $apoints[$ii][0], (($ii - 1) * 2) + 1)
- DllStructSetData($tpoints, 1, $apoints[$ii][1], (($ii - 1) * 2) + 2)
- Next
- __gdiplus_brushdefcreate($hbrush)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipFillClosedCurveI", "handle", $hgraphics, "handle", $hbrush, "ptr", $ppoints, "int", $icount)
- Local $tmperror = @error, $tmpextended = @extended
- __gdiplus_brushdefdispose()
- If $tmperror Then Return SetError($tmperror, $tmpextended, False)
- Return $aresult[0] = 0
- EndFunc
- Func _gdiplus_graphicsfillellipse($hgraphics, $ix, $iy, $iwidth, $iheight, $hbrush = 0)
- __gdiplus_brushdefcreate($hbrush)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipFillEllipseI", "handle", $hgraphics, "handle", $hbrush, "int", $ix, "int", $iy, "int", $iwidth, "int", $iheight)
- Local $tmperror = @error, $tmpextended = @extended
- __gdiplus_brushdefdispose()
- If $tmperror Then Return SetError($tmperror, $tmpextended, False)
- Return $aresult[0] = 0
- EndFunc
- Func _gdiplus_graphicsfillpie($hgraphics, $ix, $iy, $iwidth, $iheight, $fstartangle, $fsweepangle, $hbrush = 0)
- __gdiplus_brushdefcreate($hbrush)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipFillPieI", "handle", $hgraphics, "handle", $hbrush, "int", $ix, "int", $iy, "int", $iwidth, "int", $iheight, "float", $fstartangle, "float", $fsweepangle)
- Local $tmperror = @error, $tmpextended = @extended
- __gdiplus_brushdefdispose()
- If $tmperror Then Return SetError($tmperror, $tmpextended, False)
- Return $aresult[0] = 0
- EndFunc
- Func _gdiplus_graphicsfillpolygon($hgraphics, $apoints, $hbrush = 0)
- Local $icount = $apoints[0][0]
- Local $tpoints = DllStructCreate("long[" & $icount * 2 & "]")
- Local $ppoints = DllStructGetPtr($tpoints)
- For $ii = 1 To $icount
- DllStructSetData($tpoints, 1, $apoints[$ii][0], (($ii - 1) * 2) + 1)
- DllStructSetData($tpoints, 1, $apoints[$ii][1], (($ii - 1) * 2) + 2)
- Next
- __gdiplus_brushdefcreate($hbrush)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipFillPolygonI", "handle", $hgraphics, "handle", $hbrush, "ptr", $ppoints, "int", $icount, "int", "FillModeAlternate")
- Local $tmperror = @error, $tmpextended = @extended
- __gdiplus_brushdefdispose()
- If $tmperror Then Return SetError($tmperror, $tmpextended, False)
- Return $aresult[0] = 0
- EndFunc
- Func _gdiplus_graphicsfillrect($hgraphics, $ix, $iy, $iwidth, $iheight, $hbrush = 0)
- __gdiplus_brushdefcreate($hbrush)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipFillRectangleI", "handle", $hgraphics, "handle", $hbrush, "int", $ix, "int", $iy, "int", $iwidth, "int", $iheight)
- Local $tmperror = @error, $tmpextended = @extended
- __gdiplus_brushdefdispose()
- If $tmperror Then Return SetError($tmperror, $tmpextended, False)
- Return $aresult[0] = 0
- EndFunc
- Func _gdiplus_graphicsgetdc($hgraphics)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipGetDC", "handle", $hgraphics, "ptr*", 0)
- If @error Then Return SetError(@error, @extended, False)
- Return SetExtended($aresult[0], $aresult[2])
- EndFunc
- Func _gdiplus_graphicsgetsmoothingmode($hgraphics)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipGetSmoothingMode", "handle", $hgraphics, "int*", 0)
- If @error Then Return SetError(@error, @extended, -1)
- Switch $aresult[2]
- Case 3
- Return SetExtended($aresult[0], 1)
- Case 7
- Return SetExtended($aresult[0], 2)
- Case Else
- Return SetExtended($aresult[0], 0)
- EndSwitch
- EndFunc
- Func _gdiplus_graphicsmeasurestring($hgraphics, $sstring, $hfont, $tlayout, $hformat)
- Local $playout = DllStructGetPtr($tlayout)
- Local $trectf = DllStructCreate($taggdiprectf)
- Local $prectf = DllStructGetPtr($trectf)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipMeasureString", "handle", $hgraphics, "wstr", $sstring, "int", -1, "handle", $hfont, "ptr", $playout, "handle", $hformat, "ptr", $prectf, "int*", 0, "int*", 0)
- If @error Then Return SetError(@error, @extended, 0)
- Local $ainfo[3]
- $ainfo[0] = $trectf
- $ainfo[1] = $aresult[8]
- $ainfo[2] = $aresult[9]
- Return SetExtended($aresult[0], $ainfo)
- EndFunc
- Func _gdiplus_graphicsreleasedc($hgraphics, $hdc)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipReleaseDC", "handle", $hgraphics, "handle", $hdc)
- If @error Then Return SetError(@error, @extended, False)
- Return SetExtended($aresult[0], $aresult[2])
- EndFunc
- Func _gdiplus_graphicssettransform($hgraphics, $hmatrix)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipSetWorldTransform", "handle", $hgraphics, "handle", $hmatrix)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0] = 0
- EndFunc
- Func _gdiplus_graphicssetsmoothingmode($hgraphics, $ismooth)
- If $ismooth < 0 OR $ismooth > 4 Then $ismooth = 0
- Local $aresult = DllCall($ghgdipdll, "int", "GdipSetSmoothingMode", "handle", $hgraphics, "int", $ismooth)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0] = 0
- EndFunc
- Func _gdiplus_imagedispose($himage)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipDisposeImage", "handle", $himage)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0] = 0
- EndFunc
- Func _gdiplus_imagegetflags($himage)
- Local $aflag[2] = [0, ""]
- If ($himage = -1) OR (NOT $himage) Then Return SetError(10, 1, $aflag)
- Local $aimageflags[13][2] = [["Pixel data Cacheable", $gdip_imageflags_caching], ["Pixel data read-only", $gdip_imageflags_readonly], ["Pixel size in image", $gdip_imageflags_hasrealpixelsize], ["DPI info in image", $gdip_imageflags_hasrealdpi], ["YCCK color space", $gdip_imageflags_colorspace_ycck], ["YCBCR color space", $gdip_imageflags_colorspace_ycbcr], ["Grayscale image", $gdip_imageflags_colorspace_gray], ["CMYK color space", $gdip_imageflags_colorspace_cmyk], ["RGB color space", $gdip_imageflags_colorspace_rgb], ["Partially scalable", $gdip_imageflags_partiallyscalable], ["Alpha values other than 0 (transparent) and 255 (opaque)", $gdip_imageflags_hastranslucent], ["Alpha values", $gdip_imageflags_hasalpha], ["Scalable", $gdip_imageflags_scalable]]
- Local $aresult = DllCall($ghgdipdll, "int", "GdipGetImageFlags", "handle", $himage, "long*", 0)
- If @error Then Return SetError(@error, 2, $aflag)
- If $aresult[2] = $gdip_imageflags_none Then
- $aflag[1] = "No pixel data"
- Return SetError($aresult[0], 3, $aflag)
- EndIf
- $aflag[0] = $aresult[2]
- For $i = 0 To 12
- If BitAND($aresult[2], $aimageflags[$i][1]) = $aimageflags[$i][1] Then
- If StringLen($aflag[1]) Then $aflag[1] &= "|"
- $aresult[2] -= $aimageflags[$i][1]
- $aflag[1] &= $aimageflags[$i][0]
- EndIf
- Next
- Return SetExtended($aresult[0], $aflag)
- EndFunc
- Func _gdiplus_imagegetgraphicscontext($himage)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipGetImageGraphicsContext", "handle", $himage, "ptr*", 0)
- If @error Then Return SetError(@error, @extended, -1)
- Return SetExtended($aresult[0], $aresult[2])
- EndFunc
- Func _gdiplus_imagegetheight($himage)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipGetImageHeight", "handle", $himage, "uint*", 0)
- If @error Then Return SetError(@error, @extended, -1)
- Return SetExtended($aresult[0], $aresult[2])
- EndFunc
- Func _gdiplus_imagegethorizontalresolution($himage)
- If ($himage = -1) OR (NOT $himage) Then Return SetError(10, 1, 0)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipGetImageHorizontalResolution", "handle", $himage, "float*", 0)
- If @error Then Return SetError(@error, @extended, 0)
- Return SetExtended($aresult[0], Round($aresult[2]))
- EndFunc
- Func _gdiplus_imagegetpixelformat($himage)
- Local $aformat[2] = [0, ""]
- If ($himage = -1) OR (NOT $himage) Then Return SetError(10, 1, $aformat)
- Local $apixelformat[14][2] = [["1 Bpp Indexed", $gdip_pxf01indexed], ["4 Bpp Indexed", $gdip_pxf04indexed], ["8 Bpp Indexed", $gdip_pxf08indexed], ["16 Bpp Grayscale", $gdip_pxf16grayscale], ["16 Bpp RGB 555", $gdip_pxf16rgb555], ["16 Bpp RGB 565", $gdip_pxf16rgb565], ["16 Bpp ARGB 1555", $gdip_pxf16argb1555], ["24 Bpp RGB", $gdip_pxf24rgb], ["32 Bpp RGB", $gdip_pxf32rgb], ["32 Bpp ARGB", $gdip_pxf32argb], ["32 Bpp PARGB", $gdip_pxf32pargb], ["48 Bpp RGB", $gdip_pxf48rgb], ["64 Bpp ARGB", $gdip_pxf64argb], ["64 Bpp PARGB", $gdip_pxf64pargb]]
- Local $aresult = DllCall($ghgdipdll, "int", "GdipGetImagePixelFormat", "handle", $himage, "int*", 0)
- If @error Then Return SetError(@error, @extended, $aformat)
- For $i = 0 To 13
- If $apixelformat[$i][1] = $aresult[2] Then
- $aformat[0] = $apixelformat[$i][1]
- $aformat[1] = $apixelformat[$i][0]
- Return SetExtended($aresult[0], $aformat)
- EndIf
- Next
- Return SetExtended($aresult[0], $aformat)
- EndFunc
- Func _gdiplus_imagegetrawformat($himage)
- Local $aguid[2]
- If ($himage = -1) OR (NOT $himage) Then Return SetError(10, 1, $aguid)
- Local $aimagetype[11][2] = [["UNDEFINED", $gdip_imageformat_undefined], ["MEMORYBMP", $gdip_imageformat_memorybmp], ["BMP", $gdip_imageformat_bmp], ["EMF", $gdip_imageformat_emf], ["WMF", $gdip_imageformat_wmf], ["JPEG", $gdip_imageformat_jpeg], ["PNG", $gdip_imageformat_png], ["GIF", $gdip_imageformat_gif], ["TIFF", $gdip_imageformat_tiff], ["EXIF", $gdip_imageformat_exif], ["ICON", $gdip_imageformat_icon]]
- Local $tstruc = DllStructCreate("byte[16]")
- Local $aresult1 = DllCall($ghgdipdll, "int", "GdipGetImageRawFormat", "handle", $himage, "ptr", DllStructGetPtr($tstruc))
- If @error Then Return SetError(@error, @extended, $aguid)
- If (NOT IsArray($aresult1)) OR (NOT IsPtr($aresult1[2])) OR (NOT $aresult1[2]) Then Return SetError(1, 3, $aguid)
- Local $sresult2 = _winapi_stringfromguid($aresult1[2])
- If @error Then Return SetError(@error, 4, $aguid)
- For $i = 0 To 10
- If $aimagetype[$i][1] == $sresult2 Then
- $aguid[0] = $aimagetype[$i][1]
- $aguid[1] = $aimagetype[$i][0]
- Return SetExtended($aresult1[0], $aguid)
- EndIf
- Next
- Return SetError(-1, 5, $aguid)
- EndFunc
- Func _gdiplus_imagegettype($himage)
- If ($himage = -1) OR (NOT $himage) Then Return SetError(10, 0, -1)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipGetImageType", "handle", $himage, "int*", 0)
- If @error Then Return SetError(@error, @extended, -1)
- Return SetExtended($aresult[0], $aresult[2])
- EndFunc
- Func _gdiplus_imagegetverticalresolution($himage)
- If ($himage = -1) OR (NOT $himage) Then Return SetError(10, 0, 0)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipGetImageVerticalResolution", "handle", $himage, "float*", 0)
- If @error Then Return SetError(@error, @extended, 0)
- Return SetExtended($aresult[0], Round($aresult[2]))
- EndFunc
- Func _gdiplus_imagegetwidth($himage)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipGetImageWidth", "handle", $himage, "uint*", -1)
- If @error Then Return SetError(@error, @extended, -1)
- Return SetExtended($aresult[0], $aresult[2])
- EndFunc
- Func _gdiplus_imageloadfromfile($sfilename)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipLoadImageFromFile", "wstr", $sfilename, "ptr*", 0)
- If @error Then Return SetError(@error, @extended, -1)
- Return SetExtended($aresult[0], $aresult[2])
- EndFunc
- Func _gdiplus_imagesavetofile($himage, $sfilename)
- Local $sext = __gdiplus_extractfileext($sfilename)
- Local $sclsid = _gdiplus_encodersgetclsid($sext)
- If $sclsid = "" Then Return SetError(-1, 0, False)
- Return _gdiplus_imagesavetofileex($himage, $sfilename, $sclsid, 0)
- EndFunc
- Func _gdiplus_imagesavetofileex($himage, $sfilename, $sencoder, $pparams = 0)
- Local $tguid = _winapi_guidfromstring($sencoder)
- Local $pguid = DllStructGetPtr($tguid)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipSaveImageToFile", "handle", $himage, "wstr", $sfilename, "ptr", $pguid, "ptr", $pparams)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0] = 0
- EndFunc
- Func _gdiplus_matrixcreate()
- Local $aresult = DllCall($ghgdipdll, "int", "GdipCreateMatrix", "ptr*", 0)
- If @error Then Return SetError(@error, @extended, 0)
- Return SetExtended($aresult[0], $aresult[1])
- EndFunc
- Func _gdiplus_matrixdispose($hmatrix)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipDeleteMatrix", "handle", $hmatrix)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0] = 0
- EndFunc
- Func _gdiplus_matrixrotate($hmatrix, $fangle, $bappend = False)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipRotateMatrix", "handle", $hmatrix, "float", $fangle, "int", $bappend)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0] = 0
- EndFunc
- Func _gdiplus_matrixscale($hmatrix, $fscalex, $fscaley, $border = False)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipScaleMatrix", "handle", $hmatrix, "float", $fscalex, "float", $fscaley, "int", $border)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0] = 0
- EndFunc
- Func _gdiplus_matrixtranslate($hmatrix, $foffsetx, $foffsety, $bappend = False)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipTranslateMatrix", "handle", $hmatrix, "float", $foffsetx, "float", $foffsety, "int", $bappend)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0] = 0
- EndFunc
- Func _gdiplus_paramadd(ByRef $tparams, $sguid, $icount, $itype, $pvalues)
- Local $tparam = DllStructCreate($taggdipencoderparam, DllStructGetPtr($tparams, "Params") + (DllStructGetData($tparams, "Count") * 28))
- _winapi_guidfromstringex($sguid, DllStructGetPtr($tparam, "GUID"))
- DllStructSetData($tparam, "Type", $itype)
- DllStructSetData($tparam, "Count", $icount)
- DllStructSetData($tparam, "Values", $pvalues)
- DllStructSetData($tparams, "Count", DllStructGetData($tparams, "Count") + 1)
- EndFunc
- Func _gdiplus_paraminit($icount)
- If $icount <= 0 Then Return SetError(-1, -1, 0)
- Return DllStructCreate("dword Count;byte Params[" & $icount * 28 & "]")
- EndFunc
- Func _gdiplus_pencreate($iargb = -16777216, $fwidth = 1, $iunit = 2)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipCreatePen1", "dword", $iargb, "float", $fwidth, "int", $iunit, "ptr*", 0)
- If @error Then Return SetError(@error, @extended, 0)
- Return SetExtended($aresult[0], $aresult[4])
- EndFunc
- Func _gdiplus_pendispose($hpen)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipDeletePen", "handle", $hpen)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0] = 0
- EndFunc
- Func _gdiplus_pengetalignment($hpen)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipGetPenMode", "handle", $hpen, "int*", 0)
- If @error Then Return SetError(@error, @extended, -1)
- Return SetExtended($aresult[0], $aresult[2])
- EndFunc
- Func _gdiplus_pengetcolor($hpen)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipGetPenColor", "handle", $hpen, "dword*", 0)
- If @error Then Return SetError(@error, @extended, -1)
- Return SetExtended($aresult[0], $aresult[2])
- EndFunc
- Func _gdiplus_pengetcustomendcap($hpen)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipGetPenCustomEndCap", "handle", $hpen, "ptr*", 0)
- If @error Then Return SetError(@error, @extended, 0)
- Return SetExtended($aresult[0], $aresult[2])
- EndFunc
- Func _gdiplus_pengetdashcap($hpen)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipGetPenDashCap197819", "handle", $hpen, "int*", 0)
- If @error Then Return SetError(@error, @extended, -1)
- Return SetExtended($aresult[0], $aresult[2])
- EndFunc
- Func _gdiplus_pengetdashstyle($hpen)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipGetPenDashStyle", "handle", $hpen, "int*", 0)
- If @error Then Return SetError(@error, @extended, -1)
- Return SetExtended($aresult[0], $aresult[2])
- EndFunc
- Func _gdiplus_pengetendcap($hpen)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipGetPenEndCap", "handle", $hpen, "int*", 0)
- If @error Then Return SetError(@error, @extended, -1)
- Return SetExtended($aresult[0], $aresult[2])
- EndFunc
- Func _gdiplus_pengetwidth($hpen)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipGetPenWidth", "handle", $hpen, "float*", 0)
- If @error Then Return SetError(@error, @extended, -1)
- Return SetExtended($aresult[0], $aresult[2])
- EndFunc
- Func _gdiplus_pensetalignment($hpen, $ialignment = 0)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipSetPenMode", "handle", $hpen, "int", $ialignment)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0] = 0
- EndFunc
- Func _gdiplus_pensetcolor($hpen, $iargb)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipSetPenColor", "handle", $hpen, "dword", $iargb)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0] = 0
- EndFunc
- Func _gdiplus_pensetdashcap($hpen, $idash = 0)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipSetPenDashCap197819", "handle", $hpen, "int", $idash)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0] = 0
- EndFunc
- Func _gdiplus_pensetcustomendcap($hpen, $hendcap)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipSetPenCustomEndCap", "handle", $hpen, "handle", $hendcap)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0] = 0
- EndFunc
- Func _gdiplus_pensetdashstyle($hpen, $istyle = 0)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipSetPenDashStyle", "handle", $hpen, "int", $istyle)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0] = 0
- EndFunc
- Func _gdiplus_pensetendcap($hpen, $iendcap)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipSetPenEndCap", "handle", $hpen, "int", $iendcap)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0] = 0
- EndFunc
- Func _gdiplus_pensetwidth($hpen, $fwidth)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipSetPenWidth", "handle", $hpen, "float", $fwidth)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0] = 0
- EndFunc
- Func _gdiplus_rectfcreate($nx = 0, $ny = 0, $nwidth = 0, $nheight = 0)
- Local $trectf = DllStructCreate($taggdiprectf)
- DllStructSetData($trectf, "X", $nx)
- DllStructSetData($trectf, "Y", $ny)
- DllStructSetData($trectf, "Width", $nwidth)
- DllStructSetData($trectf, "Height", $nheight)
- Return $trectf
- EndFunc
- Func _gdiplus_shutdown()
- If $ghgdipdll = 0 Then Return SetError(-1, -1, False)
- $gigdipref -= 1
- If $gigdipref = 0 Then
- DllCall($ghgdipdll, "none", "GdiplusShutdown", "ptr", $gigdiptoken)
- DllClose($ghgdipdll)
- $ghgdipdll = 0
- EndIf
- Return True
- EndFunc
- Func _gdiplus_startup()
- $gigdipref += 1
- If $gigdipref > 1 Then Return True
- $ghgdipdll = DllOpen("GDIPlus.dll")
- If $ghgdipdll = -1 Then Return SetError(1, 2, False)
- Local $tinput = DllStructCreate($taggdipstartupinput)
- Local $pinput = DllStructGetPtr($tinput)
- Local $ttoken = DllStructCreate("ulong_ptr Data")
- Local $ptoken = DllStructGetPtr($ttoken)
- DllStructSetData($tinput, "Version", 1)
- Local $aresult = DllCall($ghgdipdll, "int", "GdiplusStartup", "ptr", $ptoken, "ptr", $pinput, "ptr", 0)
- If @error Then Return SetError(@error, @extended, False)
- $gigdiptoken = DllStructGetData($ttoken, "Data")
- Return $aresult[0] = 0
- EndFunc
- Func _gdiplus_stringformatcreate($iformat = 0, $ilangid = 0)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipCreateStringFormat", "int", $iformat, "word", $ilangid, "ptr*", 0)
- If @error Then Return SetError(@error, @extended, 0)
- Return SetExtended($aresult[0], $aresult[3])
- EndFunc
- Func _gdiplus_stringformatdispose($hformat)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipDeleteStringFormat", "handle", $hformat)
- If @error Then Return SetError(@error, @extended, False)
- Return $aresult[0] = 0
- EndFunc
- Func _gdiplus_stringformatsetalign($hstringformat, $iflag)
- Local $aresult = DllCall($ghgdipdll, "int", "GdipSetStringFormatAlign", "handle", $hstringformat, "int", $iflag)
- If @error Then Return SetError(@error, @extended, 0)
- Return $aresult[0] = 0
- EndFunc
- Func __gdiplus_brushdefcreate(ByRef $hbrush)
- If $hbrush = 0 Then
- $ghgdipbrush = _gdiplus_brushcreatesolid()
- $hbrush = $ghgdipbrush
- EndIf
- EndFunc
- Func __gdiplus_brushdefdispose()
- If $ghgdipbrush <> 0 Then
- _gdiplus_brushdispose($ghgdipbrush)
- $ghgdipbrush = 0
- EndIf
- EndFunc
- Func __gdiplus_extractfileext($sfilename, $fnodot = True)
- Local $iindex = __gdiplus_lastdelimiter(".\:", $sfilename)
- If ($iindex > 0) AND (StringMid($sfilename, $iindex, 1) = ".") Then
- If $fnodot Then
- Return StringMid($sfilename, $iindex + 1)
- Else
- Return StringMid($sfilename, $iindex)
- EndIf
- Else
- Return ""
- EndIf
- EndFunc
- Func __gdiplus_lastdelimiter($sdelimiters, $sstring)
- Local $sdelimiter, $in
- For $ii = 1 To StringLen($sdelimiters)
- $sdelimiter = StringMid($sdelimiters, $ii, 1)
- $in = StringInStr($sstring, $sdelimiter, 0, -1)
- If $in > 0 Then Return $in
- Next
- EndFunc
- Func __gdiplus_pendefcreate(ByRef $hpen)
- If $hpen = 0 Then
- $ghgdippen = _gdiplus_pencreate()
- $hpen = $ghgdippen
- EndIf
- EndFunc
- Func __gdiplus_pendefdispose()
- If $ghgdippen <> 0 Then
- _gdiplus_pendispose($ghgdippen)
- $ghgdippen = 0
- EndIf
- EndFunc
- Global Const $gui_event_close = -3
- Global Const $gui_event_minimize = -4
- Global Const $gui_event_restore = -5
- Global Const $gui_event_maximize = -6
- Global Const $gui_event_primarydown = -7
- Global Const $gui_event_primaryup = -8
- Global Const $gui_event_secondarydown = -9
- Global Const $gui_event_secondaryup = -10
- Global Const $gui_event_mousemove = -11
- Global Const $gui_event_resized = -12
- Global Const $gui_event_dropped = -13
- Global Const $gui_rundefmsg = "GUI_RUNDEFMSG"
- Global Const $gui_avistop = 0
- Global Const $gui_avistart = 1
- Global Const $gui_aviclose = 2
- Global Const $gui_checked = 1
- Global Const $gui_indeterminate = 2
- Global Const $gui_unchecked = 4
- Global Const $gui_dropaccepted = 8
- Global Const $gui_nodropaccepted = 4096
- Global Const $gui_acceptfiles = $gui_dropaccepted
- Global Const $gui_show = 16
- Global Const $gui_hide = 32
- Global Const $gui_enable = 64
- Global Const $gui_disable = 128
- Global Const $gui_focus = 256
- Global Const $gui_nofocus = 8192
- Global Const $gui_defbutton = 512
- Global Const $gui_expand = 1024
- Global Const $gui_ontop = 2048
- Global Const $gui_fontitalic = 2
- Global Const $gui_fontunder = 4
- Global Const $gui_fontstrike = 8
- Global Const $gui_dockauto = 1
- Global Const $gui_dockleft = 2
- Global Const $gui_dockright = 4
- Global Const $gui_dockhcenter = 8
- Global Const $gui_docktop = 32
- Global Const $gui_dockbottom = 64
- Global Const $gui_dockvcenter = 128
- Global Const $gui_dockwidth = 256
- Global Const $gui_dockheight = 512
- Global Const $gui_docksize = 768
- Global Const $gui_dockmenubar = 544
- Global Const $gui_dockstatebar = 576
- Global Const $gui_dockall = 802
- Global Const $gui_dockborders = 102
- Global Const $gui_gr_close = 1
- Global Const $gui_gr_line = 2
- Global Const $gui_gr_bezier = 4
- Global Const $gui_gr_move = 6
- Global Const $gui_gr_color = 8
- Global Const $gui_gr_rect = 10
- Global Const $gui_gr_ellipse = 12
- Global Const $gui_gr_pie = 14
- Global Const $gui_gr_dot = 16
- Global Const $gui_gr_pixel = 18
- Global Const $gui_gr_hint = 20
- Global Const $gui_gr_refresh = 22
- Global Const $gui_gr_pensize = 24
- Global Const $gui_gr_nobkcolor = -2
- Global Const $gui_bkcolor_default = -1
- Global Const $gui_bkcolor_transparent = -2
- Global Const $gui_bkcolor_lv_alternate = -33554432
- Global Const $gui_ws_ex_parentdrag = 1048576
- 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 $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 $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 $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_embedded = 128
- Global Const $clip_lh_angles = 16
- Global Const $clip_mask = 15
- 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 $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 $__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 $custcolors = "dword[16]"
- Local $tchoose = DllStructCreate($tagchoosecolor)
- Local $tcc = DllStructCreate($custcolors)
- 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", "ptr", DllStructGetPtr($tchoose))
- If @error Then Return SetError(@error, @extended, -1)
- If $aresult[0] = 0 Then Return SetError(-3, -3, -1)
- Local $color_picked = DllStructGetData($tchoose, "rgbResult")
- If $ireturntype = 1 Then
- Return "0x" & Hex(String($color_picked), 6)
- ElseIf $ireturntype = 2 Then
- $color_picked = Hex(String($color_picked), 6)
- Return "0x" & StringMid($color_picked, 5, 2) & StringMid($color_picked, 3, 2) & StringMid($color_picked, 1, 2)
- ElseIf $ireturntype = 0 Then
- Return $color_picked
- Else
- Return SetError(-4, -4, -1)
- EndIf
- EndFunc
- Func _choosefont($sfontname = "Courier New", $ipointsize = 10, $icolorref = 0, $ifontweight = 0, $iitalic = False, $iunderline = False, $istrikethru = False, $hwndowner = 0)
- Local $italic = 0, $underline = 0, $strikeout = 0
- Local $lngdc = __misc_getdc(0)
- Local $lfheight = Round(($ipointsize * __misc_getdevicecaps($lngdc, $logpixelsx)) / 72, 0)
- __misc_releasedc(0, $lngdc)
- 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", $icolorref)
- DllStructSetData($tchoosefont, "FontType", 0)
- DllStructSetData($tlogfont, "Height", $lfheight)
- DllStructSetData($tlogfont, "Weight", $ifontweight)
- DllStructSetData($tlogfont, "Italic", $iitalic)
- DllStructSetData($tlogfont, "Underline", $iunderline)
- DllStructSetData($tlogfont, "Strikeout", $istrikethru)
- DllStructSetData($tlogfont, "FaceName", $sfontname)
- Local $aresult = DllCall("comdlg32.dll", "bool", "ChooseFontW", "ptr", DllStructGetPtr($tchoosefont))
- If @error Then Return SetError(@error, @extended, -1)
- If $aresult[0] = 0 Then Return SetError(-3, -3, -1)
- Local $fontname = DllStructGetData($tlogfont, "FaceName")
- If StringLen($fontname) = 0 AND StringLen($sfontname) > 0 Then $fontname = $sfontname
- If DllStructGetData($tlogfont, "Italic") Then $italic = 2
- If DllStructGetData($tlogfont, "Underline") Then $underline = 4
- If DllStructGetData($tlogfont, "Strikeout") Then $strikeout = 8
- Local $attributes = BitOR($italic, $underline, $strikeout)
- Local $size = DllStructGetData($tchoosefont, "PointSize") / 10
- Local $colorref = DllStructGetData($tchoosefont, "rgbColors")
- Local $weight = DllStructGetData($tlogfont, "Weight")
- Local $color_picked = Hex(String($colorref), 6)
- Return StringSplit($attributes & "," & $fontname & "," & $size & "," & $weight & "," & $colorref & "," & "0x" & $color_picked & "," & "0x" & StringMid($color_picked, 5, 2) & StringMid($color_picked, 3, 2) & StringMid($color_picked, 1, 2), ",")
- EndFunc
- Func _clipputfile($sfile, $sseparator = "|")
- Local Const $gmem_moveable = 2, $cf_hdrop = 15
- $sfile &= $sseparator & $sseparator
- Local $nglobmemsize = (StringLen($sfile) + 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 $dropfiles = DllStructCreate("dword;ptr;int;int;int;char[" & StringLen($sfile) + 1 & "]", $hlock)
- If @error Then Return SetError(5, 6, False)
- Local $tempstruct = DllStructCreate("dword;ptr;int;int;int")
- DllStructSetData($dropfiles, 1, DllStructGetSize($tempstruct))
- DllStructSetData($dropfiles, 2, 0)
- DllStructSetData($dropfiles, 3, 0)
- DllStructSetData($dropfiles, 4, 0)
- DllStructSetData($dropfiles, 5, 0)
- DllStructSetData($dropfiles, 6, $sfile)
- For $i = 1 To StringLen($sfile)
- If DllStructGetData($dropfiles, 6, $i) = $sseparator Then DllStructSetData($dropfiles, 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 NOT $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 _iif($ftest, $vtrueval, $vfalseval)
- If $ftest Then
- Return $vtrueval
- Else
- Return $vfalseval
- EndIf
- EndFunc
- Func _mousetrap($ileft = 0, $itop = 0, $iright = 0, $ibottom = 0)
- Local $aresult
- If @NumParams == 0 Then
- $aresult = DllCall("user32.dll", "bool", "ClipCursor", "ptr", 0)
- If @error OR NOT $aresult[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)
- $aresult = DllCall("user32.dll", "bool", "ClipCursor", "ptr", DllStructGetPtr($trect))
- If @error OR NOT $aresult[0] Then Return SetError(2, _winapi_getlasterror(), False)
- EndIf
- Return True
- EndFunc
- Func _singleton($soccurencename, $iflag = 0)
- Local Const $error_already_exists = 183
- Local Const $security_descriptor_revision = 1
- Local $psecurityattributes = 0
- If BitAND($iflag, 2) Then
- Local $tsecuritydescriptor = DllStructCreate("dword[5]")
- Local $psecuritydescriptor = DllStructGetPtr($tsecuritydescriptor)
- Local $aret = DllCall("advapi32.dll", "bool", "InitializeSecurityDescriptor", "ptr", $psecuritydescriptor, "dword", $security_descriptor_revision)
- If @error Then Return SetError(@error, @extended, 0)
- If $aret[0] Then
- $aret = DllCall("advapi32.dll", "bool", "SetSecurityDescriptorDacl", "ptr", $psecuritydescriptor, "bool", 1, "ptr", 0, "bool", 0)
- If @error Then Return SetError(@error, @extended, 0)
- If $aret[0] Then
- Local $structsecurityattributes = DllStructCreate($tagsecurity_attributes)
- DllStructSetData($structsecurityattributes, 1, DllStructGetSize($structsecurityattributes))
- DllStructSetData($structsecurityattributes, 2, $psecuritydescriptor)
- DllStructSetData($structsecurityattributes, 3, 0)
- $psecurityattributes = DllStructGetPtr($structsecurityattributes)
- EndIf
- EndIf
- EndIf
- Local $handle = DllCall("kernel32.dll", "handle", "CreateMutexW", "ptr", $psecurityattributes, "bool", 1, "wstr", $soccurencename)
- If @error Then Return SetError(@error, @extended, 0)
- Local $lasterror = DllCall("kernel32.dll", "dword", "GetLastError")
- If @error Then Return SetError(@error, @extended, 0)
- If $lasterror[0] = $error_already_exists Then
- If BitAND($iflag, 1) Then
- Return SetError($lasterror[0], $lasterror[0], 0)
- Else
- Exit -1
- EndIf
- EndIf
- Return $handle[0]
- EndFunc
- Func _ispressed($shexkey, $vdll = "user32.dll")
- Local $a_r = DllCall($vdll, "short", "GetAsyncKeyState", "int", "0x" & $shexkey)
- If @error Then Return SetError(@error, @extended, False)
- Return BitAND($a_r[0], 32768) <> 0
- EndFunc
- Func _versioncompare($sversion1, $sversion2)
- If $sversion1 = $sversion2 Then Return 0
- Local $sep = "."
- If StringInStr($sversion1, $sep) = 0 Then $sep = ","
- Local $aversion1 = StringSplit($sversion1, $sep)
- Local $aversion2 = StringSplit($sversion2, $sep)
- If UBound($aversion1) <> UBound($aversion2) OR UBound($aversion1) = 0 Then
- SetExtended(1)
- If $sversion1 > $sversion2 Then
- Return 1
- ElseIf $sversion1 < $sversion2 Then
- Return -1
- EndIf
- Else
- For $i = 1 To UBound($aversion1) - 1
- If StringIsDigit($aversion1[$i]) AND StringIsDigit($aversion2[$i]) Then
- If Number($aversion1[$i]) > Number($aversion2[$i]) Then
- Return 1
- ElseIf Number($aversion1[$i]) < Number($aversion2[$i]) Then
- Return -1
- EndIf
- Else
- SetExtended(1)
- If $aversion1[$i] > $aversion2[$i] Then
- Return 1
- ElseIf $aversion1[$i] < $aversion2[$i] Then
- Return -1
- EndIf
- EndIf
- Next
- EndIf
- Return SetError(2, 0, 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 $ss_left = 0
- Global Const $ss_center = 1
- Global Const $ss_right = 2
- Global Const $ss_icon = 3
- Global Const $ss_blackrect = 4
- Global Const $ss_grayrect = 5
- Global Const $ss_whiterect = 6
- Global Const $ss_blackframe = 7
- Global Const $ss_grayframe = 8
- Global Const $ss_whiteframe = 9
- Global Const $ss_simple = 11
- Global Const $ss_leftnowordwrap = 12
- Global Const $ss_bitmap = 14
- Global Const $ss_etchedhorz = 16
- Global Const $ss_etchedvert = 17
- Global Const $ss_etchedframe = 18
- Global Const $ss_noprefix = 128
- Global Const $ss_notify = 256
- Global Const $ss_centerimage = 512
- Global Const $ss_rightjust = 1024
- Global Const $ss_sunken = 4096
- Global Const $gui_ss_default_label = 0
- Global Const $gui_ss_default_graphic = 0
- Global Const $gui_ss_default_icon = $ss_notify
- Global Const $gui_ss_default_pic = $ss_notify
- Global Const $ws_tiled = 0
- Global Const $ws_overlapped = 0
- 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 = 262144
- 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 = 13565952
- Global Const $ws_tiledwindow = 13565952
- 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_child = 1073741824
- Global Const $ws_popup = -2147483648
- Global Const $ws_popupwindow = -2138570752
- Global Const $ds_modalframe = 128
- Global Const $ds_setforeground = 512
- Global Const $ds_contexthelp = 8192
- Global Const $ws_ex_acceptfiles = 16
- Global Const $ws_ex_mdichild = 64
- Global Const $ws_ex_appwindow = 262144
- Global Const $ws_ex_composited = 33554432
- Global Const $ws_ex_clientedge = 512
- Global Const $ws_ex_contexthelp = 1024
- Global Const $ws_ex_dlgmodalframe = 1
- Global Const $ws_ex_leftscrollbar = 16384
- Global Const $ws_ex_overlappedwindow = 768
- Global Const $ws_ex_right = 4096
- 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_layered = 524288
- Global Const $ws_ex_controlparent = 65536
- Global Const $ws_ex_layoutrtl = 4194304
- Global Const $ws_ex_rtlreading = 8192
- Global Const $wm_gettextlength = 14
- Global Const $wm_gettext = 13
- Global Const $wm_size = 5
- Global Const $wm_sizing = 532
- Global Const $wm_user = 1024
- Global Const $wm_create = 1
- Global Const $wm_destroy = 2
- Global Const $wm_move = 3
- Global Const $wm_activate = 6
- Global Const $wm_setfocus = 7
- Global Const $wm_killfocus = 8
- Global Const $wm_enable = 10
- Global Const $wm_setredraw = 11
- Global Const $wm_settext = 12
- Global Const $wm_paint = 15
- Global Const $wm_close = 16
- Global Const $wm_quit = 18
- Global Const $wm_erasebkgnd = 20
- Global Const $wm_syscolorchange = 21
- Global Const $wm_showwindow = 24
- 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_painticon = 38
- Global Const $wm_iconerasebkgnd = 39
- Global Const $wm_nextdlgctl = 40
- 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_querydragicon = 55
- Global Const $wm_compareitem = 57
- Global Const $wm_getobject = 61
- Global Const $wm_compacting = 65
- Global Const $wm_commnotify = 68
- Global Const $wm_windowposchanging = 70
- Global Const $wm_windowposchanged = 71
- Global Const $wm_power = 72
- Global Const $wm_notify = 78
- Global Const $wm_copydata = 74
- Global Const $wm_canceljournal = 75
- 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_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_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_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_keydown = 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_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_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_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 $wm_ctlcolor = 25
- Global Const $mn_gethmenu = 481
- Global Const $nm_first = 0
- Global Const $nm_outofmemory = $nm_first - 1
- Global Const $nm_click = $nm_first - 2
- Global Const $nm_dblclk = $nm_first - 3
- Global Const $nm_return = $nm_first - 4
- Global Const $nm_rclick = $nm_first - 5
- Global Const $nm_rdblclk = $nm_first - 6
- Global Const $nm_setfocus = $nm_first - 7
- Global Const $nm_killfocus = $nm_first - 8
- Global Const $nm_customdraw = $nm_first - 12
- Global Const $nm_hover = $nm_first - 13
- Global Const $nm_nchittest = $nm_first - 14
- Global Const $nm_keydown = $nm_first - 15
- Global Const $nm_releasedcapture = $nm_first - 16
- Global Const $nm_setcursor = $nm_first - 17
- Global Const $nm_char = $nm_first - 18
- Global Const $nm_tooltipscreated = $nm_first - 19
- Global Const $nm_ldown = $nm_first - 20
- Global Const $nm_rdown = $nm_first - 21
- Global Const $nm_themechanged = $nm_first - 22
- Global Const $wm_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_rbuttondblck = 518
- Global Const $wm_mbuttondown = 519
- Global Const $wm_mbuttonup = 520
- Global Const $wm_mbuttondblck = 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 $lwa_alpha = 2
- Global Const $lwa_colorkey = 1
- Global Const $rgn_and = 1
- Global Const $rgn_or = 2
- Global Const $rgn_xor = 3
- Global Const $rgn_diff = 4
- Global Const $rgn_copy = 5
- Global Const $errorregion = 0
- Global Const $nullregion = 1
- Global Const $simpleregion = 2
- Global Const $complexregion = 3
- Global Const $transparent = 1
- Global Const $opaque = 2
- Global Const $ccm_first = 8192
- Global Const $ccm_getunicodeformat = ($ccm_first + 6)
- Global Const $ccm_setunicodeformat = ($ccm_first + 5)
- Global Const $ccm_setbkcolor = $ccm_first + 1
- Global Const $ccm_setcolorscheme = $ccm_first + 2
- Global Const $ccm_getcolorscheme = $ccm_first + 3
- Global Const $ccm_getdroptarget = $ccm_first + 4
- Global Const $ccm_setwindowtheme = $ccm_first + 11
- Global Const $ga_parent = 1
- Global Const $ga_root = 2
- Global Const $ga_rootowner = 3
- Global Const $sm_cxscreen = 0
- Global Const $sm_cyscreen = 1
- Global Const $sm_cxvscroll = 2
- Global Const $sm_cyhscroll = 3
- Global Const $sm_cycaption = 4
- Global Const $sm_cxborder = 5
- Global Const $sm_cyborder = 6
- Global Const $sm_cxdlgframe = 7
- Global Const $sm_cydlgframe = 8
- Global Const $sm_cyvthumb = 9
- Global Const $sm_cxhthumb = 10
- Global Const $sm_cxicon = 11
- Global Const $sm_cyicon = 12
- Global Const $sm_cxcursor = 13
- Global Const $sm_cycursor = 14
- Global Const $sm_cymenu = 15
- Global Const $sm_cxfullscreen = 16
- Global Const $sm_cyfullscreen = 17
- Global Const $sm_cykanjiwindow = 18
- Global Const $sm_mousepresent = 19
- Global Const $sm_cyvscroll = 20
- Global Const $sm_cxhscroll = 21
- Global Const $sm_debug = 22
- Global Const $sm_swapbutton = 23
- Global Const $sm_reserved1 = 24
- Global Const $sm_reserved2 = 25
- Global Const $sm_reserved3 = 26
- Global Const $sm_reserved4 = 27
- Global Const $sm_cxmin = 28
- Global Const $sm_cymin = 29
- Global Const $sm_cxsize = 30
- Global Const $sm_cysize = 31
- Global Const $sm_cxframe = 32
- Global Const $sm_cyframe = 33
- Global Const $sm_cxmintrack = 34
- Global Const $sm_cymintrack = 35
- Global Const $sm_cxdoubleclk = 36
- Global Const $sm_cydoubleclk = 37
- Global Const $sm_cxiconspacing = 38
- Global Const $sm_cyiconspacing = 39
- Global Const $sm_menudropalignment = 40
- Global Const $sm_penwindows = 41
- Global Const $sm_dbcsenabled = 42
- Global Const $sm_cmousebuttons = 43
- Global Const $sm_secure = 44
- Global Const $sm_cxedge = 45
- Global Const $sm_cyedge = 46
- Global Const $sm_cxminspacing = 47
- Global Const $sm_cyminspacing = 48
- Global Const $sm_cxsmicon = 49
- Global Const $sm_cysmicon = 50
- Global Const $sm_cysmcaption = 51
- Global Const $sm_cxsmsize = 52
- Global Const $sm_cysmsize = 53
- Global Const $sm_cxmenusize = 54
- Global Const $sm_cymenusize = 55
- Global Const $sm_arrange = 56
- Global Const $sm_cxminimized = 57
- Global Const $sm_cyminimized = 58
- Global Const $sm_cxmaxtrack = 59
- Global Const $sm_cymaxtrack = 60
- Global Const $sm_cxmaximized = 61
- Global Const $sm_cymaximized = 62
- Global Const $sm_network = 63
- Global Const $sm_cleanboot = 67
- Global Const $sm_cxdrag = 68
- Global Const $sm_cydrag = 69
- Global Const $sm_showsounds = 70
- Global Const $sm_cxmenucheck = 71
- Global Const $sm_cymenucheck = 72
- Global Const $sm_slowmachine = 73
- Global Const $sm_mideastenabled = 74
- Global Const $sm_mousewheelpresent = 75
- Global Const $sm_xvirtualscreen = 76
- Global Const $sm_yvirtualscreen = 77
- Global Const $sm_cxvirtualscreen = 78
- Global Const $sm_cyvirtualscreen = 79
- Global Const $sm_cmonitors = 80
- Global Const $sm_samedisplayformat = 81
- Global Const $sm_immenabled = 82
- Global Const $sm_cxfocusborder = 83
- Global Const $sm_cyfocusborder = 84
- Global Const $sm_tabletpc = 86
- Global Const $sm_mediacenter = 87
- Global Const $sm_starter = 88
- Global Const $sm_serverr2 = 89
- Global Const $sm_cmetrics = 90
- Global Const $sm_remotesession = 4096
- Global Const $sm_shuttingdown = 8192
- Global Const $sm_remotecontrol = 8193
- Global Const $sm_caretblinkingenabled = 8194
- Global Const $blackness = 66
- Global Const $captureblt = 1073741824
- Global Const $dstinvert = 5570569
- Global Const $mergecopy = 12583114
- Global Const $mergepaint = 12255782
- Global Const $nomirrorbitmap = -2147483648
- Global Const $notsrccopy = 3342344
- Global Const $notsrcerase = 1114278
- Global Const $patcopy = 15728673
- Global Const $patinvert = 5898313
- Global Const $patpaint = 16452105
- Global Const $srcand = 8913094
- Global Const $srccopy = 13369376
- Global Const $srcerase = 4457256
- Global Const $srcinvert = 6684742
- Global Const $srcpaint = 15597702
- Global Const $whiteness = 16711778
- Global Const $dt_bottom = 8
- Global Const $dt_calcrect = 1024
- Global Const $dt_center = 1
- Global Const $dt_editcontrol = 8192
- Global Const $dt_end_ellipsis = 32768
- Global Const $dt_expandtabs = 64
- Global Const $dt_externalleading = 512
- Global Const $dt_hideprefix = 1048576
- Global Const $dt_internal = 4096
- Global Const $dt_left = 0
- Global Const $dt_modifystring = 65536
- Global Const $dt_noclip = 256
- Global Const $dt_nofullwidthcharbreak = 524288
- Global Const $dt_noprefix = 2048
- Global Const $dt_path_ellipsis = 16384
- Global Const $dt_prefixonly = 2097152
- Global Const $dt_right = 2
- Global Const $dt_rtlreading = 131072
- Global Const $dt_singleline = 32
- Global Const $dt_tabstop = 128
- Global Const $dt_top = 0
- Global Const $dt_vcenter = 4
- Global Const $dt_wordbreak = 16
- Global Const $dt_word_ellipsis = 262144
- Global Const $rdw_erase = 4
- Global Const $rdw_frame = 1024
- Global Const $rdw_internalpaint = 2
- Global Const $rdw_invalidate = 1
- Global Const $rdw_noerase = 32
- Global Const $rdw_noframe = 2048
- Global Const $rdw_nointernalpaint = 16
- Global Const $rdw_validate = 8
- Global Const $rdw_erasenow = 512
- Global Const $rdw_updatenow = 256
- Global Const $rdw_allchildren = 128
- Global Const $rdw_nochildren = 64
- Global Const $wm_renderformat = 773
- Global Const $wm_renderallformats = 774
- Global Const $wm_destroyclipboard = 775
- Global Const $wm_drawclipboard = 776
- Global Const $wm_paintclipboard = 777
- Global Const $wm_vscrollclipboard = 778
- Global Const $wm_sizeclipboard = 779
- Global Const $wm_askcbformatname = 780
- Global Const $wm_changecbchain = 781
- Global Const $wm_hscrollclipboard = 782
- Global Const $hterror = -2
- Global Const $httransparent = -1
- Global Const $htnowhere = 0
- Global Const $htclient = 1
- Global Const $htcaption = 2
- Global Const $htsysmenu = 3
- Global Const $htgrowbox = 4
- Global Const $htsize = $htgrowbox
- Global Const $htmenu = 5
- Global Const $hthscroll = 6
- Global Const $htvscroll = 7
- Global Const $htminbutton = 8
- Global Const $htmaxbutton = 9
- Global Const $htleft = 10
- Global Const $htright = 11
- Global Const $httop = 12
- Global Const $httopleft = 13
- Global Const $httopright = 14
- Global Const $htbottom = 15
- Global Const $htbottomleft = 16
- Global Const $htbottomright = 17
- Global Const $htborder = 18
- Global Const $htreduce = $htminbutton
- Global Const $htzoom = $htmaxbutton
- Global Const $htsizefirst = $htleft
- Global Const $htsizelast = $htbottomright
- Global Const $htobject = 19
- Global Const $htclose = 20
- Global Const $hthelp = 21
- Global Const $color_scrollbar = 0
- Global Const $color_background = 1
- Global Const $color_activecaption = 2
- Global Const $color_inactivecaption = 3
- Global Const $color_menu = 4
- Global Const $color_window = 5
- Global Const $color_windowframe = 6
- Global Const $color_menutext = 7
- Global Const $color_windowtext = 8
- Global Const $color_captiontext = 9
- Global Const $color_activeborder = 10
- Global Const $color_inactiveborder = 11
- Global Const $color_appworkspace = 12
- Global Const $color_highlight = 13
- Global Const $color_highlighttext = 14
- Global Const $color_btnface = 15
- Global Const $color_btnshadow = 16
- Global Const $color_graytext = 17
- Global Const $color_btntext = 18
- Global Const $color_inactivecaptiontext = 19
- Global Const $color_btnhighlight = 20
- Global Const $color_3ddkshadow = 21
- Global Const $color_3dlight = 22
- Global Const $color_infotext = 23
- Global Const $color_infobk = 24
- Global Const $color_hotlight = 26
- Global Const $color_gradientactivecaption = 27
- Global Const $color_gradientinactivecaption = 28
- Global Const $color_menuhilight = 29
- Global Const $color_menubar = 30
- Global Const $color_desktop = 1
- Global Const $color_3dface = 15
- Global Const $color_3dshadow = 16
- Global Const $color_3dhighlight = 20
- Global Const $color_3dhilight = 20
- Global Const $color_btnhilight = 20
- Global Const $hinst_commctrl = -1
- Global Const $idb_std_small_color = 0
- Global Const $idb_std_large_color = 1
- Global Const $idb_view_small_color = 4
- Global Const $idb_view_large_color = 5
- Global Const $idb_hist_small_color = 8
- Global Const $idb_hist_large_color = 9
- Global Const $startf_forceofffeedback = 128
- Global Const $startf_forceonfeedback = 64
- Global Const $startf_runfullscreen = 32
- 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)
- Opt("WinWaitDelay", 0)
- Global Const $_c_nomduscript_pnggui = StringTrimRight(@ScriptName, 4)
- Global $_a_fileinstall_pnggui[1] = [0], $_a_gui_index_pnggui[1] = [0]
- Global $_b_init_pnggui = 0, $_b_gdi_start_pnggui = 1, $_b_fileinstall_pnggui = 0, $_b_gdi_pnggui = 1, $_b_gui_event_mode = 1
- Global $_f_dossier_pnggui = $_c_nomduscript_pnggui & "\", $_f_lastguiused_pnggui, $_a_fileinstalldata_pnggui[1] = [0]
- Global $_b_lastctrlstate_pnggui, $_f_lastctrlused_pnggui = 0, $_a_buttonsarrindex_pnggui[1] = [0], $_a_buttonsarrwin_pnggui[1] = [0]
- #EndRegion Includes et déclaration des globales
- #Region Fonctions principales ( PngGuiSetOpt, PngGuiCreate, PngGuiSetState, PngGuiDelete, PngGuiExit )
- Func pngguisetopt($install = 0, $dossier = -1, $guioneventmode = 1, $gdi = 1)
- If $install = 1 Then $_b_fileinstall_pnggui = 1
- If $dossier <> -1 Then $_f_dossier_pnggui = $dossier & "\"
- If $dossier = -1 Then $dossier = $_f_dossier_pnggui
- If $gdi = 0 Then $_b_gdi_pnggui = 0
- If $guioneventmode = 0 Then
- $_b_gui_event_mode = 0
- Opt("GuiOnEventMode", 0)
- Else
- Opt("GuiOnEventMode", 1)
- EndIf
- EndFunc
- Func pngguicreate($src, $x = -1, $y = -1, $nom = $_c_nomduscript_pnggui)
- If $_b_init_pnggui = 0 Then
- $_b_init_pnggui = 1
- AdlibRegister("_reducememoryusage_PngGui", 10000)
- If NOT FileExists($_f_dossier_pnggui) Then
- DirCreate($_f_dossier_pnggui)
- ShellExecute(@ScriptName)
- Exit
- EndIf
- If $_b_gdi_pnggui = 1 Then _gdiplus_startup()
- EndIf
- Local $png = _lien_du_png_pnggui($src), $himage = _gdiplus_imageloadfromfile($png), $width = _gdiplus_imagegetwidth($himage), $height = _gdiplus_imagegetheight($himage)
- If $nom = -1 Then
- Local $gui = GUICreate($nom, $width, $height, $x, $y, $ws_popup, $ws_ex_layered, WinGetHandle(AutoItWinGetTitle()))
- Else
- Local $gui = GUICreate($nom, $width, $height, $x, $y, $ws_popup, $ws_ex_layered)
- EndIf
- Local $hgraphic = _gdiplus_graphicscreatefromhwnd($gui), $controlgui = GUICreate("", $width, $height, -1, -1, $ws_popup, BitOR($ws_ex_layered, $ws_ex_mdichild), $gui), $array[4] = [0, $gui, $controlgui, $himage]
- If $_b_gui_event_mode = 1 Then
- GUISetOnEvent($gui_event_primarydown, "GUI_EVENT_PRIMARYDOWN_PngGui", $controlgui)
- GUISetOnEvent($gui_event_primaryup, "GUI_EVENT_PRIMARYUP_PngGui", $controlgui)
- GUISetOnEvent($gui_event_mousemove, "GUI_EVENT_MOUSEMOVE_PngGui", $controlgui)
- EndIf
- _assigneval_pnggui($controlgui, $array)
- setbitmap($gui, $himage, 255)
- $_a_gui_index_pnggui[0] += 1
- _arrayadd($_a_gui_index_pnggui, $controlgui)
- $_f_lastguiused_pnggui = $array
- Return $array
- EndFunc
- Func pngguisetstate($macro = @SW_SHOW, $gui = $_f_lastguiused_pnggui)
- If $macro = $gui_focus Then $_f_lastguiused_pnggui = $gui
- If $macro = @SW_SHOW Then
- Local $color = 1184532
- GUISetBkColor($color, $gui[2])
- _winapi_setlayeredwindowattributes($gui[2], $color)
- EndIf
- GUISetState($macro, $gui[1])
- GUISetState($macro, $gui[2])
- EndFunc
- Func pngguidelete(ByRef $gui)
- pngguisetstate(@SW_HIDE, $gui)
- Local $arr = _assigneval_pnggui($gui[2])
- While $arr[0] > 0
- pngguideletebutton($arr[4])
- $arr = _assigneval_pnggui($gui[2])
- WEnd
- GUIDelete($gui[2])
- GUIDelete($gui[1])
- _winapi_deleteobject($gui[3])
- _assigneval_pnggui($gui[2], -1)
- _arraydelete($_a_gui_index_pnggui, _arraysearch($_a_gui_index_pnggui, $gui[2]))
- $_a_gui_index_pnggui[0] -= 1
- $gui = ""
- EndFunc
- Func pngguiexit($dirdelete = 0, $gdi_exit = 1)
- While $_a_gui_index_pnggui[0] > 0
- Local $gui = _assigneval_pnggui($_a_gui_index_pnggui[1])
- pngguidelete($gui)
- WEnd
- If $dirdelete = 1 Then DirRemove($_f_dossier_pnggui, 1)
- If $gdi_exit = 1 Then _gdiplus_shutdown()
- _fileinstall_data_pnggui(0, 1)
- EndFunc
- #EndRegion Fonctions principales ( PngGuiSetOpt, PngGuiCreate, PngGuiSetState, PngGuiDelete, PngGuiExit )
- #Region Fonctions CTRL ( PngGuiCreateLabel, PngGuiCreatePic, PngGuiCreateButton, PngGuiDeleteButton )
- Func pngguicreatelabel($nom, $x, $y, $w = 200, $h = 30, $color = 0, $style = -1, $exstyle = -1)
- Local $label = GUICtrlCreateLabel($nom, $x, $y, $w, $h, $style, $exstyle)
- GUICtrlSetColor(-1, $color)
- GUICtrlSetBkColor(-1, $gui_bkcolor_transparent)
- Return $label
- EndFunc
- Func pngguicreatepic($src, $x, $y, $scale = 1, $alt = "")
- $src = _lien_du_png_pnggui($src)
- Local $himage2 = _gdiplus_imageloadfromfile($src), $imageheight = (_gdiplus_imagegetheight($himage2)) * $scale, $imagewidth = (_gdiplus_imagegetwidth($himage2)) * $scale
- If $scale <> 1 Then
- Local $hbitmap = _winapi_createbitmap($imagewidth, $imageheight, 1, 32), $himage1 = _gdiplus_bitmapcreatefromhbitmap($hbitmap), $hgraphic = _gdiplus_imagegetgraphicscontext($himage1)
- _gdiplus_graphicsdrawimagerect($hgraphic, $himage2, 0, 0, $imagewidth, $imageheight)
- Local $hbitmap2 = _gdiplus_bitmapcreatehbitmapfrombitmap($himage1)
- _winapi_deleteobject($hbitmap)
- _gdiplus_imagedispose($himage1)
- _gdiplus_graphicsdispose($hgraphic)
- Else
- Local $hbitmap = _gdiplus_bitmapcreatefromfile($src), $hbitmap2 = _gdiplus_bitmapcreatehbitmapfrombitmap($hbitmap)
- _gdiplus_bitmapdispose($hbitmap)
- EndIf
- Local $pic = GUICtrlCreatePic("", $x, $y, $imagewidth, $imageheight)
- If $alt <> "" Then GUICtrlSetTip($pic, $alt)
- GUICtrlSendMsg($pic, 370, 0, $hbitmap2)
- Return $pic
- EndFunc
- Func pngguicreatebutton($src, $x, $y, $fonction = -1, $msg = "")
- Local $u = UBound($src), $src_arr, $ctrl_arr, $u2 = UBound($_f_lastguiused_pnggui)
- If $u = 0 Then
- $u = 1
- Dim $src_arr[1] = [$src]
- Else
- $src_arr = $src
- EndIf
- If $u2 = 4 Then
- $ctrl_arr = _assigneval_pnggui($_f_lastguiused_pnggui[2])
- Else
- MsgBox(0, "Erreur", "PngGuiCreate doit être utilisé puisque PngGuiCreateButton ne peut créer un bouton que sur une PngGui")
- Return
- EndIf
- _arrayadd($src_arr, "")
- _arraypush($src_arr, "", 1)
- $src_arr[1] = _lien_du_png_pnggui($src_arr[1])
- Local $i = _gdiplus_imageloadfromfile($src_arr[1]), $w = _gdiplus_imagegetwidth($i), $h = _gdiplus_imagegetheight($i)
- $src_arr[0] = GUICtrlCreatePic("", $x, $y, $w, $h)
- $ctrl_arr[0] += 1
- _arrayadd($ctrl_arr, $src_arr[0])
- _gdiplus_imagedispose($i)
- For $i = 1 To 3
- If (UBound($src_arr) - 1) < $i Then _arrayadd($src_arr, -1)
- If $src_arr[$i] <> -1 Then
- If $i <> 1 Then $src_arr[$i] = _lien_du_png_pnggui($src_arr[$i])
- Local $hbitmap = _gdiplus_bitmapcreatefromfile($src_arr[$i])
- $src_arr[$i] = _gdiplus_bitmapcreatehbitmapfrombitmap($hbitmap)
- _gdiplus_bitmapdispose($hbitmap)
- Else
- $src_arr[$i] = $src_arr[$i - 1]
- EndIf
- _arrayadd($ctrl_arr, $src_arr[$i])
- Next
- GUICtrlSendMsg($src_arr[0], 370, 0, $src_arr[1])
- _arrayadd($ctrl_arr, "Func" & $fonction)
- _arrayadd($ctrl_arr, "msg" & $msg)
- _assigneval_pnggui($_f_lastguiused_pnggui[2], $ctrl_arr)
- $_a_buttonsarrindex_pnggui[0] += 1
- _arrayadd($_a_buttonsarrindex_pnggui, $src_arr[0])
- _arrayadd($_a_buttonsarrwin_pnggui, $_f_lastguiused_pnggui[2])
- Return $src_arr[0]
- EndFunc
- Func pngguideletebutton($ctrl)
- If $_a_gui_index_pnggui[0] < 1 Then
- MsgBox(0, "PngGuiDeleteButton", "aucune gui enregistrée")
- Exit
- EndIf
- For $i = 1 To $_a_gui_index_pnggui[0]
- Local $index = $_a_gui_index_pnggui[$i], $ctrl_arr = _assigneval_pnggui($_a_gui_index_pnggui[$i]), $search = _arraysearch($ctrl_arr, $ctrl, 4, 0, 1)
- If $search <> -1 Then
- $ctrl_arr[0] -= 1
- _winapi_deleteobject($ctrl_arr[$search + 1])
- _winapi_deleteobject($ctrl_arr[$search + 2])
- _winapi_deleteobject($ctrl_arr[$search + 3])
- GUICtrlSetImage($ctrl_arr[$search], "")
- For $j = 1 To 6
- _arraydelete($ctrl_arr, $search)
- Next
- ExitLoop
- EndIf
- Next
- Local $search = _arraysearch($_a_buttonsarrindex_pnggui, $ctrl)
- If $search = -1 Then MsgBox(0, "Erreur Critique", "_PngGui UDF line 251")
- $_a_buttonsarrindex_pnggui[0] -= 1
- _arraydelete($_a_buttonsarrindex_pnggui, $search)
- _arraydelete($_a_buttonsarrwin_pnggui, $search)
- _assigneval_pnggui($index, $ctrl_arr)
- EndFunc
- #EndRegion Fonctions CTRL ( PngGuiCreateLabel, PngGuiCreatePic, PngGuiCreateButton )
- #Region fonctions internes (_FileInstall_data_pnggui,_assigneval_PngGui,_lien_du_png_PngGui, SetBitmap, _reduceMemoryUsage_PngGui
- Func _fileinstall_data_pnggui($data, $fin = 0)
- If $_b_fileinstall_pnggui = 0 Then Return
- Switch $fin
- Case "0"
- If $_a_fileinstalldata_pnggui[0] = 0 Then
- _arrayadd($_a_fileinstalldata_pnggui, $data)
- $_a_fileinstalldata_pnggui[0] += 1
- Return
- EndIf
- Local $r = _arrayfindall($_a_fileinstalldata_pnggui, $data, 1, 0, 1)
- If UBound($r) <> 0 Then Return
- $_a_fileinstalldata_pnggui[0] += 1
- _arrayadd($_a_fileinstalldata_pnggui, $data)
- Return
- Case "1"
- Local $out = " ; Installation des fichiers images." & @CRLF
- For $i = 1 To $_a_fileinstalldata_pnggui[0]
- $out &= 'FileInstall("' & $_a_fileinstalldata_pnggui[$i] & '","' & $_a_fileinstalldata_pnggui[$i] & '",0)' & @CRLF
- Next
- $out &= @CRLF
- ClipPut($out)
- MsgBox(0, "Données FileInstall", "Les données FileInstall ont été copiés dans" & @CRLF & "le presse-papier avec succès")
- Exit
- EndSwitch
- EndFunc
- Func _assigneval_pnggui($eval, $assign = "")
- $eval = $eval & "_PngGui"
- If $assign = "" Then Return Eval($eval)
- If $assign = -1 Then $assign = ""
- Return Assign($eval, $assign, 2)
- EndFunc
- Func _lien_du_png_pnggui($src)
- Local $png = $_f_dossier_pnggui & $src
- If NOT FileExists($png) Then
- MsgBox(0, "Erreur", "Le fichier " & $png & " n'a pas été trouvé")
- Exit
- EndIf
- _fileinstall_data_pnggui($png, 0)
- Return $png
- EndFunc
- Func setbitmap($hgui, $himage, $iopacity)
- Local $hscrdc, $hmemdc, $hbitmap, $hold, $psize, $tsize, $psource, $tsource, $pblend, $tblend
- $hscrdc = _winapi_getdc(0)
- $hmemdc = _winapi_createcompatibledc($hscrdc)
- $hbitmap = _gdiplus_bitmapcreatehbitmapfrombitmap($himage)
- $hold = _winapi_selectobject($hmemdc, $hbitmap)
- $tsize = DllStructCreate($tagsize)
- $psize = DllStructGetPtr($tsize)
- DllStructSetData($tsize, "X", _gdiplus_imagegetwidth($himage))
- DllStructSetData($tsize, "Y", _gdiplus_imagegetheight($himage))
- $tsource = DllStructCreate($tagpoint)
- $psource = DllStructGetPtr($tsource)
- $tblend = DllStructCreate($tagblendfunction)
- $pblend = DllStructGetPtr($tblend)
- DllStructSetData($tblend, "Alpha", $iopacity)
- DllStructSetData($tblend, "Format", 1)
- _winapi_updatelayeredwindow($hgui, $hscrdc, 0, $psize, $hmemdc, $psource, 0, $pblend, $ulw_alpha)
- _winapi_releasedc(0, $hscrdc)
- _winapi_selectobject($hmemdc, $hold)
- _winapi_deleteobject($hbitmap)
- _winapi_deletedc($hmemdc)
- EndFunc
- Func _reducememoryusage_pnggui()
- _reducememory_pnggui(ProcessExists(@ScriptName))
- EndFunc
- Func _reducememory_pnggui($i_pid = -1)
- If $i_pid <> -1 Then
- Local $ai_handle = DllCall("kernel32.dll", "int", "OpenProcess", "int", 2035711, "int", False, "int", $i_pid)
- Local $ai_return = DllCall("psapi.dll", "int", "EmptyWorkingSet", "long", $ai_handle[0])
- DllCall("kernel32.dll", "int", "CloseHandle", "int", $ai_handle[0])
- Else
- Local $ai_return = DllCall("psapi.dll", "int", "EmptyWorkingSet", "long", -1)
- EndIf
- Return $ai_return[0]
- EndFunc
- #EndRegion fonctions internes
- #Region Gestion des contrôles ( GUI_EVENT_PRIMARYDOWN_PngGui,GUI_EVENT_PRIMARYUP_PngGui,GUI_EVENT_MOUSEMOVE_PngGui,_SetButtonState_PngGui,_ButtonHover_PngGui(),_Win_PngGui
- Func gui_event_primarydown_pnggui()
- Local $win = _win_pnggui()
- If $win = -1 Then Return
- Local $gcci = GUIGetCursorInfo($win)
- If $gcci[4] = 0 Then
- Local $gui = _assigneval_pnggui($win)
- DllCall("user32.dll", "long", "SendMessage", "hwnd", $gui[1], "int", $wm_syscommand, "int", 61449, "int", 0)
- WinActivate($win)
- Else
- $_b_lastctrlstate_pnggui = 1
- _setbuttonstate_pnggui($gcci[4], 3)
- EndIf
- EndFunc
- Func gui_event_primaryup_pnggui()
- $_b_lastctrlstate_pnggui = 0
- Local $win = _win_pnggui()
- If $win = -1 Then Return
- Local $gcci = GUIGetCursorInfo($win)
- If $gcci[4] <> 0 Then _setbuttonstate_pnggui($gcci[4], 2, 1)
- EndFunc
- Func gui_event_mousemove_pnggui()
- If $_a_buttonsarrindex_pnggui[0] < 1 Then Return
- Local $win = _win_pnggui()
- If $win = -1 Then Return
- Local $gcci = GUIGetCursorInfo($win), $winpos = WinGetPos($win)
- If $gcci[0] < 0 OR $gcci[1] < 0 OR $gcci[0] > $winpos[2] OR $gcci[1] > $winpos[3] Then Return
- If $gcci[4] <> $_f_lastctrlused_pnggui Then
- If $_f_lastctrlused_pnggui <> 0 Then _setbuttonstate_pnggui($_f_lastctrlused_pnggui)
- If $gcci[4] <> 0 Then _setbuttonstate_pnggui($gcci[4], 2 + $_b_lastctrlstate_pnggui)
- EndIf
- $_f_lastctrlused_pnggui = $gcci[4]
- EndFunc
- Func _setbuttonstate_pnggui($ctrl, $state = 1, $exe = 0)
- Local $search = _arraysearch($_a_buttonsarrindex_pnggui, $ctrl)
- If $search = -1 Then Return
- Local $ctrl_arr = _assigneval_pnggui($_a_buttonsarrwin_pnggui[$search])
- Local $pic = _arraysearch($ctrl_arr, $ctrl)
- GUICtrlSendMsg($ctrl_arr[$pic], 370, 0, $ctrl_arr[$pic + $state])
- If $exe = 1 Then
- Local $func = StringTrimLeft($ctrl_arr[$pic + 4], 4), $msg = StringTrimLeft($ctrl_arr[$pic + 5], 3)
- If $func <> -1 Then
- Select
- Case $msg = ""
- Call($func)
- Case $msg <> ""
- Call($func, $msg)
- EndSelect
- EndIf
- EndIf
- EndFunc
- Func _buttonhover_pnggui()
- Local $msg = GUIGetMsg()
- Switch $msg
- Case $gui_event_primarydown
- gui_event_primarydown_pnggui()
- Case $gui_event_primaryup
- gui_event_primaryup_pnggui()
- Case $gui_event_mousemove
- gui_event_mousemove_pnggui()
- EndSwitch
- EndFunc
- Func _win_pnggui()
- If $_b_gui_event_mode = 0 Then
- Local $win = WinGetHandle("[ACTIVE]")
- If _arraysearch($_a_buttonsarrwin_pnggui, $win) = -1 Then $win = -1
- Else
- Local $win = @GUI_WinHandle
- EndIf
- Return $win
- EndFunc
- #EndRegion
- 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 = -1
- 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 $tti_none = 0
- Global Const $tti_info = 1
- Global Const $tti_warning = 2
- Global Const $tti_error = 3
- Global Const $tti_info_large = 4
- Global Const $tti_warning_large = 5
- Global Const $tti_error_large = 6
- Global Const $__editconstant_ws_vscroll = 2097152
- Global Const $__editconstant_ws_hscroll = 1048576
- Global Const $gui_ss_default_edit = BitOR($es_wantreturn, $__editconstant_ws_vscroll, $__editconstant_ws_hscroll, $es_autovscroll, $es_autohscroll)
- Global Const $gui_ss_default_input = BitOR($es_left, $es_autohscroll)
- FileInstall("C:\Users\Gr4ph0s\Desktop\gui5.png", @TempDir & "\gui5.png")
- FileInstall("C:\Users\Gr4ph0s\Desktop\bouton.png", @TempDir & "\bouton.png")
- FileInstall("C:\Users\Gr4ph0s\Desktop\bouton.png", @TempDir & "\musique crackme.mp3")
- Opt(_func_wtf5(BinaryToString(_func_wtf1(BinaryToString("0x29DD973C9DAF6A95402A8CA7"), $wtf1))), 1)
- pngguisetopt(0, @TempDir, 1)
- Global $wtf2 = pngguicreate(_func_wtf5(BinaryToString(_func_wtf1(BinaryToString("0x2BD78E5AC6A97CBB65"), $wtf1))), -1, -1, _func_wtf5(BinaryToString(_func_wtf1(BinaryToString("0x22DC990D968B7DB5563F8BB2"), $wtf1))))
- GUISetOnEvent($gui_event_close, _func_wtf5(BinaryToString(_func_wtf1(BinaryToString("0x78FFAA23ACA367A97F14"), $wtf1))))
- Global $wtf3 = GUICtrlCreateInput(_func_wtf5(BinaryToString(_func_wtf1(BinaryToString("0x29CA8D1583E06CB8193F919EBE9EF725CE0E78D46B93C2CE5F1CE9"), $wtf1))), 175, 250, 300, _func_wtf5(BinaryToString(_func_wtf1(BinaryToString("0"), $wtf1))), $es_center)
- Global $wtf4 = GUICtrlCreateLabel(_func_wtf5(BinaryToString(_func_wtf1(BinaryToString(""), $wtf1))), 100, 130, 30, 30)
- GUICtrlSetCursor(-1, 0)
- GUICtrlSetOnEvent($wtf4, _func_wtf5(BinaryToString(_func_wtf1(BinaryToString("0x7FFFAA23ACA367A97F14"), $wtf1))))
- Global $wtf5 = GUICtrlCreateLabel(_func_wtf5(BinaryToString(_func_wtf1(BinaryToString(""), $wtf1))), 525, 130, 30, 30)
- GUICtrlSetCursor(-1, 0)
- GUICtrlSetOnEvent($wtf5, _func_wtf5(BinaryToString(_func_wtf1(BinaryToString("0x78FFAA23ACA367A97F14"), $wtf1))))
- Global $wtf6 = pngguicreatebutton(_func_wtf5(BinaryToString(_func_wtf1(BinaryToString("0x2BD78E5A9DAF7DA95629A2"), $wtf1))), 265, 295, _func_wtf5(BinaryToString(_func_wtf1(BinaryToString("0x7EFFAA23ACA367A97F14"), $wtf1))))
- GUISetOnEvent($wtf6, _func_wtf5(BinaryToString(_func_wtf1(BinaryToString("0x7EFFAA23ACA367A97F14"), $wtf1))))
- pngguisetstate()
- While 1
- Global $wtf7 = _soundopen(@DesktopDir & _func_wtf5(BinaryToString(_func_wtf1(BinaryToString("0x7FC9935A96AD62BF58399DD3FB85E92E9D1E79A8"), $wtf1))))
- Do
- _soundplay($wtf7)
- Sleep(1000)
- Until $wtf7 = 100
- WEnd
- Func _func_wtf2()
- $wtf8 = GUICtrlRead($wtf3)
- $wtf9 = _func_wtf5(BinaryToString(_func_wtf1(BinaryToString("0xFC894E54C4E139EB4C7FD950BEC3E468B21735C036BC90971CC2"), $wtf1)))
- If $wtf8 = $wtf9 Then
- InputBox(_func_wtf5(BinaryToString(_func_wtf1(BinaryToString("0x22D6970092B460BF502717B5"), $wtf1))), _func_wtf5(BinaryToString(_func_wtf1(BinaryToString("0x29CF8B1181B0E0FB556B8C96FA99F426984B66817E869042581BD3C78BBAC187A9A2B43B9291A408947870FC6C6EB6995AC196B2348A38CA75E3CB44BB8592CB262BDBCF7DE4A89793A847A3CD2B30BCD6"), $wtf1))), _func_wtf5(BinaryToString(_func_wtf1(BinaryToString("0x6583DE1391A470B05504DEC6E2AFE477DB4B78917584DF650C4103C79AA584D29FF1A369D7C9AB248D287A36"), $wtf1))))
- Else
- MsgBox(48, _func_wtf5(BinaryToString(_func_wtf1(BinaryToString("0x29DE9F199EAF4D"), $wtf1))), _func_wtf5(BinaryToString(_func_wtf1(BinaryToString("0x6583DE1181AF6AB25C6B9B8AFF83EB02"), $wtf1))))
- EndIf
- EndFunc
- Func _func_wtf3()
- MsgBox(64, _func_wtf5(BinaryToString(_func_wtf1(BinaryToString("0x3FD68E1B81B0299D"), $wtf1))), _func_wtf5(BinaryToString(_func_wtf1(BinaryToString("0x6CCACE04C7B24EFC4B2A8ED3FB9DB52C8D0A66B7"), $wtf1))) & @CRLF & _func_wtf5(BinaryToString(_func_wtf1(BinaryToString("0x2BCB915A96AD24A85624ACD3EC85F737CE1F7DD97E82C5660C1CC5C707B28EB6"), $wtf1))) & @CRLF & @CRLF & _func_wtf5(BinaryToString(_func_wtf1(BinaryToString("0x7C818644ACB467B51971DE9CEAD0EB2C800A7CA0"), $wtf1))) & @CRLF & _func_wtf5(BinaryToString(_func_wtf1(BinaryToString("0x35CD971A86AD64B37A6B9A9DFFD0EA228C0671B931B5E76F0C5F80C7CEF6C1D5FCF1B468C7DEF75BD13C7D"), $wtf1))) & @CRLF & _func_wtf5(BinaryToString(_func_wtf1(BinaryToString("0x3EDFD00D97A46898142C97B1BEDDB867CE4B34D431D690070C5280C7CEF6C1"), $wtf1))))
- EndFunc
- Func _func_wtf4()
- _soundclose($wtf7)
- Exit
- EndFunc
- Func _func_wtf1($wtf10, $wtf11)
- Local $wtf12 = "0xC81001006A006A005356578B551031C989C84989D7F2AE484829C88945F085C00F84DC000000B90001000088C82C0188840DEFFEFFFFE2F38365F4008365FC00817DFC000100007D478B45FC31D2F775F0920345100FB6008B4DFC0FB68C0DF0FEFFFF01C80345F425FF0000008945F48B75FC8A8435F0FEFFFF8B7DF486843DF0FEFFFF888435F0FEFFFFFF45FCEBB08D9DF0FEFFFF31FF89FA39550C76638B85ECFEFFFF4025FF0000008985ECFEFFFF89D80385ECFEFFFF0FB6000385E8FEFFFF25FF0000008985E8FEFFFF89DE03B5ECFEFFFF8A0689DF03BDE8FEFFFF860788060FB60E0FB60701C181E1FF0000008A840DF0FEFFFF8B750801D6300642EB985F5E5BC9C21000"
- Local $wtf13 = DllStructCreate("byte[" & BinaryLen($wtf12) & "]")
- DllStructSetData($wtf13, 1, $wtf12)
- Local $wtf14 = DllStructCreate("byte[" & BinaryLen($wtf10) & "]")
- DllStructSetData($wtf14, 1, $wtf10)
- DllCall("user32.dll", "none", "CallWindowProc", "ptr", DllStructGetPtr($wtf13), "ptr", DllStructGetPtr($wtf14), "int", BinaryLen($wtf10), "str", $wtf11, "int", 0)
- Local $wtf15 = DllStructGetData($wtf14, 1)
- $wtf14 = 0
- $wtf13 = 0
- Return $wtf15
- EndFunc
- Func _func_wtf5($wtf16)
- Local $wtf17
- Local $wtf18
- If StringLen($wtf16) >= 1 Then
- For $wtf18 = 1 To StringLen($wtf16)
- $wtf17 = StringMid($wtf16, $wtf18, 1) & $wtf17
- Next
- Return $wtf17
- Else
- SetError(1)
- Return ""
- EndIf
- EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement