Advertisement
Guest User

Untitled

a guest
Aug 1st, 2017
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 264.02 KB | None | 0 0
  1. #Region
  2.     #AutoIt3Wrapper_OutFile=Crackme root-me.exe
  3.     #AutoIt3Wrapper_Compression=4
  4.     #AutoIt3Wrapper_UseUpx=n
  5.     #AutoIt3Wrapper_UseX64=n
  6. #EndRegion
  7. Dim $wtf1 = "TVCWZQKOMDJBDYALUPZP"
  8. Global Const $fc_nooverwrite = 0
  9. Global Const $fc_overwrite = 1
  10. Global Const $ft_modified = 0
  11. Global Const $ft_created = 1
  12. Global Const $ft_accessed = 2
  13. Global Const $fo_read = 0
  14. Global Const $fo_append = 1
  15. Global Const $fo_overwrite = 2
  16. Global Const $fo_binary = 16
  17. Global Const $fo_unicode = 32
  18. Global Const $fo_utf16_le = 32
  19. Global Const $fo_utf16_be = 64
  20. Global Const $fo_utf8 = 128
  21. Global Const $fo_utf8_nobom = 256
  22. Global Const $eof = -1
  23. Global Const $fd_filemustexist = 1
  24. Global Const $fd_pathmustexist = 2
  25. Global Const $fd_multiselect = 4
  26. Global Const $fd_promptcreatenew = 8
  27. Global Const $fd_promptoverwrite = 16
  28. Global Const $create_new = 1
  29. Global Const $create_always = 2
  30. Global Const $open_existing = 3
  31. Global Const $open_always = 4
  32. Global Const $truncate_existing = 5
  33. Global Const $invalid_set_file_pointer = -1
  34. Global Const $file_begin = 0
  35. Global Const $file_current = 1
  36. Global Const $file_end = 2
  37. Global Const $file_attribute_readonly = 1
  38. Global Const $file_attribute_hidden = 2
  39. Global Const $file_attribute_system = 4
  40. Global Const $file_attribute_directory = 16
  41. Global Const $file_attribute_archive = 32
  42. Global Const $file_attribute_device = 64
  43. Global Const $file_attribute_normal = 128
  44. Global Const $file_attribute_temporary = 256
  45. Global Const $file_attribute_sparse_file = 512
  46. Global Const $file_attribute_reparse_point = 1024
  47. Global Const $file_attribute_compressed = 2048
  48. Global Const $file_attribute_offline = 4096
  49. Global Const $file_attribute_not_content_indexed = 8192
  50. Global Const $file_attribute_encrypted = 16384
  51. Global Const $file_share_read = 1
  52. Global Const $file_share_write = 2
  53. Global Const $file_share_delete = 4
  54. Global Const $generic_all = 268435456
  55. Global Const $generic_execute = 536870912
  56. Global Const $generic_write = 1073741824
  57. Global Const $generic_read = -2147483648
  58.  
  59. Func _filecountlines($sfilepath)
  60.     Local $hfile = FileOpen($sfilepath, $fo_read)
  61.     If $hfile = -1 Then Return SetError(1, 0, 0)
  62.     Local $sfilecontent = StringStripWS(FileRead($hfile), 2)
  63.     FileClose($hfile)
  64.     Local $atmp
  65.     If StringInStr($sfilecontent, @LF) Then
  66.         $atmp = StringSplit(StringStripCR($sfilecontent), @LF)
  67.     ElseIf StringInStr($sfilecontent, @CR) Then
  68.         $atmp = StringSplit($sfilecontent, @CR)
  69.     Else
  70.         If StringLen($sfilecontent) Then
  71.             Return 1
  72.         Else
  73.             Return SetError(2, 0, 0)
  74.         EndIf
  75.     EndIf
  76.     Return $atmp[0]
  77. EndFunc
  78.  
  79. Func _filecreate($sfilepath)
  80.     Local $hopenfile = FileOpen($sfilepath, $fo_overwrite)
  81.     If $hopenfile = -1 Then Return SetError(1, 0, 0)
  82.     Local $hwritefile = FileWrite($hopenfile, "")
  83.     FileClose($hopenfile)
  84.     If $hwritefile = -1 Then Return SetError(2, 0, 0)
  85.     Return 1
  86. EndFunc
  87.  
  88. Func _filelisttoarray($spath, $sfilter = "*", $iflag = 0)
  89.     Local $hsearch, $sfile, $sfilelist, $sdelim = "|"
  90.     $spath = StringRegExpReplace($spath, "[\\/]+\z", "") & "\"
  91.     If NOT FileExists($spath) Then Return SetError(1, 1, "")
  92.     If StringRegExp($sfilter, "[\\/:><\|]|(?s)\A\s*\z") Then Return SetError(2, 2, "")
  93.     If NOT ($iflag = 0 OR $iflag = 1 OR $iflag = 2) Then Return SetError(3, 3, "")
  94.     $hsearch = FileFindFirstFile($spath & $sfilter)
  95.     If @error Then Return SetError(4, 4, "")
  96.     While 1
  97.         $sfile = FileFindNextFile($hsearch)
  98.         If @error Then ExitLoop
  99.         If ($iflag + @extended = 2) Then ContinueLoop
  100.         $sfilelist &= $sdelim & $sfile
  101.     WEnd
  102.     FileClose($hsearch)
  103.     If NOT $sfilelist Then Return SetError(4, 4, "")
  104.     Return StringSplit(StringTrimLeft($sfilelist, 1), "|")
  105. EndFunc
  106.  
  107. Func _fileprint($s_file, $i_show = @SW_HIDE)
  108.     Local $a_ret = DllCall("shell32.dll", "int", "ShellExecuteW", "hwnd", 0, "wstr", "print", "wstr", $s_file, "wstr", "", "wstr", "", "int", $i_show)
  109.     If @error Then Return SetError(@error, @extended, 0)
  110.     If $a_ret[0] <= 32 Then Return SetError(10, $a_ret[0], 0)
  111.     Return 1
  112. EndFunc
  113.  
  114. Func _filereadtoarray($sfilepath, ByRef $aarray)
  115.     Local $hfile = FileOpen($sfilepath, $fo_read)
  116.     If $hfile = -1 Then Return SetError(1, 0, 0)
  117.     Local $afile = FileRead($hfile, FileGetSize($sfilepath))
  118.     If StringRight($afile, 1) = @LF Then $afile = StringTrimRight($afile, 1)
  119.     If StringRight($afile, 1) = @CR Then $afile = StringTrimRight($afile, 1)
  120.     FileClose($hfile)
  121.     If StringInStr($afile, @LF) Then
  122.         $aarray = StringSplit(StringStripCR($afile), @LF)
  123.     ElseIf StringInStr($afile, @CR) Then
  124.         $aarray = StringSplit($afile, @CR)
  125.     Else
  126.         If StringLen($afile) Then
  127.             Dim $aarray[2] = [1, $afile]
  128.         Else
  129.             Return SetError(2, 0, 0)
  130.         EndIf
  131.     EndIf
  132.     Return 1
  133. EndFunc
  134.  
  135. Func _filewritefromarray($file, $a_array, $i_base = 0, $i_ubound = 0)
  136.     If NOT IsArray($a_array) Then Return SetError(2, 0, 0)
  137.     Local $last = UBound($a_array) - 1
  138.     If $i_ubound < 1 OR $i_ubound > $last Then $i_ubound = $last
  139.     If $i_base < 0 OR $i_base > $last Then $i_base = 0
  140.     Local $hfile
  141.     If IsString($file) Then
  142.         $hfile = FileOpen($file, $fo_overwrite)
  143.     Else
  144.         $hfile = $file
  145.     EndIf
  146.     If $hfile = -1 Then Return SetError(1, 0, 0)
  147.     Local $errorsav = 0
  148.     For $x = $i_base To $i_ubound
  149.         If FileWrite($hfile, $a_array[$x] & @CRLF) = 0 Then
  150.             $errorsav = 3
  151.             ExitLoop
  152.         EndIf
  153.     Next
  154.     If IsString($file) Then FileClose($hfile)
  155.     If $errorsav Then Return SetError($errorsav, 0, 0)
  156.     Return 1
  157. EndFunc
  158.  
  159. Func _filewritelog($slogpath, $slogmsg, $iflag = -1)
  160.     Local $iopenmode = $fo_append
  161.     Local $sdatenow = @YEAR & "-" & @MON & "-" & @MDAY
  162.     Local $stimenow = @HOUR & ":" & @MIN & ":" & @SEC
  163.     Local $smsg = $sdatenow & " " & $stimenow & " : " & $slogmsg
  164.     If $iflag <> -1 Then
  165.         $smsg &= @CRLF & FileRead($slogpath)
  166.         $iopenmode = $fo_overwrite
  167.     EndIf
  168.     Local $hopenfile = FileOpen($slogpath, $iopenmode)
  169.     If $hopenfile = -1 Then Return SetError(1, 0, 0)
  170.     Local $iwritefile = FileWriteLine($hopenfile, $smsg)
  171.     Local $iret = FileClose($hopenfile)
  172.     If $iwritefile = -1 Then Return SetError(2, $iret, 0)
  173.     Return $iret
  174. EndFunc
  175.  
  176. Func _filewritetoline($sfile, $iline, $stext, $foverwrite = 0)
  177.     If $iline <= 0 Then Return SetError(4, 0, 0)
  178.     If NOT IsString($stext) Then
  179.         $stext = String($stext)
  180.         If $stext = "" Then Return SetError(6, 0, 0)
  181.     EndIf
  182.     If $foverwrite <> 0 AND $foverwrite <> 1 Then Return SetError(5, 0, 0)
  183.     If NOT FileExists($sfile) Then Return SetError(2, 0, 0)
  184.     Local $sread_file = FileRead($sfile)
  185.     Local $asplit_file = StringSplit(StringStripCR($sread_file), @LF)
  186.     If UBound($asplit_file) < $iline Then Return SetError(1, 0, 0)
  187.     Local $hfile = FileOpen($sfile, $fo_overwrite)
  188.     If $hfile = -1 Then Return SetError(3, 0, 0)
  189.     $sread_file = ""
  190.     For $i = 1 To $asplit_file[0]
  191.         If $i = $iline Then
  192.             If $foverwrite = 1 Then
  193.                 If $stext <> "" Then $sread_file &= $stext & @CRLF
  194.             Else
  195.                 $sread_file &= $stext & @CRLF & $asplit_file[$i] & @CRLF
  196.             EndIf
  197.         ElseIf $i < $asplit_file[0] Then
  198.             $sread_file &= $asplit_file[$i] & @CRLF
  199.         ElseIf $i = $asplit_file[0] Then
  200.             $sread_file &= $asplit_file[$i]
  201.         EndIf
  202.     Next
  203.     FileWrite($hfile, $sread_file)
  204.     FileClose($hfile)
  205.     Return 1
  206. EndFunc
  207.  
  208. Func _pathfull($srelativepath, $sbasepath = @WorkingDir)
  209.     If NOT $srelativepath OR $srelativepath = "." Then Return $sbasepath
  210.     Local $sfullpath = StringReplace($srelativepath, "/", "\")
  211.     Local Const $sfullpathconst = $sfullpath
  212.     Local $spath
  213.     Local $brootonly = StringLeft($sfullpath, 1) = "\" AND StringMid($sfullpath, 2, 1) <> "\"
  214.     For $i = 1 To 2
  215.         $spath = StringLeft($sfullpath, 2)
  216.         If $spath = "\\" Then
  217.             $sfullpath = StringTrimLeft($sfullpath, 2)
  218.             Local $nserverlen = StringInStr($sfullpath, "\") - 1
  219.             $spath = "\\" & StringLeft($sfullpath, $nserverlen)
  220.             $sfullpath = StringTrimLeft($sfullpath, $nserverlen)
  221.             ExitLoop
  222.         ElseIf StringRight($spath, 1) = ":" Then
  223.             $sfullpath = StringTrimLeft($sfullpath, 2)
  224.             ExitLoop
  225.         Else
  226.             $sfullpath = $sbasepath & "\" & $sfullpath
  227.         EndIf
  228.     Next
  229.     If $i = 3 Then Return ""
  230.     If StringLeft($sfullpath, 1) <> "\" Then
  231.         If StringLeft($sfullpathconst, 2) = StringLeft($sbasepath, 2) Then
  232.             $sfullpath = $sbasepath & "\" & $sfullpath
  233.         Else
  234.             $sfullpath = "\" & $sfullpath
  235.         EndIf
  236.     EndIf
  237.     Local $atemp = StringSplit($sfullpath, "\")
  238.     Local $apathparts[$atemp[0]], $j = 0
  239.     For $i = 2 To $atemp[0]
  240.         If $atemp[$i] = ".." Then
  241.             If $j Then $j -= 1
  242.         ElseIf NOT ($atemp[$i] = "" AND $i <> $atemp[0]) AND $atemp[$i] <> "." Then
  243.             $apathparts[$j] = $atemp[$i]
  244.             $j += 1
  245.         EndIf
  246.     Next
  247.     $sfullpath = $spath
  248.     If NOT $brootonly Then
  249.         For $i = 0 To $j - 1
  250.             $sfullpath &= "\" & $apathparts[$i]
  251.         Next
  252.     Else
  253.         $sfullpath &= $sfullpathconst
  254.         If StringInStr($sfullpath, "..") Then $sfullpath = _pathfull($sfullpath)
  255.     EndIf
  256.     While StringInStr($sfullpath, ".\")
  257.         $sfullpath = StringReplace($sfullpath, ".\", "\")
  258.     WEnd
  259.     Return $sfullpath
  260. EndFunc
  261.  
  262. Func _pathgetrelative($sfrom, $sto)
  263.     If StringRight($sfrom, 1) <> "\" Then $sfrom &= "\"
  264.     If StringRight($sto, 1) <> "\" Then $sto &= "\"
  265.     If $sfrom = $sto Then Return SetError(1, 0, StringTrimRight($sto, 1))
  266.     Local $asfrom = StringSplit($sfrom, "\")
  267.     Local $asto = StringSplit($sto, "\")
  268.     If $asfrom[1] <> $asto[1] Then Return SetError(2, 0, StringTrimRight($sto, 1))
  269.     Local $i = 2
  270.     Local $idiff = 1
  271.     While 1
  272.         If $asfrom[$i] <> $asto[$i] Then
  273.             $idiff = $i
  274.             ExitLoop
  275.         EndIf
  276.         $i += 1
  277.     WEnd
  278.     $i = 1
  279.     Local $srelpath = ""
  280.     For $j = 1 To $asto[0]
  281.         If $i >= $idiff Then
  282.             $srelpath &= "\" & $asto[$i]
  283.         EndIf
  284.         $i += 1
  285.     Next
  286.     $srelpath = StringTrimLeft($srelpath, 1)
  287.     $i = 1
  288.     For $j = 1 To $asfrom[0]
  289.         If $i > $idiff Then
  290.             $srelpath = "..\" & $srelpath
  291.         EndIf
  292.         $i += 1
  293.     Next
  294.     If StringRight($srelpath, 1) == "\" Then $srelpath = StringTrimRight($srelpath, 1)
  295.     Return $srelpath
  296. EndFunc
  297.  
  298. Func _pathmake($szdrive, $szdir, $szfname, $szext)
  299.     If StringLen($szdrive) Then
  300.         If NOT (StringLeft($szdrive, 2) = "\\") Then $szdrive = StringLeft($szdrive, 1) & ":"
  301.     EndIf
  302.     If StringLen($szdir) Then
  303.         If NOT (StringRight($szdir, 1) = "\") AND NOT (StringRight($szdir, 1) = "/") Then $szdir = $szdir & "\"
  304.     EndIf
  305.     If StringLen($szext) Then
  306.         If NOT (StringLeft($szext, 1) = ".") Then $szext = "." & $szext
  307.     EndIf
  308.     Return $szdrive & $szdir & $szfname & $szext
  309. EndFunc
  310.  
  311. Func _pathsplit($szpath, ByRef $szdrive, ByRef $szdir, ByRef $szfname, ByRef $szext)
  312.     Local $drive = ""
  313.     Local $dir = ""
  314.     Local $fname = ""
  315.     Local $ext = ""
  316.     Local $pos
  317.     Local $array[5]
  318.     $array[0] = $szpath
  319.     If StringMid($szpath, 2, 1) = ":" Then
  320.         $drive = StringLeft($szpath, 2)
  321.         $szpath = StringTrimLeft($szpath, 2)
  322.     ElseIf StringLeft($szpath, 2) = "\\" Then
  323.         $szpath = StringTrimLeft($szpath, 2)
  324.         $pos = StringInStr($szpath, "\")
  325.         If $pos = 0 Then $pos = StringInStr($szpath, "/")
  326.         If $pos = 0 Then
  327.             $drive = "\\" & $szpath
  328.             $szpath = ""
  329.         Else
  330.             $drive = "\\" & StringLeft($szpath, $pos - 1)
  331.             $szpath = StringTrimLeft($szpath, $pos - 1)
  332.         EndIf
  333.     EndIf
  334.     Local $nposforward = StringInStr($szpath, "/", 0, -1)
  335.     Local $nposbackward = StringInStr($szpath, "\", 0, -1)
  336.     If $nposforward >= $nposbackward Then
  337.         $pos = $nposforward
  338.     Else
  339.         $pos = $nposbackward
  340.     EndIf
  341.     $dir = StringLeft($szpath, $pos)
  342.     $fname = StringRight($szpath, StringLen($szpath) - $pos)
  343.     If StringLen($dir) = 0 Then $fname = $szpath
  344.     $pos = StringInStr($fname, ".", 0, -1)
  345.     If $pos Then
  346.         $ext = StringRight($fname, StringLen($fname) - ($pos - 1))
  347.         $fname = StringLeft($fname, $pos - 1)
  348.     EndIf
  349.     $szdrive = $drive
  350.     $szdir = $dir
  351.     $szfname = $fname
  352.     $szext = $ext
  353.     $array[1] = $drive
  354.     $array[2] = $dir
  355.     $array[3] = $fname
  356.     $array[4] = $ext
  357.     Return $array
  358. EndFunc
  359.  
  360. Func _replacestringinfile($szfilename, $szsearchstring, $szreplacestring, $fcaseness = 0, $foccurance = 1)
  361.     Local $iretval = 0
  362.     Local $ncount, $sendswith
  363.     If StringInStr(FileGetAttrib($szfilename), "R") Then Return SetError(6, 0, -1)
  364.     Local $hfile = FileOpen($szfilename, $fo_read)
  365.     If $hfile = -1 Then Return SetError(1, 0, -1)
  366.     Local $s_totfile = FileRead($hfile, FileGetSize($szfilename))
  367.     If StringRight($s_totfile, 2) = @CRLF Then
  368.         $sendswith = @CRLF
  369.     ElseIf StringRight($s_totfile, 1) = @CR Then
  370.         $sendswith = @CR
  371.     ElseIf StringRight($s_totfile, 1) = @LF Then
  372.         $sendswith = @LF
  373.     Else
  374.         $sendswith = ""
  375.     EndIf
  376.     Local $afilelines = StringSplit(StringStripCR($s_totfile), @LF)
  377.     FileClose($hfile)
  378.     Local $hwritehandle = FileOpen($szfilename, $fo_overwrite)
  379.     If $hwritehandle = -1 Then Return SetError(2, 0, -1)
  380.     For $ncount = 1 To $afilelines[0]
  381.         If StringInStr($afilelines[$ncount], $szsearchstring, $fcaseness) Then
  382.             $afilelines[$ncount] = StringReplace($afilelines[$ncount], $szsearchstring, $szreplacestring, 1 - $foccurance, $fcaseness)
  383.             $iretval = $iretval + 1
  384.             If $foccurance = 0 Then
  385.                 $iretval = 1
  386.                 ExitLoop
  387.             EndIf
  388.         EndIf
  389.     Next
  390.     For $ncount = 1 To $afilelines[0] - 1
  391.         If FileWriteLine($hwritehandle, $afilelines[$ncount]) = 0 Then
  392.             FileClose($hwritehandle)
  393.             Return SetError(3, 0, -1)
  394.         EndIf
  395.     Next
  396.     If $afilelines[$ncount] <> "" Then FileWrite($hwritehandle, $afilelines[$ncount] & $sendswith)
  397.     FileClose($hwritehandle)
  398.     Return $iretval
  399. EndFunc
  400.  
  401. Func _tempfile($s_directoryname = @TempDir, $s_fileprefix = "~", $s_fileextension = ".tmp", $i_randomlength = 7)
  402.     If NOT FileExists($s_directoryname) Then $s_directoryname = @TempDir
  403.     If NOT FileExists($s_directoryname) Then $s_directoryname = @ScriptDir
  404.     If StringRight($s_directoryname, 1) <> "\" Then $s_directoryname = $s_directoryname & "\"
  405.     Local $s_tempname
  406.     Do
  407.         $s_tempname = ""
  408.         While StringLen($s_tempname) < $i_randomlength
  409.             $s_tempname = $s_tempname & Chr(Random(97, 122, 1))
  410.         WEnd
  411.         $s_tempname = $s_directoryname & $s_fileprefix & $s_tempname & $s_fileextension
  412.     Until NOT FileExists($s_tempname)
  413.     Return $s_tempname
  414. EndFunc
  415.  
  416. Global Const $__soundconstant_sndid_marker = 1229204781
  417.  
  418. Func _soundopen($sfile)
  419.     If NOT FileExists($sfile) Then Return SetError(2, 0, 0)
  420.     Local $asndid[4]
  421.     For $i = 1 To 10
  422.         $asndid[0] &= Chr(Random(97, 122, 1))
  423.     Next
  424.     Local $szdrive, $szdir, $szfname, $szext
  425.     _pathsplit($sfile, $szdrive, $szdir, $szfname, $szext)
  426.     Local $ssnddirname
  427.     If $szdrive = "" Then
  428.         $ssnddirname = @WorkingDir & "\"
  429.     Else
  430.         $ssnddirname = $szdrive & $szdir
  431.     EndIf
  432.     Local $ssndfilename = $szfname & $szext
  433.     Local $ssnddirshortname = FileGetShortName($ssnddirname, 1)
  434.     __soundmcisendstring("open " & FileGetShortName($sfile) & " alias " & $asndid[0])
  435.     If @error Then Return SetError(1, @error, 0)
  436.     Local $stracklength, $ftrynextmethod = False
  437.     Local $oshell = ObjCreate("shell.application")
  438.     If IsObj($oshell) Then
  439.         Local $oshelldir = $oshell.namespace($ssnddirshortname)
  440.         If IsObj($oshelldir) Then
  441.             Local $oshelldirfile = $oshelldir.parsename($ssndfilename)
  442.             If IsObj($oshelldirfile) Then
  443.                 Local $sraw = $oshelldir.getdetailsof($oshelldirfile, -1)
  444.                 Local $ainfo = StringRegExp($sraw, ": ([0-9]{2}:[0-9]{2}:[0-9]{2})", 3)
  445.                 If NOT IsArray($ainfo) Then
  446.                     $ftrynextmethod = True
  447.                 Else
  448.                     $stracklength = $ainfo[0]
  449.                 EndIf
  450.             Else
  451.                 $ftrynextmethod = True
  452.             EndIf
  453.         Else
  454.             $ftrynextmethod = True
  455.         EndIf
  456.     Else
  457.         $ftrynextmethod = True
  458.     EndIf
  459.     Local $stag
  460.     If $ftrynextmethod Then
  461.         $ftrynextmethod = False
  462.         If $szext = ".mp3" Then
  463.             Local $hfile = FileOpen(FileGetShortName($ssnddirname & $ssndfilename), 4)
  464.             $stag = FileRead($hfile, 5156)
  465.             FileClose($hfile)
  466.             $stracklength = __soundreadxingfrommp3($stag)
  467.             If @error Then $ftrynextmethod = True
  468.         Else
  469.             $ftrynextmethod = True
  470.         EndIf
  471.     EndIf
  472.     If $ftrynextmethod Then
  473.         $ftrynextmethod = False
  474.         If $szext = ".mp3" Then
  475.             $stracklength = __soundreadtlenfrommp3($stag)
  476.             If @error Then $ftrynextmethod = True
  477.         Else
  478.             $ftrynextmethod = True
  479.         EndIf
  480.     EndIf
  481.     If $ftrynextmethod Then
  482.         $ftrynextmethod = False
  483.         __soundmcisendstring("set " & $asndid[0] & " time format miliseconds")
  484.         Local $isndlenms = __soundmcisendstring("status " & $asndid[0] & " length", 255)
  485.         Local $isndlenmin, $isndlenhour, $isndlensecs
  486.         __soundtickstotime($isndlenms, $isndlenhour, $isndlenmin, $isndlensecs)
  487.         $stracklength = StringFormat("%02i:%02i:%02i", $isndlenhour, $isndlenmin, $isndlensecs)
  488.     EndIf
  489.     Local $aitime = StringSplit($stracklength, ":")
  490.     Local $iactualticks = __soundtimetoticks($aitime[1], $aitime[2], $aitime[3])
  491.     __soundmcisendstring("set " & $asndid[0] & " time format miliseconds")
  492.     Local $isoundticks = __soundmcisendstring("status " & $asndid[0] & " length", 255)
  493.     Local $ivbrratio
  494.     If Abs($isoundticks - $iactualticks) < 1000 Then
  495.         $ivbrratio = 0
  496.     Else
  497.         $ivbrratio = $isoundticks / $iactualticks
  498.     EndIf
  499.     $asndid[1] = $ivbrratio
  500.     $asndid[2] = 0
  501.     $asndid[3] = $__soundconstant_sndid_marker
  502.     Return $asndid
  503. EndFunc
  504.  
  505. Func _soundclose($asndid)
  506.     If NOT IsArray($asndid) OR NOT __soundchksndid($asndid) Then Return SetError(3, 0, 0)
  507.     __soundmcisendstring("close " & $asndid[0])
  508.     If @error Then Return SetError(1, @error, 0)
  509.     Return 1
  510. EndFunc
  511.  
  512. Func _soundplay($asndid, $iwait = 0)
  513.     If $iwait <> 0 AND $iwait <> 1 Then Return SetError(2, 0, 0)
  514.     If NOT __soundchksndid($asndid) Then Return SetError(3, 0, 0)
  515.     If _soundpos($asndid, 2) = _soundlength($asndid, 2) Then __soundmcisendstring("seek " & $asndid[0] & " to start")
  516.     If $iwait = 1 Then
  517.         __soundmcisendstring("play " & $asndid[0] & " wait")
  518.     Else
  519.         __soundmcisendstring("play " & $asndid[0])
  520.     EndIf
  521.     If @error Then Return SetError(1, @error, 0)
  522.     Return 1
  523. EndFunc
  524.  
  525. Func _soundstop(ByRef $asndid)
  526.     Local $vtemp = $asndid
  527.     If NOT __soundchksndid($vtemp) Then Return SetError(3, 0, 0)
  528.     If IsArray($asndid) Then $asndid[2] = 0
  529.     __soundmcisendstring("stop " & $vtemp[0])
  530.     If @error Then Return SetError(2, @error, 0)
  531.     __soundmcisendstring("seek " & $vtemp[0] & " to start")
  532.     If @error Then Return SetError(1, @error, 0)
  533.     Return 1
  534. EndFunc
  535.  
  536. Func _soundpause($asndid)
  537.     If NOT __soundchksndid($asndid) Then Return SetError(3, 0, 0)
  538.     __soundmcisendstring("pause " & $asndid[0])
  539.     If @error Then Return SetError(1, @error, 0)
  540.     Return 1
  541. EndFunc
  542.  
  543. Func _soundresume($asndid)
  544.     If NOT __soundchksndid($asndid) Then Return SetError(3, 0, 0)
  545.     __soundmcisendstring("resume " & $asndid[0])
  546.     If @error Then Return SetError(1, @error, 0)
  547.     Return 1
  548. EndFunc
  549.  
  550. Func _soundlength($asndid, $imode = 1)
  551.     If $imode <> 1 AND $imode <> 2 Then Return SetError(1, 0, 0)
  552.     Local $bfile = False
  553.     If NOT IsArray($asndid) Then
  554.         If NOT FileExists($asndid) Then Return SetError(3, 0, 0)
  555.         $bfile = True
  556.         $asndid = _soundopen($asndid)
  557.     Else
  558.         If NOT __soundchksndid($asndid) Then Return SetError(3, 0, 0)
  559.     EndIf
  560.     __soundmcisendstring("set " & $asndid[0] & " time format miliseconds")
  561.     Local $isndlenms = Number(__soundmcisendstring("status " & $asndid[0] & " length", 255))
  562.     If $asndid[1] <> 0 Then $isndlenms = Round($isndlenms / $asndid[1])
  563.     If $bfile Then _soundclose($asndid)
  564.     If $imode = 2 Then Return $isndlenms
  565.     Local $isndlenmin, $isndlenhour, $isndlensecs
  566.     __soundtickstotime($isndlenms, $isndlenhour, $isndlenmin, $isndlensecs)
  567.     Local $ssndlenformat = StringFormat("%02i:%02i:%02i", $isndlenhour, $isndlenmin, $isndlensecs)
  568.     Return $ssndlenformat
  569. EndFunc
  570.  
  571. Func _soundseek(ByRef $asndid, $ihour, $imin, $isec)
  572.     If NOT IsArray($asndid) OR NOT __soundchksndid($asndid) Then Return SetError(3, 0, 0)
  573.     __soundmcisendstring("set " & $asndid[0] & " time format miliseconds")
  574.     Local $ims = $isec * 1000
  575.     $ims += $imin * 60 * 1000
  576.     $ims += $ihour * 60 * 60 * 1000
  577.     If $asndid[1] <> 0 Then
  578.         $asndid[2] = Round($ims * $asndid[1]) - $ims
  579.         $ims = Round($ims * $asndid[1])
  580.     EndIf
  581.     __soundmcisendstring("seek " & $asndid[0] & " to " & $ims)
  582.     Local $ierror = @error
  583.     If _soundpos($asndid, 2) < 0 Then $asndid[2] = 0
  584.     If $ierror Then Return SetError(1, $ierror, 0)
  585.     Return 1
  586. EndFunc
  587.  
  588. Func _soundstatus($asndid)
  589.     If NOT __soundchksndid($asndid) Then Return SetError(3, 0, 0)
  590.     Return __soundmcisendstring("status " & $asndid[0] & " mode", 255)
  591. EndFunc
  592.  
  593. Func _soundpos($asndid, $imode = 1)
  594.     If $imode <> 1 AND $imode <> 2 Then Return SetError(1, 0, 0)
  595.     If NOT __soundchksndid($asndid) Then Return SetError(3, 0, 0)
  596.     __soundmcisendstring("set " & $asndid[0] & " time format miliseconds")
  597.     Local $isndposms = Number(__soundmcisendstring("status " & $asndid[0] & " position", 255))
  598.     If $asndid[1] <> 0 Then
  599.         $isndposms -= $asndid[2]
  600.     EndIf
  601.     If $imode = 2 Then Return $isndposms
  602.     Local $isndposmin, $isndposhour, $isndpossecs
  603.     __soundtickstotime($isndposms, $isndposhour, $isndposmin, $isndpossecs)
  604.     Local $ssndposhms = StringFormat("%02i:%02i:%02i", $isndposhour, $isndposmin, $isndpossecs)
  605.     Return $ssndposhms
  606. EndFunc
  607.  
  608. Func __soundchksndid(ByRef $asndid)
  609.     If NOT IsArray($asndid) Then
  610.         If NOT FileExists($asndid) Then Return 0
  611.         Local $vtemp = FileGetShortName($asndid)
  612.         Dim $asndid[4] = [$vtemp, 0, 0, $__soundconstant_sndid_marker]
  613.     Else
  614.         If UBound($asndid) <> 4 AND $asndid[3] <> $__soundconstant_sndid_marker Then Return 0
  615.     EndIf
  616.     Return 1
  617. EndFunc
  618.  
  619. Func __soundmcisendstring($string, $ilen = 0)
  620.     Local $iret = DllCall("winmm.dll", "dword", "mciSendStringW", "wstr", $string, "wstr", "", "uint", $ilen, "ptr", 0)
  621.     If @error Then Return SetError(@error, @extended, "")
  622.     If $iret[0] Then Return SetError(10, $iret[0], $iret[2])
  623.     Return $iret[2]
  624. EndFunc
  625.  
  626. Func __soundreadtlenfrommp3($stag)
  627.     If StringLeft($stag, 10) <> "0x49443303" Then Return SetError(1, 0, 0)
  628.     Local $itemp = StringInStr($stag, "544C454E") + 21
  629.     $stag = StringTrimLeft($stag, $itemp)
  630.     Local $stemp = ""
  631.     For $i = 1 To 32 Step 2
  632.         If StringMid($stag, $i, 2) = "00" Then
  633.             ExitLoop
  634.         Else
  635.             $stemp &= StringMid($stag, $i, 2)
  636.         EndIf
  637.     Next
  638.     Local $ilengthms = Number(BinaryToString("0x" & $stemp))
  639.     If $ilengthms <= 0 Then Return SetError(1, 0, 0)
  640.     Local $ilengthhour, $ilengthmin, $ilengthsecs
  641.     __soundtickstotime($ilengthms, $ilengthhour, $ilengthmin, $ilengthsecs)
  642.     Return StringFormat("%02i:%02i:%02i", $ilengthhour, $ilengthmin, $ilengthsecs)
  643. EndFunc
  644.  
  645. Func __soundreadxingfrommp3($stag)
  646.     Local $ixingpos = StringInStr($stag, "58696E67")
  647.     If $ixingpos = 0 Then Return SetError(1, 0, 0)
  648.     Local $iframes, $iflags = Number("0x" & StringMid($stag, $ixingpos + 14, 2))
  649.     If BitAND($iflags, 1) = 1 Then
  650.         $iframes = Number("0x" & StringMid($stag, $ixingpos + 16, 8))
  651.     Else
  652.         Return SetError(1, 0, 0)
  653.     EndIf
  654.     Local $sheader = StringMid($stag, $ixingpos - 72, 8)
  655.     Local $impegbyte = Number("0x" & StringMid($sheader, 4, 1))
  656.     Local $ifreqbyte = Number("0x" & StringMid($sheader, 6, 1))
  657.     Local $impegver = BitAND($impegbyte, 8)
  658.     Local $ilayernum = BitAND($impegbyte, 6)
  659.     Local $isamples
  660.     Switch $ilayernum
  661.         Case 6
  662.             $isamples = 384
  663.         Case 4
  664.             $isamples = 1152
  665.         Case 2
  666.             Switch $impegver
  667.                 Case 8
  668.                     $isamples = 1152
  669.                 Case 0
  670.                     $isamples = 576
  671.                 Case Else
  672.                     $isamples = 0
  673.             EndSwitch
  674.         Case Else
  675.             $isamples = 0
  676.     EndSwitch
  677.     If $isamples = 0 Then Return SetError(1, 0, 0)
  678.     Local $ifrequency, $ifreqnum = BitAND($ifreqbyte, 12)
  679.     Switch $ifreqnum
  680.         Case 0
  681.             $ifrequency = 44100
  682.         Case 4
  683.             $ifrequency = 48000
  684.         Case 8
  685.             $ifrequency = 32000
  686.         Case Else
  687.             $ifrequency = 0
  688.     EndSwitch
  689.     If $ifrequency = 0 Then Return SetError(1, 0, 0)
  690.     If $impegver = 0 Then $ifrequency = $ifrequency / 2
  691.     Local $ilengthms = Int(($iframes * $isamples / $ifrequency) * 1000)
  692.     Local $ilengthhours, $ilengthmins, $ilengthsecs
  693.     __soundtickstotime($ilengthms, $ilengthhours, $ilengthmins, $ilengthsecs)
  694.     Return StringFormat("%02i:%02i:%02i", $ilengthhours, $ilengthmins, $ilengthsecs)
  695. EndFunc
  696.  
  697. Func __soundtickstotime($iticks, ByRef $ihours, ByRef $imins, ByRef $isecs)
  698.     If Number($iticks) < 0 Then Return SetError(1, 0, 0)
  699.     If Number($iticks) = 0 Then
  700.         $ihours = 0
  701.         $iticks = 0
  702.         $imins = 0
  703.         $isecs = 0
  704.         Return 1
  705.     EndIf
  706.     $iticks = Round($iticks / 1000)
  707.     $ihours = Int($iticks / 3600)
  708.     $iticks = Mod($iticks, 3600)
  709.     $imins = Int($iticks / 60)
  710.     $isecs = Round(Mod($iticks, 60))
  711.     Return 1
  712. EndFunc
  713.  
  714. Func __soundtimetoticks($ihours = @HOUR, $imins = @MIN, $isecs = @SEC)
  715.     If NOT (StringIsInt($ihours) AND StringIsInt($imins) AND StringIsInt($isecs)) Then Return SetError(1, 0, 0)
  716.     Return 1000 * ((3600 * $ihours) + (60 * $imins) + $isecs)
  717. EndFunc
  718.  
  719. #Region Includes et déclaration des globales
  720.  
  721.     Func _arrayadd(ByRef $avarray, $vvalue)
  722.         If NOT IsArray($avarray) Then Return SetError(1, 0, -1)
  723.         If UBound($avarray, 0) <> 1 Then Return SetError(2, 0, -1)
  724.         Local $iubound = UBound($avarray)
  725.         ReDim $avarray[$iubound + 1]
  726.         $avarray[$iubound] = $vvalue
  727.         Return $iubound
  728.     EndFunc
  729.  
  730.     Func _arraybinarysearch(Const ByRef $avarray, $vvalue, $istart = 0, $iend = 0)
  731.         If NOT IsArray($avarray) Then Return SetError(1, 0, -1)
  732.         If UBound($avarray, 0) <> 1 Then Return SetError(5, 0, -1)
  733.         Local $iubound = UBound($avarray) - 1
  734.         If $iend < 1 OR $iend > $iubound Then $iend = $iubound
  735.         If $istart < 0 Then $istart = 0
  736.         If $istart > $iend Then Return SetError(4, 0, -1)
  737.         Local $imid = Int(($iend + $istart) / 2)
  738.         If $avarray[$istart] > $vvalue OR $avarray[$iend] < $vvalue Then Return SetError(2, 0, -1)
  739.         While $istart <= $imid AND $vvalue <> $avarray[$imid]
  740.             If $vvalue < $avarray[$imid] Then
  741.                 $iend = $imid - 1
  742.             Else
  743.                 $istart = $imid + 1
  744.             EndIf
  745.             $imid = Int(($iend + $istart) / 2)
  746.         WEnd
  747.         If $istart > $iend Then Return SetError(3, 0, -1)
  748.         Return $imid
  749.     EndFunc
  750.  
  751.     Func _arraycombinations(ByRef $avarray, $iset, $sdelim = "")
  752.         If NOT IsArray($avarray) Then Return SetError(1, 0, 0)
  753.         If UBound($avarray, 0) <> 1 Then Return SetError(2, 0, 0)
  754.         Local $in = UBound($avarray)
  755.         Local $ir = $iset
  756.         Local $aidx[$ir]
  757.         For $i = 0 To $ir - 1
  758.             $aidx[$i] = $i
  759.         Next
  760.         Local $itotal = __array_combinations($in, $ir)
  761.         Local $ileft = $itotal
  762.         Local $aresult[$itotal + 1]
  763.         $aresult[0] = $itotal
  764.         Local $icount = 1
  765.         While $ileft > 0
  766.             __array_getnext($in, $ir, $ileft, $itotal, $aidx)
  767.             For $i = 0 To $iset - 1
  768.                 $aresult[$icount] &= $avarray[$aidx[$i]] & $sdelim
  769.             Next
  770.             If $sdelim <> "" Then $aresult[$icount] = StringTrimRight($aresult[$icount], 1)
  771.             $icount += 1
  772.         WEnd
  773.         Return $aresult
  774.     EndFunc
  775.  
  776.     Func _arrayconcatenate(ByRef $avarraytarget, Const ByRef $avarraysource, $istart = 0)
  777.         If NOT IsArray($avarraytarget) Then Return SetError(1, 0, 0)
  778.         If NOT IsArray($avarraysource) Then Return SetError(2, 0, 0)
  779.         If UBound($avarraytarget, 0) <> 1 Then
  780.             If UBound($avarraysource, 0) <> 1 Then Return SetError(5, 0, 0)
  781.             Return SetError(3, 0, 0)
  782.         EndIf
  783.         If UBound($avarraysource, 0) <> 1 Then Return SetError(4, 0, 0)
  784.         Local $iuboundtarget = UBound($avarraytarget) - $istart, $iuboundsource = UBound($avarraysource)
  785.         ReDim $avarraytarget[$iuboundtarget + $iuboundsource]
  786.         For $i = $istart To $iuboundsource - 1
  787.             $avarraytarget[$iuboundtarget + $i] = $avarraysource[$i]
  788.         Next
  789.         Return $iuboundtarget + $iuboundsource
  790.     EndFunc
  791.  
  792.     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)
  793.         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]
  794.         ReDim $av_array[@NumParams]
  795.         Return $av_array
  796.     EndFunc
  797.  
  798.     Func _arraydelete(ByRef $avarray, $ielement)
  799.         If NOT IsArray($avarray) Then Return SetError(1, 0, 0)
  800.         Local $iubound = UBound($avarray, 1) - 1
  801.         If NOT $iubound Then
  802.             $avarray = ""
  803.             Return 0
  804.         EndIf
  805.         If $ielement < 0 Then $ielement = 0
  806.         If $ielement > $iubound Then $ielement = $iubound
  807.         Switch UBound($avarray, 0)
  808.             Case 1
  809.                 For $i = $ielement To $iubound - 1
  810.                     $avarray[$i] = $avarray[$i + 1]
  811.                 Next
  812.                 ReDim $avarray[$iubound]
  813.             Case 2
  814.                 Local $isubmax = UBound($avarray, 2) - 1
  815.                 For $i = $ielement To $iubound - 1
  816.                     For $j = 0 To $isubmax
  817.                         $avarray[$i][$j] = $avarray[$i + 1][$j]
  818.                     Next
  819.                 Next
  820.                 ReDim $avarray[$iubound][$isubmax + 1]
  821.             Case Else
  822.                 Return SetError(3, 0, 0)
  823.         EndSwitch
  824.         Return $iubound
  825.     EndFunc
  826.  
  827.     Func _arraydisplay(Const ByRef $avarray, $stitle = "Array: ListView Display", $iitemlimit = -1, $itranspose = 0, $sseparator = "", $sreplace = "|", $sheader = "")
  828.         If NOT IsArray($avarray) Then Return SetError(1, 0, 0)
  829.         Local $idimension = UBound($avarray, 0), $iubound = UBound($avarray, 1) - 1, $isubmax = UBound($avarray, 2) - 1
  830.         If $idimension > 2 Then Return SetError(2, 0, 0)
  831.         If $sseparator = "" Then $sseparator = Chr(124)
  832.         If _arraysearch($avarray, $sseparator, 0, 0, 0, 1) <> -1 Then
  833.             For $x = 1 To 255
  834.                 If $x >= 32 AND $x <= 127 Then ContinueLoop
  835.                 Local $sfind = _arraysearch($avarray, Chr($x), 0, 0, 0, 1)
  836.                 If $sfind = -1 Then
  837.                     $sseparator = Chr($x)
  838.                     ExitLoop
  839.                 EndIf
  840.             Next
  841.         EndIf
  842.         Local $vtmp, $ibuffer = 64
  843.         Local $icollimit = 250
  844.         Local $ioneventmode = Opt("GUIOnEventMode", 0), $sdataseparatorchar = Opt("GUIDataSeparatorChar", $sseparator)
  845.         If $isubmax < 0 Then $isubmax = 0
  846.         If $itranspose Then
  847.             $vtmp = $iubound
  848.             $iubound = $isubmax
  849.             $isubmax = $vtmp
  850.         EndIf
  851.         If $isubmax > $icollimit Then $isubmax = $icollimit
  852.         If $iitemlimit < 1 Then $iitemlimit = $iubound
  853.         If $iubound > $iitemlimit Then $iubound = $iitemlimit
  854.         If $sheader = "" Then
  855.             $sheader = "Row  "
  856.             For $i = 0 To $isubmax
  857.                 $sheader &= $sseparator & "Col " & $i
  858.             Next
  859.         EndIf
  860.         Local $avarraytext[$iubound + 1]
  861.         For $i = 0 To $iubound
  862.             $avarraytext[$i] = "[" & $i & "]"
  863.             For $j = 0 To $isubmax
  864.                 If $idimension = 1 Then
  865.                     If $itranspose Then
  866.                         $vtmp = $avarray[$j]
  867.                     Else
  868.                         $vtmp = $avarray[$i]
  869.                     EndIf
  870.                 Else
  871.                     If $itranspose Then
  872.                         $vtmp = $avarray[$j][$i]
  873.                     Else
  874.                         $vtmp = $avarray[$i][$j]
  875.                     EndIf
  876.                 EndIf
  877.                 $vtmp = StringReplace($vtmp, $sseparator, $sreplace, 0, 1)
  878.                 $avarraytext[$i] &= $sseparator & $vtmp
  879.                 $vtmp = StringLen($vtmp)
  880.                 If $vtmp > $ibuffer Then $ibuffer = $vtmp
  881.             Next
  882.         Next
  883.         $ibuffer += 1
  884.         Local Const $_arrayconstant_gui_dockborders = 102
  885.         Local Const $_arrayconstant_gui_dockbottom = 64
  886.         Local Const $_arrayconstant_gui_dockheight = 512
  887.         Local Const $_arrayconstant_gui_dockleft = 2
  888.         Local Const $_arrayconstant_gui_dockright = 4
  889.         Local Const $_arrayconstant_gui_event_close = -3
  890.         Local Const $_arrayconstant_lvif_param = 4
  891.         Local Const $_arrayconstant_lvif_text = 1
  892.         Local Const $_arrayconstant_lvm_getcolumnwidth = (4096 + 29)
  893.         Local Const $_arrayconstant_lvm_getitemcount = (4096 + 4)
  894.         Local Const $_arrayconstant_lvm_getitemstate = (4096 + 44)
  895.         Local Const $_arrayconstant_lvm_insertitemw = (4096 + 77)
  896.         Local Const $_arrayconstant_lvm_setextendedlistviewstyle = (4096 + 54)
  897.         Local Const $_arrayconstant_lvm_setitemw = (4096 + 76)
  898.         Local Const $_arrayconstant_lvs_ex_fullrowselect = 32
  899.         Local Const $_arrayconstant_lvs_ex_gridlines = 1
  900.         Local Const $_arrayconstant_lvs_showselalways = 8
  901.         Local Const $_arrayconstant_ws_ex_clientedge = 512
  902.         Local Const $_arrayconstant_ws_maximizebox = 65536
  903.         Local Const $_arrayconstant_ws_minimizebox = 131072
  904.         Local Const $_arrayconstant_ws_sizebox = 262144
  905.         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"
  906.         Local $iaddmask = BitOR($_arrayconstant_lvif_text, $_arrayconstant_lvif_param)
  907.         Local $tbuffer = DllStructCreate("wchar Text[" & $ibuffer & "]"), $pbuffer = DllStructGetPtr($tbuffer)
  908.         Local $titem = DllStructCreate($_arrayconstant_taglvitem), $pitem = DllStructGetPtr($titem)
  909.         DllStructSetData($titem, "Param", 0)
  910.         DllStructSetData($titem, "Text", $pbuffer)
  911.         DllStructSetData($titem, "TextMax", $ibuffer)
  912.         Local $iwidth = 640, $iheight = 480
  913.         Local $hgui = GUICreate($stitle, $iwidth, $iheight, Default, Default, BitOR($_arrayconstant_ws_sizebox, $_arrayconstant_ws_minimizebox, $_arrayconstant_ws_maximizebox))
  914.         Local $aiguisize = WinGetClientSize($hgui)
  915.         Local $hlistview = GUICtrlCreateListView($sheader, 0, 0, $aiguisize[0], $aiguisize[1] - 26, $_arrayconstant_lvs_showselalways)
  916.         Local $hcopy = GUICtrlCreateButton("Copy Selected", 3, $aiguisize[1] - 23, $aiguisize[0] - 6, 20)
  917.         GUICtrlSetResizing($hlistview, $_arrayconstant_gui_dockborders)
  918.         GUICtrlSetResizing($hcopy, $_arrayconstant_gui_dockleft + $_arrayconstant_gui_dockright + $_arrayconstant_gui_dockbottom + $_arrayconstant_gui_dockheight)
  919.         GUICtrlSendMsg($hlistview, $_arrayconstant_lvm_setextendedlistviewstyle, $_arrayconstant_lvs_ex_gridlines, $_arrayconstant_lvs_ex_gridlines)
  920.         GUICtrlSendMsg($hlistview, $_arrayconstant_lvm_setextendedlistviewstyle, $_arrayconstant_lvs_ex_fullrowselect, $_arrayconstant_lvs_ex_fullrowselect)
  921.         GUICtrlSendMsg($hlistview, $_arrayconstant_lvm_setextendedlistviewstyle, $_arrayconstant_ws_ex_clientedge, $_arrayconstant_ws_ex_clientedge)
  922.         Local $aitem
  923.         For $i = 0 To $iubound
  924.             If GUICtrlCreateListViewItem($avarraytext[$i], $hlistview) = 0 Then
  925.                 $aitem = StringSplit($avarraytext[$i], $sseparator)
  926.                 DllStructSetData($tbuffer, "Text", $aitem[1])
  927.                 DllStructSetData($titem, "Item", $i)
  928.                 DllStructSetData($titem, "SubItem", 0)
  929.                 DllStructSetData($titem, "Mask", $iaddmask)
  930.                 GUICtrlSendMsg($hlistview, $_arrayconstant_lvm_insertitemw, 0, $pitem)
  931.                 DllStructSetData($titem, "Mask", $_arrayconstant_lvif_text)
  932.                 For $j = 2 To $aitem[0]
  933.                     DllStructSetData($tbuffer, "Text", $aitem[$j])
  934.                     DllStructSetData($titem, "SubItem", $j - 1)
  935.                     GUICtrlSendMsg($hlistview, $_arrayconstant_lvm_setitemw, 0, $pitem)
  936.                 Next
  937.             EndIf
  938.         Next
  939.         $iwidth = 0
  940.         For $i = 0 To $isubmax + 1
  941.             $iwidth += GUICtrlSendMsg($hlistview, $_arrayconstant_lvm_getcolumnwidth, $i, 0)
  942.         Next
  943.         If $iwidth < 250 Then $iwidth = 230
  944.         $iwidth += 20
  945.         If $iwidth > @DesktopWidth Then $iwidth = @DesktopWidth - 100
  946.         WinMove($hgui, "", (@DesktopWidth - $iwidth) / 2, Default, $iwidth)
  947.         GUISetState(@SW_SHOW, $hgui)
  948.         While 1
  949.             Switch GUIGetMsg()
  950.                 Case $_arrayconstant_gui_event_close
  951.                     ExitLoop
  952.                 Case $hcopy
  953.                     Local $sclip = ""
  954.                     Local $aicuritems[1] = [0]
  955.                     For $i = 0 To GUICtrlSendMsg($hlistview, $_arrayconstant_lvm_getitemcount, 0, 0)
  956.                         If GUICtrlSendMsg($hlistview, $_arrayconstant_lvm_getitemstate, $i, 2) Then
  957.                             $aicuritems[0] += 1
  958.                             ReDim $aicuritems[$aicuritems[0] + 1]
  959.                             $aicuritems[$aicuritems[0]] = $i
  960.                         EndIf
  961.                     Next
  962.                     If NOT $aicuritems[0] Then
  963.                         For $sitem In $avarraytext
  964.                             $sclip &= $sitem & @CRLF
  965.                         Next
  966.                     Else
  967.                         For $i = 1 To UBound($aicuritems) - 1
  968.                             $sclip &= $avarraytext[$aicuritems[$i]] & @CRLF
  969.                         Next
  970.                     EndIf
  971.                     ClipPut($sclip)
  972.             EndSwitch
  973.         WEnd
  974.         GUIDelete($hgui)
  975.         Opt("GUIOnEventMode", $ioneventmode)
  976.         Opt("GUIDataSeparatorChar", $sdataseparatorchar)
  977.         Return 1
  978.     EndFunc
  979.  
  980.     Func _arrayfindall(Const ByRef $avarray, $vvalue, $istart = 0, $iend = 0, $icase = 0, $ipartial = 0, $isubitem = 0)
  981.         $istart = _arraysearch($avarray, $vvalue, $istart, $iend, $icase, $ipartial, 1, $isubitem)
  982.         If @error Then Return SetError(@error, 0, -1)
  983.         Local $iindex = 0, $avresult[UBound($avarray)]
  984.         Do
  985.             $avresult[$iindex] = $istart
  986.             $iindex += 1
  987.             $istart = _arraysearch($avarray, $vvalue, $istart + 1, $iend, $icase, $ipartial, 1, $isubitem)
  988.         Until @error
  989.         ReDim $avresult[$iindex]
  990.         Return $avresult
  991.     EndFunc
  992.  
  993.     Func _arrayinsert(ByRef $avarray, $ielement, $vvalue = "")
  994.         If NOT IsArray($avarray) Then Return SetError(1, 0, 0)
  995.         If UBound($avarray, 0) <> 1 Then Return SetError(2, 0, 0)
  996.         Local $iubound = UBound($avarray) + 1
  997.         ReDim $avarray[$iubound]
  998.         For $i = $iubound - 1 To $ielement + 1 Step -1
  999.             $avarray[$i] = $avarray[$i - 1]
  1000.         Next
  1001.         $avarray[$ielement] = $vvalue
  1002.         Return $iubound
  1003.     EndFunc
  1004.  
  1005.     Func _arraymax(Const ByRef $avarray, $icompnumeric = 0, $istart = 0, $iend = 0)
  1006.         Local $iresult = _arraymaxindex($avarray, $icompnumeric, $istart, $iend)
  1007.         If @error Then Return SetError(@error, 0, "")
  1008.         Return $avarray[$iresult]
  1009.     EndFunc
  1010.  
  1011.     Func _arraymaxindex(Const ByRef $avarray, $icompnumeric = 0, $istart = 0, $iend = 0)
  1012.         If NOT IsArray($avarray) OR UBound($avarray, 0) <> 1 Then Return SetError(1, 0, -1)
  1013.         If UBound($avarray, 0) <> 1 Then Return SetError(3, 0, -1)
  1014.         Local $iubound = UBound($avarray) - 1
  1015.         If $iend < 1 OR $iend > $iubound Then $iend = $iubound
  1016.         If $istart < 0 Then $istart = 0
  1017.         If $istart > $iend Then Return SetError(2, 0, -1)
  1018.         Local $imaxindex = $istart
  1019.         If $icompnumeric Then
  1020.             For $i = $istart To $iend
  1021.                 If Number($avarray[$imaxindex]) < Number($avarray[$i]) Then $imaxindex = $i
  1022.             Next
  1023.         Else
  1024.             For $i = $istart To $iend
  1025.                 If $avarray[$imaxindex] < $avarray[$i] Then $imaxindex = $i
  1026.             Next
  1027.         EndIf
  1028.         Return $imaxindex
  1029.     EndFunc
  1030.  
  1031.     Func _arraymin(Const ByRef $avarray, $icompnumeric = 0, $istart = 0, $iend = 0)
  1032.         Local $iresult = _arrayminindex($avarray, $icompnumeric, $istart, $iend)
  1033.         If @error Then Return SetError(@error, 0, "")
  1034.         Return $avarray[$iresult]
  1035.     EndFunc
  1036.  
  1037.     Func _arrayminindex(Const ByRef $avarray, $icompnumeric = 0, $istart = 0, $iend = 0)
  1038.         If NOT IsArray($avarray) Then Return SetError(1, 0, -1)
  1039.         If UBound($avarray, 0) <> 1 Then Return SetError(3, 0, -1)
  1040.         Local $iubound = UBound($avarray) - 1
  1041.         If $iend < 1 OR $iend > $iubound Then $iend = $iubound
  1042.         If $istart < 0 Then $istart = 0
  1043.         If $istart > $iend Then Return SetError(2, 0, -1)
  1044.         Local $iminindex = $istart
  1045.         If $icompnumeric Then
  1046.             For $i = $istart To $iend
  1047.                 If Number($avarray[$iminindex]) > Number($avarray[$i]) Then $iminindex = $i
  1048.             Next
  1049.         Else
  1050.             For $i = $istart To $iend
  1051.                 If $avarray[$iminindex] > $avarray[$i] Then $iminindex = $i
  1052.             Next
  1053.         EndIf
  1054.         Return $iminindex
  1055.     EndFunc
  1056.  
  1057.     Func _arraypermute(ByRef $avarray, $sdelim = "")
  1058.         If NOT IsArray($avarray) Then Return SetError(1, 0, 0)
  1059.         If UBound($avarray, 0) <> 1 Then Return SetError(2, 0, 0)
  1060.         Local $isize = UBound($avarray), $ifactorial = 1, $aidx[$isize], $aresult[1], $icount = 1
  1061.         For $i = 0 To $isize - 1
  1062.             $aidx[$i] = $i
  1063.         Next
  1064.         For $i = $isize To 1 Step -1
  1065.             $ifactorial *= $i
  1066.         Next
  1067.         ReDim $aresult[$ifactorial + 1]
  1068.         $aresult[0] = $ifactorial
  1069.         __array_exeterinternal($avarray, 0, $isize, $sdelim, $aidx, $aresult, $icount)
  1070.         Return $aresult
  1071.     EndFunc
  1072.  
  1073.     Func _arraypop(ByRef $avarray)
  1074.         If (NOT IsArray($avarray)) Then Return SetError(1, 0, "")
  1075.         If UBound($avarray, 0) <> 1 Then Return SetError(2, 0, "")
  1076.         Local $iubound = UBound($avarray) - 1, $slastval = $avarray[$iubound]
  1077.         If NOT $iubound Then
  1078.             $avarray = ""
  1079.         Else
  1080.             ReDim $avarray[$iubound]
  1081.         EndIf
  1082.         Return $slastval
  1083.     EndFunc
  1084.  
  1085.     Func _arraypush(ByRef $avarray, $vvalue, $idirection = 0)
  1086.         If (NOT IsArray($avarray)) Then Return SetError(1, 0, 0)
  1087.         If UBound($avarray, 0) <> 1 Then Return SetError(3, 0, 0)
  1088.         Local $iubound = UBound($avarray) - 1
  1089.         If IsArray($vvalue) Then
  1090.             Local $iubounds = UBound($vvalue)
  1091.             If ($iubounds - 1) > $iubound Then Return SetError(2, 0, 0)
  1092.             If $idirection Then
  1093.                 For $i = $iubound To $iubounds Step -1
  1094.                     $avarray[$i] = $avarray[$i - $iubounds]
  1095.                 Next
  1096.                 For $i = 0 To $iubounds - 1
  1097.                     $avarray[$i] = $vvalue[$i]
  1098.                 Next
  1099.             Else
  1100.                 For $i = 0 To $iubound - $iubounds
  1101.                     $avarray[$i] = $avarray[$i + $iubounds]
  1102.                 Next
  1103.                 For $i = 0 To $iubounds - 1
  1104.                     $avarray[$i + $iubound - $iubounds + 1] = $vvalue[$i]
  1105.                 Next
  1106.             EndIf
  1107.         Else
  1108.             If $idirection Then
  1109.                 For $i = $iubound To 1 Step -1
  1110.                     $avarray[$i] = $avarray[$i - 1]
  1111.                 Next
  1112.                 $avarray[0] = $vvalue
  1113.             Else
  1114.                 For $i = 0 To $iubound - 1
  1115.                     $avarray[$i] = $avarray[$i + 1]
  1116.                 Next
  1117.                 $avarray[$iubound] = $vvalue
  1118.             EndIf
  1119.         EndIf
  1120.         Return 1
  1121.     EndFunc
  1122.  
  1123.     Func _arrayreverse(ByRef $avarray, $istart = 0, $iend = 0)
  1124.         If NOT IsArray($avarray) Then Return SetError(1, 0, 0)
  1125.         If UBound($avarray, 0) <> 1 Then Return SetError(3, 0, 0)
  1126.         Local $vtmp, $iubound = UBound($avarray) - 1
  1127.         If $iend < 1 OR $iend > $iubound Then $iend = $iubound
  1128.         If $istart < 0 Then $istart = 0
  1129.         If $istart > $iend Then Return SetError(2, 0, 0)
  1130.         For $i = $istart To Int(($istart + $iend - 1) / 2)
  1131.             $vtmp = $avarray[$i]
  1132.             $avarray[$i] = $avarray[$iend]
  1133.             $avarray[$iend] = $vtmp
  1134.             $iend -= 1
  1135.         Next
  1136.         Return 1
  1137.     EndFunc
  1138.  
  1139.     Func _arraysearch(Const ByRef $avarray, $vvalue, $istart = 0, $iend = 0, $icase = 0, $ipartial = 0, $iforward = 1, $isubitem = -1)
  1140.         If NOT IsArray($avarray) Then Return SetError(1, 0, -1)
  1141.         If UBound($avarray, 0) > 2 OR UBound($avarray, 0) < 1 Then Return SetError(2, 0, -1)
  1142.         Local $iubound = UBound($avarray) - 1
  1143.         If $iend < 1 OR $iend > $iubound Then $iend = $iubound
  1144.         If $istart < 0 Then $istart = 0
  1145.         If $istart > $iend Then Return SetError(4, 0, -1)
  1146.         Local $istep = 1
  1147.         If NOT $iforward Then
  1148.             Local $itmp = $istart
  1149.             $istart = $iend
  1150.             $iend = $itmp
  1151.             $istep = -1
  1152.         EndIf
  1153.         Switch UBound($avarray, 0)
  1154.             Case 1
  1155.                 If NOT $ipartial Then
  1156.                     If NOT $icase Then
  1157.                         For $i = $istart To $iend Step $istep
  1158.                             If $avarray[$i] = $vvalue Then Return $i
  1159.                         Next
  1160.                     Else
  1161.                         For $i = $istart To $iend Step $istep
  1162.                             If $avarray[$i] == $vvalue Then Return $i
  1163.                         Next
  1164.                     EndIf
  1165.                 Else
  1166.                     For $i = $istart To $iend Step $istep
  1167.                         If StringInStr($avarray[$i], $vvalue, $icase) > 0 Then Return $i
  1168.                     Next
  1169.                 EndIf
  1170.             Case 2
  1171.                 Local $iuboundsub = UBound($avarray, 2) - 1
  1172.                 If $isubitem > $iuboundsub Then $isubitem = $iuboundsub
  1173.                 If $isubitem < 0 Then
  1174.                     $isubitem = 0
  1175.                 Else
  1176.                     $iuboundsub = $isubitem
  1177.                 EndIf
  1178.                 For $j = $isubitem To $iuboundsub
  1179.                     If NOT $ipartial Then
  1180.                         If NOT $icase Then
  1181.                             For $i = $istart To $iend Step $istep
  1182.                                 If $avarray[$i][$j] = $vvalue Then Return $i
  1183.                             Next
  1184.                         Else
  1185.                             For $i = $istart To $iend Step $istep
  1186.                                 If $avarray[$i][$j] == $vvalue Then Return $i
  1187.                             Next
  1188.                         EndIf
  1189.                     Else
  1190.                         For $i = $istart To $iend Step $istep
  1191.                             If StringInStr($avarray[$i][$j], $vvalue, $icase) > 0 Then Return $i
  1192.                         Next
  1193.                     EndIf
  1194.                 Next
  1195.             Case Else
  1196.                 Return SetError(7, 0, -1)
  1197.         EndSwitch
  1198.         Return SetError(6, 0, -1)
  1199.     EndFunc
  1200.  
  1201.     Func _arraysort(ByRef $avarray, $idescending = 0, $istart = 0, $iend = 0, $isubitem = 0)
  1202.         If NOT IsArray($avarray) Then Return SetError(1, 0, 0)
  1203.         Local $iubound = UBound($avarray) - 1
  1204.         If $iend < 1 OR $iend > $iubound Then $iend = $iubound
  1205.         If $istart < 0 Then $istart = 0
  1206.         If $istart > $iend Then Return SetError(2, 0, 0)
  1207.         Switch UBound($avarray, 0)
  1208.             Case 1
  1209.                 __arrayquicksort1d($avarray, $istart, $iend)
  1210.                 If $idescending Then _arrayreverse($avarray, $istart, $iend)
  1211.             Case 2
  1212.                 Local $isubmax = UBound($avarray, 2) - 1
  1213.                 If $isubitem > $isubmax Then Return SetError(3, 0, 0)
  1214.                 If $idescending Then
  1215.                     $idescending = -1
  1216.                 Else
  1217.                     $idescending = 1
  1218.                 EndIf
  1219.                 __arrayquicksort2d($avarray, $idescending, $istart, $iend, $isubitem, $isubmax)
  1220.             Case Else
  1221.                 Return SetError(4, 0, 0)
  1222.         EndSwitch
  1223.         Return 1
  1224.     EndFunc
  1225.  
  1226.     Func __arrayquicksort1d(ByRef $avarray, ByRef $istart, ByRef $iend)
  1227.         If $iend <= $istart Then Return
  1228.         Local $vtmp
  1229.         If ($iend - $istart) < 15 Then
  1230.             Local $vcur
  1231.             For $i = $istart + 1 To $iend
  1232.                 $vtmp = $avarray[$i]
  1233.                 If IsNumber($vtmp) Then
  1234.                     For $j = $i - 1 To $istart Step -1
  1235.                         $vcur = $avarray[$j]
  1236.                         If ($vtmp >= $vcur AND IsNumber($vcur)) OR (NOT IsNumber($vcur) AND StringCompare($vtmp, $vcur) >= 0) Then ExitLoop
  1237.                         $avarray[$j + 1] = $vcur
  1238.                     Next
  1239.                 Else
  1240.                     For $j = $i - 1 To $istart Step -1
  1241.                         If (StringCompare($vtmp, $avarray[$j]) >= 0) Then ExitLoop
  1242.                         $avarray[$j + 1] = $avarray[$j]
  1243.                     Next
  1244.                 EndIf
  1245.                 $avarray[$j + 1] = $vtmp
  1246.             Next
  1247.             Return
  1248.         EndIf
  1249.         Local $l = $istart, $r = $iend, $vpivot = $avarray[Int(($istart + $iend) / 2)], $fnum = IsNumber($vpivot)
  1250.         Do
  1251.             If $fnum Then
  1252.                 While ($avarray[$l] < $vpivot AND IsNumber($avarray[$l])) OR (NOT IsNumber($avarray[$l]) AND StringCompare($avarray[$l], $vpivot) < 0)
  1253.                     $l += 1
  1254.                 WEnd
  1255.                 While ($avarray[$r] > $vpivot AND IsNumber($avarray[$r])) OR (NOT IsNumber($avarray[$r]) AND StringCompare($avarray[$r], $vpivot) > 0)
  1256.                     $r -= 1
  1257.                 WEnd
  1258.             Else
  1259.                 While (StringCompare($avarray[$l], $vpivot) < 0)
  1260.                     $l += 1
  1261.                 WEnd
  1262.                 While (StringCompare($avarray[$r], $vpivot) > 0)
  1263.                     $r -= 1
  1264.                 WEnd
  1265.             EndIf
  1266.             If $l <= $r Then
  1267.                 $vtmp = $avarray[$l]
  1268.                 $avarray[$l] = $avarray[$r]
  1269.                 $avarray[$r] = $vtmp
  1270.                 $l += 1
  1271.                 $r -= 1
  1272.             EndIf
  1273.         Until $l > $r
  1274.         __arrayquicksort1d($avarray, $istart, $r)
  1275.         __arrayquicksort1d($avarray, $l, $iend)
  1276.     EndFunc
  1277.  
  1278.     Func __arrayquicksort2d(ByRef $avarray, ByRef $istep, ByRef $istart, ByRef $iend, ByRef $isubitem, ByRef $isubmax)
  1279.         If $iend <= $istart Then Return
  1280.         Local $vtmp, $l = $istart, $r = $iend, $vpivot = $avarray[Int(($istart + $iend) / 2)][$isubitem], $fnum = IsNumber($vpivot)
  1281.         Do
  1282.             If $fnum Then
  1283.                 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)
  1284.                     $l += 1
  1285.                 WEnd
  1286.                 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)
  1287.                     $r -= 1
  1288.                 WEnd
  1289.             Else
  1290.                 While ($istep * StringCompare($avarray[$l][$isubitem], $vpivot) < 0)
  1291.                     $l += 1
  1292.                 WEnd
  1293.                 While ($istep * StringCompare($avarray[$r][$isubitem], $vpivot) > 0)
  1294.                     $r -= 1
  1295.                 WEnd
  1296.             EndIf
  1297.             If $l <= $r Then
  1298.                 For $i = 0 To $isubmax
  1299.                     $vtmp = $avarray[$l][$i]
  1300.                     $avarray[$l][$i] = $avarray[$r][$i]
  1301.                     $avarray[$r][$i] = $vtmp
  1302.                 Next
  1303.                 $l += 1
  1304.                 $r -= 1
  1305.             EndIf
  1306.         Until $l > $r
  1307.         __arrayquicksort2d($avarray, $istep, $istart, $r, $isubitem, $isubmax)
  1308.         __arrayquicksort2d($avarray, $istep, $l, $iend, $isubitem, $isubmax)
  1309.     EndFunc
  1310.  
  1311.     Func _arrayswap(ByRef $vitem1, ByRef $vitem2)
  1312.         Local $vtmp = $vitem1
  1313.         $vitem1 = $vitem2
  1314.         $vitem2 = $vtmp
  1315.     EndFunc
  1316.  
  1317.     Func _arraytoclip(Const ByRef $avarray, $istart = 0, $iend = 0)
  1318.         Local $sresult = _arraytostring($avarray, @CR, $istart, $iend)
  1319.         If @error Then Return SetError(@error, 0, 0)
  1320.         Return ClipPut($sresult)
  1321.     EndFunc
  1322.  
  1323.     Func _arraytostring(Const ByRef $avarray, $sdelim = "|", $istart = 0, $iend = 0)
  1324.         If NOT IsArray($avarray) Then Return SetError(1, 0, "")
  1325.         If UBound($avarray, 0) <> 1 Then Return SetError(3, 0, "")
  1326.         Local $sresult, $iubound = UBound($avarray) - 1
  1327.         If $iend < 1 OR $iend > $iubound Then $iend = $iubound
  1328.         If $istart < 0 Then $istart = 0
  1329.         If $istart > $iend Then Return SetError(2, 0, "")
  1330.         For $i = $istart To $iend
  1331.             $sresult &= $avarray[$i] & $sdelim
  1332.         Next
  1333.         Return StringTrimRight($sresult, StringLen($sdelim))
  1334.     EndFunc
  1335.  
  1336.     Func _arraytrim(ByRef $avarray, $itrimnum, $idirection = 0, $istart = 0, $iend = 0)
  1337.         If NOT IsArray($avarray) Then Return SetError(1, 0, 0)
  1338.         If UBound($avarray, 0) <> 1 Then Return SetError(2, 0, 0)
  1339.         Local $iubound = UBound($avarray) - 1
  1340.         If $iend < 1 OR $iend > $iubound Then $iend = $iubound
  1341.         If $istart < 0 Then $istart = 0
  1342.         If $istart > $iend Then Return SetError(5, 0, 0)
  1343.         If $idirection Then
  1344.             For $i = $istart To $iend
  1345.                 $avarray[$i] = StringTrimRight($avarray[$i], $itrimnum)
  1346.             Next
  1347.         Else
  1348.             For $i = $istart To $iend
  1349.                 $avarray[$i] = StringTrimLeft($avarray[$i], $itrimnum)
  1350.             Next
  1351.         EndIf
  1352.         Return 1
  1353.     EndFunc
  1354.  
  1355.     Func _arrayunique($aarray, $idimension = 1, $ibase = 0, $icase = 0, $vdelim = "|")
  1356.         Local $iubounddim
  1357.         If $vdelim = "|" Then $vdelim = Chr(1)
  1358.         If NOT IsArray($aarray) Then Return SetError(1, 0, 0)
  1359.         If NOT $idimension > 0 Then
  1360.             Return SetError(3, 0, 0)
  1361.         Else
  1362.             $iubounddim = UBound($aarray, 1)
  1363.             If @error Then Return SetError(3, 0, 0)
  1364.             If $idimension > 1 Then
  1365.                 Local $aarraytmp[1]
  1366.                 For $i = 0 To $iubounddim - 1
  1367.                     _arrayadd($aarraytmp, $aarray[$i][$idimension - 1])
  1368.                 Next
  1369.                 _arraydelete($aarraytmp, 0)
  1370.             Else
  1371.                 If UBound($aarray, 0) = 1 Then
  1372.                     Dim $aarraytmp[1]
  1373.                     For $i = 0 To $iubounddim - 1
  1374.                         _arrayadd($aarraytmp, $aarray[$i])
  1375.                     Next
  1376.                     _arraydelete($aarraytmp, 0)
  1377.                 Else
  1378.                     Dim $aarraytmp[1]
  1379.                     For $i = 0 To $iubounddim - 1
  1380.                         _arrayadd($aarraytmp, $aarray[$i][$idimension - 1])
  1381.                     Next
  1382.                     _arraydelete($aarraytmp, 0)
  1383.                 EndIf
  1384.             EndIf
  1385.         EndIf
  1386.         Local $shold
  1387.         For $icc = $ibase To UBound($aarraytmp) - 1
  1388.             If NOT StringInStr($vdelim & $shold, $vdelim & $aarraytmp[$icc] & $vdelim, $icase) Then $shold &= $aarraytmp[$icc] & $vdelim
  1389.         Next
  1390.         If $shold Then
  1391.             $aarraytmp = StringSplit(StringTrimRight($shold, StringLen($vdelim)), $vdelim, 1)
  1392.             Return $aarraytmp
  1393.         EndIf
  1394.         Return SetError(2, 0, 0)
  1395.     EndFunc
  1396.  
  1397.     Func __array_exeterinternal(ByRef $avarray, $istart, $isize, $sdelim, ByRef $aidx, ByRef $aresult, ByRef $icount)
  1398.         If $istart == $isize - 1 Then
  1399.             For $i = 0 To $isize - 1
  1400.                 $aresult[$icount] &= $avarray[$aidx[$i]] & $sdelim
  1401.             Next
  1402.             If $sdelim <> "" Then $aresult[$icount] = StringTrimRight($aresult[$icount], 1)
  1403.             $icount += 1
  1404.         Else
  1405.             Local $itemp
  1406.             For $i = $istart To $isize - 1
  1407.                 $itemp = $aidx[$i]
  1408.                 $aidx[$i] = $aidx[$istart]
  1409.                 $aidx[$istart] = $itemp
  1410.                 __array_exeterinternal($avarray, $istart + 1, $isize, $sdelim, $aidx, $aresult, $icount)
  1411.                 $aidx[$istart] = $aidx[$i]
  1412.                 $aidx[$i] = $itemp
  1413.             Next
  1414.         EndIf
  1415.     EndFunc
  1416.  
  1417.     Func __array_combinations($in, $ir)
  1418.         Local $i_total = 1
  1419.         For $i = $ir To 1 Step -1
  1420.             $i_total *= ($in / $i)
  1421.             $in -= 1
  1422.         Next
  1423.         Return Round($i_total)
  1424.     EndFunc
  1425.  
  1426.     Func __array_getnext($in, $ir, ByRef $ileft, $itotal, ByRef $aidx)
  1427.         If $ileft == $itotal Then
  1428.             $ileft -= 1
  1429.             Return
  1430.         EndIf
  1431.         Local $i = $ir - 1
  1432.         While $aidx[$i] == $in - $ir + $i
  1433.             $i -= 1
  1434.         WEnd
  1435.         $aidx[$i] += 1
  1436.         For $j = $i + 1 To $ir - 1
  1437.             $aidx[$j] = $aidx[$i] + $j - $i
  1438.         Next
  1439.         $ileft -= 1
  1440.     EndFunc
  1441.  
  1442.     Global Const $bs_groupbox = 7
  1443.     Global Const $bs_bottom = 2048
  1444.     Global Const $bs_center = 768
  1445.     Global Const $bs_defpushbutton = 1
  1446.     Global Const $bs_left = 256
  1447.     Global Const $bs_multiline = 8192
  1448.     Global Const $bs_pushbox = 10
  1449.     Global Const $bs_pushlike = 4096
  1450.     Global Const $bs_right = 512
  1451.     Global Const $bs_rightbutton = 32
  1452.     Global Const $bs_top = 1024
  1453.     Global Const $bs_vcenter = 3072
  1454.     Global Const $bs_flat = 32768
  1455.     Global Const $bs_icon = 64
  1456.     Global Const $bs_bitmap = 128
  1457.     Global Const $bs_notify = 16384
  1458.     Global Const $bs_splitbutton = 12
  1459.     Global Const $bs_defsplitbutton = 13
  1460.     Global Const $bs_commandlink = 14
  1461.     Global Const $bs_defcommandlink = 15
  1462.     Global Const $bcsif_glyph = 1
  1463.     Global Const $bcsif_image = 2
  1464.     Global Const $bcsif_style = 4
  1465.     Global Const $bcsif_size = 8
  1466.     Global Const $bcss_nosplit = 1
  1467.     Global Const $bcss_stretch = 2
  1468.     Global Const $bcss_alignleft = 4
  1469.     Global Const $bcss_image = 8
  1470.     Global Const $button_imagelist_align_left = 0
  1471.     Global Const $button_imagelist_align_right = 1
  1472.     Global Const $button_imagelist_align_top = 2
  1473.     Global Const $button_imagelist_align_bottom = 3
  1474.     Global Const $button_imagelist_align_center = 4
  1475.     Global Const $bs_3state = 5
  1476.     Global Const $bs_auto3state = 6
  1477.     Global Const $bs_autocheckbox = 3
  1478.     Global Const $bs_checkbox = 2
  1479.     Global Const $bs_radiobutton = 4
  1480.     Global Const $bs_autoradiobutton = 9
  1481.     Global Const $bs_ownerdraw = 11
  1482.     Global Const $gui_ss_default_button = 0
  1483.     Global Const $gui_ss_default_checkbox = 0
  1484.     Global Const $gui_ss_default_group = 0
  1485.     Global Const $gui_ss_default_radio = 0
  1486.     Global Const $bcm_first = 5632
  1487.     Global Const $bcm_getidealsize = ($bcm_first + 1)
  1488.     Global Const $bcm_getimagelist = ($bcm_first + 3)
  1489.     Global Const $bcm_getnote = ($bcm_first + 10)
  1490.     Global Const $bcm_getnotelength = ($bcm_first + 11)
  1491.     Global Const $bcm_getsplitinfo = ($bcm_first + 8)
  1492.     Global Const $bcm_gettextmargin = ($bcm_first + 5)
  1493.     Global Const $bcm_setdropdownstate = ($bcm_first + 6)
  1494.     Global Const $bcm_setimagelist = ($bcm_first + 2)
  1495.     Global Const $bcm_setnote = ($bcm_first + 9)
  1496.     Global Const $bcm_setshield = ($bcm_first + 12)
  1497.     Global Const $bcm_setsplitinfo = ($bcm_first + 7)
  1498.     Global Const $bcm_settextmargin = ($bcm_first + 4)
  1499.     Global Const $bm_click = 245
  1500.     Global Const $bm_getcheck = 240
  1501.     Global Const $bm_getimage = 246
  1502.     Global Const $bm_getstate = 242
  1503.     Global Const $bm_setcheck = 241
  1504.     Global Const $bm_setdontclick = 248
  1505.     Global Const $bm_setimage = 247
  1506.     Global Const $bm_setstate = 243
  1507.     Global Const $bm_setstyle = 244
  1508.     Global Const $bcn_first = -1250
  1509.     Global Const $bcn_dropdown = ($bcn_first + 2)
  1510.     Global Const $bcn_hotitemchange = ($bcn_first + 1)
  1511.     Global Const $bn_clicked = 0
  1512.     Global Const $bn_paint = 1
  1513.     Global Const $bn_hilite = 2
  1514.     Global Const $bn_unhilite = 3
  1515.     Global Const $bn_disable = 4
  1516.     Global Const $bn_doubleclicked = 5
  1517.     Global Const $bn_setfocus = 6
  1518.     Global Const $bn_killfocus = 7
  1519.     Global Const $bn_pushed = $bn_hilite
  1520.     Global Const $bn_unpushed = $bn_unhilite
  1521.     Global Const $bn_dblclk = $bn_doubleclicked
  1522.     Global Const $bst_checked = 1
  1523.     Global Const $bst_indeterminate = 2
  1524.     Global Const $bst_unchecked = 0
  1525.     Global Const $bst_focus = 8
  1526.     Global Const $bst_pushed = 4
  1527.     Global Const $bst_dontclick = 128
  1528.     Global Const $gdip_dashcapflat = 0
  1529.     Global Const $gdip_dashcapround = 2
  1530.     Global Const $gdip_dashcaptriangle = 3
  1531.     Global Const $gdip_dashstylesolid = 0
  1532.     Global Const $gdip_dashstyledash = 1
  1533.     Global Const $gdip_dashstyledot = 2
  1534.     Global Const $gdip_dashstyledashdot = 3
  1535.     Global Const $gdip_dashstyledashdotdot = 4
  1536.     Global Const $gdip_dashstylecustom = 5
  1537.     Global Const $gdip_epgchrominancetable = "{F2E455DC-09B3-4316-8260-676ADA32481C}"
  1538.     Global Const $gdip_epgcolordepth = "{66087055-AD66-4C7C-9A18-38A2310B8337}"
  1539.     Global Const $gdip_epgcompression = "{E09D739D-CCD4-44EE-8EBA-3FBF8BE4FC58}"
  1540.     Global Const $gdip_epgluminancetable = "{EDB33BCE-0266-4A77-B904-27216099E717}"
  1541.     Global Const $gdip_epgquality = "{1D5BE4B5-FA4A-452D-9CDD-5DB35105E7EB}"
  1542.     Global Const $gdip_epgrendermethod = "{6D42C53A-229A-4825-8BB7-5C99E2B9A8B8}"
  1543.     Global Const $gdip_epgsaveflag = "{292266FC-AC40-47BF-8CFC-A85B89A655DE}"
  1544.     Global Const $gdip_epgscanmethod = "{3A4E2661-3109-4E56-8536-42C156E7DCFA}"
  1545.     Global Const $gdip_epgtransformation = "{8D0EB2D1-A58E-4EA8-AA14-108074B7B6F9}"
  1546.     Global Const $gdip_epgversion = "{24D18C76-814A-41A4-BF53-1C219CCCF797}"
  1547.     Global Const $gdip_eptbyte = 1
  1548.     Global Const $gdip_eptascii = 2
  1549.     Global Const $gdip_eptshort = 3
  1550.     Global Const $gdip_eptlong = 4
  1551.     Global Const $gdip_eptrational = 5
  1552.     Global Const $gdip_eptlongrange = 6
  1553.     Global Const $gdip_eptundefined = 7
  1554.     Global Const $gdip_eptrationalrange = 8
  1555.     Global Const $gdip_errok = 0
  1556.     Global Const $gdip_errgenericerror = 1
  1557.     Global Const $gdip_errinvalidparameter = 2
  1558.     Global Const $gdip_erroutofmemory = 3
  1559.     Global Const $gdip_errobjectbusy = 4
  1560.     Global Const $gdip_errinsufficientbuffer = 5
  1561.     Global Const $gdip_errnotimplemented = 6
  1562.     Global Const $gdip_errwin32error = 7
  1563.     Global Const $gdip_errwrongstate = 8
  1564.     Global Const $gdip_erraborted = 9
  1565.     Global Const $gdip_errfilenotfound = 10
  1566.     Global Const $gdip_errvalueoverflow = 11
  1567.     Global Const $gdip_erraccessdenied = 12
  1568.     Global Const $gdip_errunknownimageformat = 13
  1569.     Global Const $gdip_errfontfamilynotfound = 14
  1570.     Global Const $gdip_errfontstylenotfound = 15
  1571.     Global Const $gdip_errnottruetypefont = 16
  1572.     Global Const $gdip_errunsupportedgdiversion = 17
  1573.     Global Const $gdip_errgdiplusnotinitialized = 18
  1574.     Global Const $gdip_errpropertynotfound = 19
  1575.     Global Const $gdip_errpropertynotsupported = 20
  1576.     Global Const $gdip_evtcompressionlzw = 2
  1577.     Global Const $gdip_evtcompressionccitt3 = 3
  1578.     Global Const $gdip_evtcompressionccitt4 = 4
  1579.     Global Const $gdip_evtcompressionrle = 5
  1580.     Global Const $gdip_evtcompressionnone = 6
  1581.     Global Const $gdip_evttransformrotate90 = 13
  1582.     Global Const $gdip_evttransformrotate180 = 14
  1583.     Global Const $gdip_evttransformrotate270 = 15
  1584.     Global Const $gdip_evttransformfliphorizontal = 16
  1585.     Global Const $gdip_evttransformflipvertical = 17
  1586.     Global Const $gdip_evtmultiframe = 18
  1587.     Global Const $gdip_evtlastframe = 19
  1588.     Global Const $gdip_evtflush = 20
  1589.     Global Const $gdip_evtframedimensionpage = 23
  1590.     Global Const $gdip_icfencoder = 1
  1591.     Global Const $gdip_icfdecoder = 2
  1592.     Global Const $gdip_icfsupportbitmap = 4
  1593.     Global Const $gdip_icfsupportvector = 8
  1594.     Global Const $gdip_icfseekableencode = 16
  1595.     Global Const $gdip_icfblockingdecode = 32
  1596.     Global Const $gdip_icfbuiltin = 65536
  1597.     Global Const $gdip_icfsystem = 131072
  1598.     Global Const $gdip_icfuser = 262144
  1599.     Global Const $gdip_ilmread = 1
  1600.     Global Const $gdip_ilmwrite = 2
  1601.     Global Const $gdip_ilmuserinputbuf = 4
  1602.     Global Const $gdip_linecapflat = 0
  1603.     Global Const $gdip_linecapsquare = 1
  1604.     Global Const $gdip_linecapround = 2
  1605.     Global Const $gdip_linecaptriangle = 3
  1606.     Global Const $gdip_linecapnoanchor = 16
  1607.     Global Const $gdip_linecapsquareanchor = 17
  1608.     Global Const $gdip_linecaproundanchor = 18
  1609.     Global Const $gdip_linecapdiamondanchor = 19
  1610.     Global Const $gdip_linecaparrowanchor = 20
  1611.     Global Const $gdip_linecapcustom = 255
  1612.     Global Const $gdip_pxf01indexed = 196865
  1613.     Global Const $gdip_pxf04indexed = 197634
  1614.     Global Const $gdip_pxf08indexed = 198659
  1615.     Global Const $gdip_pxf16grayscale = 1052676
  1616.     Global Const $gdip_pxf16rgb555 = 135173
  1617.     Global Const $gdip_pxf16rgb565 = 135174
  1618.     Global Const $gdip_pxf16argb1555 = 397319
  1619.     Global Const $gdip_pxf24rgb = 137224
  1620.     Global Const $gdip_pxf32rgb = 139273
  1621.     Global Const $gdip_pxf32argb = 2498570
  1622.     Global Const $gdip_pxf32pargb = 860171
  1623.     Global Const $gdip_pxf48rgb = 1060876
  1624.     Global Const $gdip_pxf64argb = 3424269
  1625.     Global Const $gdip_pxf64pargb = 1851406
  1626.     Global Const $gdip_imageformat_undefined = "{B96B3CA9-0728-11D3-9D7B-0000F81EF32E}"
  1627.     Global Const $gdip_imageformat_memorybmp = "{B96B3CAA-0728-11D3-9D7B-0000F81EF32E}"
  1628.     Global Const $gdip_imageformat_bmp = "{B96B3CAB-0728-11D3-9D7B-0000F81EF32E}"
  1629.     Global Const $gdip_imageformat_emf = "{B96B3CAC-0728-11D3-9D7B-0000F81EF32E}"
  1630.     Global Const $gdip_imageformat_wmf = "{B96B3CAD-0728-11D3-9D7B-0000F81EF32E}"
  1631.     Global Const $gdip_imageformat_jpeg = "{B96B3CAE-0728-11D3-9D7B-0000F81EF32E}"
  1632.     Global Const $gdip_imageformat_png = "{B96B3CAF-0728-11D3-9D7B-0000F81EF32E}"
  1633.     Global Const $gdip_imageformat_gif = "{B96B3CB0-0728-11D3-9D7B-0000F81EF32E}"
  1634.     Global Const $gdip_imageformat_tiff = "{B96B3CB1-0728-11D3-9D7B-0000F81EF32E}"
  1635.     Global Const $gdip_imageformat_exif = "{B96B3CB2-0728-11D3-9D7B-0000F81EF32E}"
  1636.     Global Const $gdip_imageformat_icon = "{B96B3CB5-0728-11D3-9D7B-0000F81EF32E}"
  1637.     Global Const $gdip_imagetype_unknown = 0
  1638.     Global Const $gdip_imagetype_bitmap = 1
  1639.     Global Const $gdip_imagetype_metafile = 2
  1640.     Global Const $gdip_imageflags_none = 0
  1641.     Global Const $gdip_imageflags_scalable = 1
  1642.     Global Const $gdip_imageflags_hasalpha = 2
  1643.     Global Const $gdip_imageflags_hastranslucent = 4
  1644.     Global Const $gdip_imageflags_partiallyscalable = 8
  1645.     Global Const $gdip_imageflags_colorspace_rgb = 16
  1646.     Global Const $gdip_imageflags_colorspace_cmyk = 32
  1647.     Global Const $gdip_imageflags_colorspace_gray = 64
  1648.     Global Const $gdip_imageflags_colorspace_ycbcr = 128
  1649.     Global Const $gdip_imageflags_colorspace_ycck = 256
  1650.     Global Const $gdip_imageflags_hasrealdpi = 4096
  1651.     Global Const $gdip_imageflags_hasrealpixelsize = 8192
  1652.     Global Const $gdip_imageflags_readonly = 65536
  1653.     Global Const $gdip_imageflags_caching = 131072
  1654.     Global Const $tagpoint = "long X;long Y"
  1655.     Global Const $tagrect = "long Left;long Top;long Right;long Bottom"
  1656.     Global Const $tagsize = "long X;long Y"
  1657.     Global Const $tagmargins = "int cxLeftWidth;int cxRightWidth;int cyTopHeight;int cyBottomHeight"
  1658.     Global Const $tagfiletime = "dword Lo;dword Hi"
  1659.     Global Const $tagsystemtime = "word Year;word Month;word Dow;word Day;word Hour;word Minute;word Second;word MSeconds"
  1660.     Global Const $tagtime_zone_information = "long Bias;wchar StdName[32];word StdDate[8];long StdBias;wchar DayName[32];word DayDate[8];long DayBias"
  1661.     Global Const $tagnmhdr = "hwnd hWndFrom;uint_ptr IDFrom;INT Code"
  1662.     Global Const $tagcomboboxexitem = "uint Mask;int_ptr Item;ptr Text;int TextMax;int Image;int SelectedImage;int OverlayImage;" & "int Indent;lparam Param"
  1663.     Global Const $tagnmcbedragbegin = $tagnmhdr & ";int ItemID;ptr szText"
  1664.     Global Const $tagnmcbeendedit = $tagnmhdr & ";bool fChanged;int NewSelection;ptr szText;int Why"
  1665.     Global Const $tagnmcomboboxex = $tagnmhdr & ";uint Mask;int_ptr Item;ptr Text;int TextMax;int Image;" & "int SelectedImage;int OverlayImage;int Indent;lparam Param"
  1666.     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"
  1667.     Global Const $tagnmdatetimechange = $tagnmhdr & ";dword Flag;" & $tagsystemtime
  1668.     Global Const $tagnmdatetimeformat = $tagnmhdr & ";ptr Format;" & $tagsystemtime & ";ptr pDisplay;wchar Display[64]"
  1669.     Global Const $tagnmdatetimeformatquery = $tagnmhdr & ";ptr Format;long SizeX;long SizeY"
  1670.     Global Const $tagnmdatetimekeydown = $tagnmhdr & ";int VirtKey;ptr Format;" & $tagsystemtime
  1671.     Global Const $tagnmdatetimestring = $tagnmhdr & ";ptr UserString;" & $tagsystemtime & ";dword Flags"
  1672.     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"
  1673.     Global Const $taggdipbitmapdata = "uint Width;uint Height;int Stride;int Format;ptr Scan0;uint_ptr Reserved"
  1674.     Global Const $taggdipencoderparam = "byte GUID[16];dword Count;dword Type;ptr Values"
  1675.     Global Const $taggdipencoderparams = "dword Count;byte Params[0]"
  1676.     Global Const $taggdiprectf = "float X;float Y;float Width;float Height"
  1677.     Global Const $taggdipstartupinput = "uint Version;ptr Callback;bool NoThread;bool NoCodecs"
  1678.     Global Const $taggdipstartupoutput = "ptr HookProc;ptr UnhookProc"
  1679.     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"
  1680.     Global Const $taggdippencoderparams = "dword Count;byte Params[0]"
  1681.     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"
  1682.     Global Const $tagnmhddispinfo = $tagnmhdr & ";int Item;uint Mask;ptr Text;int TextMax;int Image;lparam lParam"
  1683.     Global Const $tagnmhdfilterbtnclick = $tagnmhdr & ";int Item;" & $tagrect
  1684.     Global Const $tagnmheader = $tagnmhdr & ";int Item;int Button;ptr pItem"
  1685.     Global Const $taggetipaddress = "byte Field4;byte Field3;byte Field2;byte Field1"
  1686.     Global Const $tagnmipaddress = $tagnmhdr & ";int Field;int Value"
  1687.     Global Const $taglvfindinfo = "uint Flags;ptr Text;lparam Param;" & $tagpoint & ";uint Direction"
  1688.     Global Const $taglvhittestinfo = $tagpoint & ";uint Flags;int Item;int SubItem"
  1689.     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"
  1690.     Global Const $tagnmlistview = $tagnmhdr & ";int Item;int SubItem;uint NewState;uint OldState;uint Changed;" & "long ActionX;long ActionY;lparam Param"
  1691.     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"
  1692.     Global Const $tagnmlvdispinfo = $tagnmhdr & ";" & $taglvitem
  1693.     Global Const $tagnmlvfinditem = $tagnmhdr & ";" & $taglvfindinfo
  1694.     Global Const $tagnmlvgetinfotip = $tagnmhdr & ";dword Flags;ptr Text;int TextMax;int Item;int SubItem;lparam lParam"
  1695.     Global Const $tagnmitemactivate = $tagnmhdr & ";int Index;int SubItem;uint NewState;uint OldState;uint Changed;" & $tagpoint & ";lparam lParam;uint KeyFlags"
  1696.     Global Const $tagnmlvkeydown = $tagnmhdr & ";align 1;word VKey;uint Flags"
  1697.     Global Const $tagnmlvscroll = $tagnmhdr & ";int DX;int DY"
  1698.     Global Const $tagmchittestinfo = "uint Size;" & $tagpoint & ";uint Hit;" & $tagsystemtime
  1699.     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"
  1700.     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"
  1701.     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"
  1702.     Global Const $tagnmdaystate = $tagnmhdr & ";" & $tagsystemtime & ";int DayState;ptr pDayState"
  1703.     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"
  1704.     Global Const $tagnmobjectnotify = $tagnmhdr & ";int Item;ptr piid;ptr pObject;long Result"
  1705.     Global Const $tagnmtckeydown = $tagnmhdr & ";word VKey;uint Flags"
  1706.     Global Const $tagtvitem = "uint Mask;handle hItem;uint State;uint StateMask;ptr Text;int TextMax;int Image;int SelectedImage;" & "int Children;lparam Param"
  1707.     Global Const $tagtvitemex = $tagtvitem & ";int Integral"
  1708.     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"
  1709.     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"
  1710.     Global Const $tagnmtvdispinfo = $tagnmhdr & ";" & $tagtvitem
  1711.     Global Const $tagnmtvgetinfotip = $tagnmhdr & ";ptr Text;int TextMax;handle hItem;lparam lParam"
  1712.     Global Const $tagtvhittestinfo = $tagpoint & ";uint Flags;handle Item"
  1713.     Global Const $tagnmtvkeydown = $tagnmhdr & ";word VKey;uint Flags"
  1714.     Global Const $tagnmmouse = $tagnmhdr & ";dword_ptr ItemSpec;dword_ptr ItemData;" & $tagpoint & ";lparam HitInfo"
  1715.     Global Const $tagtoken_privileges = "dword Count;int64 LUID;dword Attributes"
  1716.     Global Const $tagimageinfo = "handle hBitmap;handle hMask;int Unused1;int Unused2;" & $tagrect
  1717.     Global Const $tagmenuinfo = "dword Size;INT Mask;dword Style;uint YMax;handle hBack;dword ContextHelpID;ulong_ptr MenuData"
  1718.     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"
  1719.     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"
  1720.     Global Const $tagnmrebarautobreak = $tagnmhdr & ";uint uBand;uint wID;lparam lParam;uint uMsg;uint fStyleCurrent;bool fAutoBreak"
  1721.     Global Const $tagnmrbautosize = $tagnmhdr & ";bool fChanged;long TargetLeft;long TargetTop;long TargetRight;long TargetBottom;" & "long ActualLeft;long ActualTop;long ActualRight;long ActualBottom"
  1722.     Global Const $tagnmrebar = $tagnmhdr & ";dword dwMask;uint uBand;uint fStyle;uint wID;laram lParam"
  1723.     Global Const $tagnmrebarchevron = $tagnmhdr & ";uint uBand;uint wID;lparam lParam;" & $tagrect & ";lparam lParamNM"
  1724.     Global Const $tagnmrebarchildsize = $tagnmhdr & ";uint uBand;uint wID;long CLeft;long CTop;long CRight;long CBottom;" & "long BLeft;long BTop;long BRight;long BBottom"
  1725.     Global Const $tagcolorscheme = "dword Size;dword BtnHighlight;dword BtnShadow"
  1726.     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
  1727.     Global Const $tagnmtbhotitem = $tagnmhdr & ";int idOld;int idNew;dword dwFlags"
  1728.     Global Const $tagtbbutton = "int Bitmap;int Command;byte State;byte Style;align;dword_ptr Param;int_ptr String"
  1729.     Global Const $tagtbbuttoninfo = "uint Size;dword Mask;int Command;int Image;byte State;byte Style;word CX;dword_ptr Param;ptr Text;int TextMax"
  1730.     Global Const $tagnetresource = "dword Scope;dword Type;dword DisplayType;dword Usage;ptr LocalName;ptr RemoteName;ptr Comment;ptr Provider"
  1731.     Global Const $tagoverlapped = "ulong_ptr Internal;ulong_ptr InternalHigh;dword Offset;dword OffsetHigh;handle hEvent"
  1732.     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"
  1733.     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"
  1734.     Global Const $tagblendfunction = "byte Op;byte Flags;byte Alpha;byte Format"
  1735.     Global Const $tagguid = "dword Data1;word Data2;word Data3;byte Data4[8]"
  1736.     Global Const $tagwindowplacement = "uint length; uint flags;uint showCmd;long ptMinPosition[2];long ptMaxPosition[2];long rcNormalPosition[4]"
  1737.     Global Const $tagwindowpos = "hwnd hWnd;hwnd InsertAfter;int X;int Y;int CX;int CY;uint Flags"
  1738.     Global Const $tagscrollinfo = "uint cbSize;uint fMask;int  nMin;int  nMax;uint nPage;int  nPos;int  nTrackPos"
  1739.     Global Const $tagscrollbarinfo = "dword cbSize;" & $tagrect & ";int dxyLineButton;int xyThumbTop;" & "int xyThumbBottom;int reserved;dword rgstate[6]"
  1740.     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]"
  1741.     Global Const $tagkbdllhookstruct = "dword vkCode;dword scanCode;dword flags;dword time;ulong_ptr dwExtraInfo"
  1742.     Global Const $tagprocess_information = "handle hProcess;handle hThread;dword ProcessID;dword ThreadID"
  1743.     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"
  1744.     Global Const $tagsecurity_attributes = "dword Length;ptr Descriptor;bool InheritHandle"
  1745.     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]"
  1746.     Global Const $error_no_token = 1008
  1747.     Global Const $se_assignprimarytoken_name = "SeAssignPrimaryTokenPrivilege"
  1748.     Global Const $se_audit_name = "SeAuditPrivilege"
  1749.     Global Const $se_backup_name = "SeBackupPrivilege"
  1750.     Global Const $se_change_notify_name = "SeChangeNotifyPrivilege"
  1751.     Global Const $se_create_global_name = "SeCreateGlobalPrivilege"
  1752.     Global Const $se_create_pagefile_name = "SeCreatePagefilePrivilege"
  1753.     Global Const $se_create_permanent_name = "SeCreatePermanentPrivilege"
  1754.     Global Const $se_create_token_name = "SeCreateTokenPrivilege"
  1755.     Global Const $se_debug_name = "SeDebugPrivilege"
  1756.     Global Const $se_enable_delegation_name = "SeEnableDelegationPrivilege"
  1757.     Global Const $se_impersonate_name = "SeImpersonatePrivilege"
  1758.     Global Const $se_inc_base_priority_name = "SeIncreaseBasePriorityPrivilege"
  1759.     Global Const $se_increase_quota_name = "SeIncreaseQuotaPrivilege"
  1760.     Global Const $se_load_driver_name = "SeLoadDriverPrivilege"
  1761.     Global Const $se_lock_memory_name = "SeLockMemoryPrivilege"
  1762.     Global Const $se_machine_account_name = "SeMachineAccountPrivilege"
  1763.     Global Const $se_manage_volume_name = "SeManageVolumePrivilege"
  1764.     Global Const $se_prof_single_process_name = "SeProfileSingleProcessPrivilege"
  1765.     Global Const $se_remote_shutdown_name = "SeRemoteShutdownPrivilege"
  1766.     Global Const $se_restore_name = "SeRestorePrivilege"
  1767.     Global Const $se_security_name = "SeSecurityPrivilege"
  1768.     Global Const $se_shutdown_name = "SeShutdownPrivilege"
  1769.     Global Const $se_sync_agent_name = "SeSyncAgentPrivilege"
  1770.     Global Const $se_system_environment_name = "SeSystemEnvironmentPrivilege"
  1771.     Global Const $se_system_profile_name = "SeSystemProfilePrivilege"
  1772.     Global Const $se_systemtime_name = "SeSystemtimePrivilege"
  1773.     Global Const $se_take_ownership_name = "SeTakeOwnershipPrivilege"
  1774.     Global Const $se_tcb_name = "SeTcbPrivilege"
  1775.     Global Const $se_unsolicited_input_name = "SeUnsolicitedInputPrivilege"
  1776.     Global Const $se_undock_name = "SeUndockPrivilege"
  1777.     Global Const $se_privilege_enabled_by_default = 1
  1778.     Global Const $se_privilege_enabled = 2
  1779.     Global Const $se_privilege_removed = 4
  1780.     Global Const $se_privilege_used_for_access = -2147483648
  1781.     Global Const $tokenuser = 1
  1782.     Global Const $tokengroups = 2
  1783.     Global Const $tokenprivileges = 3
  1784.     Global Const $tokenowner = 4
  1785.     Global Const $tokenprimarygroup = 5
  1786.     Global Const $tokendefaultdacl = 6
  1787.     Global Const $tokensource = 7
  1788.     Global Const $tokentype = 8
  1789.     Global Const $tokenimpersonationlevel = 9
  1790.     Global Const $tokenstatistics = 10
  1791.     Global Const $tokenrestrictedsids = 11
  1792.     Global Const $tokensessionid = 12
  1793.     Global Const $tokengroupsandprivileges = 13
  1794.     Global Const $tokensessionreference = 14
  1795.     Global Const $tokensandboxinert = 15
  1796.     Global Const $tokenauditpolicy = 16
  1797.     Global Const $tokenorigin = 17
  1798.     Global Const $tokenelevationtype = 18
  1799.     Global Const $tokenlinkedtoken = 19
  1800.     Global Const $tokenelevation = 20
  1801.     Global Const $tokenhasrestrictions = 21
  1802.     Global Const $tokenaccessinformation = 22
  1803.     Global Const $tokenvirtualizationallowed = 23
  1804.     Global Const $tokenvirtualizationenabled = 24
  1805.     Global Const $tokenintegritylevel = 25
  1806.     Global Const $tokenuiaccess = 26
  1807.     Global Const $tokenmandatorypolicy = 27
  1808.     Global Const $tokenlogonsid = 28
  1809.     Global Const $token_assign_primary = 1
  1810.     Global Const $token_duplicate = 2
  1811.     Global Const $token_impersonate = 4
  1812.     Global Const $token_query = 8
  1813.     Global Const $token_query_source = 16
  1814.     Global Const $token_adjust_privileges = 32
  1815.     Global Const $token_adjust_groups = 64
  1816.     Global Const $token_adjust_default = 128
  1817.     Global Const $token_adjust_sessionid = 256
  1818.  
  1819.     Func _winapi_getlasterror($curerr = @error, $curext = @extended)
  1820.         Local $aresult = DllCall("kernel32.dll", "dword", "GetLastError")
  1821.         Return SetError($curerr, $curext, $aresult[0])
  1822.     EndFunc
  1823.  
  1824.     Func _winapi_setlasterror($ierrcode, $curerr = @error, $curext = @extended)
  1825.         DllCall("kernel32.dll", "none", "SetLastError", "dword", $ierrcode)
  1826.         Return SetError($curerr, $curext)
  1827.     EndFunc
  1828.  
  1829.     Func _security__adjusttokenprivileges($htoken, $fdisableall, $pnewstate, $ibufferlen, $pprevstate = 0, $prequired = 0)
  1830.         Local $aresult = DllCall("advapi32.dll", "bool", "AdjustTokenPrivileges", "handle", $htoken, "bool", $fdisableall, "ptr", $pnewstate, "dword", $ibufferlen, "ptr", $pprevstate, "ptr", $prequired)
  1831.         If @error Then Return SetError(@error, @extended, False)
  1832.         Return $aresult[0]
  1833.     EndFunc
  1834.  
  1835.     Func _security__getaccountsid($saccount, $ssystem = "")
  1836.         Local $aacct = _security__lookupaccountname($saccount, $ssystem)
  1837.         If @error Then Return SetError(@error, 0, 0)
  1838.         Return _security__stringsidtosid($aacct[0])
  1839.     EndFunc
  1840.  
  1841.     Func _security__getlengthsid($psid)
  1842.         If NOT _security__isvalidsid($psid) Then Return SetError(-1, 0, 0)
  1843.         Local $aresult = DllCall("advapi32.dll", "dword", "GetLengthSid", "ptr", $psid)
  1844.         If @error Then Return SetError(@error, @extended, 0)
  1845.         Return $aresult[0]
  1846.     EndFunc
  1847.  
  1848.     Func _security__gettokeninformation($htoken, $iclass)
  1849.         Local $aresult = DllCall("advapi32.dll", "bool", "GetTokenInformation", "handle", $htoken, "int", $iclass, "ptr", 0, "dword", 0, "dword*", 0)
  1850.         If @error Then Return SetError(@error, @extended, 0)
  1851.         If NOT $aresult[0] Then Return 0
  1852.         Local $tbuffer = DllStructCreate("byte[" & $aresult[5] & "]")
  1853.         Local $pbuffer = DllStructGetPtr($tbuffer)
  1854.         $aresult = DllCall("advapi32.dll", "bool", "GetTokenInformation", "handle", $htoken, "int", $iclass, "ptr", $pbuffer, "dword", $aresult[5], "dword*", 0)
  1855.         If @error Then Return SetError(@error, @extended, 0)
  1856.         If NOT $aresult[0] Then Return 0
  1857.         Return $tbuffer
  1858.     EndFunc
  1859.  
  1860.     Func _security__impersonateself($ilevel = 2)
  1861.         Local $aresult = DllCall("advapi32.dll", "bool", "ImpersonateSelf", "int", $ilevel)
  1862.         If @error Then Return SetError(@error, @extended, False)
  1863.         Return $aresult[0]
  1864.     EndFunc
  1865.  
  1866.     Func _security__isvalidsid($psid)
  1867.         Local $aresult = DllCall("advapi32.dll", "bool", "IsValidSid", "ptr", $psid)
  1868.         If @error Then Return SetError(@error, @extended, False)
  1869.         Return $aresult[0]
  1870.     EndFunc
  1871.  
  1872.     Func _security__lookupaccountname($saccount, $ssystem = "")
  1873.         Local $tdata = DllStructCreate("byte SID[256]")
  1874.         Local $psid = DllStructGetPtr($tdata, "SID")
  1875.         Local $aresult = DllCall("advapi32.dll", "bool", "LookupAccountNameW", "wstr", $ssystem, "wstr", $saccount, "ptr", $psid, "dword*", 256, "wstr", "", "dword*", 256, "int*", 0)
  1876.         If @error Then Return SetError(@error, @extended, 0)
  1877.         If NOT $aresult[0] Then Return 0
  1878.         Local $aacct[3]
  1879.         $aacct[0] = _security__sidtostringsid($psid)
  1880.         $aacct[1] = $aresult[5]
  1881.         $aacct[2] = $aresult[7]
  1882.         Return $aacct
  1883.     EndFunc
  1884.  
  1885.     Func _security__lookupaccountsid($vsid)
  1886.         Local $psid, $aacct[3]
  1887.         If IsString($vsid) Then
  1888.             Local $tsid = _security__stringsidtosid($vsid)
  1889.             $psid = DllStructGetPtr($tsid)
  1890.         Else
  1891.             $psid = $vsid
  1892.         EndIf
  1893.         If NOT _security__isvalidsid($psid) Then Return SetError(-1, 0, 0)
  1894.         Local $aresult = DllCall("advapi32.dll", "bool", "LookupAccountSidW", "ptr", 0, "ptr", $psid, "wstr", "", "dword*", 256, "wstr", "", "dword*", 256, "int*", 0)
  1895.         If @error Then Return SetError(@error, @extended, 0)
  1896.         If NOT $aresult[0] Then Return 0
  1897.         Local $aacct[3]
  1898.         $aacct[0] = $aresult[3]
  1899.         $aacct[1] = $aresult[5]
  1900.         $aacct[2] = $aresult[7]
  1901.         Return $aacct
  1902.     EndFunc
  1903.  
  1904.     Func _security__lookupprivilegevalue($ssystem, $sname)
  1905.         Local $aresult = DllCall("advapi32.dll", "int", "LookupPrivilegeValueW", "wstr", $ssystem, "wstr", $sname, "int64*", 0)
  1906.         If @error Then Return SetError(@error, @extended, 0)
  1907.         Return SetError(0, $aresult[0], $aresult[3])
  1908.     EndFunc
  1909.  
  1910.     Func _security__openprocesstoken($hprocess, $iaccess)
  1911.         Local $aresult = DllCall("advapi32.dll", "int", "OpenProcessToken", "handle", $hprocess, "dword", $iaccess, "ptr", 0)
  1912.         If @error Then Return SetError(@error, @extended, 0)
  1913.         Return SetError(0, $aresult[0], $aresult[3])
  1914.     EndFunc
  1915.  
  1916.     Func _security__openthreadtoken($iaccess, $hthread = 0, $fopenasself = False)
  1917.         If $hthread = 0 Then $hthread = DllCall("kernel32.dll", "handle", "GetCurrentThread")
  1918.         If @error Then Return SetError(@error, @extended, 0)
  1919.         Local $aresult = DllCall("advapi32.dll", "bool", "OpenThreadToken", "handle", $hthread[0], "dword", $iaccess, "int", $fopenasself, "ptr*", 0)
  1920.         If @error Then Return SetError(@error, @extended, 0)
  1921.         Return SetError(0, $aresult[0], $aresult[4])
  1922.     EndFunc
  1923.  
  1924.     Func _security__openthreadtokenex($iaccess, $hthread = 0, $fopenasself = False)
  1925.         Local $htoken = _security__openthreadtoken($iaccess, $hthread, $fopenasself)
  1926.         If $htoken = 0 Then
  1927.             If _winapi_getlasterror() <> $error_no_token Then Return SetError(-3, _winapi_getlasterror(), 0)
  1928.             If NOT _security__impersonateself() Then Return SetError(-1, _winapi_getlasterror(), 0)
  1929.             $htoken = _security__openthreadtoken($iaccess, $hthread, $fopenasself)
  1930.             If $htoken = 0 Then Return SetError(-2, _winapi_getlasterror(), 0)
  1931.         EndIf
  1932.         Return $htoken
  1933.     EndFunc
  1934.  
  1935.     Func _security__setprivilege($htoken, $sprivilege, $fenable)
  1936.         Local $iluid = _security__lookupprivilegevalue("", $sprivilege)
  1937.         If $iluid = 0 Then Return SetError(-1, 0, False)
  1938.         Local $tcurrstate = DllStructCreate($tagtoken_privileges)
  1939.         Local $pcurrstate = DllStructGetPtr($tcurrstate)
  1940.         Local $icurrstate = DllStructGetSize($tcurrstate)
  1941.         Local $tprevstate = DllStructCreate($tagtoken_privileges)
  1942.         Local $pprevstate = DllStructGetPtr($tprevstate)
  1943.         Local $iprevstate = DllStructGetSize($tprevstate)
  1944.         Local $trequired = DllStructCreate("int Data")
  1945.         Local $prequired = DllStructGetPtr($trequired)
  1946.         DllStructSetData($tcurrstate, "Count", 1)
  1947.         DllStructSetData($tcurrstate, "LUID", $iluid)
  1948.         If NOT _security__adjusttokenprivileges($htoken, False, $pcurrstate, $icurrstate, $pprevstate, $prequired) Then Return SetError(-2, @error, False)
  1949.         DllStructSetData($tprevstate, "Count", 1)
  1950.         DllStructSetData($tprevstate, "LUID", $iluid)
  1951.         Local $iattributes = DllStructGetData($tprevstate, "Attributes")
  1952.         If $fenable Then
  1953.             $iattributes = BitOR($iattributes, $se_privilege_enabled)
  1954.         Else
  1955.             $iattributes = BitAND($iattributes, BitNOT($se_privilege_enabled))
  1956.         EndIf
  1957.         DllStructSetData($tprevstate, "Attributes", $iattributes)
  1958.         If NOT _security__adjusttokenprivileges($htoken, False, $pprevstate, $iprevstate, $pcurrstate, $prequired) Then Return SetError(-3, @error, False)
  1959.         Return True
  1960.     EndFunc
  1961.  
  1962.     Func _security__sidtostringsid($psid)
  1963.         If NOT _security__isvalidsid($psid) Then Return SetError(-1, 0, "")
  1964.         Local $aresult = DllCall("advapi32.dll", "int", "ConvertSidToStringSidW", "ptr", $psid, "ptr*", 0)
  1965.         If @error Then Return SetError(@error, @extended, "")
  1966.         If NOT $aresult[0] Then Return ""
  1967.         Local $tbuffer = DllStructCreate("wchar Text[256]", $aresult[2])
  1968.         Local $ssid = DllStructGetData($tbuffer, "Text")
  1969.         DllCall("Kernel32.dll", "ptr", "LocalFree", "ptr", $aresult[2])
  1970.         Return $ssid
  1971.     EndFunc
  1972.  
  1973.     Func _security__sidtypestr($itype)
  1974.         Switch $itype
  1975.             Case 1
  1976.                 Return "User"
  1977.             Case 2
  1978.                 Return "Group"
  1979.             Case 3
  1980.                 Return "Domain"
  1981.             Case 4
  1982.                 Return "Alias"
  1983.             Case 5
  1984.                 Return "Well Known Group"
  1985.             Case 6
  1986.                 Return "Deleted Account"
  1987.             Case 7
  1988.                 Return "Invalid"
  1989.             Case 8
  1990.                 Return "Invalid"
  1991.             Case 9
  1992.                 Return "Computer"
  1993.             Case Else
  1994.                 Return "Unknown SID Type"
  1995.         EndSwitch
  1996.     EndFunc
  1997.  
  1998.     Func _security__stringsidtosid($ssid)
  1999.         Local $aresult = DllCall("advapi32.dll", "bool", "ConvertStringSidToSidW", "wstr", $ssid, "ptr*", 0)
  2000.         If @error Then Return SetError(@error, @extended, 0)
  2001.         If NOT $aresult[0] Then Return 0
  2002.         Local $isize = _security__getlengthsid($aresult[2])
  2003.         Local $tbuffer = DllStructCreate("byte Data[" & $isize & "]", $aresult[2])
  2004.         Local $tsid = DllStructCreate("byte Data[" & $isize & "]")
  2005.         DllStructSetData($tsid, "Data", DllStructGetData($tbuffer, "Data"))
  2006.         DllCall("kernel32.dll", "ptr", "LocalFree", "ptr", $aresult[2])
  2007.         Return $tsid
  2008.     EndFunc
  2009.  
  2010.     Func _sendmessage($hwnd, $imsg, $wparam = 0, $lparam = 0, $ireturn = 0, $wparamtype = "wparam", $lparamtype = "lparam", $sreturntype = "lresult")
  2011.         Local $aresult = DllCall("user32.dll", $sreturntype, "SendMessageW", "hwnd", $hwnd, "uint", $imsg, $wparamtype, $wparam, $lparamtype, $lparam)
  2012.         If @error Then Return SetError(@error, @extended, "")
  2013.         If $ireturn >= 0 AND $ireturn <= 4 Then Return $aresult[$ireturn]
  2014.         Return $aresult
  2015.     EndFunc
  2016.  
  2017.     Func _sendmessagea($hwnd, $imsg, $wparam = 0, $lparam = 0, $ireturn = 0, $wparamtype = "wparam", $lparamtype = "lparam", $sreturntype = "lresult")
  2018.         Local $aresult = DllCall("user32.dll", $sreturntype, "SendMessageA", "hwnd", $hwnd, "uint", $imsg, $wparamtype, $wparam, $lparamtype, $lparam)
  2019.         If @error Then Return SetError(@error, @extended, "")
  2020.         If $ireturn >= 0 AND $ireturn <= 4 Then Return $aresult[$ireturn]
  2021.         Return $aresult
  2022.     EndFunc
  2023.  
  2024.     Global $__gainprocess_winapi[64][2] = [[0, 0]]
  2025.     Global $__gawinlist_winapi[64][2] = [[0, 0]]
  2026.     Global Const $__winapiconstant_wm_setfont = 48
  2027.     Global Const $__winapiconstant_fw_normal = 400
  2028.     Global Const $__winapiconstant_default_charset = 1
  2029.     Global Const $__winapiconstant_out_default_precis = 0
  2030.     Global Const $__winapiconstant_clip_default_precis = 0
  2031.     Global Const $__winapiconstant_default_quality = 0
  2032.     Global Const $__winapiconstant_format_message_allocate_buffer = 256
  2033.     Global Const $__winapiconstant_format_message_from_system = 4096
  2034.     Global Const $__winapiconstant_logpixelsx = 88
  2035.     Global Const $__winapiconstant_logpixelsy = 90
  2036.     Global Const $hgdi_error = Ptr(-1)
  2037.     Global Const $invalid_handle_value = Ptr(-1)
  2038.     Global Const $clr_invalid = -1
  2039.     Global Const $__winapiconstant_flashw_caption = 1
  2040.     Global Const $__winapiconstant_flashw_tray = 2
  2041.     Global Const $__winapiconstant_flashw_timer = 4
  2042.     Global Const $__winapiconstant_flashw_timernofg = 12
  2043.     Global Const $__winapiconstant_gw_hwndnext = 2
  2044.     Global Const $__winapiconstant_gw_child = 5
  2045.     Global Const $__winapiconstant_di_mask = 1
  2046.     Global Const $__winapiconstant_di_image = 2
  2047.     Global Const $__winapiconstant_di_normal = 3
  2048.     Global Const $__winapiconstant_di_compat = 4
  2049.     Global Const $__winapiconstant_di_defaultsize = 8
  2050.     Global Const $__winapiconstant_di_nomirror = 16
  2051.     Global Const $__winapiconstant_display_device_attached_to_desktop = 1
  2052.     Global Const $__winapiconstant_display_device_primary_device = 4
  2053.     Global Const $__winapiconstant_display_device_mirroring_driver = 8
  2054.     Global Const $__winapiconstant_display_device_vga_compatible = 16
  2055.     Global Const $__winapiconstant_display_device_removable = 32
  2056.     Global Const $__winapiconstant_display_device_modespruned = 134217728
  2057.     Global Const $null_brush = 5
  2058.     Global Const $null_pen = 8
  2059.     Global Const $black_brush = 4
  2060.     Global Const $dkgray_brush = 3
  2061.     Global Const $dc_brush = 18
  2062.     Global Const $gray_brush = 2
  2063.     Global Const $hollow_brush = $null_brush
  2064.     Global Const $ltgray_brush = 1
  2065.     Global Const $white_brush = 0
  2066.     Global Const $black_pen = 7
  2067.     Global Const $dc_pen = 19
  2068.     Global Const $white_pen = 6
  2069.     Global Const $ansi_fixed_font = 11
  2070.     Global Const $ansi_var_font = 12
  2071.     Global Const $device_default_font = 14
  2072.     Global Const $default_gui_font = 17
  2073.     Global Const $oem_fixed_font = 10
  2074.     Global Const $system_font = 13
  2075.     Global Const $system_fixed_font = 16
  2076.     Global Const $default_palette = 15
  2077.     Global Const $mb_precomposed = 1
  2078.     Global Const $mb_composite = 2
  2079.     Global Const $mb_useglyphchars = 4
  2080.     Global Const $ulw_alpha = 2
  2081.     Global Const $ulw_colorkey = 1
  2082.     Global Const $ulw_opaque = 4
  2083.     Global Const $wh_callwndproc = 4
  2084.     Global Const $wh_callwndprocret = 12
  2085.     Global Const $wh_cbt = 5
  2086.     Global Const $wh_debug = 9
  2087.     Global Const $wh_foregroundidle = 11
  2088.     Global Const $wh_getmessage = 3
  2089.     Global Const $wh_journalplayback = 1
  2090.     Global Const $wh_journalrecord = 0
  2091.     Global Const $wh_keyboard = 2
  2092.     Global Const $wh_keyboard_ll = 13
  2093.     Global Const $wh_mouse = 7
  2094.     Global Const $wh_mouse_ll = 14
  2095.     Global Const $wh_msgfilter = -1
  2096.     Global Const $wh_shell = 10
  2097.     Global Const $wh_sysmsgfilter = 6
  2098.     Global Const $wpf_asyncwindowplacement = 4
  2099.     Global Const $wpf_restoretomaximized = 2
  2100.     Global Const $wpf_setminposition = 1
  2101.     Global Const $kf_extended = 256
  2102.     Global Const $kf_altdown = 8192
  2103.     Global Const $kf_up = 32768
  2104.     Global Const $llkhf_extended = BitShift($kf_extended, 8)
  2105.     Global Const $llkhf_injected = 16
  2106.     Global Const $llkhf_altdown = BitShift($kf_altdown, 8)
  2107.     Global Const $llkhf_up = BitShift($kf_up, 8)
  2108.     Global Const $ofn_allowmultiselect = 512
  2109.     Global Const $ofn_createprompt = 8192
  2110.     Global Const $ofn_dontaddtorecent = 33554432
  2111.     Global Const $ofn_enablehook = 32
  2112.     Global Const $ofn_enableincludenotify = 4194304
  2113.     Global Const $ofn_enablesizing = 8388608
  2114.     Global Const $ofn_enabletemplate = 64
  2115.     Global Const $ofn_enabletemplatehandle = 128
  2116.     Global Const $ofn_explorer = 524288
  2117.     Global Const $ofn_extensiondifferent = 1024
  2118.     Global Const $ofn_filemustexist = 4096
  2119.     Global Const $ofn_forceshowhidden = 268435456
  2120.     Global Const $ofn_hidereadonly = 4
  2121.     Global Const $ofn_longnames = 2097152
  2122.     Global Const $ofn_nochangedir = 8
  2123.     Global Const $ofn_nodereferencelinks = 1048576
  2124.     Global Const $ofn_nolongnames = 262144
  2125.     Global Const $ofn_nonetworkbutton = 131072
  2126.     Global Const $ofn_noreadonlyreturn = 32768
  2127.     Global Const $ofn_notestfilecreate = 65536
  2128.     Global Const $ofn_novalidate = 256
  2129.     Global Const $ofn_overwriteprompt = 2
  2130.     Global Const $ofn_pathmustexist = 2048
  2131.     Global Const $ofn_readonly = 1
  2132.     Global Const $ofn_shareaware = 16384
  2133.     Global Const $ofn_showhelp = 16
  2134.     Global Const $ofn_ex_noplacesbar = 1
  2135.     Global Const $tagcursorinfo = "dword Size;dword Flags;handle hCursor;" & $tagpoint
  2136.     Global Const $tagdisplay_device = "dword Size;wchar Name[32];wchar String[128];dword Flags;wchar ID[128];wchar Key[128]"
  2137.     Global Const $tagflashwinfo = "uint Size;hwnd hWnd;dword Flags;uint Count;dword TimeOut"
  2138.     Global Const $tagiconinfo = "bool Icon;dword XHotSpot;dword YHotSpot;handle hMask;handle hColor"
  2139.     Global Const $tagmemorystatusex = "dword Length;dword MemoryLoad;" & "uint64 TotalPhys;uint64 AvailPhys;uint64 TotalPageFile;uint64 AvailPageFile;" & "uint64 TotalVirtual;uint64 AvailVirtual;uint64 AvailExtendedVirtual"
  2140.  
  2141.     Func _winapi_attachconsole($iprocessid = -1)
  2142.         Local $aresult = DllCall("kernel32.dll", "bool", "AttachConsole", "dword", $iprocessid)
  2143.         If @error Then Return SetError(@error, @extended, False)
  2144.         Return $aresult[0]
  2145.     EndFunc
  2146.  
  2147.     Func _winapi_attachthreadinput($iattach, $iattachto, $fattach)
  2148.         Local $aresult = DllCall("user32.dll", "bool", "AttachThreadInput", "dword", $iattach, "dword", $iattachto, "bool", $fattach)
  2149.         If @error Then Return SetError(@error, @extended, False)
  2150.         Return $aresult[0]
  2151.     EndFunc
  2152.  
  2153.     Func _winapi_beep($ifreq = 500, $iduration = 1000)
  2154.         Local $aresult = DllCall("kernel32.dll", "bool", "Beep", "dword", $ifreq, "dword", $iduration)
  2155.         If @error Then Return SetError(@error, @extended, False)
  2156.         Return $aresult[0]
  2157.     EndFunc
  2158.  
  2159.     Func _winapi_bitblt($hdestdc, $ixdest, $iydest, $iwidth, $iheight, $hsrcdc, $ixsrc, $iysrc, $irop)
  2160.         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)
  2161.         If @error Then Return SetError(@error, @extended, False)
  2162.         Return $aresult[0]
  2163.     EndFunc
  2164.  
  2165.     Func _winapi_callnexthookex($hhk, $icode, $wparam, $lparam)
  2166.         Local $aresult = DllCall("user32.dll", "lresult", "CallNextHookEx", "handle", $hhk, "int", $icode, "wparam", $wparam, "lparam", $lparam)
  2167.         If @error Then Return SetError(@error, @extended, -1)
  2168.         Return $aresult[0]
  2169.     EndFunc
  2170.  
  2171.     Func _winapi_callwindowproc($lpprevwndfunc, $hwnd, $msg, $wparam, $lparam)
  2172.         Local $aresult = DllCall("user32.dll", "lresult", "CallWindowProc", "ptr", $lpprevwndfunc, "hwnd", $hwnd, "uint", $msg, "wparam", $wparam, "lparam", $lparam)
  2173.         If @error Then Return SetError(@error, @extended, -1)
  2174.         Return $aresult[0]
  2175.     EndFunc
  2176.  
  2177.     Func _winapi_clienttoscreen($hwnd, ByRef $tpoint)
  2178.         Local $ppoint = DllStructGetPtr($tpoint)
  2179.         DllCall("user32.dll", "bool", "ClientToScreen", "hwnd", $hwnd, "ptr", $ppoint)
  2180.         Return SetError(@error, @extended, $tpoint)
  2181.     EndFunc
  2182.  
  2183.     Func _winapi_closehandle($hobject)
  2184.         Local $aresult = DllCall("kernel32.dll", "bool", "CloseHandle", "handle", $hobject)
  2185.         If @error Then Return SetError(@error, @extended, False)
  2186.         Return $aresult[0]
  2187.     EndFunc
  2188.  
  2189.     Func _winapi_combinergn($hrgndest, $hrgnsrc1, $hrgnsrc2, $icombinemode)
  2190.         Local $aresult = DllCall("gdi32.dll", "int", "CombineRgn", "handle", $hrgndest, "handle", $hrgnsrc1, "handle", $hrgnsrc2, "int", $icombinemode)
  2191.         If @error Then Return SetError(@error, @extended, 0)
  2192.         Return $aresult[0]
  2193.     EndFunc
  2194.  
  2195.     Func _winapi_commdlgextendederror()
  2196.         Local Const $cderr_dialogfailure = 65535
  2197.         Local Const $cderr_findresfailure = 6
  2198.         Local Const $cderr_initialization = 2
  2199.         Local Const $cderr_loadresfailure = 7
  2200.         Local Const $cderr_loadstrfailure = 5
  2201.         Local Const $cderr_lockresfailure = 8
  2202.         Local Const $cderr_memallocfailure = 9
  2203.         Local Const $cderr_memlockfailure = 10
  2204.         Local Const $cderr_nohinstance = 4
  2205.         Local Const $cderr_nohook = 11
  2206.         Local Const $cderr_notemplate = 3
  2207.         Local Const $cderr_registermsgfail = 12
  2208.         Local Const $cderr_structsize = 1
  2209.         Local Const $fnerr_buffertoosmall = 12291
  2210.         Local Const $fnerr_invalidfilename = 12290
  2211.         Local Const $fnerr_subclassfailure = 12289
  2212.         Local $aresult = DllCall("comdlg32.dll", "dword", "CommDlgExtendedError")
  2213.         If @error Then Return SetError(@error, @extended, 0)
  2214.         Switch $aresult[0]
  2215.             Case $cderr_dialogfailure
  2216.                 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.")
  2217.             Case $cderr_findresfailure
  2218.                 Return SetError($aresult[0], 0, "The common dialog box function failed to find a specified resource.")
  2219.             Case $cderr_initialization
  2220.                 Return SetError($aresult[0], 0, "The common dialog box function failed during initialization." & @LF & "This error often occurs when sufficient memory is not available.")
  2221.             Case $cderr_loadresfailure
  2222.                 Return SetError($aresult[0], 0, "The common dialog box function failed to load a specified resource.")
  2223.             Case $cderr_loadstrfailure
  2224.                 Return SetError($aresult[0], 0, "The common dialog box function failed to load a specified string.")
  2225.             Case $cderr_lockresfailure
  2226.                 Return SetError($aresult[0], 0, "The common dialog box function failed to lock a specified resource.")
  2227.             Case $cderr_memallocfailure
  2228.                 Return SetError($aresult[0], 0, "The common dialog box function was unable to allocate memory for internal structures.")
  2229.             Case $cderr_memlockfailure
  2230.                 Return SetError($aresult[0], 0, "The common dialog box function was unable to lock the memory associated with a handle.")
  2231.             Case $cderr_nohinstance
  2232.                 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.")
  2233.             Case $cderr_nohook
  2234.                 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.")
  2235.             Case $cderr_notemplate
  2236.                 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.")
  2237.             Case $cderr_registermsgfail
  2238.                 Return SetError($aresult[0], 0, "The RegisterWindowMessage function returned an error code when it was called by the common dialog box function.")
  2239.             Case $cderr_structsize
  2240.                 Return SetError($aresult[0], 0, "The lStructSize member of the initialization structure for the corresponding common dialog box is invalid")
  2241.             Case $fnerr_buffertoosmall
  2242.                 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.")
  2243.             Case $fnerr_invalidfilename
  2244.                 Return SetError($aresult[0], 0, "A file name is invalid.")
  2245.             Case $fnerr_subclassfailure
  2246.                 Return SetError($aresult[0], 0, "An attempt to subclass a list box failed because sufficient memory was not available.")
  2247.         EndSwitch
  2248.         Return Hex($aresult[0])
  2249.     EndFunc
  2250.  
  2251.     Func _winapi_copyicon($hicon)
  2252.         Local $aresult = DllCall("user32.dll", "handle", "CopyIcon", "handle", $hicon)
  2253.         If @error Then Return SetError(@error, @extended, 0)
  2254.         Return $aresult[0]
  2255.     EndFunc
  2256.  
  2257.     Func _winapi_createbitmap($iwidth, $iheight, $iplanes = 1, $ibitsperpel = 1, $pbits = 0)
  2258.         Local $aresult = DllCall("gdi32.dll", "handle", "CreateBitmap", "int", $iwidth, "int", $iheight, "uint", $iplanes, "uint", $ibitsperpel, "ptr", $pbits)
  2259.         If @error Then Return SetError(@error, @extended, 0)
  2260.         Return $aresult[0]
  2261.     EndFunc
  2262.  
  2263.     Func _winapi_createcompatiblebitmap($hdc, $iwidth, $iheight)
  2264.         Local $aresult = DllCall("gdi32.dll", "handle", "CreateCompatibleBitmap", "handle", $hdc, "int", $iwidth, "int", $iheight)
  2265.         If @error Then Return SetError(@error, @extended, 0)
  2266.         Return $aresult[0]
  2267.     EndFunc
  2268.  
  2269.     Func _winapi_createcompatibledc($hdc)
  2270.         Local $aresult = DllCall("gdi32.dll", "handle", "CreateCompatibleDC", "handle", $hdc)
  2271.         If @error Then Return SetError(@error, @extended, 0)
  2272.         Return $aresult[0]
  2273.     EndFunc
  2274.  
  2275.     Func _winapi_createevent($pattributes = 0, $fmanualreset = True, $finitialstate = True, $sname = "")
  2276.         Local $snametype = "wstr"
  2277.         If $sname = "" Then
  2278.             $sname = 0
  2279.             $snametype = "ptr"
  2280.         EndIf
  2281.         Local $aresult = DllCall("kernel32.dll", "handle", "CreateEventW", "ptr", $pattributes, "bool", $fmanualreset, "bool", $finitialstate, $snametype, $sname)
  2282.         If @error Then Return SetError(@error, @extended, 0)
  2283.         Return $aresult[0]
  2284.     EndFunc
  2285.  
  2286.     Func _winapi_createfile($sfilename, $icreation, $iaccess = 4, $ishare = 0, $iattributes = 0, $psecurity = 0)
  2287.         Local $ida = 0, $ism = 0, $icd = 0, $ifa = 0
  2288.         If BitAND($iaccess, 1) <> 0 Then $ida = BitOR($ida, $generic_execute)
  2289.         If BitAND($iaccess, 2) <> 0 Then $ida = BitOR($ida, $generic_read)
  2290.         If BitAND($iaccess, 4) <> 0 Then $ida = BitOR($ida, $generic_write)
  2291.         If BitAND($ishare, 1) <> 0 Then $ism = BitOR($ism, $file_share_delete)
  2292.         If BitAND($ishare, 2) <> 0 Then $ism = BitOR($ism, $file_share_read)
  2293.         If BitAND($ishare, 4) <> 0 Then $ism = BitOR($ism, $file_share_write)
  2294.         Switch $icreation
  2295.             Case 0
  2296.                 $icd = $create_new
  2297.             Case 1
  2298.                 $icd = $create_always
  2299.             Case 2
  2300.                 $icd = $open_existing
  2301.             Case 3
  2302.                 $icd = $open_always
  2303.             Case 4
  2304.                 $icd = $truncate_existing
  2305.         EndSwitch
  2306.         If BitAND($iattributes, 1) <> 0 Then $ifa = BitOR($ifa, $file_attribute_archive)
  2307.         If BitAND($iattributes, 2) <> 0 Then $ifa = BitOR($ifa, $file_attribute_hidden)
  2308.         If BitAND($iattributes, 4) <> 0 Then $ifa = BitOR($ifa, $file_attribute_readonly)
  2309.         If BitAND($iattributes, 8) <> 0 Then $ifa = BitOR($ifa, $file_attribute_system)
  2310.         Local $aresult = DllCall("kernel32.dll", "handle", "CreateFileW", "wstr", $sfilename, "dword", $ida, "dword", $ism, "ptr", $psecurity, "dword", $icd, "dword", $ifa, "ptr", 0)
  2311.         If @error OR $aresult[0] = Ptr(-1) Then Return SetError(@error, @extended, 0)
  2312.         Return $aresult[0]
  2313.     EndFunc
  2314.  
  2315.     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")
  2316.         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)
  2317.         If @error Then Return SetError(@error, @extended, 0)
  2318.         Return $aresult[0]
  2319.     EndFunc
  2320.  
  2321.     Func _winapi_createfontindirect($tlogfont)
  2322.         Local $aresult = DllCall("gdi32.dll", "handle", "CreateFontIndirectW", "ptr", DllStructGetPtr($tlogfont))
  2323.         If @error Then Return SetError(@error, @extended, 0)
  2324.         Return $aresult[0]
  2325.     EndFunc
  2326.  
  2327.     Func _winapi_createpen($ipenstyle, $iwidth, $ncolor)
  2328.         Local $aresult = DllCall("gdi32.dll", "handle", "CreatePen", "int", $ipenstyle, "int", $iwidth, "dword", $ncolor)
  2329.         If @error Then Return SetError(@error, @extended, 0)
  2330.         Return $aresult[0]
  2331.     EndFunc
  2332.  
  2333.     Func _winapi_createprocess($sappname, $scommand, $psecurity, $pthread, $finherit, $iflags, $penviron, $sdir, $pstartupinfo, $pprocess)
  2334.         Local $pcommand = 0
  2335.         Local $sappnametype = "wstr", $sdirtype = "wstr"
  2336.         If $sappname = "" Then
  2337.             $sappnametype = "ptr"
  2338.             $sappname = 0
  2339.         EndIf
  2340.         If $scommand <> "" Then
  2341.             Local $tcommand = DllStructCreate("wchar Text[" & 260 + 1 & "]")
  2342.             $pcommand = DllStructGetPtr($tcommand)
  2343.             DllStructSetData($tcommand, "Text", $scommand)
  2344.         EndIf
  2345.         If $sdir = "" Then
  2346.             $sdirtype = "ptr"
  2347.             $sdir = 0
  2348.         EndIf
  2349.         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)
  2350.         If @error Then Return SetError(@error, @extended, False)
  2351.         Return $aresult[0]
  2352.     EndFunc
  2353.  
  2354.     Func _winapi_createrectrgn($ileftrect, $itoprect, $irightrect, $ibottomrect)
  2355.         Local $aresult = DllCall("gdi32.dll", "handle", "CreateRectRgn", "int", $ileftrect, "int", $itoprect, "int", $irightrect, "int", $ibottomrect)
  2356.         If @error Then Return SetError(@error, @extended, 0)
  2357.         Return $aresult[0]
  2358.     EndFunc
  2359.  
  2360.     Func _winapi_createroundrectrgn($ileftrect, $itoprect, $irightrect, $ibottomrect, $iwidthellipse, $iheightellipse)
  2361.         Local $aresult = DllCall("gdi32.dll", "handle", "CreateRoundRectRgn", "int", $ileftrect, "int", $itoprect, "int", $irightrect, "int", $ibottomrect, "int", $iwidthellipse, "int", $iheightellipse)
  2362.         If @error Then Return SetError(@error, @extended, 0)
  2363.         Return $aresult[0]
  2364.     EndFunc
  2365.  
  2366.     Func _winapi_createsolidbitmap($hwnd, $icolor, $iwidth, $iheight, $brgb = 1)
  2367.         Local $hdc = _winapi_getdc($hwnd)
  2368.         Local $hdestdc = _winapi_createcompatibledc($hdc)
  2369.         Local $hbitmap = _winapi_createcompatiblebitmap($hdc, $iwidth, $iheight)
  2370.         Local $hold = _winapi_selectobject($hdestdc, $hbitmap)
  2371.         Local $trect = DllStructCreate($tagrect)
  2372.         DllStructSetData($trect, 1, 0)
  2373.         DllStructSetData($trect, 2, 0)
  2374.         DllStructSetData($trect, 3, $iwidth)
  2375.         DllStructSetData($trect, 4, $iheight)
  2376.         If $brgb Then
  2377.             $icolor = BitOR(BitAND($icolor, 65280), BitShift(BitAND($icolor, 255), -16), BitShift(BitAND($icolor, 16711680), 16))
  2378.         EndIf
  2379.         Local $hbrush = _winapi_createsolidbrush($icolor)
  2380.         _winapi_fillrect($hdestdc, DllStructGetPtr($trect), $hbrush)
  2381.         If @error Then
  2382.             _winapi_deleteobject($hbitmap)
  2383.             $hbitmap = 0
  2384.         EndIf
  2385.         _winapi_deleteobject($hbrush)
  2386.         _winapi_releasedc($hwnd, $hdc)
  2387.         _winapi_selectobject($hdestdc, $hold)
  2388.         _winapi_deletedc($hdestdc)
  2389.         If NOT $hbitmap Then Return SetError(1, 0, 0)
  2390.         Return $hbitmap
  2391.     EndFunc
  2392.  
  2393.     Func _winapi_createsolidbrush($ncolor)
  2394.         Local $aresult = DllCall("gdi32.dll", "handle", "CreateSolidBrush", "dword", $ncolor)
  2395.         If @error Then Return SetError(@error, @extended, 0)
  2396.         Return $aresult[0]
  2397.     EndFunc
  2398.  
  2399.     Func _winapi_createwindowex($iexstyle, $sclass, $sname, $istyle, $ix, $iy, $iwidth, $iheight, $hparent, $hmenu = 0, $hinstance = 0, $pparam = 0)
  2400.         If $hinstance = 0 Then $hinstance = _winapi_getmodulehandle("")
  2401.         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)
  2402.         If @error Then Return SetError(@error, @extended, 0)
  2403.         Return $aresult[0]
  2404.     EndFunc
  2405.  
  2406.     Func _winapi_defwindowproc($hwnd, $imsg, $iwparam, $ilparam)
  2407.         Local $aresult = DllCall("user32.dll", "lresult", "DefWindowProc", "hwnd", $hwnd, "uint", $imsg, "wparam", $iwparam, "lparam", $ilparam)
  2408.         If @error Then Return SetError(@error, @extended, 0)
  2409.         Return $aresult[0]
  2410.     EndFunc
  2411.  
  2412.     Func _winapi_deletedc($hdc)
  2413.         Local $aresult = DllCall("gdi32.dll", "bool", "DeleteDC", "handle", $hdc)
  2414.         If @error Then Return SetError(@error, @extended, False)
  2415.         Return $aresult[0]
  2416.     EndFunc
  2417.  
  2418.     Func _winapi_deleteobject($hobject)
  2419.         Local $aresult = DllCall("gdi32.dll", "bool", "DeleteObject", "handle", $hobject)
  2420.         If @error Then Return SetError(@error, @extended, False)
  2421.         Return $aresult[0]
  2422.     EndFunc
  2423.  
  2424.     Func _winapi_destroyicon($hicon)
  2425.         Local $aresult = DllCall("user32.dll", "bool", "DestroyIcon", "handle", $hicon)
  2426.         If @error Then Return SetError(@error, @extended, False)
  2427.         Return $aresult[0]
  2428.     EndFunc
  2429.  
  2430.     Func _winapi_destroywindow($hwnd)
  2431.         Local $aresult = DllCall("user32.dll", "bool", "DestroyWindow", "hwnd", $hwnd)
  2432.         If @error Then Return SetError(@error, @extended, False)
  2433.         Return $aresult[0]
  2434.     EndFunc
  2435.  
  2436.     Func _winapi_drawedge($hdc, $ptrrect, $nedgetype, $grfflags)
  2437.         Local $aresult = DllCall("user32.dll", "bool", "DrawEdge", "handle", $hdc, "ptr", $ptrrect, "uint", $nedgetype, "uint", $grfflags)
  2438.         If @error Then Return SetError(@error, @extended, False)
  2439.         Return $aresult[0]
  2440.     EndFunc
  2441.  
  2442.     Func _winapi_drawframecontrol($hdc, $ptrrect, $ntype, $nstate)
  2443.         Local $aresult = DllCall("user32.dll", "bool", "DrawFrameControl", "handle", $hdc, "ptr", $ptrrect, "uint", $ntype, "uint", $nstate)
  2444.         If @error Then Return SetError(@error, @extended, False)
  2445.         Return $aresult[0]
  2446.     EndFunc
  2447.  
  2448.     Func _winapi_drawicon($hdc, $ix, $iy, $hicon)
  2449.         Local $aresult = DllCall("user32.dll", "bool", "DrawIcon", "handle", $hdc, "int", $ix, "int", $iy, "handle", $hicon)
  2450.         If @error Then Return SetError(@error, @extended, False)
  2451.         Return $aresult[0]
  2452.     EndFunc
  2453.  
  2454.     Func _winapi_drawiconex($hdc, $ix, $iy, $hicon, $iwidth = 0, $iheight = 0, $istep = 0, $hbrush = 0, $iflags = 3)
  2455.         Local $ioptions
  2456.         Switch $iflags
  2457.             Case 1
  2458.                 $ioptions = $__winapiconstant_di_mask
  2459.             Case 2
  2460.                 $ioptions = $__winapiconstant_di_image
  2461.             Case 3
  2462.                 $ioptions = $__winapiconstant_di_normal
  2463.             Case 4
  2464.                 $ioptions = $__winapiconstant_di_compat
  2465.             Case 5
  2466.                 $ioptions = $__winapiconstant_di_defaultsize
  2467.             Case Else
  2468.                 $ioptions = $__winapiconstant_di_nomirror
  2469.         EndSwitch
  2470.         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)
  2471.         If @error Then Return SetError(@error, @extended, False)
  2472.         Return $aresult[0]
  2473.     EndFunc
  2474.  
  2475.     Func _winapi_drawline($hdc, $ix1, $iy1, $ix2, $iy2)
  2476.         _winapi_moveto($hdc, $ix1, $iy1)
  2477.         If @error Then Return SetError(@error, @extended, False)
  2478.         _winapi_lineto($hdc, $ix2, $iy2)
  2479.         If @error Then Return SetError(@error, @extended, False)
  2480.         Return True
  2481.     EndFunc
  2482.  
  2483.     Func _winapi_drawtext($hdc, $stext, ByRef $trect, $iflags)
  2484.         Local $aresult = DllCall("user32.dll", "int", "DrawTextW", "handle", $hdc, "wstr", $stext, "int", -1, "ptr", DllStructGetPtr($trect), "uint", $iflags)
  2485.         If @error Then Return SetError(@error, @extended, 0)
  2486.         Return $aresult[0]
  2487.     EndFunc
  2488.  
  2489.     Func _winapi_enablewindow($hwnd, $fenable = True)
  2490.         Local $aresult = DllCall("user32.dll", "bool", "EnableWindow", "hwnd", $hwnd, "bool", $fenable)
  2491.         If @error Then Return SetError(@error, @extended, False)
  2492.         Return $aresult[0]
  2493.     EndFunc
  2494.  
  2495.     Func _winapi_enumdisplaydevices($sdevice, $idevnum)
  2496.         Local $pname = 0, $iflags = 0, $adevice[5]
  2497.         If $sdevice <> "" Then
  2498.             Local $tname = DllStructCreate("wchar Text[" & StringLen($sdevice) + 1 & "]")
  2499.             $pname = DllStructGetPtr($tname)
  2500.             DllStructSetData($tname, "Text", $sdevice)
  2501.         EndIf
  2502.         Local $tdevice = DllStructCreate($tagdisplay_device)
  2503.         Local $pdevice = DllStructGetPtr($tdevice)
  2504.         Local $idevice = DllStructGetSize($tdevice)
  2505.         DllStructSetData($tdevice, "Size", $idevice)
  2506.         DllCall("user32.dll", "bool", "EnumDisplayDevicesW", "ptr", $pname, "dword", $idevnum, "ptr", $pdevice, "dword", 1)
  2507.         If @error Then Return SetError(@error, @extended, 0)
  2508.         Local $in = DllStructGetData($tdevice, "Flags")
  2509.         If BitAND($in, $__winapiconstant_display_device_attached_to_desktop) <> 0 Then $iflags = BitOR($iflags, 1)
  2510.         If BitAND($in, $__winapiconstant_display_device_primary_device) <> 0 Then $iflags = BitOR($iflags, 2)
  2511.         If BitAND($in, $__winapiconstant_display_device_mirroring_driver) <> 0 Then $iflags = BitOR($iflags, 4)
  2512.         If BitAND($in, $__winapiconstant_display_device_vga_compatible) <> 0 Then $iflags = BitOR($iflags, 8)
  2513.         If BitAND($in, $__winapiconstant_display_device_removable) <> 0 Then $iflags = BitOR($iflags, 16)
  2514.         If BitAND($in, $__winapiconstant_display_device_modespruned) <> 0 Then $iflags = BitOR($iflags, 32)
  2515.         $adevice[0] = True
  2516.         $adevice[1] = DllStructGetData($tdevice, "Name")
  2517.         $adevice[2] = DllStructGetData($tdevice, "String")
  2518.         $adevice[3] = $iflags
  2519.         $adevice[4] = DllStructGetData($tdevice, "ID")
  2520.         Return $adevice
  2521.     EndFunc
  2522.  
  2523.     Func _winapi_enumwindows($fvisible = True, $hwnd = Default)
  2524.         __winapi_enumwindowsinit()
  2525.         If $hwnd = Default Then $hwnd = _winapi_getdesktopwindow()
  2526.         __winapi_enumwindowschild($hwnd, $fvisible)
  2527.         Return $__gawinlist_winapi
  2528.     EndFunc
  2529.  
  2530.     Func __winapi_enumwindowsadd($hwnd, $sclass = "")
  2531.         If $sclass = "" Then $sclass = _winapi_getclassname($hwnd)
  2532.         $__gawinlist_winapi[0][0] += 1
  2533.         Local $icount = $__gawinlist_winapi[0][0]
  2534.         If $icount >= $__gawinlist_winapi[0][1] Then
  2535.             ReDim $__gawinlist_winapi[$icount + 64][2]
  2536.             $__gawinlist_winapi[0][1] += 64
  2537.         EndIf
  2538.         $__gawinlist_winapi[$icount][0] = $hwnd
  2539.         $__gawinlist_winapi[$icount][1] = $sclass
  2540.     EndFunc
  2541.  
  2542.     Func __winapi_enumwindowschild($hwnd, $fvisible = True)
  2543.         $hwnd = _winapi_getwindow($hwnd, $__winapiconstant_gw_child)
  2544.         While $hwnd <> 0
  2545.             If (NOT $fvisible) OR _winapi_iswindowvisible($hwnd) Then
  2546.                 __winapi_enumwindowschild($hwnd, $fvisible)
  2547.                 __winapi_enumwindowsadd($hwnd)
  2548.             EndIf
  2549.             $hwnd = _winapi_getwindow($hwnd, $__winapiconstant_gw_hwndnext)
  2550.         WEnd
  2551.     EndFunc
  2552.  
  2553.     Func __winapi_enumwindowsinit()
  2554.         ReDim $__gawinlist_winapi[64][2]
  2555.         $__gawinlist_winapi[0][0] = 0
  2556.         $__gawinlist_winapi[0][1] = 64
  2557.     EndFunc
  2558.  
  2559.     Func _winapi_enumwindowspopup()
  2560.         __winapi_enumwindowsinit()
  2561.         Local $hwnd = _winapi_getwindow(_winapi_getdesktopwindow(), $__winapiconstant_gw_child)
  2562.         Local $sclass
  2563.         While $hwnd <> 0
  2564.             If _winapi_iswindowvisible($hwnd) Then
  2565.                 $sclass = _winapi_getclassname($hwnd)
  2566.                 If $sclass = "#32768" Then
  2567.                     __winapi_enumwindowsadd($hwnd)
  2568.                 ElseIf $sclass = "ToolbarWindow32" Then
  2569.                     __winapi_enumwindowsadd($hwnd)
  2570.                 ElseIf $sclass = "ToolTips_Class32" Then
  2571.                     __winapi_enumwindowsadd($hwnd)
  2572.                 ElseIf $sclass = "BaseBar" Then
  2573.                     __winapi_enumwindowschild($hwnd)
  2574.                 EndIf
  2575.             EndIf
  2576.             $hwnd = _winapi_getwindow($hwnd, $__winapiconstant_gw_hwndnext)
  2577.         WEnd
  2578.         Return $__gawinlist_winapi
  2579.     EndFunc
  2580.  
  2581.     Func _winapi_enumwindowstop()
  2582.         __winapi_enumwindowsinit()
  2583.         Local $hwnd = _winapi_getwindow(_winapi_getdesktopwindow(), $__winapiconstant_gw_child)
  2584.         While $hwnd <> 0
  2585.             If _winapi_iswindowvisible($hwnd) Then __winapi_enumwindowsadd($hwnd)
  2586.             $hwnd = _winapi_getwindow($hwnd, $__winapiconstant_gw_hwndnext)
  2587.         WEnd
  2588.         Return $__gawinlist_winapi
  2589.     EndFunc
  2590.  
  2591.     Func _winapi_expandenvironmentstrings($sstring)
  2592.         Local $aresult = DllCall("kernel32.dll", "dword", "ExpandEnvironmentStringsW", "wstr", $sstring, "wstr", "", "dword", 4096)
  2593.         If @error Then Return SetError(@error, @extended, "")
  2594.         Return $aresult[2]
  2595.     EndFunc
  2596.  
  2597.     Func _winapi_extracticonex($sfile, $iindex, $plarge, $psmall, $iicons)
  2598.         Local $aresult = DllCall("shell32.dll", "uint", "ExtractIconExW", "wstr", $sfile, "int", $iindex, "handle", $plarge, "handle", $psmall, "uint", $iicons)
  2599.         If @error Then Return SetError(@error, @extended, 0)
  2600.         Return $aresult[0]
  2601.     EndFunc
  2602.  
  2603.     Func _winapi_fatalappexit($smessage)
  2604.         DllCall("kernel32.dll", "none", "FatalAppExitW", "uint", 0, "wstr", $smessage)
  2605.         If @error Then Return SetError(@error, @extended)
  2606.     EndFunc
  2607.  
  2608.     Func _winapi_fillrect($hdc, $ptrrect, $hbrush)
  2609.         Local $aresult
  2610.         If IsPtr($hbrush) Then
  2611.             $aresult = DllCall("user32.dll", "int", "FillRect", "handle", $hdc, "ptr", $ptrrect, "handle", $hbrush)
  2612.         Else
  2613.             $aresult = DllCall("user32.dll", "int", "FillRect", "handle", $hdc, "ptr", $ptrrect, "dword", $hbrush)
  2614.         EndIf
  2615.         If @error Then Return SetError(@error, @extended, False)
  2616.         Return $aresult[0]
  2617.     EndFunc
  2618.  
  2619.     Func _winapi_findexecutable($sfilename, $sdirectory = "")
  2620.         Local $aresult = DllCall("shell32.dll", "INT", "FindExecutableW", "wstr", $sfilename, "wstr", $sdirectory, "wstr", "")
  2621.         If @error Then Return SetError(@error, @extended, 0)
  2622.         Return SetExtended($aresult[0], $aresult[3])
  2623.     EndFunc
  2624.  
  2625.     Func _winapi_findwindow($sclassname, $swindowname)
  2626.         Local $aresult = DllCall("user32.dll", "hwnd", "FindWindowW", "wstr", $sclassname, "wstr", $swindowname)
  2627.         If @error Then Return SetError(@error, @extended, 0)
  2628.         Return $aresult[0]
  2629.     EndFunc
  2630.  
  2631.     Func _winapi_flashwindow($hwnd, $finvert = True)
  2632.         Local $aresult = DllCall("user32.dll", "bool", "FlashWindow", "hwnd", $hwnd, "bool", $finvert)
  2633.         If @error Then Return SetError(@error, @extended, False)
  2634.         Return $aresult[0]
  2635.     EndFunc
  2636.  
  2637.     Func _winapi_flashwindowex($hwnd, $iflags = 3, $icount = 3, $itimeout = 0)
  2638.         Local $tflash = DllStructCreate($tagflashwinfo)
  2639.         Local $pflash = DllStructGetPtr($tflash)
  2640.         Local $iflash = DllStructGetSize($tflash)
  2641.         Local $imode = 0
  2642.         If BitAND($iflags, 1) <> 0 Then $imode = BitOR($imode, $__winapiconstant_flashw_caption)
  2643.         If BitAND($iflags, 2) <> 0 Then $imode = BitOR($imode, $__winapiconstant_flashw_tray)
  2644.         If BitAND($iflags, 4) <> 0 Then $imode = BitOR($imode, $__winapiconstant_flashw_timer)
  2645.         If BitAND($iflags, 8) <> 0 Then $imode = BitOR($imode, $__winapiconstant_flashw_timernofg)
  2646.         DllStructSetData($tflash, "Size", $iflash)
  2647.         DllStructSetData($tflash, "hWnd", $hwnd)
  2648.         DllStructSetData($tflash, "Flags", $imode)
  2649.         DllStructSetData($tflash, "Count", $icount)
  2650.         DllStructSetData($tflash, "Timeout", $itimeout)
  2651.         Local $aresult = DllCall("user32.dll", "bool", "FlashWindowEx", "ptr", $pflash)
  2652.         If @error Then Return SetError(@error, @extended, False)
  2653.         Return $aresult[0]
  2654.     EndFunc
  2655.  
  2656.     Func _winapi_floattoint($nfloat)
  2657.         Local $tfloat = DllStructCreate("float")
  2658.         Local $tint = DllStructCreate("int", DllStructGetPtr($tfloat))
  2659.         DllStructSetData($tfloat, 1, $nfloat)
  2660.         Return DllStructGetData($tint, 1)
  2661.     EndFunc
  2662.  
  2663.     Func _winapi_flushfilebuffers($hfile)
  2664.         Local $aresult = DllCall("kernel32.dll", "bool", "FlushFileBuffers", "handle", $hfile)
  2665.         If @error Then Return SetError(@error, @extended, False)
  2666.         Return $aresult[0]
  2667.     EndFunc
  2668.  
  2669.     Func _winapi_formatmessage($iflags, $psource, $imessageid, $ilanguageid, ByRef $pbuffer, $isize, $varguments)
  2670.         Local $sbuffertype = "ptr"
  2671.         If IsString($pbuffer) Then $sbuffertype = "wstr"
  2672.         Local $aresult = DllCall("Kernel32.dll", "dword", "FormatMessageW", "dword", $iflags, "ptr", $psource, "dword", $imessageid, "dword", $ilanguageid, $sbuffertype, $pbuffer, "dword", $isize, "ptr", $varguments)
  2673.         If @error Then Return SetError(@error, @extended, 0)
  2674.         If $sbuffertype = "wstr" Then $pbuffer = $aresult[5]
  2675.         Return $aresult[0]
  2676.     EndFunc
  2677.  
  2678.     Func _winapi_framerect($hdc, $ptrrect, $hbrush)
  2679.         Local $aresult = DllCall("user32.dll", "int", "FrameRect", "handle", $hdc, "ptr", $ptrrect, "handle", $hbrush)
  2680.         If @error Then Return SetError(@error, @extended, False)
  2681.         Return $aresult[0]
  2682.     EndFunc
  2683.  
  2684.     Func _winapi_freelibrary($hmodule)
  2685.         Local $aresult = DllCall("kernel32.dll", "bool", "FreeLibrary", "handle", $hmodule)
  2686.         If @error Then Return SetError(@error, @extended, False)
  2687.         Return $aresult[0]
  2688.     EndFunc
  2689.  
  2690.     Func _winapi_getancestor($hwnd, $iflags = 1)
  2691.         Local $aresult = DllCall("user32.dll", "hwnd", "GetAncestor", "hwnd", $hwnd, "uint", $iflags)
  2692.         If @error Then Return SetError(@error, @extended, 0)
  2693.         Return $aresult[0]
  2694.     EndFunc
  2695.  
  2696.     Func _winapi_getasynckeystate($ikey)
  2697.         Local $aresult = DllCall("user32.dll", "short", "GetAsyncKeyState", "int", $ikey)
  2698.         If @error Then Return SetError(@error, @extended, 0)
  2699.         Return $aresult[0]
  2700.     EndFunc
  2701.  
  2702.     Func _winapi_getbkmode($hdc)
  2703.         Local $aresult = DllCall("gdi32.dll", "int", "GetBkMode", "handle", $hdc)
  2704.         If @error Then Return SetError(@error, @extended, 0)
  2705.         Return $aresult[0]
  2706.     EndFunc
  2707.  
  2708.     Func _winapi_getclassname($hwnd)
  2709.         If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
  2710.         Local $aresult = DllCall("user32.dll", "int", "GetClassNameW", "hwnd", $hwnd, "wstr", "", "int", 4096)
  2711.         If @error Then Return SetError(@error, @extended, False)
  2712.         Return SetExtended($aresult[0], $aresult[2])
  2713.     EndFunc
  2714.  
  2715.     Func _winapi_getclientheight($hwnd)
  2716.         Local $trect = _winapi_getclientrect($hwnd)
  2717.         If @error Then Return SetError(@error, @extended, 0)
  2718.         Return DllStructGetData($trect, "Bottom") - DllStructGetData($trect, "Top")
  2719.     EndFunc
  2720.  
  2721.     Func _winapi_getclientwidth($hwnd)
  2722.         Local $trect = _winapi_getclientrect($hwnd)
  2723.         If @error Then Return SetError(@error, @extended, 0)
  2724.         Return DllStructGetData($trect, "Right") - DllStructGetData($trect, "Left")
  2725.     EndFunc
  2726.  
  2727.     Func _winapi_getclientrect($hwnd)
  2728.         Local $trect = DllStructCreate($tagrect)
  2729.         DllCall("user32.dll", "bool", "GetClientRect", "hwnd", $hwnd, "ptr", DllStructGetPtr($trect))
  2730.         If @error Then Return SetError(@error, @extended, 0)
  2731.         Return $trect
  2732.     EndFunc
  2733.  
  2734.     Func _winapi_getcurrentprocess()
  2735.         Local $aresult = DllCall("kernel32.dll", "handle", "GetCurrentProcess")
  2736.         If @error Then Return SetError(@error, @extended, 0)
  2737.         Return $aresult[0]
  2738.     EndFunc
  2739.  
  2740.     Func _winapi_getcurrentprocessid()
  2741.         Local $aresult = DllCall("kernel32.dll", "dword", "GetCurrentProcessId")
  2742.         If @error Then Return SetError(@error, @extended, 0)
  2743.         Return $aresult[0]
  2744.     EndFunc
  2745.  
  2746.     Func _winapi_getcurrentthread()
  2747.         Local $aresult = DllCall("kernel32.dll", "handle", "GetCurrentThread")
  2748.         If @error Then Return SetError(@error, @extended, 0)
  2749.         Return $aresult[0]
  2750.     EndFunc
  2751.  
  2752.     Func _winapi_getcurrentthreadid()
  2753.         Local $aresult = DllCall("kernel32.dll", "dword", "GetCurrentThreadId")
  2754.         If @error Then Return SetError(@error, @extended, 0)
  2755.         Return $aresult[0]
  2756.     EndFunc
  2757.  
  2758.     Func _winapi_getcursorinfo()
  2759.         Local $tcursor = DllStructCreate($tagcursorinfo)
  2760.         Local $icursor = DllStructGetSize($tcursor)
  2761.         DllStructSetData($tcursor, "Size", $icursor)
  2762.         DllCall("user32.dll", "bool", "GetCursorInfo", "ptr", DllStructGetPtr($tcursor))
  2763.         If @error Then Return SetError(@error, @extended, 0)
  2764.         Local $acursor[5]
  2765.         $acursor[0] = True
  2766.         $acursor[1] = DllStructGetData($tcursor, "Flags") <> 0
  2767.         $acursor[2] = DllStructGetData($tcursor, "hCursor")
  2768.         $acursor[3] = DllStructGetData($tcursor, "X")
  2769.         $acursor[4] = DllStructGetData($tcursor, "Y")
  2770.         Return $acursor
  2771.     EndFunc
  2772.  
  2773.     Func _winapi_getdc($hwnd)
  2774.         Local $aresult = DllCall("user32.dll", "handle", "GetDC", "hwnd", $hwnd)
  2775.         If @error Then Return SetError(@error, @extended, 0)
  2776.         Return $aresult[0]
  2777.     EndFunc
  2778.  
  2779.     Func _winapi_getdesktopwindow()
  2780.         Local $aresult = DllCall("user32.dll", "hwnd", "GetDesktopWindow")
  2781.         If @error Then Return SetError(@error, @extended, 0)
  2782.         Return $aresult[0]
  2783.     EndFunc
  2784.  
  2785.     Func _winapi_getdevicecaps($hdc, $iindex)
  2786.         Local $aresult = DllCall("gdi32.dll", "int", "GetDeviceCaps", "handle", $hdc, "int", $iindex)
  2787.         If @error Then Return SetError(@error, @extended, 0)
  2788.         Return $aresult[0]
  2789.     EndFunc
  2790.  
  2791.     Func _winapi_getdibits($hdc, $hbmp, $istartscan, $iscanlines, $pbits, $pbi, $iusage)
  2792.         Local $aresult = DllCall("gdi32.dll", "int", "GetDIBits", "handle", $hdc, "handle", $hbmp, "uint", $istartscan, "uint", $iscanlines, "ptr", $pbits, "ptr", $pbi, "uint", $iusage)
  2793.         If @error Then Return SetError(@error, @extended, False)
  2794.         Return $aresult[0]
  2795.     EndFunc
  2796.  
  2797.     Func _winapi_getdlgctrlid($hwnd)
  2798.         Local $aresult = DllCall("user32.dll", "int", "GetDlgCtrlID", "hwnd", $hwnd)
  2799.         If @error Then Return SetError(@error, @extended, 0)
  2800.         Return $aresult[0]
  2801.     EndFunc
  2802.  
  2803.     Func _winapi_getdlgitem($hwnd, $iitemid)
  2804.         Local $aresult = DllCall("user32.dll", "hwnd", "GetDlgItem", "hwnd", $hwnd, "int", $iitemid)
  2805.         If @error Then Return SetError(@error, @extended, 0)
  2806.         Return $aresult[0]
  2807.     EndFunc
  2808.  
  2809.     Func _winapi_getfocus()
  2810.         Local $aresult = DllCall("user32.dll", "hwnd", "GetFocus")
  2811.         If @error Then Return SetError(@error, @extended, 0)
  2812.         Return $aresult[0]
  2813.     EndFunc
  2814.  
  2815.     Func _winapi_getforegroundwindow()
  2816.         Local $aresult = DllCall("user32.dll", "hwnd", "GetForegroundWindow")
  2817.         If @error Then Return SetError(@error, @extended, 0)
  2818.         Return $aresult[0]
  2819.     EndFunc
  2820.  
  2821.     Func _winapi_getguiresources($iflag = 0, $hprocess = -1)
  2822.         If $hprocess = -1 Then $hprocess = _winapi_getcurrentprocess()
  2823.         Local $aresult = DllCall("user32.dll", "dword", "GetGuiResources", "handle", $hprocess, "dword", $iflag)
  2824.         If @error Then Return SetError(@error, @extended, 0)
  2825.         Return $aresult[0]
  2826.     EndFunc
  2827.  
  2828.     Func _winapi_geticoninfo($hicon)
  2829.         Local $tinfo = DllStructCreate($tagiconinfo)
  2830.         DllCall("user32.dll", "bool", "GetIconInfo", "handle", $hicon, "ptr", DllStructGetPtr($tinfo))
  2831.         If @error Then Return SetError(@error, @extended, 0)
  2832.         Local $aicon[6]
  2833.         $aicon[0] = True
  2834.         $aicon[1] = DllStructGetData($tinfo, "Icon") <> 0
  2835.         $aicon[2] = DllStructGetData($tinfo, "XHotSpot")
  2836.         $aicon[3] = DllStructGetData($tinfo, "YHotSpot")
  2837.         $aicon[4] = DllStructGetData($tinfo, "hMask")
  2838.         $aicon[5] = DllStructGetData($tinfo, "hColor")
  2839.         Return $aicon
  2840.     EndFunc
  2841.  
  2842.     Func _winapi_getfilesizeex($hfile)
  2843.         Local $aresult = DllCall("kernel32.dll", "bool", "GetFileSizeEx", "handle", $hfile, "int64*", 0)
  2844.         If @error Then Return SetError(@error, @extended, 0)
  2845.         Return $aresult[2]
  2846.     EndFunc
  2847.  
  2848.     Func _winapi_getlasterrormessage()
  2849.         Local $tbufferptr = DllStructCreate("ptr")
  2850.         Local $pbufferptr = DllStructGetPtr($tbufferptr)
  2851.         Local $ncount = _winapi_formatmessage(BitOR($__winapiconstant_format_message_allocate_buffer, $__winapiconstant_format_message_from_system), 0, _winapi_getlasterror(), 0, $pbufferptr, 0, 0)
  2852.         If @error Then Return SetError(@error, 0, "")
  2853.         Local $stext = ""
  2854.         Local $pbuffer = DllStructGetData($tbufferptr, 1)
  2855.         If $pbuffer Then
  2856.             If $ncount > 0 Then
  2857.                 Local $tbuffer = DllStructCreate("wchar[" & ($ncount + 1) & "]", $pbuffer)
  2858.                 $stext = DllStructGetData($tbuffer, 1)
  2859.             EndIf
  2860.             _winapi_localfree($pbuffer)
  2861.         EndIf
  2862.         Return $stext
  2863.     EndFunc
  2864.  
  2865.     Func _winapi_getlayeredwindowattributes($hwnd, ByRef $i_transcolor, ByRef $transparency, $ascolorref = False)
  2866.         $i_transcolor = -1
  2867.         $transparency = -1
  2868.         Local $aresult = DllCall("user32.dll", "bool", "GetLayeredWindowAttributes", "hwnd", $hwnd, "dword*", $i_transcolor, "byte*", $transparency, "dword*", 0)
  2869.         If @error Then Return SetError(@error, @extended, 0)
  2870.         If NOT $ascolorref Then
  2871.             $aresult[2] = Hex(String($aresult[2]), 6)
  2872.             $aresult[2] = "0x" & StringMid($aresult[2], 5, 2) & StringMid($aresult[2], 3, 2) & StringMid($aresult[2], 1, 2)
  2873.         EndIf
  2874.         $i_transcolor = $aresult[2]
  2875.         $transparency = $aresult[3]
  2876.         Return $aresult[4]
  2877.     EndFunc
  2878.  
  2879.     Func _winapi_getmodulehandle($smodulename)
  2880.         Local $smodulenametype = "wstr"
  2881.         If $smodulename = "" Then
  2882.             $smodulename = 0
  2883.             $smodulenametype = "ptr"
  2884.         EndIf
  2885.         Local $aresult = DllCall("kernel32.dll", "handle", "GetModuleHandleW", $smodulenametype, $smodulename)
  2886.         If @error Then Return SetError(@error, @extended, 0)
  2887.         Return $aresult[0]
  2888.     EndFunc
  2889.  
  2890.     Func _winapi_getmousepos($ftoclient = False, $hwnd = 0)
  2891.         Local $imode = Opt("MouseCoordMode", 1)
  2892.         Local $apos = MouseGetPos()
  2893.         Opt("MouseCoordMode", $imode)
  2894.         Local $tpoint = DllStructCreate($tagpoint)
  2895.         DllStructSetData($tpoint, "X", $apos[0])
  2896.         DllStructSetData($tpoint, "Y", $apos[1])
  2897.         If $ftoclient Then
  2898.             _winapi_screentoclient($hwnd, $tpoint)
  2899.             If @error Then Return SetError(@error, @extended, 0)
  2900.         EndIf
  2901.         Return $tpoint
  2902.     EndFunc
  2903.  
  2904.     Func _winapi_getmouseposx($ftoclient = False, $hwnd = 0)
  2905.         Local $tpoint = _winapi_getmousepos($ftoclient, $hwnd)
  2906.         If @error Then Return SetError(@error, @extended, 0)
  2907.         Return DllStructGetData($tpoint, "X")
  2908.     EndFunc
  2909.  
  2910.     Func _winapi_getmouseposy($ftoclient = False, $hwnd = 0)
  2911.         Local $tpoint = _winapi_getmousepos($ftoclient, $hwnd)
  2912.         If @error Then Return SetError(@error, @extended, 0)
  2913.         Return DllStructGetData($tpoint, "Y")
  2914.     EndFunc
  2915.  
  2916.     Func _winapi_getobject($hobject, $isize, $pobject)
  2917.         Local $aresult = DllCall("gdi32.dll", "int", "GetObject", "handle", $hobject, "int", $isize, "ptr", $pobject)
  2918.         If @error Then Return SetError(@error, @extended, 0)
  2919.         Return $aresult[0]
  2920.     EndFunc
  2921.  
  2922.     Func _winapi_getopenfilename($stitle = "", $sfilter = "All files (*.*)", $sinitaldir = ".", $sdefaultfile = "", $sdefaultext = "", $ifilterindex = 1, $iflags = 0, $iflagsex = 0, $hwndowner = 0)
  2923.         Local $ipathlen = 4096
  2924.         Local $inulls = 0
  2925.         Local $tofn = DllStructCreate($tagopenfilename)
  2926.         Local $afiles[1] = [0]
  2927.         Local $iflag = $iflags
  2928.         Local $asflines = StringSplit($sfilter, "|")
  2929.         Local $asfilter[$asflines[0] * 2 + 1]
  2930.         Local $istart, $ifinal, $stfilter
  2931.         $asfilter[0] = $asflines[0] * 2
  2932.         For $i = 1 To $asflines[0]
  2933.             $istart = StringInStr($asflines[$i], "(", 0, 1)
  2934.             $ifinal = StringInStr($asflines[$i], ")", 0, -1)
  2935.             $asfilter[$i * 2 - 1] = StringStripWS(StringLeft($asflines[$i], $istart - 1), 3)
  2936.             $asfilter[$i * 2] = StringStripWS(StringTrimRight(StringTrimLeft($asflines[$i], $istart), StringLen($asflines[$i]) - $ifinal + 1), 3)
  2937.             $stfilter &= "wchar[" & StringLen($asfilter[$i * 2 - 1]) + 1 & "];wchar[" & StringLen($asfilter[$i * 2]) + 1 & "];"
  2938.         Next
  2939.         Local $ttitle = DllStructCreate("wchar Title[" & StringLen($stitle) + 1 & "]")
  2940.         Local $tinitialdir = DllStructCreate("wchar InitDir[" & StringLen($sinitaldir) + 1 & "]")
  2941.         Local $tfilter = DllStructCreate($stfilter & "wchar")
  2942.         Local $tpath = DllStructCreate("wchar Path[" & $ipathlen & "]")
  2943.         Local $textn = DllStructCreate("wchar Extension[" & StringLen($sdefaultext) + 1 & "]")
  2944.         For $i = 1 To $asfilter[0]
  2945.             DllStructSetData($tfilter, $i, $asfilter[$i])
  2946.         Next
  2947.         DllStructSetData($ttitle, "Title", $stitle)
  2948.         DllStructSetData($tinitialdir, "InitDir", $sinitaldir)
  2949.         DllStructSetData($tpath, "Path", $sdefaultfile)
  2950.         DllStructSetData($textn, "Extension", $sdefaultext)
  2951.         DllStructSetData($tofn, "StructSize", DllStructGetSize($tofn))
  2952.         DllStructSetData($tofn, "hwndOwner", $hwndowner)
  2953.         DllStructSetData($tofn, "lpstrFilter", DllStructGetPtr($tfilter))
  2954.         DllStructSetData($tofn, "nFilterIndex", $ifilterindex)
  2955.         DllStructSetData($tofn, "lpstrFile", DllStructGetPtr($tpath))
  2956.         DllStructSetData($tofn, "nMaxFile", $ipathlen)
  2957.         DllStructSetData($tofn, "lpstrInitialDir", DllStructGetPtr($tinitialdir))
  2958.         DllStructSetData($tofn, "lpstrTitle", DllStructGetPtr($ttitle))
  2959.         DllStructSetData($tofn, "Flags", $iflag)
  2960.         DllStructSetData($tofn, "lpstrDefExt", DllStructGetPtr($textn))
  2961.         DllStructSetData($tofn, "FlagsEx", $iflagsex)
  2962.         DllCall("comdlg32.dll", "bool", "GetOpenFileNameW", "ptr", DllStructGetPtr($tofn))
  2963.         If @error Then Return SetError(@error, @extended, $afiles)
  2964.         If BitAND($iflags, $ofn_allowmultiselect) = $ofn_allowmultiselect AND BitAND($iflags, $ofn_explorer) = $ofn_explorer Then
  2965.             For $x = 1 To $ipathlen
  2966.                 If DllStructGetData($tpath, "Path", $x) = Chr(0) Then
  2967.                     DllStructSetData($tpath, "Path", "|", $x)
  2968.                     $inulls += 1
  2969.                 Else
  2970.                     $inulls = 0
  2971.                 EndIf
  2972.                 If $inulls = 2 Then ExitLoop
  2973.             Next
  2974.             DllStructSetData($tpath, "Path", Chr(0), $x - 1)
  2975.             $afiles = StringSplit(DllStructGetData($tpath, "Path"), "|")
  2976.             If $afiles[0] = 1 Then Return __winapi_parsefiledialogpath(DllStructGetData($tpath, "Path"))
  2977.             Return StringSplit(DllStructGetData($tpath, "Path"), "|")
  2978.         ElseIf BitAND($iflags, $ofn_allowmultiselect) = $ofn_allowmultiselect Then
  2979.             $afiles = StringSplit(DllStructGetData($tpath, "Path"), " ")
  2980.             If $afiles[0] = 1 Then Return __winapi_parsefiledialogpath(DllStructGetData($tpath, "Path"))
  2981.             Return StringSplit(StringReplace(DllStructGetData($tpath, "Path"), " ", "|"), "|")
  2982.         Else
  2983.             Return __winapi_parsefiledialogpath(DllStructGetData($tpath, "Path"))
  2984.         EndIf
  2985.     EndFunc
  2986.  
  2987.     Func _winapi_getoverlappedresult($hfile, $poverlapped, ByRef $ibytes, $fwait = False)
  2988.         Local $aresult = DllCall("kernel32.dll", "bool", "GetOverlappedResult", "handle", $hfile, "ptr", $poverlapped, "dword*", 0, "bool", $fwait)
  2989.         If @error Then Return SetError(@error, @extended, False)
  2990.         $ibytes = $aresult[3]
  2991.         Return $aresult[0]
  2992.     EndFunc
  2993.  
  2994.     Func _winapi_getparent($hwnd)
  2995.         Local $aresult = DllCall("user32.dll", "hwnd", "GetParent", "hwnd", $hwnd)
  2996.         If @error Then Return SetError(@error, @extended, 0)
  2997.         Return $aresult[0]
  2998.     EndFunc
  2999.  
  3000.     Func _winapi_getprocessaffinitymask($hprocess)
  3001.         Local $aresult = DllCall("kernel32.dll", "bool", "GetProcessAffinityMask", "handle", $hprocess, "dword_ptr*", 0, "dword_ptr*", 0)
  3002.         If @error Then Return SetError(@error, @extended, 0)
  3003.         Local $amask[3]
  3004.         $amask[0] = True
  3005.         $amask[1] = $aresult[2]
  3006.         $amask[2] = $aresult[3]
  3007.         Return $amask
  3008.     EndFunc
  3009.  
  3010.     Func _winapi_getsavefilename($stitle = "", $sfilter = "All files (*.*)", $sinitaldir = ".", $sdefaultfile = "", $sdefaultext = "", $ifilterindex = 1, $iflags = 0, $iflagsex = 0, $hwndowner = 0)
  3011.         Local $ipathlen = 4096
  3012.         Local $tofn = DllStructCreate($tagopenfilename)
  3013.         Local $afiles[1] = [0]
  3014.         Local $iflag = $iflags
  3015.         Local $asflines = StringSplit($sfilter, "|")
  3016.         Local $asfilter[$asflines[0] * 2 + 1]
  3017.         Local $istart, $ifinal, $stfilter
  3018.         $asfilter[0] = $asflines[0] * 2
  3019.         For $i = 1 To $asflines[0]
  3020.             $istart = StringInStr($asflines[$i], "(", 0, 1)
  3021.             $ifinal = StringInStr($asflines[$i], ")", 0, -1)
  3022.             $asfilter[$i * 2 - 1] = StringStripWS(StringLeft($asflines[$i], $istart - 1), 3)
  3023.             $asfilter[$i * 2] = StringStripWS(StringTrimRight(StringTrimLeft($asflines[$i], $istart), StringLen($asflines[$i]) - $ifinal + 1), 3)
  3024.             $stfilter &= "wchar[" & StringLen($asfilter[$i * 2 - 1]) + 1 & "];wchar[" & StringLen($asfilter[$i * 2]) + 1 & "];"
  3025.         Next
  3026.         Local $ttitle = DllStructCreate("wchar Title[" & StringLen($stitle) + 1 & "]")
  3027.         Local $tinitialdir = DllStructCreate("wchar InitDir[" & StringLen($sinitaldir) + 1 & "]")
  3028.         Local $tfilter = DllStructCreate($stfilter & "wchar")
  3029.         Local $tpath = DllStructCreate("wchar Path[" & $ipathlen & "]")
  3030.         Local $textn = DllStructCreate("wchar Extension[" & StringLen($sdefaultext) + 1 & "]")
  3031.         For $i = 1 To $asfilter[0]
  3032.             DllStructSetData($tfilter, $i, $asfilter[$i])
  3033.         Next
  3034.         DllStructSetData($ttitle, "Title", $stitle)
  3035.         DllStructSetData($tinitialdir, "InitDir", $sinitaldir)
  3036.         DllStructSetData($tpath, "Path", $sdefaultfile)
  3037.         DllStructSetData($textn, "Extension", $sdefaultext)
  3038.         DllStructSetData($tofn, "StructSize", DllStructGetSize($tofn))
  3039.         DllStructSetData($tofn, "hwndOwner", $hwndowner)
  3040.         DllStructSetData($tofn, "lpstrFilter", DllStructGetPtr($tfilter))
  3041.         DllStructSetData($tofn, "nFilterIndex", $ifilterindex)
  3042.         DllStructSetData($tofn, "lpstrFile", DllStructGetPtr($tpath))
  3043.         DllStructSetData($tofn, "nMaxFile", $ipathlen)
  3044.         DllStructSetData($tofn, "lpstrInitialDir", DllStructGetPtr($tinitialdir))
  3045.         DllStructSetData($tofn, "lpstrTitle", DllStructGetPtr($ttitle))
  3046.         DllStructSetData($tofn, "Flags", $iflag)
  3047.         DllStructSetData($tofn, "lpstrDefExt", DllStructGetPtr($textn))
  3048.         DllStructSetData($tofn, "FlagsEx", $iflagsex)
  3049.         DllCall("comdlg32.dll", "bool", "GetSaveFileNameW", "ptr", DllStructGetPtr($tofn))
  3050.         If @error Then Return SetError(@error, @extended, $afiles)
  3051.         Return __winapi_parsefiledialogpath(DllStructGetData($tpath, "Path"))
  3052.     EndFunc
  3053.  
  3054.     Func _winapi_getstockobject($iobject)
  3055.         Local $aresult = DllCall("gdi32.dll", "handle", "GetStockObject", "int", $iobject)
  3056.         If @error Then Return SetError(@error, @extended, 0)
  3057.         Return $aresult[0]
  3058.     EndFunc
  3059.  
  3060.     Func _winapi_getstdhandle($istdhandle)
  3061.         If $istdhandle < 0 OR $istdhandle > 2 Then Return SetError(2, 0, -1)
  3062.         Local Const $ahandle[3] = [-10, -11, -12]
  3063.         Local $aresult = DllCall("kernel32.dll", "handle", "GetStdHandle", "dword", $ahandle[$istdhandle])
  3064.         If @error Then Return SetError(@error, @extended, -1)
  3065.         Return $aresult[0]
  3066.     EndFunc
  3067.  
  3068.     Func _winapi_getsyscolor($iindex)
  3069.         Local $aresult = DllCall("user32.dll", "dword", "GetSysColor", "int", $iindex)
  3070.         If @error Then Return SetError(@error, @extended, 0)
  3071.         Return $aresult[0]
  3072.     EndFunc
  3073.  
  3074.     Func _winapi_getsyscolorbrush($iindex)
  3075.         Local $aresult = DllCall("user32.dll", "handle", "GetSysColorBrush", "int", $iindex)
  3076.         If @error Then Return SetError(@error, @extended, 0)
  3077.         Return $aresult[0]
  3078.     EndFunc
  3079.  
  3080.     Func _winapi_getsystemmetrics($iindex)
  3081.         Local $aresult = DllCall("user32.dll", "int", "GetSystemMetrics", "int", $iindex)
  3082.         If @error Then Return SetError(@error, @extended, 0)
  3083.         Return $aresult[0]
  3084.     EndFunc
  3085.  
  3086.     Func _winapi_gettextextentpoint32($hdc, $stext)
  3087.         Local $tsize = DllStructCreate($tagsize)
  3088.         Local $isize = StringLen($stext)
  3089.         DllCall("gdi32.dll", "bool", "GetTextExtentPoint32W", "handle", $hdc, "wstr", $stext, "int", $isize, "ptr", DllStructGetPtr($tsize))
  3090.         If @error Then Return SetError(@error, @extended, 0)
  3091.         Return $tsize
  3092.     EndFunc
  3093.  
  3094.     Func _winapi_getwindow($hwnd, $icmd)
  3095.         Local $aresult = DllCall("user32.dll", "hwnd", "GetWindow", "hwnd", $hwnd, "uint", $icmd)
  3096.         If @error Then Return SetError(@error, @extended, 0)
  3097.         Return $aresult[0]
  3098.     EndFunc
  3099.  
  3100.     Func _winapi_getwindowdc($hwnd)
  3101.         Local $aresult = DllCall("user32.dll", "handle", "GetWindowDC", "hwnd", $hwnd)
  3102.         If @error Then Return SetError(@error, @extended, 0)
  3103.         Return $aresult[0]
  3104.     EndFunc
  3105.  
  3106.     Func _winapi_getwindowheight($hwnd)
  3107.         Local $trect = _winapi_getwindowrect($hwnd)
  3108.         If @error Then Return SetError(@error, @extended, 0)
  3109.         Return DllStructGetData($trect, "Bottom") - DllStructGetData($trect, "Top")
  3110.     EndFunc
  3111.  
  3112.     Func _winapi_getwindowlong($hwnd, $iindex)
  3113.         Local $sfuncname = "GetWindowLongW"
  3114.         If @AutoItX64 Then $sfuncname = "GetWindowLongPtrW"
  3115.         Local $aresult = DllCall("user32.dll", "long_ptr", $sfuncname, "hwnd", $hwnd, "int", $iindex)
  3116.         If @error Then Return SetError(@error, @extended, 0)
  3117.         Return $aresult[0]
  3118.     EndFunc
  3119.  
  3120.     Func _winapi_getwindowplacement($hwnd)
  3121.         Local $twindowplacement = DllStructCreate($tagwindowplacement)
  3122.         DllStructSetData($twindowplacement, "length", DllStructGetSize($twindowplacement))
  3123.         Local $pwindowplacement = DllStructGetPtr($twindowplacement)
  3124.         DllCall("user32.dll", "bool", "GetWindowPlacement", "hwnd", $hwnd, "ptr", $pwindowplacement)
  3125.         If @error Then Return SetError(@error, @extended, 0)
  3126.         Return $twindowplacement
  3127.     EndFunc
  3128.  
  3129.     Func _winapi_getwindowrect($hwnd)
  3130.         Local $trect = DllStructCreate($tagrect)
  3131.         DllCall("user32.dll", "bool", "GetWindowRect", "hwnd", $hwnd, "ptr", DllStructGetPtr($trect))
  3132.         If @error Then Return SetError(@error, @extended, 0)
  3133.         Return $trect
  3134.     EndFunc
  3135.  
  3136.     Func _winapi_getwindowrgn($hwnd, $hrgn)
  3137.         Local $aresult = DllCall("user32.dll", "int", "GetWindowRgn", "hwnd", $hwnd, "handle", $hrgn)
  3138.         If @error Then Return SetError(@error, @extended, 0)
  3139.         Return $aresult[0]
  3140.     EndFunc
  3141.  
  3142.     Func _winapi_getwindowtext($hwnd)
  3143.         Local $aresult = DllCall("user32.dll", "int", "GetWindowTextW", "hwnd", $hwnd, "wstr", "", "int", 4096)
  3144.         If @error Then Return SetError(@error, @extended, "")
  3145.         Return SetExtended($aresult[0], $aresult[2])
  3146.     EndFunc
  3147.  
  3148.     Func _winapi_getwindowthreadprocessid($hwnd, ByRef $ipid)
  3149.         Local $aresult = DllCall("user32.dll", "dword", "GetWindowThreadProcessId", "hwnd", $hwnd, "dword*", 0)
  3150.         If @error Then Return SetError(@error, @extended, 0)
  3151.         $ipid = $aresult[2]
  3152.         Return $aresult[0]
  3153.     EndFunc
  3154.  
  3155.     Func _winapi_getwindowwidth($hwnd)
  3156.         Local $trect = _winapi_getwindowrect($hwnd)
  3157.         If @error Then Return SetError(@error, @extended, 0)
  3158.         Return DllStructGetData($trect, "Right") - DllStructGetData($trect, "Left")
  3159.     EndFunc
  3160.  
  3161.     Func _winapi_getxyfrompoint(ByRef $tpoint, ByRef $ix, ByRef $iy)
  3162.         $ix = DllStructGetData($tpoint, "X")
  3163.         $iy = DllStructGetData($tpoint, "Y")
  3164.     EndFunc
  3165.  
  3166.     Func _winapi_globalmemorystatus()
  3167.         Local $tmem = DllStructCreate($tagmemorystatusex)
  3168.         Local $pmem = DllStructGetPtr($tmem)
  3169.         Local $imem = DllStructGetSize($tmem)
  3170.         DllStructSetData($tmem, 1, $imem)
  3171.         DllCall("kernel32.dll", "none", "GlobalMemoryStatusEx", "ptr", $pmem)
  3172.         If @error Then Return SetError(@error, @extended, 0)
  3173.         Local $amem[7]
  3174.         $amem[0] = DllStructGetData($tmem, 2)
  3175.         $amem[1] = DllStructGetData($tmem, 3)
  3176.         $amem[2] = DllStructGetData($tmem, 4)
  3177.         $amem[3] = DllStructGetData($tmem, 5)
  3178.         $amem[4] = DllStructGetData($tmem, 6)
  3179.         $amem[5] = DllStructGetData($tmem, 7)
  3180.         $amem[6] = DllStructGetData($tmem, 8)
  3181.         Return $amem
  3182.     EndFunc
  3183.  
  3184.     Func _winapi_guidfromstring($sguid)
  3185.         Local $tguid = DllStructCreate($tagguid)
  3186.         _winapi_guidfromstringex($sguid, DllStructGetPtr($tguid))
  3187.         If @error Then Return SetError(@error, @extended, 0)
  3188.         Return $tguid
  3189.     EndFunc
  3190.  
  3191.     Func _winapi_guidfromstringex($sguid, $pguid)
  3192.         Local $aresult = DllCall("ole32.dll", "long", "CLSIDFromString", "wstr", $sguid, "ptr", $pguid)
  3193.         If @error Then Return SetError(@error, @extended, False)
  3194.         Return $aresult[0]
  3195.     EndFunc
  3196.  
  3197.     Func _winapi_hiword($ilong)
  3198.         Return BitShift($ilong, 16)
  3199.     EndFunc
  3200.  
  3201.     Func _winapi_inprocess($hwnd, ByRef $hlastwnd)
  3202.         If $hwnd = $hlastwnd Then Return True
  3203.         For $ii = $__gainprocess_winapi[0][0] To 1 Step -1
  3204.             If $hwnd = $__gainprocess_winapi[$ii][0] Then
  3205.                 If $__gainprocess_winapi[$ii][1] Then
  3206.                     $hlastwnd = $hwnd
  3207.                     Return True
  3208.                 Else
  3209.                     Return False
  3210.                 EndIf
  3211.             EndIf
  3212.         Next
  3213.         Local $iprocessid
  3214.         _winapi_getwindowthreadprocessid($hwnd, $iprocessid)
  3215.         Local $icount = $__gainprocess_winapi[0][0] + 1
  3216.         If $icount >= 64 Then $icount = 1
  3217.         $__gainprocess_winapi[0][0] = $icount
  3218.         $__gainprocess_winapi[$icount][0] = $hwnd
  3219.         $__gainprocess_winapi[$icount][1] = ($iprocessid = @AutoItPID)
  3220.         Return $__gainprocess_winapi[$icount][1]
  3221.     EndFunc
  3222.  
  3223.     Func _winapi_inttofloat($iint)
  3224.         Local $tint = DllStructCreate("int")
  3225.         Local $tfloat = DllStructCreate("float", DllStructGetPtr($tint))
  3226.         DllStructSetData($tint, 1, $iint)
  3227.         Return DllStructGetData($tfloat, 1)
  3228.     EndFunc
  3229.  
  3230.     Func _winapi_isclassname($hwnd, $sclassname)
  3231.         Local $sseparator = Opt("GUIDataSeparatorChar")
  3232.         Local $aclassname = StringSplit($sclassname, $sseparator)
  3233.         If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd)
  3234.         Local $sclasscheck = _winapi_getclassname($hwnd)
  3235.         For $x = 1 To UBound($aclassname) - 1
  3236.             If StringUpper(StringMid($sclasscheck, 1, StringLen($aclassname[$x]))) = StringUpper($aclassname[$x]) Then Return True
  3237.         Next
  3238.         Return False
  3239.     EndFunc
  3240.  
  3241.     Func _winapi_iswindow($hwnd)
  3242.         Local $aresult = DllCall("user32.dll", "bool", "IsWindow", "hwnd", $hwnd)
  3243.         If @error Then Return SetError(@error, @extended, 0)
  3244.         Return $aresult[0]
  3245.     EndFunc
  3246.  
  3247.     Func _winapi_iswindowvisible($hwnd)
  3248.         Local $aresult = DllCall("user32.dll", "bool", "IsWindowVisible", "hwnd", $hwnd)
  3249.         If @error Then Return SetError(@error, @extended, 0)
  3250.         Return $aresult[0]
  3251.     EndFunc
  3252.  
  3253.     Func _winapi_invalidaterect($hwnd, $trect = 0, $ferase = True)
  3254.         Local $prect = 0
  3255.         If IsDllStruct($trect) Then $prect = DllStructGetPtr($trect)
  3256.         Local $aresult = DllCall("user32.dll", "bool", "InvalidateRect", "hwnd", $hwnd, "ptr", $prect, "bool", $ferase)
  3257.         If @error Then Return SetError(@error, @extended, False)
  3258.         Return $aresult[0]
  3259.     EndFunc
  3260.  
  3261.     Func _winapi_lineto($hdc, $ix, $iy)
  3262.         Local $aresult = DllCall("gdi32.dll", "bool", "LineTo", "handle", $hdc, "int", $ix, "int", $iy)
  3263.         If @error Then Return SetError(@error, @extended, False)
  3264.         Return $aresult[0]
  3265.     EndFunc
  3266.  
  3267.     Func _winapi_loadbitmap($hinstance, $sbitmap)
  3268.         Local $sbitmaptype = "int"
  3269.         If IsString($sbitmap) Then $sbitmaptype = "wstr"
  3270.         Local $aresult = DllCall("user32.dll", "handle", "LoadBitmapW", "handle", $hinstance, $sbitmaptype, $sbitmap)
  3271.         If @error Then Return SetError(@error, @extended, 0)
  3272.         Return $aresult[0]
  3273.     EndFunc
  3274.  
  3275.     Func _winapi_loadimage($hinstance, $simage, $itype, $ixdesired, $iydesired, $iload)
  3276.         Local $aresult, $simagetype = "int"
  3277.         If IsString($simage) Then $simagetype = "wstr"
  3278.         $aresult = DllCall("user32.dll", "handle", "LoadImageW", "handle", $hinstance, $simagetype, $simage, "uint", $itype, "int", $ixdesired, "int", $iydesired, "uint", $iload)
  3279.         If @error Then Return SetError(@error, @extended, 0)
  3280.         Return $aresult[0]
  3281.     EndFunc
  3282.  
  3283.     Func _winapi_loadlibrary($sfilename)
  3284.         Local $aresult = DllCall("kernel32.dll", "handle", "LoadLibraryW", "wstr", $sfilename)
  3285.         If @error Then Return SetError(@error, @extended, 0)
  3286.         Return $aresult[0]
  3287.     EndFunc
  3288.  
  3289.     Func _winapi_loadlibraryex($sfilename, $iflags = 0)
  3290.         Local $aresult = DllCall("kernel32.dll", "handle", "LoadLibraryExW", "wstr", $sfilename, "ptr", 0, "dword", $iflags)
  3291.         If @error Then Return SetError(@error, @extended, 0)
  3292.         Return $aresult[0]
  3293.     EndFunc
  3294.  
  3295.     Func _winapi_loadshell32icon($iiconid)
  3296.         Local $ticons = DllStructCreate("ptr Data")
  3297.         Local $picons = DllStructGetPtr($ticons)
  3298.         Local $iicons = _winapi_extracticonex("shell32.dll", $iiconid, 0, $picons, 1)
  3299.         If @error Then Return SetError(@error, @extended, 0)
  3300.         If $iicons <= 0 Then Return SetError(1, 0, 0)
  3301.         Return DllStructGetData($ticons, "Data")
  3302.     EndFunc
  3303.  
  3304.     Func _winapi_loadstring($hinstance, $istringid)
  3305.         Local $aresult = DllCall("user32.dll", "int", "LoadStringW", "handle", $hinstance, "uint", $istringid, "wstr", "", "int", 4096)
  3306.         If @error Then Return SetError(@error, @extended, "")
  3307.         Return SetExtended($aresult[0], $aresult[3])
  3308.     EndFunc
  3309.  
  3310.     Func _winapi_localfree($hmem)
  3311.         Local $aresult = DllCall("kernel32.dll", "handle", "LocalFree", "handle", $hmem)
  3312.         If @error Then Return SetError(@error, @extended, False)
  3313.         Return $aresult[0]
  3314.     EndFunc
  3315.  
  3316.     Func _winapi_loword($ilong)
  3317.         Return BitAND($ilong, 65535)
  3318.     EndFunc
  3319.  
  3320.     Func _winapi_makelangid($lgidprimary, $lgidsub)
  3321.         Return BitOR(BitShift($lgidsub, -10), $lgidprimary)
  3322.     EndFunc
  3323.  
  3324.     Func _winapi_makelcid($lgid, $srtid)
  3325.         Return BitOR(BitShift($srtid, -16), $lgid)
  3326.     EndFunc
  3327.  
  3328.     Func _winapi_makelong($ilo, $ihi)
  3329.         Return BitOR(BitShift($ihi, -16), BitAND($ilo, 65535))
  3330.     EndFunc
  3331.  
  3332.     Func _winapi_makeqword($lodword, $hidword)
  3333.         Local $tint64 = DllStructCreate("uint64")
  3334.         Local $tdwords = DllStructCreate("dword;dword", DllStructGetPtr($tint64))
  3335.         DllStructSetData($tdwords, 1, $lodword)
  3336.         DllStructSetData($tdwords, 2, $hidword)
  3337.         Return DllStructGetData($tint64, 1)
  3338.     EndFunc
  3339.  
  3340.     Func _winapi_messagebeep($itype = 1)
  3341.         Local $isound
  3342.         Switch $itype
  3343.             Case 1
  3344.                 $isound = 0
  3345.             Case 2
  3346.                 $isound = 16
  3347.             Case 3
  3348.                 $isound = 32
  3349.             Case 4
  3350.                 $isound = 48
  3351.             Case 5
  3352.                 $isound = 64
  3353.             Case Else
  3354.                 $isound = -1
  3355.         EndSwitch
  3356.         Local $aresult = DllCall("user32.dll", "bool", "MessageBeep", "uint", $isound)
  3357.         If @error Then Return SetError(@error, @extended, False)
  3358.         Return $aresult[0]
  3359.     EndFunc
  3360.  
  3361.     Func _winapi_msgbox($iflags, $stitle, $stext)
  3362.         BlockInput(0)
  3363.         MsgBox($iflags, $stitle, $stext & "      ")
  3364.     EndFunc
  3365.  
  3366.     Func _winapi_mouse_event($iflags, $ix = 0, $iy = 0, $idata = 0, $iextrainfo = 0)
  3367.         DllCall("user32.dll", "none", "mouse_event", "dword", $iflags, "dword", $ix, "dword", $iy, "dword", $idata, "ulong_ptr", $iextrainfo)
  3368.         If @error Then Return SetError(@error, @extended)
  3369.     EndFunc
  3370.  
  3371.     Func _winapi_moveto($hdc, $ix, $iy)
  3372.         Local $aresult = DllCall("gdi32.dll", "bool", "MoveToEx", "handle", $hdc, "int", $ix, "int", $iy, "ptr", 0)
  3373.         If @error Then Return SetError(@error, @extended, False)
  3374.         Return $aresult[0]
  3375.     EndFunc
  3376.  
  3377.     Func _winapi_movewindow($hwnd, $ix, $iy, $iwidth, $iheight, $frepaint = True)
  3378.         Local $aresult = DllCall("user32.dll", "bool", "MoveWindow", "hwnd", $hwnd, "int", $ix, "int", $iy, "int", $iwidth, "int", $iheight, "bool", $frepaint)
  3379.         If @error Then Return SetError(@error, @extended, False)
  3380.         Return $aresult[0]
  3381.     EndFunc
  3382.  
  3383.     Func _winapi_muldiv($inumber, $inumerator, $idenominator)
  3384.         Local $aresult = DllCall("kernel32.dll", "int", "MulDiv", "int", $inumber, "int", $inumerator, "int", $idenominator)
  3385.         If @error Then Return SetError(@error, @extended, -1)
  3386.         Return $aresult[0]
  3387.     EndFunc
  3388.  
  3389.     Func _winapi_multibytetowidechar($stext, $icodepage = 0, $iflags = 0, $bretstring = False)
  3390.         Local $stexttype = "ptr", $ptext = $stext
  3391.         If IsDllStruct($stext) Then
  3392.             $ptext = DllStructGetPtr($stext)
  3393.         Else
  3394.             If NOT IsPtr($stext) Then $stexttype = "STR"
  3395.         EndIf
  3396.         Local $aresult = DllCall("kernel32.dll", "int", "MultiByteToWideChar", "uint", $icodepage, "dword", $iflags, $stexttype, $ptext, "int", -1, "ptr", 0, "int", 0)
  3397.         If @error Then Return SetError(@error, @extended, 0)
  3398.         Local $iout = $aresult[0]
  3399.         Local $tout = DllStructCreate("wchar[" & $iout & "]")
  3400.         Local $pout = DllStructGetPtr($tout)
  3401.         $aresult = DllCall("kernel32.dll", "int", "MultiByteToWideChar", "uint", $icodepage, "dword", $iflags, $stexttype, $ptext, "int", -1, "ptr", $pout, "int", $iout)
  3402.         If @error Then Return SetError(@error, @extended, 0)
  3403.         If $bretstring Then Return DllStructGetData($tout, 1)
  3404.         Return $tout
  3405.     EndFunc
  3406.  
  3407.     Func _winapi_multibytetowidecharex($stext, $ptext, $icodepage = 0, $iflags = 0)
  3408.         Local $aresult = DllCall("kernel32.dll", "int", "MultiByteToWideChar", "uint", $icodepage, "dword", $iflags, "STR", $stext, "int", -1, "ptr", $ptext, "int", (StringLen($stext) + 1) * 2)
  3409.         If @error Then Return SetError(@error, @extended, False)
  3410.         Return $aresult[0]
  3411.     EndFunc
  3412.  
  3413.     Func _winapi_openprocess($iaccess, $finherit, $iprocessid, $fdebugpriv = False)
  3414.         Local $aresult = DllCall("kernel32.dll", "handle", "OpenProcess", "dword", $iaccess, "bool", $finherit, "dword", $iprocessid)
  3415.         If @error Then Return SetError(@error, @extended, 0)
  3416.         If $aresult[0] Then Return $aresult[0]
  3417.         If NOT $fdebugpriv Then Return 0
  3418.         Local $htoken = _security__openthreadtokenex(BitOR($token_adjust_privileges, $token_query))
  3419.         If @error Then Return SetError(@error, @extended, 0)
  3420.         _security__setprivilege($htoken, "SeDebugPrivilege", True)
  3421.         Local $ierror = @error
  3422.         Local $ilasterror = @extended
  3423.         Local $iret = 0
  3424.         If NOT @error Then
  3425.             $aresult = DllCall("kernel32.dll", "handle", "OpenProcess", "dword", $iaccess, "bool", $finherit, "dword", $iprocessid)
  3426.             $ierror = @error
  3427.             $ilasterror = @extended
  3428.             If $aresult[0] Then $iret = $aresult[0]
  3429.             _security__setprivilege($htoken, "SeDebugPrivilege", False)
  3430.             If @error Then
  3431.                 $ierror = @error
  3432.                 $ilasterror = @extended
  3433.             EndIf
  3434.         EndIf
  3435.         _winapi_closehandle($htoken)
  3436.         Return SetError($ierror, $ilasterror, $iret)
  3437.     EndFunc
  3438.  
  3439.     Func __winapi_parsefiledialogpath($spath)
  3440.         Local $afiles[3]
  3441.         $afiles[0] = 2
  3442.         Local $stemp = StringMid($spath, 1, StringInStr($spath, "\", 0, -1) - 1)
  3443.         $afiles[1] = $stemp
  3444.         $afiles[2] = StringMid($spath, StringInStr($spath, "\", 0, -1) + 1)
  3445.         Return $afiles
  3446.     EndFunc
  3447.  
  3448.     Func _winapi_pathfindonpath(Const $szfile, $aextrapaths = "", Const $szpathdelimiter = @LF)
  3449.         Local $iextracount = 0
  3450.         If IsString($aextrapaths) Then
  3451.             If StringLen($aextrapaths) Then
  3452.                 $aextrapaths = StringSplit($aextrapaths, $szpathdelimiter, 1 + 2)
  3453.                 $iextracount = UBound($aextrapaths, 1)
  3454.             EndIf
  3455.         ElseIf IsArray($aextrapaths) Then
  3456.             $iextracount = UBound($aextrapaths)
  3457.         EndIf
  3458.         Local $tpaths, $tpathptrs
  3459.         If $iextracount Then
  3460.             Local $szstruct = ""
  3461.             For $path In $aextrapaths
  3462.                 $szstruct &= "wchar[" & StringLen($path) + 1 & "];"
  3463.             Next
  3464.             $tpaths = DllStructCreate($szstruct)
  3465.             $tpathptrs = DllStructCreate("ptr[" & $iextracount + 1 & "]")
  3466.             For $i = 1 To $iextracount
  3467.                 DllStructSetData($tpaths, $i, $aextrapaths[$i - 1])
  3468.                 DllStructSetData($tpathptrs, 1, DllStructGetPtr($tpaths, $i), $i)
  3469.             Next
  3470.             DllStructSetData($tpathptrs, 1, Ptr(0), $iextracount + 1)
  3471.         EndIf
  3472.         Local $aresult = DllCall("shlwapi.dll", "bool", "PathFindOnPathW", "wstr", $szfile, "ptr", DllStructGetPtr($tpathptrs))
  3473.         If @error Then Return SetError(@error, @extended, False)
  3474.         If $aresult[0] = 0 Then Return SetError(1, 0, $szfile)
  3475.         Return $aresult[1]
  3476.     EndFunc
  3477.  
  3478.     Func _winapi_pointfromrect(ByRef $trect, $fcenter = True)
  3479.         Local $ix1 = DllStructGetData($trect, "Left")
  3480.         Local $iy1 = DllStructGetData($trect, "Top")
  3481.         Local $ix2 = DllStructGetData($trect, "Right")
  3482.         Local $iy2 = DllStructGetData($trect, "Bottom")
  3483.         If $fcenter Then
  3484.             $ix1 = $ix1 + (($ix2 - $ix1) / 2)
  3485.             $iy1 = $iy1 + (($iy2 - $iy1) / 2)
  3486.         EndIf
  3487.         Local $tpoint = DllStructCreate($tagpoint)
  3488.         DllStructSetData($tpoint, "X", $ix1)
  3489.         DllStructSetData($tpoint, "Y", $iy1)
  3490.         Return $tpoint
  3491.     EndFunc
  3492.  
  3493.     Func _winapi_postmessage($hwnd, $imsg, $iwparam, $ilparam)
  3494.         Local $aresult = DllCall("user32.dll", "bool", "PostMessage", "hwnd", $hwnd, "uint", $imsg, "wparam", $iwparam, "lparam", $ilparam)
  3495.         If @error Then Return SetError(@error, @extended, False)
  3496.         Return $aresult[0]
  3497.     EndFunc
  3498.  
  3499.     Func _winapi_primarylangid($lgid)
  3500.         Return BitAND($lgid, 1023)
  3501.     EndFunc
  3502.  
  3503.     Func _winapi_ptinrect(ByRef $trect, ByRef $tpoint)
  3504.         Local $ix = DllStructGetData($tpoint, "X")
  3505.         Local $iy = DllStructGetData($tpoint, "Y")
  3506.         Local $aresult = DllCall("user32.dll", "bool", "PtInRect", "ptr", DllStructGetPtr($trect), "long", $ix, "long", $iy)
  3507.         If @error Then Return SetError(@error, @extended, False)
  3508.         Return $aresult[0]
  3509.     EndFunc
  3510.  
  3511.     Func _winapi_readfile($hfile, $pbuffer, $itoread, ByRef $iread, $poverlapped = 0)
  3512.         Local $aresult = DllCall("kernel32.dll", "bool", "ReadFile", "handle", $hfile, "ptr", $pbuffer, "dword", $itoread, "dword*", 0, "ptr", $poverlapped)
  3513.         If @error Then Return SetError(@error, @extended, False)
  3514.         $iread = $aresult[4]
  3515.         Return $aresult[0]
  3516.     EndFunc
  3517.  
  3518.     Func _winapi_readprocessmemory($hprocess, $pbaseaddress, $pbuffer, $isize, ByRef $iread)
  3519.         Local $aresult = DllCall("kernel32.dll", "bool", "ReadProcessMemory", "handle", $hprocess, "ptr", $pbaseaddress, "ptr", $pbuffer, "ulong_ptr", $isize, "ulong_ptr*", 0)
  3520.         If @error Then Return SetError(@error, @extended, False)
  3521.         $iread = $aresult[5]
  3522.         Return $aresult[0]
  3523.     EndFunc
  3524.  
  3525.     Func _winapi_rectisempty(ByRef $trect)
  3526.         Return (DllStructGetData($trect, "Left") = 0) AND (DllStructGetData($trect, "Top") = 0) AND (DllStructGetData($trect, "Right") = 0) AND (DllStructGetData($trect, "Bottom") = 0)
  3527.     EndFunc
  3528.  
  3529.     Func _winapi_redrawwindow($hwnd, $trect = 0, $hregion = 0, $iflags = 5)
  3530.         Local $prect = 0
  3531.         If $trect <> 0 Then $prect = DllStructGetPtr($trect)
  3532.         Local $aresult = DllCall("user32.dll", "bool", "RedrawWindow", "hwnd", $hwnd, "ptr", $prect, "handle", $hregion, "uint", $iflags)
  3533.         If @error Then Return SetError(@error, @extended, False)
  3534.         Return $aresult[0]
  3535.     EndFunc
  3536.  
  3537.     Func _winapi_registerwindowmessage($smessage)
  3538.         Local $aresult = DllCall("user32.dll", "uint", "RegisterWindowMessageW", "wstr", $smessage)
  3539.         If @error Then Return SetError(@error, @extended, 0)
  3540.         Return $aresult[0]
  3541.     EndFunc
  3542.  
  3543.     Func _winapi_releasecapture()
  3544.         Local $aresult = DllCall("user32.dll", "bool", "ReleaseCapture")
  3545.         If @error Then Return SetError(@error, @extended, False)
  3546.         Return $aresult[0]
  3547.     EndFunc
  3548.  
  3549.     Func _winapi_releasedc($hwnd, $hdc)
  3550.         Local $aresult = DllCall("user32.dll", "int", "ReleaseDC", "hwnd", $hwnd, "handle", $hdc)
  3551.         If @error Then Return SetError(@error, @extended, False)
  3552.         Return $aresult[0]
  3553.     EndFunc
  3554.  
  3555.     Func _winapi_screentoclient($hwnd, ByRef $tpoint)
  3556.         Local $aresult = DllCall("user32.dll", "bool", "ScreenToClient", "hwnd", $hwnd, "ptr", DllStructGetPtr($tpoint))
  3557.         If @error Then Return SetError(@error, @extended, False)
  3558.         Return $aresult[0]
  3559.     EndFunc
  3560.  
  3561.     Func _winapi_selectobject($hdc, $hgdiobj)
  3562.         Local $aresult = DllCall("gdi32.dll", "handle", "SelectObject", "handle", $hdc, "handle", $hgdiobj)
  3563.         If @error Then Return SetError(@error, @extended, False)
  3564.         Return $aresult[0]
  3565.     EndFunc
  3566.  
  3567.     Func _winapi_setbkcolor($hdc, $icolor)
  3568.         Local $aresult = DllCall("gdi32.dll", "INT", "SetBkColor", "handle", $hdc, "dword", $icolor)
  3569.         If @error Then Return SetError(@error, @extended, -1)
  3570.         Return $aresult[0]
  3571.     EndFunc
  3572.  
  3573.     Func _winapi_setbkmode($hdc, $ibkmode)
  3574.         Local $aresult = DllCall("gdi32.dll", "int", "SetBkMode", "handle", $hdc, "int", $ibkmode)
  3575.         If @error Then Return SetError(@error, @extended, 0)
  3576.         Return $aresult[0]
  3577.     EndFunc
  3578.  
  3579.     Func _winapi_setcapture($hwnd)
  3580.         Local $aresult = DllCall("user32.dll", "hwnd", "SetCapture", "hwnd", $hwnd)
  3581.         If @error Then Return SetError(@error, @extended, 0)
  3582.         Return $aresult[0]
  3583.     EndFunc
  3584.  
  3585.     Func _winapi_setcursor($hcursor)
  3586.         Local $aresult = DllCall("user32.dll", "handle", "SetCursor", "handle", $hcursor)
  3587.         If @error Then Return SetError(@error, @extended, 0)
  3588.         Return $aresult[0]
  3589.     EndFunc
  3590.  
  3591.     Func _winapi_setdefaultprinter($sprinter)
  3592.         Local $aresult = DllCall("winspool.drv", "bool", "SetDefaultPrinterW", "wstr", $sprinter)
  3593.         If @error Then Return SetError(@error, @extended, False)
  3594.         Return $aresult[0]
  3595.     EndFunc
  3596.  
  3597.     Func _winapi_setdibits($hdc, $hbmp, $istartscan, $iscanlines, $pbits, $pbmi, $icoloruse = 0)
  3598.         Local $aresult = DllCall("gdi32.dll", "int", "SetDIBits", "handle", $hdc, "handle", $hbmp, "uint", $istartscan, "uint", $iscanlines, "ptr", $pbits, "ptr", $pbmi, "uint", $icoloruse)
  3599.         If @error Then Return SetError(@error, @extended, False)
  3600.         Return $aresult[0]
  3601.     EndFunc
  3602.  
  3603.     Func _winapi_setendoffile($hfile)
  3604.         Local $aresult = DllCall("kernel32.dll", "bool", "SetEndOfFile", "handle", $hfile)
  3605.         If @error Then Return SetError(@error, @extended, False)
  3606.         Return $aresult[0]
  3607.     EndFunc
  3608.  
  3609.     Func _winapi_setevent($hevent)
  3610.         Local $aresult = DllCall("kernel32.dll", "bool", "SetEvent", "handle", $hevent)
  3611.         If @error Then Return SetError(@error, @extended, False)
  3612.         Return $aresult[0]
  3613.     EndFunc
  3614.  
  3615.     Func _winapi_setfilepointer($hfile, $ipos, $imethod = 0)
  3616.         Local $aresult = DllCall("kernel32.dll", "INT", "SetFilePointer", "handle", $hfile, "long", $ipos, "ptr", 0, "long", $imethod)
  3617.         If @error Then Return SetError(@error, @extended, -1)
  3618.         Return $aresult[0]
  3619.     EndFunc
  3620.  
  3621.     Func _winapi_setfocus($hwnd)
  3622.         Local $aresult = DllCall("user32.dll", "hwnd", "SetFocus", "hwnd", $hwnd)
  3623.         If @error Then Return SetError(@error, @extended, 0)
  3624.         Return $aresult[0]
  3625.     EndFunc
  3626.  
  3627.     Func _winapi_setfont($hwnd, $hfont, $fredraw = True)
  3628.         _sendmessage($hwnd, $__winapiconstant_wm_setfont, $hfont, $fredraw, 0, "hwnd")
  3629.     EndFunc
  3630.  
  3631.     Func _winapi_sethandleinformation($hobject, $imask, $iflags)
  3632.         Local $aresult = DllCall("kernel32.dll", "bool", "SetHandleInformation", "handle", $hobject, "dword", $imask, "dword", $iflags)
  3633.         If @error Then Return SetError(@error, @extended, False)
  3634.         Return $aresult[0]
  3635.     EndFunc
  3636.  
  3637.     Func _winapi_setlayeredwindowattributes($hwnd, $i_transcolor, $transparency = 255, $dwflags = 3, $iscolorref = False)
  3638.         If $dwflags = Default OR $dwflags = "" OR $dwflags < 0 Then $dwflags = 3
  3639.         If NOT $iscolorref Then
  3640.             $i_transcolor = Hex(String($i_transcolor), 6)
  3641.             $i_transcolor = Execute("0x00" & StringMid($i_transcolor, 5, 2) & StringMid($i_transcolor, 3, 2) & StringMid($i_transcolor, 1, 2))
  3642.         EndIf
  3643.         Local $aresult = DllCall("user32.dll", "bool", "SetLayeredWindowAttributes", "hwnd", $hwnd, "dword", $i_transcolor, "byte", $transparency, "dword", $dwflags)
  3644.         If @error Then Return SetError(@error, @extended, False)
  3645.         Return $aresult[0]
  3646.     EndFunc
  3647.  
  3648.     Func _winapi_setparent($hwndchild, $hwndparent)
  3649.         Local $aresult = DllCall("user32.dll", "hwnd", "SetParent", "hwnd", $hwndchild, "hwnd", $hwndparent)
  3650.         If @error Then Return SetError(@error, @extended, 0)
  3651.         Return $aresult[0]
  3652.     EndFunc
  3653.  
  3654.     Func _winapi_setprocessaffinitymask($hprocess, $imask)
  3655.         Local $aresult = DllCall("kernel32.dll", "bool", "SetProcessAffinityMask", "handle", $hprocess, "ulong_ptr", $imask)
  3656.         If @error Then Return SetError(@error, @extended, False)
  3657.         Return $aresult[0]
  3658.     EndFunc
  3659.  
  3660.     Func _winapi_setsyscolors($velements, $vcolors)
  3661.         Local $isearray = IsArray($velements), $iscarray = IsArray($vcolors)
  3662.         Local $ielementnum
  3663.         If NOT $iscarray AND NOT $isearray Then
  3664.             $ielementnum = 1
  3665.         ElseIf $iscarray OR $isearray Then
  3666.             If NOT $iscarray OR NOT $isearray Then Return SetError(-1, -1, False)
  3667.             If UBound($velements) <> UBound($vcolors) Then Return SetError(-1, -1, False)
  3668.             $ielementnum = UBound($velements)
  3669.         EndIf
  3670.         Local $telements = DllStructCreate("int Element[" & $ielementnum & "]")
  3671.         Local $tcolors = DllStructCreate("dword NewColor[" & $ielementnum & "]")
  3672.         Local $pelements = DllStructGetPtr($telements)
  3673.         Local $pcolors = DllStructGetPtr($tcolors)
  3674.         If NOT $isearray Then
  3675.             DllStructSetData($telements, "Element", $velements, 1)
  3676.         Else
  3677.             For $x = 0 To $ielementnum - 1
  3678.                 DllStructSetData($telements, "Element", $velements[$x], $x + 1)
  3679.             Next
  3680.         EndIf
  3681.         If NOT $iscarray Then
  3682.             DllStructSetData($tcolors, "NewColor", $vcolors, 1)
  3683.         Else
  3684.             For $x = 0 To $ielementnum - 1
  3685.                 DllStructSetData($tcolors, "NewColor", $vcolors[$x], $x + 1)
  3686.             Next
  3687.         EndIf
  3688.         Local $aresult = DllCall("user32.dll", "bool", "SetSysColors", "int", $ielementnum, "ptr", $pelements, "ptr", $pcolors)
  3689.         If @error Then Return SetError(@error, @extended, False)
  3690.         Return $aresult[0]
  3691.     EndFunc
  3692.  
  3693.     Func _winapi_settextcolor($hdc, $icolor)
  3694.         Local $aresult = DllCall("gdi32.dll", "INT", "SetTextColor", "handle", $hdc, "dword", $icolor)
  3695.         If @error Then Return SetError(@error, @extended, -1)
  3696.         Return $aresult[0]
  3697.     EndFunc
  3698.  
  3699.     Func _winapi_setwindowlong($hwnd, $iindex, $ivalue)
  3700.         _winapi_setlasterror(0)
  3701.         Local $sfuncname = "SetWindowLongW"
  3702.         If @AutoItX64 Then $sfuncname = "SetWindowLongPtrW"
  3703.         Local $aresult = DllCall("user32.dll", "long_ptr", $sfuncname, "hwnd", $hwnd, "int", $iindex, "long_ptr", $ivalue)
  3704.         If @error Then Return SetError(@error, @extended, 0)
  3705.         Return $aresult[0]
  3706.     EndFunc
  3707.  
  3708.     Func _winapi_setwindowplacement($hwnd, $pwindowplacement)
  3709.         Local $aresult = DllCall("user32.dll", "bool", "SetWindowPlacement", "hwnd", $hwnd, "ptr", $pwindowplacement)
  3710.         If @error Then Return SetError(@error, @extended, False)
  3711.         Return $aresult[0]
  3712.     EndFunc
  3713.  
  3714.     Func _winapi_setwindowpos($hwnd, $hafter, $ix, $iy, $icx, $icy, $iflags)
  3715.         Local $aresult = DllCall("user32.dll", "bool", "SetWindowPos", "hwnd", $hwnd, "hwnd", $hafter, "int", $ix, "int", $iy, "int", $icx, "int", $icy, "uint", $iflags)
  3716.         If @error Then Return SetError(@error, @extended, False)
  3717.         Return $aresult[0]
  3718.     EndFunc
  3719.  
  3720.     Func _winapi_setwindowrgn($hwnd, $hrgn, $bredraw = True)
  3721.         Local $aresult = DllCall("user32.dll", "int", "SetWindowRgn", "hwnd", $hwnd, "handle", $hrgn, "bool", $bredraw)
  3722.         If @error Then Return SetError(@error, @extended, False)
  3723.         Return $aresult[0]
  3724.     EndFunc
  3725.  
  3726.     Func _winapi_setwindowshookex($idhook, $lpfn, $hmod, $dwthreadid = 0)
  3727.         Local $aresult = DllCall("user32.dll", "handle", "SetWindowsHookEx", "int", $idhook, "ptr", $lpfn, "handle", $hmod, "dword", $dwthreadid)
  3728.         If @error Then Return SetError(@error, @extended, 0)
  3729.         Return $aresult[0]
  3730.     EndFunc
  3731.  
  3732.     Func _winapi_setwindowtext($hwnd, $stext)
  3733.         Local $aresult = DllCall("user32.dll", "bool", "SetWindowTextW", "hwnd", $hwnd, "wstr", $stext)
  3734.         If @error Then Return SetError(@error, @extended, False)
  3735.         Return $aresult[0]
  3736.     EndFunc
  3737.  
  3738.     Func _winapi_showcursor($fshow)
  3739.         Local $aresult = DllCall("user32.dll", "int", "ShowCursor", "bool", $fshow)
  3740.         If @error Then Return SetError(@error, @extended, 0)
  3741.         Return $aresult[0]
  3742.     EndFunc
  3743.  
  3744.     Func _winapi_showerror($stext, $fexit = True)
  3745.         _winapi_msgbox(266256, "Error", $stext)
  3746.         If $fexit Then Exit
  3747.     EndFunc
  3748.  
  3749.     Func _winapi_showmsg($stext)
  3750.         _winapi_msgbox(64 + 4096, "Information", $stext)
  3751.     EndFunc
  3752.  
  3753.     Func _winapi_showwindow($hwnd, $icmdshow = 5)
  3754.         Local $aresult = DllCall("user32.dll", "bool", "ShowWindow", "hwnd", $hwnd, "int", $icmdshow)
  3755.         If @error Then Return SetError(@error, @extended, False)
  3756.         Return $aresult[0]
  3757.     EndFunc
  3758.  
  3759.     Func _winapi_stringfromguid($pguid)
  3760.         Local $aresult = DllCall("ole32.dll", "int", "StringFromGUID2", "ptr", $pguid, "wstr", "", "int", 40)
  3761.         If @error Then Return SetError(@error, @extended, "")
  3762.         Return SetExtended($aresult[0], $aresult[2])
  3763.     EndFunc
  3764.  
  3765.     Func _winapi_sublangid($lgid)
  3766.         Return BitShift($lgid, 10)
  3767.     EndFunc
  3768.  
  3769.     Func _winapi_systemparametersinfo($iaction, $iparam = 0, $vparam = 0, $iwinini = 0)
  3770.         Local $aresult = DllCall("user32.dll", "bool", "SystemParametersInfoW", "uint", $iaction, "uint", $iparam, "ptr", $vparam, "uint", $iwinini)
  3771.         If @error Then Return SetError(@error, @extended, False)
  3772.         Return $aresult[0]
  3773.     EndFunc
  3774.  
  3775.     Func _winapi_twipsperpixelx()
  3776.         Local $lngdc, $twipsperpixelx
  3777.         $lngdc = _winapi_getdc(0)
  3778.         $twipsperpixelx = 1440 / _winapi_getdevicecaps($lngdc, $__winapiconstant_logpixelsx)
  3779.         _winapi_releasedc(0, $lngdc)
  3780.         Return $twipsperpixelx
  3781.     EndFunc
  3782.  
  3783.     Func _winapi_twipsperpixely()
  3784.         Local $lngdc, $twipsperpixely
  3785.         $lngdc = _winapi_getdc(0)
  3786.         $twipsperpixely = 1440 / _winapi_getdevicecaps($lngdc, $__winapiconstant_logpixelsy)
  3787.         _winapi_releasedc(0, $lngdc)
  3788.         Return $twipsperpixely
  3789.     EndFunc
  3790.  
  3791.     Func _winapi_unhookwindowshookex($hhk)
  3792.         Local $aresult = DllCall("user32.dll", "bool", "UnhookWindowsHookEx", "handle", $hhk)
  3793.         If @error Then Return SetError(@error, @extended, False)
  3794.         Return $aresult[0]
  3795.     EndFunc
  3796.  
  3797.     Func _winapi_updatelayeredwindow($hwnd, $hdcdest, $pptdest, $psize, $hdcsrce, $pptsrce, $irgb, $pblend, $iflags)
  3798.         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)
  3799.         If @error Then Return SetError(@error, @extended, False)
  3800.         Return $aresult[0]
  3801.     EndFunc
  3802.  
  3803.     Func _winapi_updatewindow($hwnd)
  3804.         Local $aresult = DllCall("user32.dll", "bool", "UpdateWindow", "hwnd", $hwnd)
  3805.         If @error Then Return SetError(@error, @extended, False)
  3806.         Return $aresult[0]
  3807.     EndFunc
  3808.  
  3809.     Func _winapi_waitforinputidle($hprocess, $itimeout = -1)
  3810.         Local $aresult = DllCall("user32.dll", "dword", "WaitForInputIdle", "handle", $hprocess, "dword", $itimeout)
  3811.         If @error Then Return SetError(@error, @extended, False)
  3812.         Return $aresult[0]
  3813.     EndFunc
  3814.  
  3815.     Func _winapi_waitformultipleobjects($icount, $phandles, $fwaitall = False, $itimeout = -1)
  3816.         Local $aresult = DllCall("kernel32.dll", "INT", "WaitForMultipleObjects", "dword", $icount, "ptr", $phandles, "bool", $fwaitall, "dword", $itimeout)
  3817.         If @error Then Return SetError(@error, @extended, -1)
  3818.         Return $aresult[0]
  3819.     EndFunc
  3820.  
  3821.     Func _winapi_waitforsingleobject($hhandle, $itimeout = -1)
  3822.         Local $aresult = DllCall("kernel32.dll", "INT", "WaitForSingleObject", "handle", $hhandle, "dword", $itimeout)
  3823.         If @error Then Return SetError(@error, @extended, -1)
  3824.         Return $aresult[0]
  3825.     EndFunc
  3826.  
  3827.     Func _winapi_widechartomultibyte($punicode, $icodepage = 0, $bretstring = True)
  3828.         Local $sunicodetype = "ptr"
  3829.         If IsDllStruct($punicode) Then
  3830.             $punicode = DllStructGetPtr($punicode)
  3831.         Else
  3832.             If NOT IsPtr($punicode) Then $sunicodetype = "wstr"
  3833.         EndIf
  3834.         Local $aresult = DllCall("kernel32.dll", "int", "WideCharToMultiByte", "uint", $icodepage, "dword", 0, $sunicodetype, $punicode, "int", -1, "ptr", 0, "int", 0, "ptr", 0, "ptr", 0)
  3835.         If @error Then Return SetError(@error, @extended, "")
  3836.         Local $tmultibyte = DllStructCreate("char[" & $aresult[0] & "]")
  3837.         Local $pmultibyte = DllStructGetPtr($tmultibyte)
  3838.         $aresult = DllCall("kernel32.dll", "int", "WideCharToMultiByte", "uint", $icodepage, "dword", 0, $sunicodetype, $punicode, "int", -1, "ptr", $pmultibyte, "int", $aresult[0], "ptr", 0, "ptr", 0)
  3839.         If @error Then Return SetError(@error, @extended, "")
  3840.         If $bretstring Then Return DllStructGetData($tmultibyte, 1)
  3841.         Return $tmultibyte
  3842.     EndFunc
  3843.  
  3844.     Func _winapi_windowfrompoint(ByRef $tpoint)
  3845.         Local $tpointcast = DllStructCreate("int64", DllStructGetPtr($tpoint))
  3846.         Local $aresult = DllCall("user32.dll", "hwnd", "WindowFromPoint", "int64", DllStructGetData($tpointcast, 1))
  3847.         If @error Then Return SetError(@error, @extended, 0)
  3848.         Return $aresult[0]
  3849.     EndFunc
  3850.  
  3851.     Func _winapi_writeconsole($hconsole, $stext)
  3852.         Local $aresult = DllCall("kernel32.dll", "bool", "WriteConsoleW", "handle", $hconsole, "wstr", $stext, "dword", StringLen($stext), "dword*", 0, "ptr", 0)
  3853.         If @error Then Return SetError(@error, @extended, False)
  3854.         Return $aresult[0]
  3855.     EndFunc
  3856.  
  3857.     Func _winapi_writefile($hfile, $pbuffer, $itowrite, ByRef $iwritten, $poverlapped = 0)
  3858.         Local $aresult = DllCall("kernel32.dll", "bool", "WriteFile", "handle", $hfile, "ptr", $pbuffer, "dword", $itowrite, "dword*", 0, "ptr", $poverlapped)
  3859.         If @error Then Return SetError(@error, @extended, False)
  3860.         $iwritten = $aresult[4]
  3861.         Return $aresult[0]
  3862.     EndFunc
  3863.  
  3864.     Func _winapi_writeprocessmemory($hprocess, $pbaseaddress, $pbuffer, $isize, ByRef $iwritten, $sbuffer = "ptr")
  3865.         Local $aresult = DllCall("kernel32.dll", "bool", "WriteProcessMemory", "handle", $hprocess, "ptr", $pbaseaddress, $sbuffer, $pbuffer, "ulong_ptr", $isize, "ulong_ptr*", 0)
  3866.         If @error Then Return SetError(@error, @extended, False)
  3867.         $iwritten = $aresult[5]
  3868.         Return $aresult[0]
  3869.     EndFunc
  3870.  
  3871.     Global $ghgdipbrush = 0
  3872.     Global $ghgdipdll = 0
  3873.     Global $ghgdippen = 0
  3874.     Global $gigdipref = 0
  3875.     Global $gigdiptoken = 0
  3876.  
  3877.     Func _gdiplus_arrowcapcreate($fheight, $fwidth, $bfilled = True)
  3878.         Local $aresult = DllCall($ghgdipdll, "int", "GdipCreateAdjustableArrowCap", "float", $fheight, "float", $fwidth, "bool", $bfilled, "ptr*", 0)
  3879.         If @error Then Return SetError(@error, @extended, 0)
  3880.         Return SetExtended($aresult[0], $aresult[4])
  3881.     EndFunc
  3882.  
  3883.     Func _gdiplus_arrowcapdispose($hcap)
  3884.         Local $aresult = DllCall($ghgdipdll, "int", "GdipDeleteCustomLineCap", "handle", $hcap)
  3885.         If @error Then Return SetError(@error, @extended, False)
  3886.         Return $aresult[0] = 0
  3887.     EndFunc
  3888.  
  3889.     Func _gdiplus_arrowcapgetfillstate($harrowcap)
  3890.         Local $aresult = DllCall($ghgdipdll, "int", "GdipGetAdjustableArrowCapFillState", "handle", $harrowcap, "bool*", 0)
  3891.         If @error Then Return SetError(@error, @extended, False)
  3892.         Return $aresult[0] = 0
  3893.     EndFunc
  3894.  
  3895.     Func _gdiplus_arrowcapgetheight($harrowcap)
  3896.         Local $aresult = DllCall($ghgdipdll, "int", "GdipGetAdjustableArrowCapHeight", "handle", $harrowcap, "float*", 0)
  3897.         If @error Then Return SetError(@error, @extended, 0)
  3898.         Return SetExtended($aresult[0], $aresult[2])
  3899.     EndFunc
  3900.  
  3901.     Func _gdiplus_arrowcapgetmiddleinset($harrowcap)
  3902.         Local $aresult = DllCall($ghgdipdll, "int", "GdipGetAdjustableArrowCapMiddleInset", "handle", $harrowcap, "float*", 0)
  3903.         If @error Then Return SetError(@error, @extended, 0)
  3904.         Return SetExtended($aresult[0], $aresult[2])
  3905.     EndFunc
  3906.  
  3907.     Func _gdiplus_arrowcapgetwidth($harrowcap)
  3908.         Local $aresult = DllCall($ghgdipdll, "int", "GdipGetAdjustableArrowCapWidth", "handle", $harrowcap, "float*", 0)
  3909.         If @error Then Return SetError(@error, @extended, 0)
  3910.         Return SetExtended($aresult[0], $aresult[2])
  3911.     EndFunc
  3912.  
  3913.     Func _gdiplus_arrowcapsetfillstate($harrowcap, $bfilled = True)
  3914.         Local $aresult = DllCall($ghgdipdll, "int", "GdipSetAdjustableArrowCapFillState", "handle", $harrowcap, "bool", $bfilled)
  3915.         If @error Then Return SetError(@error, @extended, False)
  3916.         Return $aresult[0] = 0
  3917.     EndFunc
  3918.  
  3919.     Func _gdiplus_arrowcapsetheight($harrowcap, $fheight)
  3920.         Local $aresult = DllCall($ghgdipdll, "int", "GdipSetAdjustableArrowCapHeight", "handle", $harrowcap, "float", $fheight)
  3921.         If @error Then Return SetError(@error, @extended, False)
  3922.         Return $aresult[0] = 0
  3923.     EndFunc
  3924.  
  3925.     Func _gdiplus_arrowcapsetmiddleinset($harrowcap, $finset)
  3926.         Local $aresult = DllCall($ghgdipdll, "int", "GdipSetAdjustableArrowCapMiddleInset", "handle", $harrowcap, "float", $finset)
  3927.         If @error Then Return SetError(@error, @extended, False)
  3928.         Return $aresult[0] = 0
  3929.     EndFunc
  3930.  
  3931.     Func _gdiplus_arrowcapsetwidth($harrowcap, $fwidth)
  3932.         Local $aresult = DllCall($ghgdipdll, "int", "GdipSetAdjustableArrowCapWidth", "handle", $harrowcap, "float", $fwidth)
  3933.         If @error Then Return SetError(@error, @extended, False)
  3934.         Return $aresult[0] = 0
  3935.     EndFunc
  3936.  
  3937.     Func _gdiplus_bitmapclonearea($hbmp, $ileft, $itop, $iwidth, $iheight, $iformat = 137224)
  3938.         Local $aresult = DllCall($ghgdipdll, "int", "GdipCloneBitmapAreaI", "int", $ileft, "int", $itop, "int", $iwidth, "int", $iheight, "int", $iformat, "handle", $hbmp, "ptr*", 0)
  3939.         If @error Then Return SetError(@error, @extended, 0)
  3940.         Return SetExtended($aresult[0], $aresult[7])
  3941.     EndFunc
  3942.  
  3943.     Func _gdiplus_bitmapcreatefromfile($sfilename)
  3944.         Local $aresult = DllCall($ghgdipdll, "int", "GdipCreateBitmapFromFile", "wstr", $sfilename, "ptr*", 0)
  3945.         If @error Then Return SetError(@error, @extended, 0)
  3946.         Return SetExtended($aresult[0], $aresult[2])
  3947.     EndFunc
  3948.  
  3949.     Func _gdiplus_bitmapcreatefromgraphics($iwidth, $iheight, $hgraphics)
  3950.         Local $aresult = DllCall($ghgdipdll, "int", "GdipCreateBitmapFromGraphics", "int", $iwidth, "int", $iheight, "handle", $hgraphics, "ptr*", 0)
  3951.         If @error Then Return SetError(@error, @extended, 0)
  3952.         Return SetExtended($aresult[0], $aresult[4])
  3953.     EndFunc
  3954.  
  3955.     Func _gdiplus_bitmapcreatefromhbitmap($hbmp, $hpal = 0)
  3956.         Local $aresult = DllCall($ghgdipdll, "int", "GdipCreateBitmapFromHBITMAP", "handle", $hbmp, "handle", $hpal, "ptr*", 0)
  3957.         If @error Then Return SetError(@error, @extended, 0)
  3958.         Return SetExtended($aresult[0], $aresult[3])
  3959.     EndFunc
  3960.  
  3961.     Func _gdiplus_bitmapcreatehbitmapfrombitmap($hbitmap, $iargb = -16777216)
  3962.         Local $aresult = DllCall($ghgdipdll, "int", "GdipCreateHBITMAPFromBitmap", "handle", $hbitmap, "ptr*", 0, "dword", $iargb)
  3963.         If @error Then Return SetError(@error, @extended, 0)
  3964.         Return SetExtended($aresult[0], $aresult[2])
  3965.     EndFunc
  3966.  
  3967.     Func _gdiplus_bitmapdispose($hbitmap)
  3968.         Local $aresult = DllCall($ghgdipdll, "int", "GdipDisposeImage", "handle", $hbitmap)
  3969.         If @error Then Return SetError(@error, @extended, False)
  3970.         Return $aresult[0] = 0
  3971.     EndFunc
  3972.  
  3973.     Func _gdiplus_bitmaplockbits($hbitmap, $ileft, $itop, $iwidth, $iheight, $iflags = $gdip_ilmread, $iformat = $gdip_pxf32rgb)
  3974.         Local $tdata = DllStructCreate($taggdipbitmapdata)
  3975.         Local $pdata = DllStructGetPtr($tdata)
  3976.         Local $trect = DllStructCreate($tagrect)
  3977.         Local $prect = DllStructGetPtr($trect)
  3978.         DllStructSetData($trect, "Left", $ileft)
  3979.         DllStructSetData($trect, "Top", $itop)
  3980.         DllStructSetData($trect, "Right", $iwidth)
  3981.         DllStructSetData($trect, "Bottom", $iheight)
  3982.         Local $aresult = DllCall($ghgdipdll, "int", "GdipBitmapLockBits", "handle", $hbitmap, "ptr", $prect, "uint", $iflags, "int", $iformat, "ptr", $pdata)
  3983.         If @error Then Return SetError(@error, @extended, 0)
  3984.         Return SetExtended($aresult[0], $tdata)
  3985.     EndFunc
  3986.  
  3987.     Func _gdiplus_bitmapunlockbits($hbitmap, $tbitmapdata)
  3988.         Local $aresult = DllCall($ghgdipdll, "int", "GdipBitmapUnlockBits", "handle", $hbitmap, "ptr", DllStructGetPtr($tbitmapdata))
  3989.         If @error Then Return SetError(@error, @extended, False)
  3990.         Return $aresult[0] = 0
  3991.     EndFunc
  3992.  
  3993.     Func _gdiplus_brushclone($hbrush)
  3994.         Local $aresult = DllCall($ghgdipdll, "int", "GdipCloneBrush", "handle", $hbrush, "ptr*", 0)
  3995.         If @error Then Return SetError(@error, @extended, 0)
  3996.         Return SetExtended($aresult[0], $aresult[2])
  3997.     EndFunc
  3998.  
  3999.     Func _gdiplus_brushcreatesolid($iargb = -16777216)
  4000.         Local $aresult = DllCall($ghgdipdll, "int", "GdipCreateSolidFill", "int", $iargb, "dword*", 0)
  4001.         If @error Then Return SetError(@error, @extended, 0)
  4002.         Return SetExtended($aresult[0], $aresult[2])
  4003.     EndFunc
  4004.  
  4005.     Func _gdiplus_brushdispose($hbrush)
  4006.         Local $aresult = DllCall($ghgdipdll, "int", "GdipDeleteBrush", "handle", $hbrush)
  4007.         If @error Then Return SetError(@error, @extended, False)
  4008.         Return $aresult[0] = 0
  4009.     EndFunc
  4010.  
  4011.     Func _gdiplus_brushgetsolidcolor($hbrush)
  4012.         Local $aresult = DllCall($ghgdipdll, "int", "GdipGetSolidFillColor", "handle", $hbrush, "dword*", 0)
  4013.         If @error Then Return SetError(@error, @extended, -1)
  4014.         Return SetExtended($aresult[0], $aresult[2])
  4015.     EndFunc
  4016.  
  4017.     Func _gdiplus_brushgettype($hbrush)
  4018.         Local $aresult = DllCall($ghgdipdll, "int", "GdipGetBrushType", "handle", $hbrush, "int*", 0)
  4019.         If @error Then Return SetError(@error, @extended, -1)
  4020.         Return SetExtended($aresult[0], $aresult[2])
  4021.     EndFunc
  4022.  
  4023.     Func _gdiplus_brushsetsolidcolor($hbrush, $iargb = -16777216)
  4024.         Local $aresult = DllCall($ghgdipdll, "int", "GdipSetSolidFillColor", "handle", $hbrush, "dword", $iargb)
  4025.         If @error Then Return SetError(@error, @extended, 0)
  4026.         Return $aresult[0] = 0
  4027.     EndFunc
  4028.  
  4029.     Func _gdiplus_customlinecapdispose($hcap)
  4030.         Local $aresult = DllCall($ghgdipdll, "int", "GdipDeleteCustomLineCap", "handle", $hcap)
  4031.         If @error Then Return SetError(@error, @extended, False)
  4032.         Return $aresult[0] = 0
  4033.     EndFunc
  4034.  
  4035.     Func _gdiplus_decoders()
  4036.         Local $icount = _gdiplus_decodersgetcount()
  4037.         Local $isize = _gdiplus_decodersgetsize()
  4038.         Local $tbuffer = DllStructCreate("byte[" & $isize & "]")
  4039.         Local $pbuffer = DllStructGetPtr($tbuffer)
  4040.         Local $aresult = DllCall($ghgdipdll, "int", "GdipGetImageDecoders", "uint", $icount, "uint", $isize, "ptr", $pbuffer)
  4041.         If @error Then Return SetError(@error, @extended, 0)
  4042.         If $aresult[0] <> 0 Then Return SetError($aresult[0], 0, 0)
  4043.         Local $tcodec, $ainfo[$icount + 1][14]
  4044.         $ainfo[0][0] = $icount
  4045.         For $ii = 1 To $icount
  4046.             $tcodec = DllStructCreate($taggdipimagecodecinfo, $pbuffer)
  4047.             $ainfo[$ii][1] = _winapi_stringfromguid(DllStructGetPtr($tcodec, "CLSID"))
  4048.             $ainfo[$ii][2] = _winapi_stringfromguid(DllStructGetPtr($tcodec, "FormatID"))
  4049.             $ainfo[$ii][3] = _winapi_widechartomultibyte(DllStructGetData($tcodec, "CodecName"))
  4050.             $ainfo[$ii][4] = _winapi_widechartomultibyte(DllStructGetData($tcodec, "DllName"))
  4051.             $ainfo[$ii][5] = _winapi_widechartomultibyte(DllStructGetData($tcodec, "FormatDesc"))
  4052.             $ainfo[$ii][6] = _winapi_widechartomultibyte(DllStructGetData($tcodec, "FileExt"))
  4053.             $ainfo[$ii][7] = _winapi_widechartomultibyte(DllStructGetData($tcodec, "MimeType"))
  4054.             $ainfo[$ii][8] = DllStructGetData($tcodec, "Flags")
  4055.             $ainfo[$ii][9] = DllStructGetData($tcodec, "Version")
  4056.             $ainfo[$ii][10] = DllStructGetData($tcodec, "SigCount")
  4057.             $ainfo[$ii][11] = DllStructGetData($tcodec, "SigSize")
  4058.             $ainfo[$ii][12] = DllStructGetData($tcodec, "SigPattern")
  4059.             $ainfo[$ii][13] = DllStructGetData($tcodec, "SigMask")
  4060.             $pbuffer += DllStructGetSize($tcodec)
  4061.         Next
  4062.         Return $ainfo
  4063.     EndFunc
  4064.  
  4065.     Func _gdiplus_decodersgetcount()
  4066.         Local $aresult = DllCall($ghgdipdll, "int", "GdipGetImageDecodersSize", "uint*", 0, "uint*", 0)
  4067.         If @error Then Return SetError(@error, @extended, -1)
  4068.         Return SetExtended($aresult[0], $aresult[1])
  4069.     EndFunc
  4070.  
  4071.     Func _gdiplus_decodersgetsize()
  4072.         Local $aresult = DllCall($ghgdipdll, "int", "GdipGetImageDecodersSize", "uint*", 0, "uint*", 0)
  4073.         If @error Then Return SetError(@error, @extended, -1)
  4074.         Return SetExtended($aresult[0], $aresult[2])
  4075.     EndFunc
  4076.  
  4077.     Func _gdiplus_drawimagepoints($hgraphic, $himage, $nulx, $nuly, $nurx, $nury, $nllx, $nlly, $count = 3)
  4078.         Local $tpoint = DllStructCreate("float X;float Y;float X2;float Y2;float X3;float Y3")
  4079.         DllStructSetData($tpoint, "X", $nulx)
  4080.         DllStructSetData($tpoint, "Y", $nuly)
  4081.         DllStructSetData($tpoint, "X2", $nurx)
  4082.         DllStructSetData($tpoint, "Y2", $nury)
  4083.         DllStructSetData($tpoint, "X3", $nllx)
  4084.         DllStructSetData($tpoint, "Y3", $nlly)
  4085.         Local $ppoint = DllStructGetPtr($tpoint)
  4086.         Local $aresult = DllCall($ghgdipdll, "int", "GdipDrawImagePoints", "handle", $hgraphic, "handle", $himage, "ptr", $ppoint, "int", $count)
  4087.         If @error Then Return SetError(@error, @extended, False)
  4088.         Return $aresult[0] = 0
  4089.     EndFunc
  4090.  
  4091.     Func _gdiplus_encoders()
  4092.         Local $icount = _gdiplus_encodersgetcount()
  4093.         Local $isize = _gdiplus_encodersgetsize()
  4094.         Local $tbuffer = DllStructCreate("byte[" & $isize & "]")
  4095.         Local $pbuffer = DllStructGetPtr($tbuffer)
  4096.         Local $aresult = DllCall($ghgdipdll, "int", "GdipGetImageEncoders", "uint", $icount, "uint", $isize, "ptr", $pbuffer)
  4097.         If @error Then Return SetError(@error, @extended, 0)
  4098.         If $aresult[0] <> 0 Then Return SetError($aresult[0], 0, 0)
  4099.         Local $tcodec, $ainfo[$icount + 1][14]
  4100.         $ainfo[0][0] = $icount
  4101.         For $ii = 1 To $icount
  4102.             $tcodec = DllStructCreate($taggdipimagecodecinfo, $pbuffer)
  4103.             $ainfo[$ii][1] = _winapi_stringfromguid(DllStructGetPtr($tcodec, "CLSID"))
  4104.             $ainfo[$ii][2] = _winapi_stringfromguid(DllStructGetPtr($tcodec, "FormatID"))
  4105.             $ainfo[$ii][3] = _winapi_widechartomultibyte(DllStructGetData($tcodec, "CodecName"))
  4106.             $ainfo[$ii][4] = _winapi_widechartomultibyte(DllStructGetData($tcodec, "DllName"))
  4107.             $ainfo[$ii][5] = _winapi_widechartomultibyte(DllStructGetData($tcodec, "FormatDesc"))
  4108.             $ainfo[$ii][6] = _winapi_widechartomultibyte(DllStructGetData($tcodec, "FileExt"))
  4109.             $ainfo[$ii][7] = _winapi_widechartomultibyte(DllStructGetData($tcodec, "MimeType"))
  4110.             $ainfo[$ii][8] = DllStructGetData($tcodec, "Flags")
  4111.             $ainfo[$ii][9] = DllStructGetData($tcodec, "Version")
  4112.             $ainfo[$ii][10] = DllStructGetData($tcodec, "SigCount")
  4113.             $ainfo[$ii][11] = DllStructGetData($tcodec, "SigSize")
  4114.             $ainfo[$ii][12] = DllStructGetData($tcodec, "SigPattern")
  4115.             $ainfo[$ii][13] = DllStructGetData($tcodec, "SigMask")
  4116.             $pbuffer += DllStructGetSize($tcodec)
  4117.         Next
  4118.         Return $ainfo
  4119.     EndFunc
  4120.  
  4121.     Func _gdiplus_encodersgetclsid($sfileext)
  4122.         Local $aencoders = _gdiplus_encoders()
  4123.         For $ii = 1 To $aencoders[0][0]
  4124.             If StringInStr($aencoders[$ii][6], "*." & $sfileext) > 0 Then Return $aencoders[$ii][1]
  4125.         Next
  4126.         Return SetError(-1, -1, "")
  4127.     EndFunc
  4128.  
  4129.     Func _gdiplus_encodersgetcount()
  4130.         Local $aresult = DllCall($ghgdipdll, "int", "GdipGetImageEncodersSize", "uint*", 0, "uint*", 0)
  4131.         If @error Then Return SetError(@error, @extended, -1)
  4132.         Return SetExtended($aresult[0], $aresult[1])
  4133.     EndFunc
  4134.  
  4135.     Func _gdiplus_encodersgetparamlist($himage, $sencoder)
  4136.         Local $isize = _gdiplus_encodersgetparamlistsize($himage, $sencoder)
  4137.         If @error Then Return SetError(@error, -1, 0)
  4138.         Local $tguid = _winapi_guidfromstring($sencoder)
  4139.         Local $pguid = DllStructGetPtr($tguid)
  4140.         Local $tbuffer = DllStructCreate("dword Count;byte Params[" & $isize - 4 & "]")
  4141.         Local $pbuffer = DllStructGetPtr($tbuffer)
  4142.         Local $aresult = DllCall($ghgdipdll, "int", "GdipGetEncoderParameterList", "handle", $himage, "ptr", $pguid, "uint", $isize, "ptr", $pbuffer)
  4143.         If @error Then Return SetError(@error, @extended, 0)
  4144.         Return SetExtended($aresult[0], $tbuffer)
  4145.     EndFunc
  4146.  
  4147.     Func _gdiplus_encodersgetparamlistsize($himage, $sencoder)
  4148.         Local $tguid = _winapi_guidfromstring($sencoder)
  4149.         Local $pguid = DllStructGetPtr($tguid)
  4150.         Local $aresult = DllCall($ghgdipdll, "int", "GdipGetEncoderParameterListSize", "handle", $himage, "ptr", $pguid, "uint*", 0)
  4151.         If @error Then Return SetError(@error, @extended, 0)
  4152.         Return SetExtended($aresult[0], $aresult[3])
  4153.     EndFunc
  4154.  
  4155.     Func _gdiplus_encodersgetsize()
  4156.         Local $aresult = DllCall($ghgdipdll, "int", "GdipGetImageEncodersSize", "uint*", 0, "uint*", 0)
  4157.         If @error Then Return SetError(@error, @extended, -1)
  4158.         Return SetExtended($aresult[0], $aresult[2])
  4159.     EndFunc
  4160.  
  4161.     Func _gdiplus_fontcreate($hfamily, $fsize, $istyle = 0, $iunit = 3)
  4162.         Local $aresult = DllCall($ghgdipdll, "int", "GdipCreateFont", "handle", $hfamily, "float", $fsize, "int", $istyle, "int", $iunit, "ptr*", 0)
  4163.         If @error Then Return SetError(@error, @extended, 0)
  4164.         Return SetExtended($aresult[0], $aresult[5])
  4165.     EndFunc
  4166.  
  4167.     Func _gdiplus_fontdispose($hfont)
  4168.         Local $aresult = DllCall($ghgdipdll, "int", "GdipDeleteFont", "handle", $hfont)
  4169.         If @error Then Return SetError(@error, @extended, False)
  4170.         Return $aresult[0] = 0
  4171.     EndFunc
  4172.  
  4173.     Func _gdiplus_fontfamilycreate($sfamily)
  4174.         Local $aresult = DllCall($ghgdipdll, "int", "GdipCreateFontFamilyFromName", "wstr", $sfamily, "ptr", 0, "handle*", 0)
  4175.         If @error Then Return SetError(@error, @extended, 0)
  4176.         Return SetExtended($aresult[0], $aresult[3])
  4177.     EndFunc
  4178.  
  4179.     Func _gdiplus_fontfamilydispose($hfamily)
  4180.         Local $aresult = DllCall($ghgdipdll, "int", "GdipDeleteFontFamily", "handle", $hfamily)
  4181.         If @error Then Return SetError(@error, @extended, False)
  4182.         Return $aresult[0] = 0
  4183.     EndFunc
  4184.  
  4185.     Func _gdiplus_graphicsclear($hgraphics, $iargb = -16777216)
  4186.         Local $aresult = DllCall($ghgdipdll, "int", "GdipGraphicsClear", "handle", $hgraphics, "dword", $iargb)
  4187.         If @error Then Return SetError(@error, @extended, False)
  4188.         Return $aresult[0] = 0
  4189.     EndFunc
  4190.  
  4191.     Func _gdiplus_graphicscreatefromhdc($hdc)
  4192.         Local $aresult = DllCall($ghgdipdll, "int", "GdipCreateFromHDC", "handle", $hdc, "ptr*", 0)
  4193.         If @error Then Return SetError(@error, @extended, 0)
  4194.         Return SetExtended($aresult[0], $aresult[2])
  4195.     EndFunc
  4196.  
  4197.     Func _gdiplus_graphicscreatefromhwnd($hwnd)
  4198.         Local $aresult = DllCall($ghgdipdll, "int", "GdipCreateFromHWND", "hwnd", $hwnd, "ptr*", 0)
  4199.         If @error Then Return SetError(@error, @extended, 0)
  4200.         Return SetExtended($aresult[0], $aresult[2])
  4201.     EndFunc
  4202.  
  4203.     Func _gdiplus_graphicsdispose($hgraphics)
  4204.         Local $aresult = DllCall($ghgdipdll, "int", "GdipDeleteGraphics", "handle", $hgraphics)
  4205.         If @error Then Return SetError(@error, @extended, False)
  4206.         Return $aresult[0] = 0
  4207.     EndFunc
  4208.  
  4209.     Func _gdiplus_graphicsdrawarc($hgraphics, $ix, $iy, $iwidth, $iheight, $fstartangle, $fsweepangle, $hpen = 0)
  4210.         __gdiplus_pendefcreate($hpen)
  4211.         Local $aresult = DllCall($ghgdipdll, "int", "GdipDrawArcI", "handle", $hgraphics, "handle", $hpen, "int", $ix, "int", $iy, "int", $iwidth, "int", $iheight, "float", $fstartangle, "float", $fsweepangle)
  4212.         Local $tmperror = @error, $tmpextended = @extended
  4213.         __gdiplus_pendefdispose()
  4214.         If $tmperror Then Return SetError($tmperror, $tmpextended, False)
  4215.         Return $aresult[0] = 0
  4216.     EndFunc
  4217.  
  4218.     Func _gdiplus_graphicsdrawbezier($hgraphics, $ix1, $iy1, $ix2, $iy2, $ix3, $iy3, $ix4, $iy4, $hpen = 0)
  4219.         __gdiplus_pendefcreate($hpen)
  4220.         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)
  4221.         Local $tmperror = @error, $tmpextended = @extended
  4222.         __gdiplus_pendefdispose()
  4223.         If $tmperror Then Return SetError($tmperror, $tmpextended, False)
  4224.         Return $aresult[0] = 0
  4225.     EndFunc
  4226.  
  4227.     Func _gdiplus_graphicsdrawclosedcurve($hgraphics, $apoints, $hpen = 0)
  4228.         Local $icount = $apoints[0][0]
  4229.         Local $tpoints = DllStructCreate("long[" & $icount * 2 & "]")
  4230.         Local $ppoints = DllStructGetPtr($tpoints)
  4231.         For $ii = 1 To $icount
  4232.             DllStructSetData($tpoints, 1, $apoints[$ii][0], (($ii - 1) * 2) + 1)
  4233.             DllStructSetData($tpoints, 1, $apoints[$ii][1], (($ii - 1) * 2) + 2)
  4234.         Next
  4235.         __gdiplus_pendefcreate($hpen)
  4236.         Local $aresult = DllCall($ghgdipdll, "int", "GdipDrawClosedCurveI", "handle", $hgraphics, "handle", $hpen, "ptr", $ppoints, "int", $icount)
  4237.         Local $tmperror = @error, $tmpextended = @extended
  4238.         __gdiplus_pendefdispose()
  4239.         If $tmperror Then Return SetError($tmperror, $tmpextended, False)
  4240.         Return $aresult[0] = 0
  4241.     EndFunc
  4242.  
  4243.     Func _gdiplus_graphicsdrawcurve($hgraphics, $apoints, $hpen = 0)
  4244.         Local $icount = $apoints[0][0]
  4245.         Local $tpoints = DllStructCreate("long[" & $icount * 2 & "]")
  4246.         Local $ppoints = DllStructGetPtr($tpoints)
  4247.         For $ii = 1 To $icount
  4248.             DllStructSetData($tpoints, 1, $apoints[$ii][0], (($ii - 1) * 2) + 1)
  4249.             DllStructSetData($tpoints, 1, $apoints[$ii][1], (($ii - 1) * 2) + 2)
  4250.         Next
  4251.         __gdiplus_pendefcreate($hpen)
  4252.         Local $aresult = DllCall($ghgdipdll, "int", "GdipDrawCurveI", "handle", $hgraphics, "handle", $hpen, "ptr", $ppoints, "int", $icount)
  4253.         Local $tmperror = @error, $tmpextended = @extended
  4254.         __gdiplus_pendefdispose()
  4255.         If $tmperror Then Return SetError($tmperror, $tmpextended, False)
  4256.         Return $aresult[0] = 0
  4257.     EndFunc
  4258.  
  4259.     Func _gdiplus_graphicsdrawellipse($hgraphics, $ix, $iy, $iwidth, $iheight, $hpen = 0)
  4260.         __gdiplus_pendefcreate($hpen)
  4261.         Local $aresult = DllCall($ghgdipdll, "int", "GdipDrawEllipseI", "handle", $hgraphics, "handle", $hpen, "int", $ix, "int", $iy, "int", $iwidth, "int", $iheight)
  4262.         Local $tmperror = @error, $tmpextended = @extended
  4263.         __gdiplus_pendefdispose()
  4264.         If $tmperror Then Return SetError($tmperror, $tmpextended, False)
  4265.         Return $aresult[0] = 0
  4266.     EndFunc
  4267.  
  4268.     Func _gdiplus_graphicsdrawimage($hgraphics, $himage, $ix, $iy)
  4269.         Local $aresult = DllCall($ghgdipdll, "int", "GdipDrawImageI", "handle", $hgraphics, "handle", $himage, "int", $ix, "int", $iy)
  4270.         If @error Then Return SetError(@error, @extended, False)
  4271.         Return $aresult[0] = 0
  4272.     EndFunc
  4273.  
  4274.     Func _gdiplus_graphicsdrawimagerect($hgraphics, $himage, $ix, $iy, $iw, $ih)
  4275.         Local $aresult = DllCall($ghgdipdll, "int", "GdipDrawImageRectI", "handle", $hgraphics, "handle", $himage, "int", $ix, "int", $iy, "int", $iw, "int", $ih)
  4276.         If @error Then Return SetError(@error, @extended, False)
  4277.         Return $aresult[0] = 0
  4278.     EndFunc
  4279.  
  4280.     Func _gdiplus_graphicsdrawimagerectrect($hgraphics, $himage, $isrcx, $isrcy, $isrcwidth, $isrcheight, $idstx, $idsty, $idstwidth, $idstheight, $iunit = 2)
  4281.         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)
  4282.         If @error Then Return SetError(@error, @extended, False)
  4283.         Return $aresult[0] = 0
  4284.     EndFunc
  4285.  
  4286.     Func _gdiplus_graphicsdrawline($hgraphics, $ix1, $iy1, $ix2, $iy2, $hpen = 0)
  4287.         __gdiplus_pendefcreate($hpen)
  4288.         Local $aresult = DllCall($ghgdipdll, "int", "GdipDrawLineI", "handle", $hgraphics, "handle", $hpen, "int", $ix1, "int", $iy1, "int", $ix2, "int", $iy2)
  4289.         Local $tmperror = @error, $tmpextended = @extended
  4290.         __gdiplus_pendefdispose()
  4291.         If $tmperror Then Return SetError($tmperror, $tmpextended, False)
  4292.         Return $aresult[0] = 0
  4293.     EndFunc
  4294.  
  4295.     Func _gdiplus_graphicsdrawpie($hgraphics, $ix, $iy, $iwidth, $iheight, $fstartangle, $fsweepangle, $hpen = 0)
  4296.         __gdiplus_pendefcreate($hpen)
  4297.         Local $aresult = DllCall($ghgdipdll, "int", "GdipDrawPieI", "handle", $hgraphics, "handle", $hpen, "int", $ix, "int", $iy, "int", $iwidth, "int", $iheight, "float", $fstartangle, "float", $fsweepangle)
  4298.         Local $tmperror = @error, $tmpextended = @extended
  4299.         __gdiplus_pendefdispose()
  4300.         If $tmperror Then Return SetError($tmperror, $tmpextended, False)
  4301.         Return $aresult[0] = 0
  4302.     EndFunc
  4303.  
  4304.     Func _gdiplus_graphicsdrawpolygon($hgraphics, $apoints, $hpen = 0)
  4305.         Local $icount = $apoints[0][0]
  4306.         Local $tpoints = DllStructCreate("long[" & $icount * 2 & "]")
  4307.         Local $ppoints = DllStructGetPtr($tpoints)
  4308.         For $ii = 1 To $icount
  4309.             DllStructSetData($tpoints, 1, $apoints[$ii][0], (($ii - 1) * 2) + 1)
  4310.             DllStructSetData($tpoints, 1, $apoints[$ii][1], (($ii - 1) * 2) + 2)
  4311.         Next
  4312.         __gdiplus_pendefcreate($hpen)
  4313.         Local $aresult = DllCall($ghgdipdll, "int", "GdipDrawPolygonI", "handle", $hgraphics, "handle", $hpen, "ptr", $ppoints, "int", $icount)
  4314.         Local $tmperror = @error, $tmpextended = @extended
  4315.         __gdiplus_pendefdispose()
  4316.         If $tmperror Then Return SetError($tmperror, $tmpextended, False)
  4317.         Return $aresult[0] = 0
  4318.     EndFunc
  4319.  
  4320.     Func _gdiplus_graphicsdrawrect($hgraphics, $ix, $iy, $iwidth, $iheight, $hpen = 0)
  4321.         __gdiplus_pendefcreate($hpen)
  4322.         Local $aresult = DllCall($ghgdipdll, "int", "GdipDrawRectangleI", "handle", $hgraphics, "handle", $hpen, "int", $ix, "int", $iy, "int", $iwidth, "int", $iheight)
  4323.         Local $tmperror = @error, $tmpextended = @extended
  4324.         __gdiplus_pendefdispose()
  4325.         If $tmperror Then Return SetError($tmperror, $tmpextended, False)
  4326.         Return $aresult[0] = 0
  4327.     EndFunc
  4328.  
  4329.     Func _gdiplus_graphicsdrawstring($hgraphics, $sstring, $nx, $ny, $sfont = "Arial", $nsize = 10, $iformat = 0)
  4330.         Local $hbrush = _gdiplus_brushcreatesolid()
  4331.         Local $hformat = _gdiplus_stringformatcreate($iformat)
  4332.         Local $hfamily = _gdiplus_fontfamilycreate($sfont)
  4333.         Local $hfont = _gdiplus_fontcreate($hfamily, $nsize)
  4334.         Local $tlayout = _gdiplus_rectfcreate($nx, $ny, 0, 0)
  4335.         Local $ainfo = _gdiplus_graphicsmeasurestring($hgraphics, $sstring, $hfont, $tlayout, $hformat)
  4336.         Local $aresult = _gdiplus_graphicsdrawstringex($hgraphics, $sstring, $hfont, $ainfo[0], $hformat, $hbrush)
  4337.         Local $ierror = @error
  4338.         _gdiplus_fontdispose($hfont)
  4339.         _gdiplus_fontfamilydispose($hfamily)
  4340.         _gdiplus_stringformatdispose($hformat)
  4341.         _gdiplus_brushdispose($hbrush)
  4342.         Return SetError($ierror, 0, $aresult)
  4343.     EndFunc
  4344.  
  4345.     Func _gdiplus_graphicsdrawstringex($hgraphics, $sstring, $hfont, $tlayout, $hformat, $hbrush)
  4346.         Local $playout = DllStructGetPtr($tlayout)
  4347.         Local $aresult = DllCall($ghgdipdll, "int", "GdipDrawString", "handle", $hgraphics, "wstr", $sstring, "int", -1, "handle", $hfont, "ptr", $playout, "handle", $hformat, "handle", $hbrush)
  4348.         If @error Then Return SetError(@error, @extended, False)
  4349.         Return $aresult[0] = 0
  4350.     EndFunc
  4351.  
  4352.     Func _gdiplus_graphicsfillclosedcurve($hgraphics, $apoints, $hbrush = 0)
  4353.         Local $icount = $apoints[0][0]
  4354.         Local $tpoints = DllStructCreate("long[" & $icount * 2 & "]")
  4355.         Local $ppoints = DllStructGetPtr($tpoints)
  4356.         For $ii = 1 To $icount
  4357.             DllStructSetData($tpoints, 1, $apoints[$ii][0], (($ii - 1) * 2) + 1)
  4358.             DllStructSetData($tpoints, 1, $apoints[$ii][1], (($ii - 1) * 2) + 2)
  4359.         Next
  4360.         __gdiplus_brushdefcreate($hbrush)
  4361.         Local $aresult = DllCall($ghgdipdll, "int", "GdipFillClosedCurveI", "handle", $hgraphics, "handle", $hbrush, "ptr", $ppoints, "int", $icount)
  4362.         Local $tmperror = @error, $tmpextended = @extended
  4363.         __gdiplus_brushdefdispose()
  4364.         If $tmperror Then Return SetError($tmperror, $tmpextended, False)
  4365.         Return $aresult[0] = 0
  4366.     EndFunc
  4367.  
  4368.     Func _gdiplus_graphicsfillellipse($hgraphics, $ix, $iy, $iwidth, $iheight, $hbrush = 0)
  4369.         __gdiplus_brushdefcreate($hbrush)
  4370.         Local $aresult = DllCall($ghgdipdll, "int", "GdipFillEllipseI", "handle", $hgraphics, "handle", $hbrush, "int", $ix, "int", $iy, "int", $iwidth, "int", $iheight)
  4371.         Local $tmperror = @error, $tmpextended = @extended
  4372.         __gdiplus_brushdefdispose()
  4373.         If $tmperror Then Return SetError($tmperror, $tmpextended, False)
  4374.         Return $aresult[0] = 0
  4375.     EndFunc
  4376.  
  4377.     Func _gdiplus_graphicsfillpie($hgraphics, $ix, $iy, $iwidth, $iheight, $fstartangle, $fsweepangle, $hbrush = 0)
  4378.         __gdiplus_brushdefcreate($hbrush)
  4379.         Local $aresult = DllCall($ghgdipdll, "int", "GdipFillPieI", "handle", $hgraphics, "handle", $hbrush, "int", $ix, "int", $iy, "int", $iwidth, "int", $iheight, "float", $fstartangle, "float", $fsweepangle)
  4380.         Local $tmperror = @error, $tmpextended = @extended
  4381.         __gdiplus_brushdefdispose()
  4382.         If $tmperror Then Return SetError($tmperror, $tmpextended, False)
  4383.         Return $aresult[0] = 0
  4384.     EndFunc
  4385.  
  4386.     Func _gdiplus_graphicsfillpolygon($hgraphics, $apoints, $hbrush = 0)
  4387.         Local $icount = $apoints[0][0]
  4388.         Local $tpoints = DllStructCreate("long[" & $icount * 2 & "]")
  4389.         Local $ppoints = DllStructGetPtr($tpoints)
  4390.         For $ii = 1 To $icount
  4391.             DllStructSetData($tpoints, 1, $apoints[$ii][0], (($ii - 1) * 2) + 1)
  4392.             DllStructSetData($tpoints, 1, $apoints[$ii][1], (($ii - 1) * 2) + 2)
  4393.         Next
  4394.         __gdiplus_brushdefcreate($hbrush)
  4395.         Local $aresult = DllCall($ghgdipdll, "int", "GdipFillPolygonI", "handle", $hgraphics, "handle", $hbrush, "ptr", $ppoints, "int", $icount, "int", "FillModeAlternate")
  4396.         Local $tmperror = @error, $tmpextended = @extended
  4397.         __gdiplus_brushdefdispose()
  4398.         If $tmperror Then Return SetError($tmperror, $tmpextended, False)
  4399.         Return $aresult[0] = 0
  4400.     EndFunc
  4401.  
  4402.     Func _gdiplus_graphicsfillrect($hgraphics, $ix, $iy, $iwidth, $iheight, $hbrush = 0)
  4403.         __gdiplus_brushdefcreate($hbrush)
  4404.         Local $aresult = DllCall($ghgdipdll, "int", "GdipFillRectangleI", "handle", $hgraphics, "handle", $hbrush, "int", $ix, "int", $iy, "int", $iwidth, "int", $iheight)
  4405.         Local $tmperror = @error, $tmpextended = @extended
  4406.         __gdiplus_brushdefdispose()
  4407.         If $tmperror Then Return SetError($tmperror, $tmpextended, False)
  4408.         Return $aresult[0] = 0
  4409.     EndFunc
  4410.  
  4411.     Func _gdiplus_graphicsgetdc($hgraphics)
  4412.         Local $aresult = DllCall($ghgdipdll, "int", "GdipGetDC", "handle", $hgraphics, "ptr*", 0)
  4413.         If @error Then Return SetError(@error, @extended, False)
  4414.         Return SetExtended($aresult[0], $aresult[2])
  4415.     EndFunc
  4416.  
  4417.     Func _gdiplus_graphicsgetsmoothingmode($hgraphics)
  4418.         Local $aresult = DllCall($ghgdipdll, "int", "GdipGetSmoothingMode", "handle", $hgraphics, "int*", 0)
  4419.         If @error Then Return SetError(@error, @extended, -1)
  4420.         Switch $aresult[2]
  4421.             Case 3
  4422.                 Return SetExtended($aresult[0], 1)
  4423.             Case 7
  4424.                 Return SetExtended($aresult[0], 2)
  4425.             Case Else
  4426.                 Return SetExtended($aresult[0], 0)
  4427.         EndSwitch
  4428.     EndFunc
  4429.  
  4430.     Func _gdiplus_graphicsmeasurestring($hgraphics, $sstring, $hfont, $tlayout, $hformat)
  4431.         Local $playout = DllStructGetPtr($tlayout)
  4432.         Local $trectf = DllStructCreate($taggdiprectf)
  4433.         Local $prectf = DllStructGetPtr($trectf)
  4434.         Local $aresult = DllCall($ghgdipdll, "int", "GdipMeasureString", "handle", $hgraphics, "wstr", $sstring, "int", -1, "handle", $hfont, "ptr", $playout, "handle", $hformat, "ptr", $prectf, "int*", 0, "int*", 0)
  4435.         If @error Then Return SetError(@error, @extended, 0)
  4436.         Local $ainfo[3]
  4437.         $ainfo[0] = $trectf
  4438.         $ainfo[1] = $aresult[8]
  4439.         $ainfo[2] = $aresult[9]
  4440.         Return SetExtended($aresult[0], $ainfo)
  4441.     EndFunc
  4442.  
  4443.     Func _gdiplus_graphicsreleasedc($hgraphics, $hdc)
  4444.         Local $aresult = DllCall($ghgdipdll, "int", "GdipReleaseDC", "handle", $hgraphics, "handle", $hdc)
  4445.         If @error Then Return SetError(@error, @extended, False)
  4446.         Return SetExtended($aresult[0], $aresult[2])
  4447.     EndFunc
  4448.  
  4449.     Func _gdiplus_graphicssettransform($hgraphics, $hmatrix)
  4450.         Local $aresult = DllCall($ghgdipdll, "int", "GdipSetWorldTransform", "handle", $hgraphics, "handle", $hmatrix)
  4451.         If @error Then Return SetError(@error, @extended, False)
  4452.         Return $aresult[0] = 0
  4453.     EndFunc
  4454.  
  4455.     Func _gdiplus_graphicssetsmoothingmode($hgraphics, $ismooth)
  4456.         If $ismooth < 0 OR $ismooth > 4 Then $ismooth = 0
  4457.         Local $aresult = DllCall($ghgdipdll, "int", "GdipSetSmoothingMode", "handle", $hgraphics, "int", $ismooth)
  4458.         If @error Then Return SetError(@error, @extended, False)
  4459.         Return $aresult[0] = 0
  4460.     EndFunc
  4461.  
  4462.     Func _gdiplus_imagedispose($himage)
  4463.         Local $aresult = DllCall($ghgdipdll, "int", "GdipDisposeImage", "handle", $himage)
  4464.         If @error Then Return SetError(@error, @extended, False)
  4465.         Return $aresult[0] = 0
  4466.     EndFunc
  4467.  
  4468.     Func _gdiplus_imagegetflags($himage)
  4469.         Local $aflag[2] = [0, ""]
  4470.         If ($himage = -1) OR (NOT $himage) Then Return SetError(10, 1, $aflag)
  4471.         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]]
  4472.         Local $aresult = DllCall($ghgdipdll, "int", "GdipGetImageFlags", "handle", $himage, "long*", 0)
  4473.         If @error Then Return SetError(@error, 2, $aflag)
  4474.         If $aresult[2] = $gdip_imageflags_none Then
  4475.             $aflag[1] = "No pixel data"
  4476.             Return SetError($aresult[0], 3, $aflag)
  4477.         EndIf
  4478.         $aflag[0] = $aresult[2]
  4479.         For $i = 0 To 12
  4480.             If BitAND($aresult[2], $aimageflags[$i][1]) = $aimageflags[$i][1] Then
  4481.                 If StringLen($aflag[1]) Then $aflag[1] &= "|"
  4482.                 $aresult[2] -= $aimageflags[$i][1]
  4483.                 $aflag[1] &= $aimageflags[$i][0]
  4484.             EndIf
  4485.         Next
  4486.         Return SetExtended($aresult[0], $aflag)
  4487.     EndFunc
  4488.  
  4489.     Func _gdiplus_imagegetgraphicscontext($himage)
  4490.         Local $aresult = DllCall($ghgdipdll, "int", "GdipGetImageGraphicsContext", "handle", $himage, "ptr*", 0)
  4491.         If @error Then Return SetError(@error, @extended, -1)
  4492.         Return SetExtended($aresult[0], $aresult[2])
  4493.     EndFunc
  4494.  
  4495.     Func _gdiplus_imagegetheight($himage)
  4496.         Local $aresult = DllCall($ghgdipdll, "int", "GdipGetImageHeight", "handle", $himage, "uint*", 0)
  4497.         If @error Then Return SetError(@error, @extended, -1)
  4498.         Return SetExtended($aresult[0], $aresult[2])
  4499.     EndFunc
  4500.  
  4501.     Func _gdiplus_imagegethorizontalresolution($himage)
  4502.         If ($himage = -1) OR (NOT $himage) Then Return SetError(10, 1, 0)
  4503.         Local $aresult = DllCall($ghgdipdll, "int", "GdipGetImageHorizontalResolution", "handle", $himage, "float*", 0)
  4504.         If @error Then Return SetError(@error, @extended, 0)
  4505.         Return SetExtended($aresult[0], Round($aresult[2]))
  4506.     EndFunc
  4507.  
  4508.     Func _gdiplus_imagegetpixelformat($himage)
  4509.         Local $aformat[2] = [0, ""]
  4510.         If ($himage = -1) OR (NOT $himage) Then Return SetError(10, 1, $aformat)
  4511.         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]]
  4512.         Local $aresult = DllCall($ghgdipdll, "int", "GdipGetImagePixelFormat", "handle", $himage, "int*", 0)
  4513.         If @error Then Return SetError(@error, @extended, $aformat)
  4514.         For $i = 0 To 13
  4515.             If $apixelformat[$i][1] = $aresult[2] Then
  4516.                 $aformat[0] = $apixelformat[$i][1]
  4517.                 $aformat[1] = $apixelformat[$i][0]
  4518.                 Return SetExtended($aresult[0], $aformat)
  4519.             EndIf
  4520.         Next
  4521.         Return SetExtended($aresult[0], $aformat)
  4522.     EndFunc
  4523.  
  4524.     Func _gdiplus_imagegetrawformat($himage)
  4525.         Local $aguid[2]
  4526.         If ($himage = -1) OR (NOT $himage) Then Return SetError(10, 1, $aguid)
  4527.         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]]
  4528.         Local $tstruc = DllStructCreate("byte[16]")
  4529.         Local $aresult1 = DllCall($ghgdipdll, "int", "GdipGetImageRawFormat", "handle", $himage, "ptr", DllStructGetPtr($tstruc))
  4530.         If @error Then Return SetError(@error, @extended, $aguid)
  4531.         If (NOT IsArray($aresult1)) OR (NOT IsPtr($aresult1[2])) OR (NOT $aresult1[2]) Then Return SetError(1, 3, $aguid)
  4532.         Local $sresult2 = _winapi_stringfromguid($aresult1[2])
  4533.         If @error Then Return SetError(@error, 4, $aguid)
  4534.         For $i = 0 To 10
  4535.             If $aimagetype[$i][1] == $sresult2 Then
  4536.                 $aguid[0] = $aimagetype[$i][1]
  4537.                 $aguid[1] = $aimagetype[$i][0]
  4538.                 Return SetExtended($aresult1[0], $aguid)
  4539.             EndIf
  4540.         Next
  4541.         Return SetError(-1, 5, $aguid)
  4542.     EndFunc
  4543.  
  4544.     Func _gdiplus_imagegettype($himage)
  4545.         If ($himage = -1) OR (NOT $himage) Then Return SetError(10, 0, -1)
  4546.         Local $aresult = DllCall($ghgdipdll, "int", "GdipGetImageType", "handle", $himage, "int*", 0)
  4547.         If @error Then Return SetError(@error, @extended, -1)
  4548.         Return SetExtended($aresult[0], $aresult[2])
  4549.     EndFunc
  4550.  
  4551.     Func _gdiplus_imagegetverticalresolution($himage)
  4552.         If ($himage = -1) OR (NOT $himage) Then Return SetError(10, 0, 0)
  4553.         Local $aresult = DllCall($ghgdipdll, "int", "GdipGetImageVerticalResolution", "handle", $himage, "float*", 0)
  4554.         If @error Then Return SetError(@error, @extended, 0)
  4555.         Return SetExtended($aresult[0], Round($aresult[2]))
  4556.     EndFunc
  4557.  
  4558.     Func _gdiplus_imagegetwidth($himage)
  4559.         Local $aresult = DllCall($ghgdipdll, "int", "GdipGetImageWidth", "handle", $himage, "uint*", -1)
  4560.         If @error Then Return SetError(@error, @extended, -1)
  4561.         Return SetExtended($aresult[0], $aresult[2])
  4562.     EndFunc
  4563.  
  4564.     Func _gdiplus_imageloadfromfile($sfilename)
  4565.         Local $aresult = DllCall($ghgdipdll, "int", "GdipLoadImageFromFile", "wstr", $sfilename, "ptr*", 0)
  4566.         If @error Then Return SetError(@error, @extended, -1)
  4567.         Return SetExtended($aresult[0], $aresult[2])
  4568.     EndFunc
  4569.  
  4570.     Func _gdiplus_imagesavetofile($himage, $sfilename)
  4571.         Local $sext = __gdiplus_extractfileext($sfilename)
  4572.         Local $sclsid = _gdiplus_encodersgetclsid($sext)
  4573.         If $sclsid = "" Then Return SetError(-1, 0, False)
  4574.         Return _gdiplus_imagesavetofileex($himage, $sfilename, $sclsid, 0)
  4575.     EndFunc
  4576.  
  4577.     Func _gdiplus_imagesavetofileex($himage, $sfilename, $sencoder, $pparams = 0)
  4578.         Local $tguid = _winapi_guidfromstring($sencoder)
  4579.         Local $pguid = DllStructGetPtr($tguid)
  4580.         Local $aresult = DllCall($ghgdipdll, "int", "GdipSaveImageToFile", "handle", $himage, "wstr", $sfilename, "ptr", $pguid, "ptr", $pparams)
  4581.         If @error Then Return SetError(@error, @extended, False)
  4582.         Return $aresult[0] = 0
  4583.     EndFunc
  4584.  
  4585.     Func _gdiplus_matrixcreate()
  4586.         Local $aresult = DllCall($ghgdipdll, "int", "GdipCreateMatrix", "ptr*", 0)
  4587.         If @error Then Return SetError(@error, @extended, 0)
  4588.         Return SetExtended($aresult[0], $aresult[1])
  4589.     EndFunc
  4590.  
  4591.     Func _gdiplus_matrixdispose($hmatrix)
  4592.         Local $aresult = DllCall($ghgdipdll, "int", "GdipDeleteMatrix", "handle", $hmatrix)
  4593.         If @error Then Return SetError(@error, @extended, False)
  4594.         Return $aresult[0] = 0
  4595.     EndFunc
  4596.  
  4597.     Func _gdiplus_matrixrotate($hmatrix, $fangle, $bappend = False)
  4598.         Local $aresult = DllCall($ghgdipdll, "int", "GdipRotateMatrix", "handle", $hmatrix, "float", $fangle, "int", $bappend)
  4599.         If @error Then Return SetError(@error, @extended, False)
  4600.         Return $aresult[0] = 0
  4601.     EndFunc
  4602.  
  4603.     Func _gdiplus_matrixscale($hmatrix, $fscalex, $fscaley, $border = False)
  4604.         Local $aresult = DllCall($ghgdipdll, "int", "GdipScaleMatrix", "handle", $hmatrix, "float", $fscalex, "float", $fscaley, "int", $border)
  4605.         If @error Then Return SetError(@error, @extended, False)
  4606.         Return $aresult[0] = 0
  4607.     EndFunc
  4608.  
  4609.     Func _gdiplus_matrixtranslate($hmatrix, $foffsetx, $foffsety, $bappend = False)
  4610.         Local $aresult = DllCall($ghgdipdll, "int", "GdipTranslateMatrix", "handle", $hmatrix, "float", $foffsetx, "float", $foffsety, "int", $bappend)
  4611.         If @error Then Return SetError(@error, @extended, False)
  4612.         Return $aresult[0] = 0
  4613.     EndFunc
  4614.  
  4615.     Func _gdiplus_paramadd(ByRef $tparams, $sguid, $icount, $itype, $pvalues)
  4616.         Local $tparam = DllStructCreate($taggdipencoderparam, DllStructGetPtr($tparams, "Params") + (DllStructGetData($tparams, "Count") * 28))
  4617.         _winapi_guidfromstringex($sguid, DllStructGetPtr($tparam, "GUID"))
  4618.         DllStructSetData($tparam, "Type", $itype)
  4619.         DllStructSetData($tparam, "Count", $icount)
  4620.         DllStructSetData($tparam, "Values", $pvalues)
  4621.         DllStructSetData($tparams, "Count", DllStructGetData($tparams, "Count") + 1)
  4622.     EndFunc
  4623.  
  4624.     Func _gdiplus_paraminit($icount)
  4625.         If $icount <= 0 Then Return SetError(-1, -1, 0)
  4626.         Return DllStructCreate("dword Count;byte Params[" & $icount * 28 & "]")
  4627.     EndFunc
  4628.  
  4629.     Func _gdiplus_pencreate($iargb = -16777216, $fwidth = 1, $iunit = 2)
  4630.         Local $aresult = DllCall($ghgdipdll, "int", "GdipCreatePen1", "dword", $iargb, "float", $fwidth, "int", $iunit, "ptr*", 0)
  4631.         If @error Then Return SetError(@error, @extended, 0)
  4632.         Return SetExtended($aresult[0], $aresult[4])
  4633.     EndFunc
  4634.  
  4635.     Func _gdiplus_pendispose($hpen)
  4636.         Local $aresult = DllCall($ghgdipdll, "int", "GdipDeletePen", "handle", $hpen)
  4637.         If @error Then Return SetError(@error, @extended, False)
  4638.         Return $aresult[0] = 0
  4639.     EndFunc
  4640.  
  4641.     Func _gdiplus_pengetalignment($hpen)
  4642.         Local $aresult = DllCall($ghgdipdll, "int", "GdipGetPenMode", "handle", $hpen, "int*", 0)
  4643.         If @error Then Return SetError(@error, @extended, -1)
  4644.         Return SetExtended($aresult[0], $aresult[2])
  4645.     EndFunc
  4646.  
  4647.     Func _gdiplus_pengetcolor($hpen)
  4648.         Local $aresult = DllCall($ghgdipdll, "int", "GdipGetPenColor", "handle", $hpen, "dword*", 0)
  4649.         If @error Then Return SetError(@error, @extended, -1)
  4650.         Return SetExtended($aresult[0], $aresult[2])
  4651.     EndFunc
  4652.  
  4653.     Func _gdiplus_pengetcustomendcap($hpen)
  4654.         Local $aresult = DllCall($ghgdipdll, "int", "GdipGetPenCustomEndCap", "handle", $hpen, "ptr*", 0)
  4655.         If @error Then Return SetError(@error, @extended, 0)
  4656.         Return SetExtended($aresult[0], $aresult[2])
  4657.     EndFunc
  4658.  
  4659.     Func _gdiplus_pengetdashcap($hpen)
  4660.         Local $aresult = DllCall($ghgdipdll, "int", "GdipGetPenDashCap197819", "handle", $hpen, "int*", 0)
  4661.         If @error Then Return SetError(@error, @extended, -1)
  4662.         Return SetExtended($aresult[0], $aresult[2])
  4663.     EndFunc
  4664.  
  4665.     Func _gdiplus_pengetdashstyle($hpen)
  4666.         Local $aresult = DllCall($ghgdipdll, "int", "GdipGetPenDashStyle", "handle", $hpen, "int*", 0)
  4667.         If @error Then Return SetError(@error, @extended, -1)
  4668.         Return SetExtended($aresult[0], $aresult[2])
  4669.     EndFunc
  4670.  
  4671.     Func _gdiplus_pengetendcap($hpen)
  4672.         Local $aresult = DllCall($ghgdipdll, "int", "GdipGetPenEndCap", "handle", $hpen, "int*", 0)
  4673.         If @error Then Return SetError(@error, @extended, -1)
  4674.         Return SetExtended($aresult[0], $aresult[2])
  4675.     EndFunc
  4676.  
  4677.     Func _gdiplus_pengetwidth($hpen)
  4678.         Local $aresult = DllCall($ghgdipdll, "int", "GdipGetPenWidth", "handle", $hpen, "float*", 0)
  4679.         If @error Then Return SetError(@error, @extended, -1)
  4680.         Return SetExtended($aresult[0], $aresult[2])
  4681.     EndFunc
  4682.  
  4683.     Func _gdiplus_pensetalignment($hpen, $ialignment = 0)
  4684.         Local $aresult = DllCall($ghgdipdll, "int", "GdipSetPenMode", "handle", $hpen, "int", $ialignment)
  4685.         If @error Then Return SetError(@error, @extended, False)
  4686.         Return $aresult[0] = 0
  4687.     EndFunc
  4688.  
  4689.     Func _gdiplus_pensetcolor($hpen, $iargb)
  4690.         Local $aresult = DllCall($ghgdipdll, "int", "GdipSetPenColor", "handle", $hpen, "dword", $iargb)
  4691.         If @error Then Return SetError(@error, @extended, False)
  4692.         Return $aresult[0] = 0
  4693.     EndFunc
  4694.  
  4695.     Func _gdiplus_pensetdashcap($hpen, $idash = 0)
  4696.         Local $aresult = DllCall($ghgdipdll, "int", "GdipSetPenDashCap197819", "handle", $hpen, "int", $idash)
  4697.         If @error Then Return SetError(@error, @extended, False)
  4698.         Return $aresult[0] = 0
  4699.     EndFunc
  4700.  
  4701.     Func _gdiplus_pensetcustomendcap($hpen, $hendcap)
  4702.         Local $aresult = DllCall($ghgdipdll, "int", "GdipSetPenCustomEndCap", "handle", $hpen, "handle", $hendcap)
  4703.         If @error Then Return SetError(@error, @extended, False)
  4704.         Return $aresult[0] = 0
  4705.     EndFunc
  4706.  
  4707.     Func _gdiplus_pensetdashstyle($hpen, $istyle = 0)
  4708.         Local $aresult = DllCall($ghgdipdll, "int", "GdipSetPenDashStyle", "handle", $hpen, "int", $istyle)
  4709.         If @error Then Return SetError(@error, @extended, False)
  4710.         Return $aresult[0] = 0
  4711.     EndFunc
  4712.  
  4713.     Func _gdiplus_pensetendcap($hpen, $iendcap)
  4714.         Local $aresult = DllCall($ghgdipdll, "int", "GdipSetPenEndCap", "handle", $hpen, "int", $iendcap)
  4715.         If @error Then Return SetError(@error, @extended, False)
  4716.         Return $aresult[0] = 0
  4717.     EndFunc
  4718.  
  4719.     Func _gdiplus_pensetwidth($hpen, $fwidth)
  4720.         Local $aresult = DllCall($ghgdipdll, "int", "GdipSetPenWidth", "handle", $hpen, "float", $fwidth)
  4721.         If @error Then Return SetError(@error, @extended, False)
  4722.         Return $aresult[0] = 0
  4723.     EndFunc
  4724.  
  4725.     Func _gdiplus_rectfcreate($nx = 0, $ny = 0, $nwidth = 0, $nheight = 0)
  4726.         Local $trectf = DllStructCreate($taggdiprectf)
  4727.         DllStructSetData($trectf, "X", $nx)
  4728.         DllStructSetData($trectf, "Y", $ny)
  4729.         DllStructSetData($trectf, "Width", $nwidth)
  4730.         DllStructSetData($trectf, "Height", $nheight)
  4731.         Return $trectf
  4732.     EndFunc
  4733.  
  4734.     Func _gdiplus_shutdown()
  4735.         If $ghgdipdll = 0 Then Return SetError(-1, -1, False)
  4736.         $gigdipref -= 1
  4737.         If $gigdipref = 0 Then
  4738.             DllCall($ghgdipdll, "none", "GdiplusShutdown", "ptr", $gigdiptoken)
  4739.             DllClose($ghgdipdll)
  4740.             $ghgdipdll = 0
  4741.         EndIf
  4742.         Return True
  4743.     EndFunc
  4744.  
  4745.     Func _gdiplus_startup()
  4746.         $gigdipref += 1
  4747.         If $gigdipref > 1 Then Return True
  4748.         $ghgdipdll = DllOpen("GDIPlus.dll")
  4749.         If $ghgdipdll = -1 Then Return SetError(1, 2, False)
  4750.         Local $tinput = DllStructCreate($taggdipstartupinput)
  4751.         Local $pinput = DllStructGetPtr($tinput)
  4752.         Local $ttoken = DllStructCreate("ulong_ptr Data")
  4753.         Local $ptoken = DllStructGetPtr($ttoken)
  4754.         DllStructSetData($tinput, "Version", 1)
  4755.         Local $aresult = DllCall($ghgdipdll, "int", "GdiplusStartup", "ptr", $ptoken, "ptr", $pinput, "ptr", 0)
  4756.         If @error Then Return SetError(@error, @extended, False)
  4757.         $gigdiptoken = DllStructGetData($ttoken, "Data")
  4758.         Return $aresult[0] = 0
  4759.     EndFunc
  4760.  
  4761.     Func _gdiplus_stringformatcreate($iformat = 0, $ilangid = 0)
  4762.         Local $aresult = DllCall($ghgdipdll, "int", "GdipCreateStringFormat", "int", $iformat, "word", $ilangid, "ptr*", 0)
  4763.         If @error Then Return SetError(@error, @extended, 0)
  4764.         Return SetExtended($aresult[0], $aresult[3])
  4765.     EndFunc
  4766.  
  4767.     Func _gdiplus_stringformatdispose($hformat)
  4768.         Local $aresult = DllCall($ghgdipdll, "int", "GdipDeleteStringFormat", "handle", $hformat)
  4769.         If @error Then Return SetError(@error, @extended, False)
  4770.         Return $aresult[0] = 0
  4771.     EndFunc
  4772.  
  4773.     Func _gdiplus_stringformatsetalign($hstringformat, $iflag)
  4774.         Local $aresult = DllCall($ghgdipdll, "int", "GdipSetStringFormatAlign", "handle", $hstringformat, "int", $iflag)
  4775.         If @error Then Return SetError(@error, @extended, 0)
  4776.         Return $aresult[0] = 0
  4777.     EndFunc
  4778.  
  4779.     Func __gdiplus_brushdefcreate(ByRef $hbrush)
  4780.         If $hbrush = 0 Then
  4781.             $ghgdipbrush = _gdiplus_brushcreatesolid()
  4782.             $hbrush = $ghgdipbrush
  4783.         EndIf
  4784.     EndFunc
  4785.  
  4786.     Func __gdiplus_brushdefdispose()
  4787.         If $ghgdipbrush <> 0 Then
  4788.             _gdiplus_brushdispose($ghgdipbrush)
  4789.             $ghgdipbrush = 0
  4790.         EndIf
  4791.     EndFunc
  4792.  
  4793.     Func __gdiplus_extractfileext($sfilename, $fnodot = True)
  4794.         Local $iindex = __gdiplus_lastdelimiter(".\:", $sfilename)
  4795.         If ($iindex > 0) AND (StringMid($sfilename, $iindex, 1) = ".") Then
  4796.             If $fnodot Then
  4797.                 Return StringMid($sfilename, $iindex + 1)
  4798.             Else
  4799.                 Return StringMid($sfilename, $iindex)
  4800.             EndIf
  4801.         Else
  4802.             Return ""
  4803.         EndIf
  4804.     EndFunc
  4805.  
  4806.     Func __gdiplus_lastdelimiter($sdelimiters, $sstring)
  4807.         Local $sdelimiter, $in
  4808.         For $ii = 1 To StringLen($sdelimiters)
  4809.             $sdelimiter = StringMid($sdelimiters, $ii, 1)
  4810.             $in = StringInStr($sstring, $sdelimiter, 0, -1)
  4811.             If $in > 0 Then Return $in
  4812.         Next
  4813.     EndFunc
  4814.  
  4815.     Func __gdiplus_pendefcreate(ByRef $hpen)
  4816.         If $hpen = 0 Then
  4817.             $ghgdippen = _gdiplus_pencreate()
  4818.             $hpen = $ghgdippen
  4819.         EndIf
  4820.     EndFunc
  4821.  
  4822.     Func __gdiplus_pendefdispose()
  4823.         If $ghgdippen <> 0 Then
  4824.             _gdiplus_pendispose($ghgdippen)
  4825.             $ghgdippen = 0
  4826.         EndIf
  4827.     EndFunc
  4828.  
  4829.     Global Const $gui_event_close = -3
  4830.     Global Const $gui_event_minimize = -4
  4831.     Global Const $gui_event_restore = -5
  4832.     Global Const $gui_event_maximize = -6
  4833.     Global Const $gui_event_primarydown = -7
  4834.     Global Const $gui_event_primaryup = -8
  4835.     Global Const $gui_event_secondarydown = -9
  4836.     Global Const $gui_event_secondaryup = -10
  4837.     Global Const $gui_event_mousemove = -11
  4838.     Global Const $gui_event_resized = -12
  4839.     Global Const $gui_event_dropped = -13
  4840.     Global Const $gui_rundefmsg = "GUI_RUNDEFMSG"
  4841.     Global Const $gui_avistop = 0
  4842.     Global Const $gui_avistart = 1
  4843.     Global Const $gui_aviclose = 2
  4844.     Global Const $gui_checked = 1
  4845.     Global Const $gui_indeterminate = 2
  4846.     Global Const $gui_unchecked = 4
  4847.     Global Const $gui_dropaccepted = 8
  4848.     Global Const $gui_nodropaccepted = 4096
  4849.     Global Const $gui_acceptfiles = $gui_dropaccepted
  4850.     Global Const $gui_show = 16
  4851.     Global Const $gui_hide = 32
  4852.     Global Const $gui_enable = 64
  4853.     Global Const $gui_disable = 128
  4854.     Global Const $gui_focus = 256
  4855.     Global Const $gui_nofocus = 8192
  4856.     Global Const $gui_defbutton = 512
  4857.     Global Const $gui_expand = 1024
  4858.     Global Const $gui_ontop = 2048
  4859.     Global Const $gui_fontitalic = 2
  4860.     Global Const $gui_fontunder = 4
  4861.     Global Const $gui_fontstrike = 8
  4862.     Global Const $gui_dockauto = 1
  4863.     Global Const $gui_dockleft = 2
  4864.     Global Const $gui_dockright = 4
  4865.     Global Const $gui_dockhcenter = 8
  4866.     Global Const $gui_docktop = 32
  4867.     Global Const $gui_dockbottom = 64
  4868.     Global Const $gui_dockvcenter = 128
  4869.     Global Const $gui_dockwidth = 256
  4870.     Global Const $gui_dockheight = 512
  4871.     Global Const $gui_docksize = 768
  4872.     Global Const $gui_dockmenubar = 544
  4873.     Global Const $gui_dockstatebar = 576
  4874.     Global Const $gui_dockall = 802
  4875.     Global Const $gui_dockborders = 102
  4876.     Global Const $gui_gr_close = 1
  4877.     Global Const $gui_gr_line = 2
  4878.     Global Const $gui_gr_bezier = 4
  4879.     Global Const $gui_gr_move = 6
  4880.     Global Const $gui_gr_color = 8
  4881.     Global Const $gui_gr_rect = 10
  4882.     Global Const $gui_gr_ellipse = 12
  4883.     Global Const $gui_gr_pie = 14
  4884.     Global Const $gui_gr_dot = 16
  4885.     Global Const $gui_gr_pixel = 18
  4886.     Global Const $gui_gr_hint = 20
  4887.     Global Const $gui_gr_refresh = 22
  4888.     Global Const $gui_gr_pensize = 24
  4889.     Global Const $gui_gr_nobkcolor = -2
  4890.     Global Const $gui_bkcolor_default = -1
  4891.     Global Const $gui_bkcolor_transparent = -2
  4892.     Global Const $gui_bkcolor_lv_alternate = -33554432
  4893.     Global Const $gui_ws_ex_parentdrag = 1048576
  4894.     Global Const $fw_dontcare = 0
  4895.     Global Const $fw_thin = 100
  4896.     Global Const $fw_extralight = 200
  4897.     Global Const $fw_ultralight = 200
  4898.     Global Const $fw_light = 300
  4899.     Global Const $fw_normal = 400
  4900.     Global Const $fw_regular = 400
  4901.     Global Const $fw_medium = 500
  4902.     Global Const $fw_semibold = 600
  4903.     Global Const $fw_demibold = 600
  4904.     Global Const $fw_bold = 700
  4905.     Global Const $fw_extrabold = 800
  4906.     Global Const $fw_ultrabold = 800
  4907.     Global Const $fw_heavy = 900
  4908.     Global Const $fw_black = 900
  4909.     Global Const $cf_effects = 256
  4910.     Global Const $cf_printerfonts = 2
  4911.     Global Const $cf_screenfonts = 1
  4912.     Global Const $cf_noscriptsel = 8388608
  4913.     Global Const $cf_inittologfontstruct = 64
  4914.     Global Const $logpixelsx = 88
  4915.     Global Const $logpixelsy = 90
  4916.     Global Const $ansi_charset = 0
  4917.     Global Const $baltic_charset = 186
  4918.     Global Const $chinesebig5_charset = 136
  4919.     Global Const $default_charset = 1
  4920.     Global Const $easteurope_charset = 238
  4921.     Global Const $gb2312_charset = 134
  4922.     Global Const $greek_charset = 161
  4923.     Global Const $hangeul_charset = 129
  4924.     Global Const $mac_charset = 77
  4925.     Global Const $oem_charset = 255
  4926.     Global Const $russian_charset = 204
  4927.     Global Const $shiftjis_charset = 128
  4928.     Global Const $symbol_charset = 2
  4929.     Global Const $turkish_charset = 162
  4930.     Global Const $vietnamese_charset = 163
  4931.     Global Const $out_character_precis = 2
  4932.     Global Const $out_default_precis = 0
  4933.     Global Const $out_device_precis = 5
  4934.     Global Const $out_outline_precis = 8
  4935.     Global Const $out_ps_only_precis = 10
  4936.     Global Const $out_raster_precis = 6
  4937.     Global Const $out_string_precis = 1
  4938.     Global Const $out_stroke_precis = 3
  4939.     Global Const $out_tt_only_precis = 7
  4940.     Global Const $out_tt_precis = 4
  4941.     Global Const $clip_character_precis = 1
  4942.     Global Const $clip_default_precis = 0
  4943.     Global Const $clip_embedded = 128
  4944.     Global Const $clip_lh_angles = 16
  4945.     Global Const $clip_mask = 15
  4946.     Global Const $clip_stroke_precis = 2
  4947.     Global Const $clip_tt_always = 32
  4948.     Global Const $antialiased_quality = 4
  4949.     Global Const $default_quality = 0
  4950.     Global Const $draft_quality = 1
  4951.     Global Const $nonantialiased_quality = 3
  4952.     Global Const $proof_quality = 2
  4953.     Global Const $default_pitch = 0
  4954.     Global Const $fixed_pitch = 1
  4955.     Global Const $variable_pitch = 2
  4956.     Global Const $ff_decorative = 80
  4957.     Global Const $ff_dontcare = 0
  4958.     Global Const $ff_modern = 48
  4959.     Global Const $ff_roman = 16
  4960.     Global Const $ff_script = 64
  4961.     Global Const $ff_swiss = 32
  4962.     Global Const $__miscconstant_cc_anycolor = 256
  4963.     Global Const $__miscconstant_cc_fullopen = 2
  4964.     Global Const $__miscconstant_cc_rgbinit = 1
  4965.     Global Const $tagchoosecolor = "dword Size;hwnd hWndOwnder;handle hInstance;dword rgbResult;ptr CustColors;dword Flags;lparam lCustData;" & "ptr lpfnHook;ptr lpTemplateName"
  4966.     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"
  4967.  
  4968.     Func _choosecolor($ireturntype = 0, $icolorref = 0, $ireftype = 0, $hwndownder = 0)
  4969.         Local $custcolors = "dword[16]"
  4970.         Local $tchoose = DllStructCreate($tagchoosecolor)
  4971.         Local $tcc = DllStructCreate($custcolors)
  4972.         If $ireftype = 1 Then
  4973.             $icolorref = Int($icolorref)
  4974.         ElseIf $ireftype = 2 Then
  4975.             $icolorref = Hex(String($icolorref), 6)
  4976.             $icolorref = "0x" & StringMid($icolorref, 5, 2) & StringMid($icolorref, 3, 2) & StringMid($icolorref, 1, 2)
  4977.         EndIf
  4978.         DllStructSetData($tchoose, "Size", DllStructGetSize($tchoose))
  4979.         DllStructSetData($tchoose, "hWndOwnder", $hwndownder)
  4980.         DllStructSetData($tchoose, "rgbResult", $icolorref)
  4981.         DllStructSetData($tchoose, "CustColors", DllStructGetPtr($tcc))
  4982.         DllStructSetData($tchoose, "Flags", BitOR($__miscconstant_cc_anycolor, $__miscconstant_cc_fullopen, $__miscconstant_cc_rgbinit))
  4983.         Local $aresult = DllCall("comdlg32.dll", "bool", "ChooseColor", "ptr", DllStructGetPtr($tchoose))
  4984.         If @error Then Return SetError(@error, @extended, -1)
  4985.         If $aresult[0] = 0 Then Return SetError(-3, -3, -1)
  4986.         Local $color_picked = DllStructGetData($tchoose, "rgbResult")
  4987.         If $ireturntype = 1 Then
  4988.             Return "0x" & Hex(String($color_picked), 6)
  4989.         ElseIf $ireturntype = 2 Then
  4990.             $color_picked = Hex(String($color_picked), 6)
  4991.             Return "0x" & StringMid($color_picked, 5, 2) & StringMid($color_picked, 3, 2) & StringMid($color_picked, 1, 2)
  4992.         ElseIf $ireturntype = 0 Then
  4993.             Return $color_picked
  4994.         Else
  4995.             Return SetError(-4, -4, -1)
  4996.         EndIf
  4997.     EndFunc
  4998.  
  4999.     Func _choosefont($sfontname = "Courier New", $ipointsize = 10, $icolorref = 0, $ifontweight = 0, $iitalic = False, $iunderline = False, $istrikethru = False, $hwndowner = 0)
  5000.         Local $italic = 0, $underline = 0, $strikeout = 0
  5001.         Local $lngdc = __misc_getdc(0)
  5002.         Local $lfheight = Round(($ipointsize * __misc_getdevicecaps($lngdc, $logpixelsx)) / 72, 0)
  5003.         __misc_releasedc(0, $lngdc)
  5004.         Local $tchoosefont = DllStructCreate($tagchoosefont)
  5005.         Local $tlogfont = DllStructCreate($taglogfont)
  5006.         DllStructSetData($tchoosefont, "Size", DllStructGetSize($tchoosefont))
  5007.         DllStructSetData($tchoosefont, "hWndOwner", $hwndowner)
  5008.         DllStructSetData($tchoosefont, "LogFont", DllStructGetPtr($tlogfont))
  5009.         DllStructSetData($tchoosefont, "PointSize", $ipointsize)
  5010.         DllStructSetData($tchoosefont, "Flags", BitOR($cf_screenfonts, $cf_printerfonts, $cf_effects, $cf_inittologfontstruct, $cf_noscriptsel))
  5011.         DllStructSetData($tchoosefont, "rgbColors", $icolorref)
  5012.         DllStructSetData($tchoosefont, "FontType", 0)
  5013.         DllStructSetData($tlogfont, "Height", $lfheight)
  5014.         DllStructSetData($tlogfont, "Weight", $ifontweight)
  5015.         DllStructSetData($tlogfont, "Italic", $iitalic)
  5016.         DllStructSetData($tlogfont, "Underline", $iunderline)
  5017.         DllStructSetData($tlogfont, "Strikeout", $istrikethru)
  5018.         DllStructSetData($tlogfont, "FaceName", $sfontname)
  5019.         Local $aresult = DllCall("comdlg32.dll", "bool", "ChooseFontW", "ptr", DllStructGetPtr($tchoosefont))
  5020.         If @error Then Return SetError(@error, @extended, -1)
  5021.         If $aresult[0] = 0 Then Return SetError(-3, -3, -1)
  5022.         Local $fontname = DllStructGetData($tlogfont, "FaceName")
  5023.         If StringLen($fontname) = 0 AND StringLen($sfontname) > 0 Then $fontname = $sfontname
  5024.         If DllStructGetData($tlogfont, "Italic") Then $italic = 2
  5025.         If DllStructGetData($tlogfont, "Underline") Then $underline = 4
  5026.         If DllStructGetData($tlogfont, "Strikeout") Then $strikeout = 8
  5027.         Local $attributes = BitOR($italic, $underline, $strikeout)
  5028.         Local $size = DllStructGetData($tchoosefont, "PointSize") / 10
  5029.         Local $colorref = DllStructGetData($tchoosefont, "rgbColors")
  5030.         Local $weight = DllStructGetData($tlogfont, "Weight")
  5031.         Local $color_picked = Hex(String($colorref), 6)
  5032.         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), ",")
  5033.     EndFunc
  5034.  
  5035.     Func _clipputfile($sfile, $sseparator = "|")
  5036.         Local Const $gmem_moveable = 2, $cf_hdrop = 15
  5037.         $sfile &= $sseparator & $sseparator
  5038.         Local $nglobmemsize = (StringLen($sfile) + 20)
  5039.         Local $aresult = DllCall("user32.dll", "bool", "OpenClipboard", "hwnd", 0)
  5040.         If @error OR $aresult[0] = 0 Then Return SetError(1, _winapi_getlasterror(), False)
  5041.         Local $ierror = 0, $ilasterror = 0
  5042.         $aresult = DllCall("user32.dll", "bool", "EmptyClipboard")
  5043.         If @error OR NOT $aresult[0] Then
  5044.             $ierror = 2
  5045.             $ilasterror = _winapi_getlasterror()
  5046.         Else
  5047.             $aresult = DllCall("kernel32.dll", "handle", "GlobalAlloc", "uint", $gmem_moveable, "ulong_ptr", $nglobmemsize)
  5048.             If @error OR NOT $aresult[0] Then
  5049.                 $ierror = 3
  5050.                 $ilasterror = _winapi_getlasterror()
  5051.             Else
  5052.                 Local $hglobal = $aresult[0]
  5053.                 $aresult = DllCall("kernel32.dll", "ptr", "GlobalLock", "handle", $hglobal)
  5054.                 If @error OR NOT $aresult[0] Then
  5055.                     $ierror = 4
  5056.                     $ilasterror = _winapi_getlasterror()
  5057.                 Else
  5058.                     Local $hlock = $aresult[0]
  5059.                     Local $dropfiles = DllStructCreate("dword;ptr;int;int;int;char[" & StringLen($sfile) + 1 & "]", $hlock)
  5060.                     If @error Then Return SetError(5, 6, False)
  5061.                     Local $tempstruct = DllStructCreate("dword;ptr;int;int;int")
  5062.                     DllStructSetData($dropfiles, 1, DllStructGetSize($tempstruct))
  5063.                     DllStructSetData($dropfiles, 2, 0)
  5064.                     DllStructSetData($dropfiles, 3, 0)
  5065.                     DllStructSetData($dropfiles, 4, 0)
  5066.                     DllStructSetData($dropfiles, 5, 0)
  5067.                     DllStructSetData($dropfiles, 6, $sfile)
  5068.                     For $i = 1 To StringLen($sfile)
  5069.                         If DllStructGetData($dropfiles, 6, $i) = $sseparator Then DllStructSetData($dropfiles, 6, Chr(0), $i)
  5070.                     Next
  5071.                     $aresult = DllCall("user32.dll", "handle", "SetClipboardData", "uint", $cf_hdrop, "handle", $hglobal)
  5072.                     If @error OR NOT $aresult[0] Then
  5073.                         $ierror = 6
  5074.                         $ilasterror = _winapi_getlasterror()
  5075.                     EndIf
  5076.                     $aresult = DllCall("kernel32.dll", "bool", "GlobalUnlock", "handle", $hglobal)
  5077.                     If (@error OR NOT $aresult[0]) AND NOT $ierror AND _winapi_getlasterror() Then
  5078.                         $ierror = 8
  5079.                         $ilasterror = _winapi_getlasterror()
  5080.                     EndIf
  5081.                 EndIf
  5082.                 $aresult = DllCall("kernel32.dll", "ptr", "GlobalFree", "handle", $hglobal)
  5083.                 If (@error OR NOT $aresult[0]) AND NOT $ierror Then
  5084.                     $ierror = 9
  5085.                     $ilasterror = _winapi_getlasterror()
  5086.                 EndIf
  5087.             EndIf
  5088.         EndIf
  5089.         $aresult = DllCall("user32.dll", "bool", "CloseClipboard")
  5090.         If (@error OR NOT $aresult[0]) AND NOT $ierror Then Return SetError(7, _winapi_getlasterror(), False)
  5091.         If $ierror Then Return SetError($ierror, $ilasterror, False)
  5092.         Return True
  5093.     EndFunc
  5094.  
  5095.     Func _iif($ftest, $vtrueval, $vfalseval)
  5096.         If $ftest Then
  5097.             Return $vtrueval
  5098.         Else
  5099.             Return $vfalseval
  5100.         EndIf
  5101.     EndFunc
  5102.  
  5103.     Func _mousetrap($ileft = 0, $itop = 0, $iright = 0, $ibottom = 0)
  5104.         Local $aresult
  5105.         If @NumParams == 0 Then
  5106.             $aresult = DllCall("user32.dll", "bool", "ClipCursor", "ptr", 0)
  5107.             If @error OR NOT $aresult[0] Then Return SetError(1, _winapi_getlasterror(), False)
  5108.         Else
  5109.             If @NumParams == 2 Then
  5110.                 $iright = $ileft + 1
  5111.                 $ibottom = $itop + 1
  5112.             EndIf
  5113.             Local $trect = DllStructCreate($tagrect)
  5114.             DllStructSetData($trect, "Left", $ileft)
  5115.             DllStructSetData($trect, "Top", $itop)
  5116.             DllStructSetData($trect, "Right", $iright)
  5117.             DllStructSetData($trect, "Bottom", $ibottom)
  5118.             $aresult = DllCall("user32.dll", "bool", "ClipCursor", "ptr", DllStructGetPtr($trect))
  5119.             If @error OR NOT $aresult[0] Then Return SetError(2, _winapi_getlasterror(), False)
  5120.         EndIf
  5121.         Return True
  5122.     EndFunc
  5123.  
  5124.     Func _singleton($soccurencename, $iflag = 0)
  5125.         Local Const $error_already_exists = 183
  5126.         Local Const $security_descriptor_revision = 1
  5127.         Local $psecurityattributes = 0
  5128.         If BitAND($iflag, 2) Then
  5129.             Local $tsecuritydescriptor = DllStructCreate("dword[5]")
  5130.             Local $psecuritydescriptor = DllStructGetPtr($tsecuritydescriptor)
  5131.             Local $aret = DllCall("advapi32.dll", "bool", "InitializeSecurityDescriptor", "ptr", $psecuritydescriptor, "dword", $security_descriptor_revision)
  5132.             If @error Then Return SetError(@error, @extended, 0)
  5133.             If $aret[0] Then
  5134.                 $aret = DllCall("advapi32.dll", "bool", "SetSecurityDescriptorDacl", "ptr", $psecuritydescriptor, "bool", 1, "ptr", 0, "bool", 0)
  5135.                 If @error Then Return SetError(@error, @extended, 0)
  5136.                 If $aret[0] Then
  5137.                     Local $structsecurityattributes = DllStructCreate($tagsecurity_attributes)
  5138.                     DllStructSetData($structsecurityattributes, 1, DllStructGetSize($structsecurityattributes))
  5139.                     DllStructSetData($structsecurityattributes, 2, $psecuritydescriptor)
  5140.                     DllStructSetData($structsecurityattributes, 3, 0)
  5141.                     $psecurityattributes = DllStructGetPtr($structsecurityattributes)
  5142.                 EndIf
  5143.             EndIf
  5144.         EndIf
  5145.         Local $handle = DllCall("kernel32.dll", "handle", "CreateMutexW", "ptr", $psecurityattributes, "bool", 1, "wstr", $soccurencename)
  5146.         If @error Then Return SetError(@error, @extended, 0)
  5147.         Local $lasterror = DllCall("kernel32.dll", "dword", "GetLastError")
  5148.         If @error Then Return SetError(@error, @extended, 0)
  5149.         If $lasterror[0] = $error_already_exists Then
  5150.             If BitAND($iflag, 1) Then
  5151.                 Return SetError($lasterror[0], $lasterror[0], 0)
  5152.             Else
  5153.                 Exit -1
  5154.             EndIf
  5155.         EndIf
  5156.         Return $handle[0]
  5157.     EndFunc
  5158.  
  5159.     Func _ispressed($shexkey, $vdll = "user32.dll")
  5160.         Local $a_r = DllCall($vdll, "short", "GetAsyncKeyState", "int", "0x" & $shexkey)
  5161.         If @error Then Return SetError(@error, @extended, False)
  5162.         Return BitAND($a_r[0], 32768) <> 0
  5163.     EndFunc
  5164.  
  5165.     Func _versioncompare($sversion1, $sversion2)
  5166.         If $sversion1 = $sversion2 Then Return 0
  5167.         Local $sep = "."
  5168.         If StringInStr($sversion1, $sep) = 0 Then $sep = ","
  5169.         Local $aversion1 = StringSplit($sversion1, $sep)
  5170.         Local $aversion2 = StringSplit($sversion2, $sep)
  5171.         If UBound($aversion1) <> UBound($aversion2) OR UBound($aversion1) = 0 Then
  5172.             SetExtended(1)
  5173.             If $sversion1 > $sversion2 Then
  5174.                 Return 1
  5175.             ElseIf $sversion1 < $sversion2 Then
  5176.                 Return -1
  5177.             EndIf
  5178.         Else
  5179.             For $i = 1 To UBound($aversion1) - 1
  5180.                 If StringIsDigit($aversion1[$i]) AND StringIsDigit($aversion2[$i]) Then
  5181.                     If Number($aversion1[$i]) > Number($aversion2[$i]) Then
  5182.                         Return 1
  5183.                     ElseIf Number($aversion1[$i]) < Number($aversion2[$i]) Then
  5184.                         Return -1
  5185.                     EndIf
  5186.                 Else
  5187.                     SetExtended(1)
  5188.                     If $aversion1[$i] > $aversion2[$i] Then
  5189.                         Return 1
  5190.                     ElseIf $aversion1[$i] < $aversion2[$i] Then
  5191.                         Return -1
  5192.                     EndIf
  5193.                 EndIf
  5194.             Next
  5195.         EndIf
  5196.         Return SetError(2, 0, 0)
  5197.     EndFunc
  5198.  
  5199.     Func __misc_getdc($hwnd)
  5200.         Local $aresult = DllCall("User32.dll", "handle", "GetDC", "hwnd", $hwnd)
  5201.         If @error OR NOT $aresult[0] Then Return SetError(1, _winapi_getlasterror(), 0)
  5202.         Return $aresult[0]
  5203.     EndFunc
  5204.  
  5205.     Func __misc_getdevicecaps($hdc, $iindex)
  5206.         Local $aresult = DllCall("GDI32.dll", "int", "GetDeviceCaps", "handle", $hdc, "int", $iindex)
  5207.         If @error Then Return SetError(@error, @extended, 0)
  5208.         Return $aresult[0]
  5209.     EndFunc
  5210.  
  5211.     Func __misc_releasedc($hwnd, $hdc)
  5212.         Local $aresult = DllCall("User32.dll", "int", "ReleaseDC", "hwnd", $hwnd, "handle", $hdc)
  5213.         If @error Then Return SetError(@error, @extended, False)
  5214.         Return $aresult[0] <> 0
  5215.     EndFunc
  5216.  
  5217.     Global Const $ss_left = 0
  5218.     Global Const $ss_center = 1
  5219.     Global Const $ss_right = 2
  5220.     Global Const $ss_icon = 3
  5221.     Global Const $ss_blackrect = 4
  5222.     Global Const $ss_grayrect = 5
  5223.     Global Const $ss_whiterect = 6
  5224.     Global Const $ss_blackframe = 7
  5225.     Global Const $ss_grayframe = 8
  5226.     Global Const $ss_whiteframe = 9
  5227.     Global Const $ss_simple = 11
  5228.     Global Const $ss_leftnowordwrap = 12
  5229.     Global Const $ss_bitmap = 14
  5230.     Global Const $ss_etchedhorz = 16
  5231.     Global Const $ss_etchedvert = 17
  5232.     Global Const $ss_etchedframe = 18
  5233.     Global Const $ss_noprefix = 128
  5234.     Global Const $ss_notify = 256
  5235.     Global Const $ss_centerimage = 512
  5236.     Global Const $ss_rightjust = 1024
  5237.     Global Const $ss_sunken = 4096
  5238.     Global Const $gui_ss_default_label = 0
  5239.     Global Const $gui_ss_default_graphic = 0
  5240.     Global Const $gui_ss_default_icon = $ss_notify
  5241.     Global Const $gui_ss_default_pic = $ss_notify
  5242.     Global Const $ws_tiled = 0
  5243.     Global Const $ws_overlapped = 0
  5244.     Global Const $ws_maximizebox = 65536
  5245.     Global Const $ws_minimizebox = 131072
  5246.     Global Const $ws_tabstop = 65536
  5247.     Global Const $ws_group = 131072
  5248.     Global Const $ws_sizebox = 262144
  5249.     Global Const $ws_thickframe = 262144
  5250.     Global Const $ws_sysmenu = 524288
  5251.     Global Const $ws_hscroll = 1048576
  5252.     Global Const $ws_vscroll = 2097152
  5253.     Global Const $ws_dlgframe = 4194304
  5254.     Global Const $ws_border = 8388608
  5255.     Global Const $ws_caption = 12582912
  5256.     Global Const $ws_overlappedwindow = 13565952
  5257.     Global Const $ws_tiledwindow = 13565952
  5258.     Global Const $ws_maximize = 16777216
  5259.     Global Const $ws_clipchildren = 33554432
  5260.     Global Const $ws_clipsiblings = 67108864
  5261.     Global Const $ws_disabled = 134217728
  5262.     Global Const $ws_visible = 268435456
  5263.     Global Const $ws_minimize = 536870912
  5264.     Global Const $ws_child = 1073741824
  5265.     Global Const $ws_popup = -2147483648
  5266.     Global Const $ws_popupwindow = -2138570752
  5267.     Global Const $ds_modalframe = 128
  5268.     Global Const $ds_setforeground = 512
  5269.     Global Const $ds_contexthelp = 8192
  5270.     Global Const $ws_ex_acceptfiles = 16
  5271.     Global Const $ws_ex_mdichild = 64
  5272.     Global Const $ws_ex_appwindow = 262144
  5273.     Global Const $ws_ex_composited = 33554432
  5274.     Global Const $ws_ex_clientedge = 512
  5275.     Global Const $ws_ex_contexthelp = 1024
  5276.     Global Const $ws_ex_dlgmodalframe = 1
  5277.     Global Const $ws_ex_leftscrollbar = 16384
  5278.     Global Const $ws_ex_overlappedwindow = 768
  5279.     Global Const $ws_ex_right = 4096
  5280.     Global Const $ws_ex_staticedge = 131072
  5281.     Global Const $ws_ex_toolwindow = 128
  5282.     Global Const $ws_ex_topmost = 8
  5283.     Global Const $ws_ex_transparent = 32
  5284.     Global Const $ws_ex_windowedge = 256
  5285.     Global Const $ws_ex_layered = 524288
  5286.     Global Const $ws_ex_controlparent = 65536
  5287.     Global Const $ws_ex_layoutrtl = 4194304
  5288.     Global Const $ws_ex_rtlreading = 8192
  5289.     Global Const $wm_gettextlength = 14
  5290.     Global Const $wm_gettext = 13
  5291.     Global Const $wm_size = 5
  5292.     Global Const $wm_sizing = 532
  5293.     Global Const $wm_user = 1024
  5294.     Global Const $wm_create = 1
  5295.     Global Const $wm_destroy = 2
  5296.     Global Const $wm_move = 3
  5297.     Global Const $wm_activate = 6
  5298.     Global Const $wm_setfocus = 7
  5299.     Global Const $wm_killfocus = 8
  5300.     Global Const $wm_enable = 10
  5301.     Global Const $wm_setredraw = 11
  5302.     Global Const $wm_settext = 12
  5303.     Global Const $wm_paint = 15
  5304.     Global Const $wm_close = 16
  5305.     Global Const $wm_quit = 18
  5306.     Global Const $wm_erasebkgnd = 20
  5307.     Global Const $wm_syscolorchange = 21
  5308.     Global Const $wm_showwindow = 24
  5309.     Global Const $wm_wininichange = 26
  5310.     Global Const $wm_devmodechange = 27
  5311.     Global Const $wm_activateapp = 28
  5312.     Global Const $wm_fontchange = 29
  5313.     Global Const $wm_timechange = 30
  5314.     Global Const $wm_cancelmode = 31
  5315.     Global Const $wm_setcursor = 32
  5316.     Global Const $wm_mouseactivate = 33
  5317.     Global Const $wm_childactivate = 34
  5318.     Global Const $wm_queuesync = 35
  5319.     Global Const $wm_getminmaxinfo = 36
  5320.     Global Const $wm_painticon = 38
  5321.     Global Const $wm_iconerasebkgnd = 39
  5322.     Global Const $wm_nextdlgctl = 40
  5323.     Global Const $wm_spoolerstatus = 42
  5324.     Global Const $wm_drawitem = 43
  5325.     Global Const $wm_measureitem = 44
  5326.     Global Const $wm_deleteitem = 45
  5327.     Global Const $wm_vkeytoitem = 46
  5328.     Global Const $wm_chartoitem = 47
  5329.     Global Const $wm_setfont = 48
  5330.     Global Const $wm_getfont = 49
  5331.     Global Const $wm_sethotkey = 50
  5332.     Global Const $wm_gethotkey = 51
  5333.     Global Const $wm_querydragicon = 55
  5334.     Global Const $wm_compareitem = 57
  5335.     Global Const $wm_getobject = 61
  5336.     Global Const $wm_compacting = 65
  5337.     Global Const $wm_commnotify = 68
  5338.     Global Const $wm_windowposchanging = 70
  5339.     Global Const $wm_windowposchanged = 71
  5340.     Global Const $wm_power = 72
  5341.     Global Const $wm_notify = 78
  5342.     Global Const $wm_copydata = 74
  5343.     Global Const $wm_canceljournal = 75
  5344.     Global Const $wm_inputlangchangerequest = 80
  5345.     Global Const $wm_inputlangchange = 81
  5346.     Global Const $wm_tcard = 82
  5347.     Global Const $wm_help = 83
  5348.     Global Const $wm_userchanged = 84
  5349.     Global Const $wm_notifyformat = 85
  5350.     Global Const $wm_cut = 768
  5351.     Global Const $wm_copy = 769
  5352.     Global Const $wm_paste = 770
  5353.     Global Const $wm_clear = 771
  5354.     Global Const $wm_undo = 772
  5355.     Global Const $wm_contextmenu = 123
  5356.     Global Const $wm_stylechanging = 124
  5357.     Global Const $wm_stylechanged = 125
  5358.     Global Const $wm_displaychange = 126
  5359.     Global Const $wm_geticon = 127
  5360.     Global Const $wm_seticon = 128
  5361.     Global Const $wm_nccreate = 129
  5362.     Global Const $wm_ncdestroy = 130
  5363.     Global Const $wm_nccalcsize = 131
  5364.     Global Const $wm_nchittest = 132
  5365.     Global Const $wm_ncpaint = 133
  5366.     Global Const $wm_ncactivate = 134
  5367.     Global Const $wm_getdlgcode = 135
  5368.     Global Const $wm_syncpaint = 136
  5369.     Global Const $wm_ncmousemove = 160
  5370.     Global Const $wm_nclbuttondown = 161
  5371.     Global Const $wm_nclbuttonup = 162
  5372.     Global Const $wm_nclbuttondblclk = 163
  5373.     Global Const $wm_ncrbuttondown = 164
  5374.     Global Const $wm_ncrbuttonup = 165
  5375.     Global Const $wm_ncrbuttondblclk = 166
  5376.     Global Const $wm_ncmbuttondown = 167
  5377.     Global Const $wm_ncmbuttonup = 168
  5378.     Global Const $wm_ncmbuttondblclk = 169
  5379.     Global Const $wm_keydown = 256
  5380.     Global Const $wm_keyup = 257
  5381.     Global Const $wm_char = 258
  5382.     Global Const $wm_deadchar = 259
  5383.     Global Const $wm_syskeydown = 260
  5384.     Global Const $wm_syskeyup = 261
  5385.     Global Const $wm_syschar = 262
  5386.     Global Const $wm_sysdeadchar = 263
  5387.     Global Const $wm_initdialog = 272
  5388.     Global Const $wm_command = 273
  5389.     Global Const $wm_syscommand = 274
  5390.     Global Const $wm_timer = 275
  5391.     Global Const $wm_hscroll = 276
  5392.     Global Const $wm_vscroll = 277
  5393.     Global Const $wm_initmenu = 278
  5394.     Global Const $wm_initmenupopup = 279
  5395.     Global Const $wm_menuselect = 287
  5396.     Global Const $wm_menuchar = 288
  5397.     Global Const $wm_enteridle = 289
  5398.     Global Const $wm_menurbuttonup = 290
  5399.     Global Const $wm_menudrag = 291
  5400.     Global Const $wm_menugetobject = 292
  5401.     Global Const $wm_uninitmenupopup = 293
  5402.     Global Const $wm_menucommand = 294
  5403.     Global Const $wm_changeuistate = 295
  5404.     Global Const $wm_updateuistate = 296
  5405.     Global Const $wm_queryuistate = 297
  5406.     Global Const $wm_ctlcolormsgbox = 306
  5407.     Global Const $wm_ctlcoloredit = 307
  5408.     Global Const $wm_ctlcolorlistbox = 308
  5409.     Global Const $wm_ctlcolorbtn = 309
  5410.     Global Const $wm_ctlcolordlg = 310
  5411.     Global Const $wm_ctlcolorscrollbar = 311
  5412.     Global Const $wm_ctlcolorstatic = 312
  5413.     Global Const $wm_ctlcolor = 25
  5414.     Global Const $mn_gethmenu = 481
  5415.     Global Const $nm_first = 0
  5416.     Global Const $nm_outofmemory = $nm_first - 1
  5417.     Global Const $nm_click = $nm_first - 2
  5418.     Global Const $nm_dblclk = $nm_first - 3
  5419.     Global Const $nm_return = $nm_first - 4
  5420.     Global Const $nm_rclick = $nm_first - 5
  5421.     Global Const $nm_rdblclk = $nm_first - 6
  5422.     Global Const $nm_setfocus = $nm_first - 7
  5423.     Global Const $nm_killfocus = $nm_first - 8
  5424.     Global Const $nm_customdraw = $nm_first - 12
  5425.     Global Const $nm_hover = $nm_first - 13
  5426.     Global Const $nm_nchittest = $nm_first - 14
  5427.     Global Const $nm_keydown = $nm_first - 15
  5428.     Global Const $nm_releasedcapture = $nm_first - 16
  5429.     Global Const $nm_setcursor = $nm_first - 17
  5430.     Global Const $nm_char = $nm_first - 18
  5431.     Global Const $nm_tooltipscreated = $nm_first - 19
  5432.     Global Const $nm_ldown = $nm_first - 20
  5433.     Global Const $nm_rdown = $nm_first - 21
  5434.     Global Const $nm_themechanged = $nm_first - 22
  5435.     Global Const $wm_mousemove = 512
  5436.     Global Const $wm_lbuttondown = 513
  5437.     Global Const $wm_lbuttonup = 514
  5438.     Global Const $wm_lbuttondblclk = 515
  5439.     Global Const $wm_rbuttondown = 516
  5440.     Global Const $wm_rbuttonup = 517
  5441.     Global Const $wm_rbuttondblck = 518
  5442.     Global Const $wm_mbuttondown = 519
  5443.     Global Const $wm_mbuttonup = 520
  5444.     Global Const $wm_mbuttondblck = 521
  5445.     Global Const $wm_mousewheel = 522
  5446.     Global Const $wm_xbuttondown = 523
  5447.     Global Const $wm_xbuttonup = 524
  5448.     Global Const $wm_xbuttondblclk = 525
  5449.     Global Const $wm_mousehwheel = 526
  5450.     Global Const $ps_solid = 0
  5451.     Global Const $ps_dash = 1
  5452.     Global Const $ps_dot = 2
  5453.     Global Const $ps_dashdot = 3
  5454.     Global Const $ps_dashdotdot = 4
  5455.     Global Const $ps_null = 5
  5456.     Global Const $ps_insideframe = 6
  5457.     Global Const $lwa_alpha = 2
  5458.     Global Const $lwa_colorkey = 1
  5459.     Global Const $rgn_and = 1
  5460.     Global Const $rgn_or = 2
  5461.     Global Const $rgn_xor = 3
  5462.     Global Const $rgn_diff = 4
  5463.     Global Const $rgn_copy = 5
  5464.     Global Const $errorregion = 0
  5465.     Global Const $nullregion = 1
  5466.     Global Const $simpleregion = 2
  5467.     Global Const $complexregion = 3
  5468.     Global Const $transparent = 1
  5469.     Global Const $opaque = 2
  5470.     Global Const $ccm_first = 8192
  5471.     Global Const $ccm_getunicodeformat = ($ccm_first + 6)
  5472.     Global Const $ccm_setunicodeformat = ($ccm_first + 5)
  5473.     Global Const $ccm_setbkcolor = $ccm_first + 1
  5474.     Global Const $ccm_setcolorscheme = $ccm_first + 2
  5475.     Global Const $ccm_getcolorscheme = $ccm_first + 3
  5476.     Global Const $ccm_getdroptarget = $ccm_first + 4
  5477.     Global Const $ccm_setwindowtheme = $ccm_first + 11
  5478.     Global Const $ga_parent = 1
  5479.     Global Const $ga_root = 2
  5480.     Global Const $ga_rootowner = 3
  5481.     Global Const $sm_cxscreen = 0
  5482.     Global Const $sm_cyscreen = 1
  5483.     Global Const $sm_cxvscroll = 2
  5484.     Global Const $sm_cyhscroll = 3
  5485.     Global Const $sm_cycaption = 4
  5486.     Global Const $sm_cxborder = 5
  5487.     Global Const $sm_cyborder = 6
  5488.     Global Const $sm_cxdlgframe = 7
  5489.     Global Const $sm_cydlgframe = 8
  5490.     Global Const $sm_cyvthumb = 9
  5491.     Global Const $sm_cxhthumb = 10
  5492.     Global Const $sm_cxicon = 11
  5493.     Global Const $sm_cyicon = 12
  5494.     Global Const $sm_cxcursor = 13
  5495.     Global Const $sm_cycursor = 14
  5496.     Global Const $sm_cymenu = 15
  5497.     Global Const $sm_cxfullscreen = 16
  5498.     Global Const $sm_cyfullscreen = 17
  5499.     Global Const $sm_cykanjiwindow = 18
  5500.     Global Const $sm_mousepresent = 19
  5501.     Global Const $sm_cyvscroll = 20
  5502.     Global Const $sm_cxhscroll = 21
  5503.     Global Const $sm_debug = 22
  5504.     Global Const $sm_swapbutton = 23
  5505.     Global Const $sm_reserved1 = 24
  5506.     Global Const $sm_reserved2 = 25
  5507.     Global Const $sm_reserved3 = 26
  5508.     Global Const $sm_reserved4 = 27
  5509.     Global Const $sm_cxmin = 28
  5510.     Global Const $sm_cymin = 29
  5511.     Global Const $sm_cxsize = 30
  5512.     Global Const $sm_cysize = 31
  5513.     Global Const $sm_cxframe = 32
  5514.     Global Const $sm_cyframe = 33
  5515.     Global Const $sm_cxmintrack = 34
  5516.     Global Const $sm_cymintrack = 35
  5517.     Global Const $sm_cxdoubleclk = 36
  5518.     Global Const $sm_cydoubleclk = 37
  5519.     Global Const $sm_cxiconspacing = 38
  5520.     Global Const $sm_cyiconspacing = 39
  5521.     Global Const $sm_menudropalignment = 40
  5522.     Global Const $sm_penwindows = 41
  5523.     Global Const $sm_dbcsenabled = 42
  5524.     Global Const $sm_cmousebuttons = 43
  5525.     Global Const $sm_secure = 44
  5526.     Global Const $sm_cxedge = 45
  5527.     Global Const $sm_cyedge = 46
  5528.     Global Const $sm_cxminspacing = 47
  5529.     Global Const $sm_cyminspacing = 48
  5530.     Global Const $sm_cxsmicon = 49
  5531.     Global Const $sm_cysmicon = 50
  5532.     Global Const $sm_cysmcaption = 51
  5533.     Global Const $sm_cxsmsize = 52
  5534.     Global Const $sm_cysmsize = 53
  5535.     Global Const $sm_cxmenusize = 54
  5536.     Global Const $sm_cymenusize = 55
  5537.     Global Const $sm_arrange = 56
  5538.     Global Const $sm_cxminimized = 57
  5539.     Global Const $sm_cyminimized = 58
  5540.     Global Const $sm_cxmaxtrack = 59
  5541.     Global Const $sm_cymaxtrack = 60
  5542.     Global Const $sm_cxmaximized = 61
  5543.     Global Const $sm_cymaximized = 62
  5544.     Global Const $sm_network = 63
  5545.     Global Const $sm_cleanboot = 67
  5546.     Global Const $sm_cxdrag = 68
  5547.     Global Const $sm_cydrag = 69
  5548.     Global Const $sm_showsounds = 70
  5549.     Global Const $sm_cxmenucheck = 71
  5550.     Global Const $sm_cymenucheck = 72
  5551.     Global Const $sm_slowmachine = 73
  5552.     Global Const $sm_mideastenabled = 74
  5553.     Global Const $sm_mousewheelpresent = 75
  5554.     Global Const $sm_xvirtualscreen = 76
  5555.     Global Const $sm_yvirtualscreen = 77
  5556.     Global Const $sm_cxvirtualscreen = 78
  5557.     Global Const $sm_cyvirtualscreen = 79
  5558.     Global Const $sm_cmonitors = 80
  5559.     Global Const $sm_samedisplayformat = 81
  5560.     Global Const $sm_immenabled = 82
  5561.     Global Const $sm_cxfocusborder = 83
  5562.     Global Const $sm_cyfocusborder = 84
  5563.     Global Const $sm_tabletpc = 86
  5564.     Global Const $sm_mediacenter = 87
  5565.     Global Const $sm_starter = 88
  5566.     Global Const $sm_serverr2 = 89
  5567.     Global Const $sm_cmetrics = 90
  5568.     Global Const $sm_remotesession = 4096
  5569.     Global Const $sm_shuttingdown = 8192
  5570.     Global Const $sm_remotecontrol = 8193
  5571.     Global Const $sm_caretblinkingenabled = 8194
  5572.     Global Const $blackness = 66
  5573.     Global Const $captureblt = 1073741824
  5574.     Global Const $dstinvert = 5570569
  5575.     Global Const $mergecopy = 12583114
  5576.     Global Const $mergepaint = 12255782
  5577.     Global Const $nomirrorbitmap = -2147483648
  5578.     Global Const $notsrccopy = 3342344
  5579.     Global Const $notsrcerase = 1114278
  5580.     Global Const $patcopy = 15728673
  5581.     Global Const $patinvert = 5898313
  5582.     Global Const $patpaint = 16452105
  5583.     Global Const $srcand = 8913094
  5584.     Global Const $srccopy = 13369376
  5585.     Global Const $srcerase = 4457256
  5586.     Global Const $srcinvert = 6684742
  5587.     Global Const $srcpaint = 15597702
  5588.     Global Const $whiteness = 16711778
  5589.     Global Const $dt_bottom = 8
  5590.     Global Const $dt_calcrect = 1024
  5591.     Global Const $dt_center = 1
  5592.     Global Const $dt_editcontrol = 8192
  5593.     Global Const $dt_end_ellipsis = 32768
  5594.     Global Const $dt_expandtabs = 64
  5595.     Global Const $dt_externalleading = 512
  5596.     Global Const $dt_hideprefix = 1048576
  5597.     Global Const $dt_internal = 4096
  5598.     Global Const $dt_left = 0
  5599.     Global Const $dt_modifystring = 65536
  5600.     Global Const $dt_noclip = 256
  5601.     Global Const $dt_nofullwidthcharbreak = 524288
  5602.     Global Const $dt_noprefix = 2048
  5603.     Global Const $dt_path_ellipsis = 16384
  5604.     Global Const $dt_prefixonly = 2097152
  5605.     Global Const $dt_right = 2
  5606.     Global Const $dt_rtlreading = 131072
  5607.     Global Const $dt_singleline = 32
  5608.     Global Const $dt_tabstop = 128
  5609.     Global Const $dt_top = 0
  5610.     Global Const $dt_vcenter = 4
  5611.     Global Const $dt_wordbreak = 16
  5612.     Global Const $dt_word_ellipsis = 262144
  5613.     Global Const $rdw_erase = 4
  5614.     Global Const $rdw_frame = 1024
  5615.     Global Const $rdw_internalpaint = 2
  5616.     Global Const $rdw_invalidate = 1
  5617.     Global Const $rdw_noerase = 32
  5618.     Global Const $rdw_noframe = 2048
  5619.     Global Const $rdw_nointernalpaint = 16
  5620.     Global Const $rdw_validate = 8
  5621.     Global Const $rdw_erasenow = 512
  5622.     Global Const $rdw_updatenow = 256
  5623.     Global Const $rdw_allchildren = 128
  5624.     Global Const $rdw_nochildren = 64
  5625.     Global Const $wm_renderformat = 773
  5626.     Global Const $wm_renderallformats = 774
  5627.     Global Const $wm_destroyclipboard = 775
  5628.     Global Const $wm_drawclipboard = 776
  5629.     Global Const $wm_paintclipboard = 777
  5630.     Global Const $wm_vscrollclipboard = 778
  5631.     Global Const $wm_sizeclipboard = 779
  5632.     Global Const $wm_askcbformatname = 780
  5633.     Global Const $wm_changecbchain = 781
  5634.     Global Const $wm_hscrollclipboard = 782
  5635.     Global Const $hterror = -2
  5636.     Global Const $httransparent = -1
  5637.     Global Const $htnowhere = 0
  5638.     Global Const $htclient = 1
  5639.     Global Const $htcaption = 2
  5640.     Global Const $htsysmenu = 3
  5641.     Global Const $htgrowbox = 4
  5642.     Global Const $htsize = $htgrowbox
  5643.     Global Const $htmenu = 5
  5644.     Global Const $hthscroll = 6
  5645.     Global Const $htvscroll = 7
  5646.     Global Const $htminbutton = 8
  5647.     Global Const $htmaxbutton = 9
  5648.     Global Const $htleft = 10
  5649.     Global Const $htright = 11
  5650.     Global Const $httop = 12
  5651.     Global Const $httopleft = 13
  5652.     Global Const $httopright = 14
  5653.     Global Const $htbottom = 15
  5654.     Global Const $htbottomleft = 16
  5655.     Global Const $htbottomright = 17
  5656.     Global Const $htborder = 18
  5657.     Global Const $htreduce = $htminbutton
  5658.     Global Const $htzoom = $htmaxbutton
  5659.     Global Const $htsizefirst = $htleft
  5660.     Global Const $htsizelast = $htbottomright
  5661.     Global Const $htobject = 19
  5662.     Global Const $htclose = 20
  5663.     Global Const $hthelp = 21
  5664.     Global Const $color_scrollbar = 0
  5665.     Global Const $color_background = 1
  5666.     Global Const $color_activecaption = 2
  5667.     Global Const $color_inactivecaption = 3
  5668.     Global Const $color_menu = 4
  5669.     Global Const $color_window = 5
  5670.     Global Const $color_windowframe = 6
  5671.     Global Const $color_menutext = 7
  5672.     Global Const $color_windowtext = 8
  5673.     Global Const $color_captiontext = 9
  5674.     Global Const $color_activeborder = 10
  5675.     Global Const $color_inactiveborder = 11
  5676.     Global Const $color_appworkspace = 12
  5677.     Global Const $color_highlight = 13
  5678.     Global Const $color_highlighttext = 14
  5679.     Global Const $color_btnface = 15
  5680.     Global Const $color_btnshadow = 16
  5681.     Global Const $color_graytext = 17
  5682.     Global Const $color_btntext = 18
  5683.     Global Const $color_inactivecaptiontext = 19
  5684.     Global Const $color_btnhighlight = 20
  5685.     Global Const $color_3ddkshadow = 21
  5686.     Global Const $color_3dlight = 22
  5687.     Global Const $color_infotext = 23
  5688.     Global Const $color_infobk = 24
  5689.     Global Const $color_hotlight = 26
  5690.     Global Const $color_gradientactivecaption = 27
  5691.     Global Const $color_gradientinactivecaption = 28
  5692.     Global Const $color_menuhilight = 29
  5693.     Global Const $color_menubar = 30
  5694.     Global Const $color_desktop = 1
  5695.     Global Const $color_3dface = 15
  5696.     Global Const $color_3dshadow = 16
  5697.     Global Const $color_3dhighlight = 20
  5698.     Global Const $color_3dhilight = 20
  5699.     Global Const $color_btnhilight = 20
  5700.     Global Const $hinst_commctrl = -1
  5701.     Global Const $idb_std_small_color = 0
  5702.     Global Const $idb_std_large_color = 1
  5703.     Global Const $idb_view_small_color = 4
  5704.     Global Const $idb_view_large_color = 5
  5705.     Global Const $idb_hist_small_color = 8
  5706.     Global Const $idb_hist_large_color = 9
  5707.     Global Const $startf_forceofffeedback = 128
  5708.     Global Const $startf_forceonfeedback = 64
  5709.     Global Const $startf_runfullscreen = 32
  5710.     Global Const $startf_usecountchars = 8
  5711.     Global Const $startf_usefillattribute = 16
  5712.     Global Const $startf_usehotkey = 512
  5713.     Global Const $startf_useposition = 4
  5714.     Global Const $startf_useshowwindow = 1
  5715.     Global Const $startf_usesize = 2
  5716.     Global Const $startf_usestdhandles = 256
  5717.     Global Const $cdds_prepaint = 1
  5718.     Global Const $cdds_postpaint = 2
  5719.     Global Const $cdds_preerase = 3
  5720.     Global Const $cdds_posterase = 4
  5721.     Global Const $cdds_item = 65536
  5722.     Global Const $cdds_itemprepaint = 65537
  5723.     Global Const $cdds_itempostpaint = 65538
  5724.     Global Const $cdds_itempreerase = 65539
  5725.     Global Const $cdds_itemposterase = 65540
  5726.     Global Const $cdds_subitem = 131072
  5727.     Global Const $cdis_selected = 1
  5728.     Global Const $cdis_grayed = 2
  5729.     Global Const $cdis_disabled = 4
  5730.     Global Const $cdis_checked = 8
  5731.     Global Const $cdis_focus = 16
  5732.     Global Const $cdis_default = 32
  5733.     Global Const $cdis_hot = 64
  5734.     Global Const $cdis_marked = 128
  5735.     Global Const $cdis_indeterminate = 256
  5736.     Global Const $cdis_showkeyboardcues = 512
  5737.     Global Const $cdis_nearhot = 1024
  5738.     Global Const $cdis_othersidehot = 2048
  5739.     Global Const $cdis_drophilited = 4096
  5740.     Global Const $cdrf_dodefault = 0
  5741.     Global Const $cdrf_newfont = 2
  5742.     Global Const $cdrf_skipdefault = 4
  5743.     Global Const $cdrf_notifypostpaint = 16
  5744.     Global Const $cdrf_notifyitemdraw = 32
  5745.     Global Const $cdrf_notifysubitemdraw = 32
  5746.     Global Const $cdrf_notifyposterase = 64
  5747.     Global Const $cdrf_doerase = 8
  5748.     Global Const $cdrf_skippostpaint = 256
  5749.     Global Const $gui_ss_default_gui = BitOR($ws_minimizebox, $ws_caption, $ws_popup, $ws_sysmenu)
  5750.     Opt("WinWaitDelay", 0)
  5751.     Global Const $_c_nomduscript_pnggui = StringTrimRight(@ScriptName, 4)
  5752.     Global $_a_fileinstall_pnggui[1] = [0], $_a_gui_index_pnggui[1] = [0]
  5753.     Global $_b_init_pnggui = 0, $_b_gdi_start_pnggui = 1, $_b_fileinstall_pnggui = 0, $_b_gdi_pnggui = 1, $_b_gui_event_mode = 1
  5754.     Global $_f_dossier_pnggui = $_c_nomduscript_pnggui & "\", $_f_lastguiused_pnggui, $_a_fileinstalldata_pnggui[1] = [0]
  5755.     Global $_b_lastctrlstate_pnggui, $_f_lastctrlused_pnggui = 0, $_a_buttonsarrindex_pnggui[1] = [0], $_a_buttonsarrwin_pnggui[1] = [0]
  5756. #EndRegion Includes et déclaration des globales
  5757. #Region Fonctions principales ( PngGuiSetOpt, PngGuiCreate, PngGuiSetState, PngGuiDelete, PngGuiExit )
  5758.  
  5759.     Func pngguisetopt($install = 0, $dossier = -1, $guioneventmode = 1, $gdi = 1)
  5760.         If $install = 1 Then $_b_fileinstall_pnggui = 1
  5761.         If $dossier <> -1 Then $_f_dossier_pnggui = $dossier & "\"
  5762.         If $dossier = -1 Then $dossier = $_f_dossier_pnggui
  5763.         If $gdi = 0 Then $_b_gdi_pnggui = 0
  5764.         If $guioneventmode = 0 Then
  5765.             $_b_gui_event_mode = 0
  5766.             Opt("GuiOnEventMode", 0)
  5767.         Else
  5768.             Opt("GuiOnEventMode", 1)
  5769.         EndIf
  5770.     EndFunc
  5771.  
  5772.     Func pngguicreate($src, $x = -1, $y = -1, $nom = $_c_nomduscript_pnggui)
  5773.         If $_b_init_pnggui = 0 Then
  5774.             $_b_init_pnggui = 1
  5775.             AdlibRegister("_reducememoryusage_PngGui", 10000)
  5776.             If NOT FileExists($_f_dossier_pnggui) Then
  5777.                 DirCreate($_f_dossier_pnggui)
  5778.                 ShellExecute(@ScriptName)
  5779.                 Exit
  5780.             EndIf
  5781.             If $_b_gdi_pnggui = 1 Then _gdiplus_startup()
  5782.         EndIf
  5783.         Local $png = _lien_du_png_pnggui($src), $himage = _gdiplus_imageloadfromfile($png), $width = _gdiplus_imagegetwidth($himage), $height = _gdiplus_imagegetheight($himage)
  5784.         If $nom = -1 Then
  5785.             Local $gui = GUICreate($nom, $width, $height, $x, $y, $ws_popup, $ws_ex_layered, WinGetHandle(AutoItWinGetTitle()))
  5786.         Else
  5787.             Local $gui = GUICreate($nom, $width, $height, $x, $y, $ws_popup, $ws_ex_layered)
  5788.         EndIf
  5789.         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]
  5790.         If $_b_gui_event_mode = 1 Then
  5791.             GUISetOnEvent($gui_event_primarydown, "GUI_EVENT_PRIMARYDOWN_PngGui", $controlgui)
  5792.             GUISetOnEvent($gui_event_primaryup, "GUI_EVENT_PRIMARYUP_PngGui", $controlgui)
  5793.             GUISetOnEvent($gui_event_mousemove, "GUI_EVENT_MOUSEMOVE_PngGui", $controlgui)
  5794.         EndIf
  5795.         _assigneval_pnggui($controlgui, $array)
  5796.         setbitmap($gui, $himage, 255)
  5797.         $_a_gui_index_pnggui[0] += 1
  5798.         _arrayadd($_a_gui_index_pnggui, $controlgui)
  5799.         $_f_lastguiused_pnggui = $array
  5800.         Return $array
  5801.     EndFunc
  5802.  
  5803.     Func pngguisetstate($macro = @SW_SHOW, $gui = $_f_lastguiused_pnggui)
  5804.         If $macro = $gui_focus Then $_f_lastguiused_pnggui = $gui
  5805.         If $macro = @SW_SHOW Then
  5806.             Local $color = 1184532
  5807.             GUISetBkColor($color, $gui[2])
  5808.             _winapi_setlayeredwindowattributes($gui[2], $color)
  5809.         EndIf
  5810.         GUISetState($macro, $gui[1])
  5811.         GUISetState($macro, $gui[2])
  5812.     EndFunc
  5813.  
  5814.     Func pngguidelete(ByRef $gui)
  5815.         pngguisetstate(@SW_HIDE, $gui)
  5816.         Local $arr = _assigneval_pnggui($gui[2])
  5817.         While $arr[0] > 0
  5818.             pngguideletebutton($arr[4])
  5819.             $arr = _assigneval_pnggui($gui[2])
  5820.         WEnd
  5821.         GUIDelete($gui[2])
  5822.         GUIDelete($gui[1])
  5823.         _winapi_deleteobject($gui[3])
  5824.         _assigneval_pnggui($gui[2], -1)
  5825.         _arraydelete($_a_gui_index_pnggui, _arraysearch($_a_gui_index_pnggui, $gui[2]))
  5826.         $_a_gui_index_pnggui[0] -= 1
  5827.         $gui = ""
  5828.     EndFunc
  5829.  
  5830.     Func pngguiexit($dirdelete = 0, $gdi_exit = 1)
  5831.         While $_a_gui_index_pnggui[0] > 0
  5832.             Local $gui = _assigneval_pnggui($_a_gui_index_pnggui[1])
  5833.             pngguidelete($gui)
  5834.         WEnd
  5835.         If $dirdelete = 1 Then DirRemove($_f_dossier_pnggui, 1)
  5836.         If $gdi_exit = 1 Then _gdiplus_shutdown()
  5837.         _fileinstall_data_pnggui(0, 1)
  5838.     EndFunc
  5839.  
  5840. #EndRegion Fonctions principales ( PngGuiSetOpt, PngGuiCreate, PngGuiSetState, PngGuiDelete, PngGuiExit )
  5841. #Region Fonctions CTRL  ( PngGuiCreateLabel, PngGuiCreatePic, PngGuiCreateButton, PngGuiDeleteButton )
  5842.  
  5843.     Func pngguicreatelabel($nom, $x, $y, $w = 200, $h = 30, $color = 0, $style = -1, $exstyle = -1)
  5844.         Local $label = GUICtrlCreateLabel($nom, $x, $y, $w, $h, $style, $exstyle)
  5845.         GUICtrlSetColor(-1, $color)
  5846.         GUICtrlSetBkColor(-1, $gui_bkcolor_transparent)
  5847.         Return $label
  5848.     EndFunc
  5849.  
  5850.     Func pngguicreatepic($src, $x, $y, $scale = 1, $alt = "")
  5851.         $src = _lien_du_png_pnggui($src)
  5852.         Local $himage2 = _gdiplus_imageloadfromfile($src), $imageheight = (_gdiplus_imagegetheight($himage2)) * $scale, $imagewidth = (_gdiplus_imagegetwidth($himage2)) * $scale
  5853.         If $scale <> 1 Then
  5854.             Local $hbitmap = _winapi_createbitmap($imagewidth, $imageheight, 1, 32), $himage1 = _gdiplus_bitmapcreatefromhbitmap($hbitmap), $hgraphic = _gdiplus_imagegetgraphicscontext($himage1)
  5855.             _gdiplus_graphicsdrawimagerect($hgraphic, $himage2, 0, 0, $imagewidth, $imageheight)
  5856.             Local $hbitmap2 = _gdiplus_bitmapcreatehbitmapfrombitmap($himage1)
  5857.             _winapi_deleteobject($hbitmap)
  5858.             _gdiplus_imagedispose($himage1)
  5859.             _gdiplus_graphicsdispose($hgraphic)
  5860.         Else
  5861.             Local $hbitmap = _gdiplus_bitmapcreatefromfile($src), $hbitmap2 = _gdiplus_bitmapcreatehbitmapfrombitmap($hbitmap)
  5862.             _gdiplus_bitmapdispose($hbitmap)
  5863.         EndIf
  5864.         Local $pic = GUICtrlCreatePic("", $x, $y, $imagewidth, $imageheight)
  5865.         If $alt <> "" Then GUICtrlSetTip($pic, $alt)
  5866.         GUICtrlSendMsg($pic, 370, 0, $hbitmap2)
  5867.         Return $pic
  5868.     EndFunc
  5869.  
  5870.     Func pngguicreatebutton($src, $x, $y, $fonction = -1, $msg = "")
  5871.         Local $u = UBound($src), $src_arr, $ctrl_arr, $u2 = UBound($_f_lastguiused_pnggui)
  5872.         If $u = 0 Then
  5873.             $u = 1
  5874.             Dim $src_arr[1] = [$src]
  5875.         Else
  5876.             $src_arr = $src
  5877.         EndIf
  5878.         If $u2 = 4 Then
  5879.             $ctrl_arr = _assigneval_pnggui($_f_lastguiused_pnggui[2])
  5880.         Else
  5881.             MsgBox(0, "Erreur", "PngGuiCreate doit être utilisé puisque PngGuiCreateButton ne peut créer un bouton que sur une PngGui")
  5882.             Return
  5883.         EndIf
  5884.         _arrayadd($src_arr, "")
  5885.         _arraypush($src_arr, "", 1)
  5886.         $src_arr[1] = _lien_du_png_pnggui($src_arr[1])
  5887.         Local $i = _gdiplus_imageloadfromfile($src_arr[1]), $w = _gdiplus_imagegetwidth($i), $h = _gdiplus_imagegetheight($i)
  5888.         $src_arr[0] = GUICtrlCreatePic("", $x, $y, $w, $h)
  5889.         $ctrl_arr[0] += 1
  5890.         _arrayadd($ctrl_arr, $src_arr[0])
  5891.         _gdiplus_imagedispose($i)
  5892.         For $i = 1 To 3
  5893.             If (UBound($src_arr) - 1) < $i Then _arrayadd($src_arr, -1)
  5894.             If $src_arr[$i] <> -1 Then
  5895.                 If $i <> 1 Then $src_arr[$i] = _lien_du_png_pnggui($src_arr[$i])
  5896.                 Local $hbitmap = _gdiplus_bitmapcreatefromfile($src_arr[$i])
  5897.                 $src_arr[$i] = _gdiplus_bitmapcreatehbitmapfrombitmap($hbitmap)
  5898.                 _gdiplus_bitmapdispose($hbitmap)
  5899.             Else
  5900.                 $src_arr[$i] = $src_arr[$i - 1]
  5901.             EndIf
  5902.             _arrayadd($ctrl_arr, $src_arr[$i])
  5903.         Next
  5904.         GUICtrlSendMsg($src_arr[0], 370, 0, $src_arr[1])
  5905.         _arrayadd($ctrl_arr, "Func" & $fonction)
  5906.         _arrayadd($ctrl_arr, "msg" & $msg)
  5907.         _assigneval_pnggui($_f_lastguiused_pnggui[2], $ctrl_arr)
  5908.         $_a_buttonsarrindex_pnggui[0] += 1
  5909.         _arrayadd($_a_buttonsarrindex_pnggui, $src_arr[0])
  5910.         _arrayadd($_a_buttonsarrwin_pnggui, $_f_lastguiused_pnggui[2])
  5911.         Return $src_arr[0]
  5912.     EndFunc
  5913.  
  5914.     Func pngguideletebutton($ctrl)
  5915.         If $_a_gui_index_pnggui[0] < 1 Then
  5916.             MsgBox(0, "PngGuiDeleteButton", "aucune gui enregistrée")
  5917.             Exit
  5918.         EndIf
  5919.         For $i = 1 To $_a_gui_index_pnggui[0]
  5920.             Local $index = $_a_gui_index_pnggui[$i], $ctrl_arr = _assigneval_pnggui($_a_gui_index_pnggui[$i]), $search = _arraysearch($ctrl_arr, $ctrl, 4, 0, 1)
  5921.             If $search <> -1 Then
  5922.                 $ctrl_arr[0] -= 1
  5923.                 _winapi_deleteobject($ctrl_arr[$search + 1])
  5924.                 _winapi_deleteobject($ctrl_arr[$search + 2])
  5925.                 _winapi_deleteobject($ctrl_arr[$search + 3])
  5926.                 GUICtrlSetImage($ctrl_arr[$search], "")
  5927.                 For $j = 1 To 6
  5928.                     _arraydelete($ctrl_arr, $search)
  5929.                 Next
  5930.                 ExitLoop
  5931.             EndIf
  5932.         Next
  5933.         Local $search = _arraysearch($_a_buttonsarrindex_pnggui, $ctrl)
  5934.         If $search = -1 Then MsgBox(0, "Erreur Critique", "_PngGui UDF line 251")
  5935.         $_a_buttonsarrindex_pnggui[0] -= 1
  5936.         _arraydelete($_a_buttonsarrindex_pnggui, $search)
  5937.         _arraydelete($_a_buttonsarrwin_pnggui, $search)
  5938.         _assigneval_pnggui($index, $ctrl_arr)
  5939.     EndFunc
  5940.  
  5941. #EndRegion Fonctions CTRL  ( PngGuiCreateLabel, PngGuiCreatePic, PngGuiCreateButton )
  5942. #Region fonctions internes (_FileInstall_data_pnggui,_assigneval_PngGui,_lien_du_png_PngGui, SetBitmap, _reduceMemoryUsage_PngGui
  5943.  
  5944.     Func _fileinstall_data_pnggui($data, $fin = 0)
  5945.         If $_b_fileinstall_pnggui = 0 Then Return
  5946.         Switch $fin
  5947.             Case "0"
  5948.                 If $_a_fileinstalldata_pnggui[0] = 0 Then
  5949.                     _arrayadd($_a_fileinstalldata_pnggui, $data)
  5950.                     $_a_fileinstalldata_pnggui[0] += 1
  5951.                     Return
  5952.                 EndIf
  5953.                 Local $r = _arrayfindall($_a_fileinstalldata_pnggui, $data, 1, 0, 1)
  5954.                 If UBound($r) <> 0 Then Return
  5955.                 $_a_fileinstalldata_pnggui[0] += 1
  5956.                 _arrayadd($_a_fileinstalldata_pnggui, $data)
  5957.                 Return
  5958.             Case "1"
  5959.                 Local $out = " ; Installation des fichiers images." & @CRLF
  5960.                 For $i = 1 To $_a_fileinstalldata_pnggui[0]
  5961.                     $out &= 'FileInstall("' & $_a_fileinstalldata_pnggui[$i] & '","' & $_a_fileinstalldata_pnggui[$i] & '",0)' & @CRLF
  5962.                 Next
  5963.                 $out &= @CRLF
  5964.                 ClipPut($out)
  5965.                 MsgBox(0, "Données FileInstall", "Les données FileInstall ont été copiés dans" & @CRLF & "le presse-papier avec succès")
  5966.                 Exit
  5967.         EndSwitch
  5968.     EndFunc
  5969.  
  5970.     Func _assigneval_pnggui($eval, $assign = "")
  5971.         $eval = $eval & "_PngGui"
  5972.         If $assign = "" Then Return Eval($eval)
  5973.         If $assign = -1 Then $assign = ""
  5974.         Return Assign($eval, $assign, 2)
  5975.     EndFunc
  5976.  
  5977.     Func _lien_du_png_pnggui($src)
  5978.         Local $png = $_f_dossier_pnggui & $src
  5979.         If NOT FileExists($png) Then
  5980.             MsgBox(0, "Erreur", "Le fichier " & $png & " n'a pas été trouvé")
  5981.             Exit
  5982.         EndIf
  5983.         _fileinstall_data_pnggui($png, 0)
  5984.         Return $png
  5985.     EndFunc
  5986.  
  5987.     Func setbitmap($hgui, $himage, $iopacity)
  5988.         Local $hscrdc, $hmemdc, $hbitmap, $hold, $psize, $tsize, $psource, $tsource, $pblend, $tblend
  5989.         $hscrdc = _winapi_getdc(0)
  5990.         $hmemdc = _winapi_createcompatibledc($hscrdc)
  5991.         $hbitmap = _gdiplus_bitmapcreatehbitmapfrombitmap($himage)
  5992.         $hold = _winapi_selectobject($hmemdc, $hbitmap)
  5993.         $tsize = DllStructCreate($tagsize)
  5994.         $psize = DllStructGetPtr($tsize)
  5995.         DllStructSetData($tsize, "X", _gdiplus_imagegetwidth($himage))
  5996.         DllStructSetData($tsize, "Y", _gdiplus_imagegetheight($himage))
  5997.         $tsource = DllStructCreate($tagpoint)
  5998.         $psource = DllStructGetPtr($tsource)
  5999.         $tblend = DllStructCreate($tagblendfunction)
  6000.         $pblend = DllStructGetPtr($tblend)
  6001.         DllStructSetData($tblend, "Alpha", $iopacity)
  6002.         DllStructSetData($tblend, "Format", 1)
  6003.         _winapi_updatelayeredwindow($hgui, $hscrdc, 0, $psize, $hmemdc, $psource, 0, $pblend, $ulw_alpha)
  6004.         _winapi_releasedc(0, $hscrdc)
  6005.         _winapi_selectobject($hmemdc, $hold)
  6006.         _winapi_deleteobject($hbitmap)
  6007.         _winapi_deletedc($hmemdc)
  6008.     EndFunc
  6009.  
  6010.     Func _reducememoryusage_pnggui()
  6011.         _reducememory_pnggui(ProcessExists(@ScriptName))
  6012.     EndFunc
  6013.  
  6014.     Func _reducememory_pnggui($i_pid = -1)
  6015.         If $i_pid <> -1 Then
  6016.             Local $ai_handle = DllCall("kernel32.dll", "int", "OpenProcess", "int", 2035711, "int", False, "int", $i_pid)
  6017.             Local $ai_return = DllCall("psapi.dll", "int", "EmptyWorkingSet", "long", $ai_handle[0])
  6018.             DllCall("kernel32.dll", "int", "CloseHandle", "int", $ai_handle[0])
  6019.         Else
  6020.             Local $ai_return = DllCall("psapi.dll", "int", "EmptyWorkingSet", "long", -1)
  6021.         EndIf
  6022.         Return $ai_return[0]
  6023.     EndFunc
  6024.  
  6025. #EndRegion fonctions internes
  6026. #Region Gestion des contrôles ( GUI_EVENT_PRIMARYDOWN_PngGui,GUI_EVENT_PRIMARYUP_PngGui,GUI_EVENT_MOUSEMOVE_PngGui,_SetButtonState_PngGui,_ButtonHover_PngGui(),_Win_PngGui
  6027.  
  6028.     Func gui_event_primarydown_pnggui()
  6029.         Local $win = _win_pnggui()
  6030.         If $win = -1 Then Return
  6031.         Local $gcci = GUIGetCursorInfo($win)
  6032.         If $gcci[4] = 0 Then
  6033.             Local $gui = _assigneval_pnggui($win)
  6034.             DllCall("user32.dll", "long", "SendMessage", "hwnd", $gui[1], "int", $wm_syscommand, "int", 61449, "int", 0)
  6035.             WinActivate($win)
  6036.         Else
  6037.             $_b_lastctrlstate_pnggui = 1
  6038.             _setbuttonstate_pnggui($gcci[4], 3)
  6039.         EndIf
  6040.     EndFunc
  6041.  
  6042.     Func gui_event_primaryup_pnggui()
  6043.         $_b_lastctrlstate_pnggui = 0
  6044.         Local $win = _win_pnggui()
  6045.         If $win = -1 Then Return
  6046.         Local $gcci = GUIGetCursorInfo($win)
  6047.         If $gcci[4] <> 0 Then _setbuttonstate_pnggui($gcci[4], 2, 1)
  6048.     EndFunc
  6049.  
  6050.     Func gui_event_mousemove_pnggui()
  6051.         If $_a_buttonsarrindex_pnggui[0] < 1 Then Return
  6052.         Local $win = _win_pnggui()
  6053.         If $win = -1 Then Return
  6054.         Local $gcci = GUIGetCursorInfo($win), $winpos = WinGetPos($win)
  6055.         If $gcci[0] < 0 OR $gcci[1] < 0 OR $gcci[0] > $winpos[2] OR $gcci[1] > $winpos[3] Then Return
  6056.         If $gcci[4] <> $_f_lastctrlused_pnggui Then
  6057.             If $_f_lastctrlused_pnggui <> 0 Then _setbuttonstate_pnggui($_f_lastctrlused_pnggui)
  6058.             If $gcci[4] <> 0 Then _setbuttonstate_pnggui($gcci[4], 2 + $_b_lastctrlstate_pnggui)
  6059.         EndIf
  6060.         $_f_lastctrlused_pnggui = $gcci[4]
  6061.     EndFunc
  6062.  
  6063.     Func _setbuttonstate_pnggui($ctrl, $state = 1, $exe = 0)
  6064.         Local $search = _arraysearch($_a_buttonsarrindex_pnggui, $ctrl)
  6065.         If $search = -1 Then Return
  6066.         Local $ctrl_arr = _assigneval_pnggui($_a_buttonsarrwin_pnggui[$search])
  6067.         Local $pic = _arraysearch($ctrl_arr, $ctrl)
  6068.         GUICtrlSendMsg($ctrl_arr[$pic], 370, 0, $ctrl_arr[$pic + $state])
  6069.         If $exe = 1 Then
  6070.             Local $func = StringTrimLeft($ctrl_arr[$pic + 4], 4), $msg = StringTrimLeft($ctrl_arr[$pic + 5], 3)
  6071.             If $func <> -1 Then
  6072.                 Select
  6073.                     Case $msg = ""
  6074.                         Call($func)
  6075.                     Case $msg <> ""
  6076.                         Call($func, $msg)
  6077.                 EndSelect
  6078.             EndIf
  6079.         EndIf
  6080.     EndFunc
  6081.  
  6082.     Func _buttonhover_pnggui()
  6083.         Local $msg = GUIGetMsg()
  6084.         Switch $msg
  6085.             Case $gui_event_primarydown
  6086.                 gui_event_primarydown_pnggui()
  6087.             Case $gui_event_primaryup
  6088.                 gui_event_primaryup_pnggui()
  6089.             Case $gui_event_mousemove
  6090.                 gui_event_mousemove_pnggui()
  6091.         EndSwitch
  6092.     EndFunc
  6093.  
  6094.     Func _win_pnggui()
  6095.         If $_b_gui_event_mode = 0 Then
  6096.             Local $win = WinGetHandle("[ACTIVE]")
  6097.             If _arraysearch($_a_buttonsarrwin_pnggui, $win) = -1 Then $win = -1
  6098.         Else
  6099.             Local $win = @GUI_WinHandle
  6100.         EndIf
  6101.         Return $win
  6102.     EndFunc
  6103.  
  6104. #EndRegion
  6105. Global Const $es_left = 0
  6106. Global Const $es_center = 1
  6107. Global Const $es_right = 2
  6108. Global Const $es_multiline = 4
  6109. Global Const $es_uppercase = 8
  6110. Global Const $es_lowercase = 16
  6111. Global Const $es_password = 32
  6112. Global Const $es_autovscroll = 64
  6113. Global Const $es_autohscroll = 128
  6114. Global Const $es_nohidesel = 256
  6115. Global Const $es_oemconvert = 1024
  6116. Global Const $es_readonly = 2048
  6117. Global Const $es_wantreturn = 4096
  6118. Global Const $es_number = 8192
  6119. Global Const $ec_err = -1
  6120. Global Const $ecm_first = 5376
  6121. Global Const $em_canundo = 198
  6122. Global Const $em_charfrompos = 215
  6123. Global Const $em_emptyundobuffer = 205
  6124. Global Const $em_fmtlines = 200
  6125. Global Const $em_getcuebanner = ($ecm_first + 2)
  6126. Global Const $em_getfirstvisibleline = 206
  6127. Global Const $em_gethandle = 189
  6128. Global Const $em_getimestatus = 217
  6129. Global Const $em_getlimittext = 213
  6130. Global Const $em_getline = 196
  6131. Global Const $em_getlinecount = 186
  6132. Global Const $em_getmargins = 212
  6133. Global Const $em_getmodify = 184
  6134. Global Const $em_getpasswordchar = 210
  6135. Global Const $em_getrect = 178
  6136. Global Const $em_getsel = 176
  6137. Global Const $em_getthumb = 190
  6138. Global Const $em_getwordbreakproc = 209
  6139. Global Const $em_hideballoontip = ($ecm_first + 4)
  6140. Global Const $em_limittext = 197
  6141. Global Const $em_linefromchar = 201
  6142. Global Const $em_lineindex = 187
  6143. Global Const $em_linelength = 193
  6144. Global Const $em_linescroll = 182
  6145. Global Const $em_posfromchar = 214
  6146. Global Const $em_replacesel = 194
  6147. Global Const $em_scroll = 181
  6148. Global Const $em_scrollcaret = 183
  6149. Global Const $em_setcuebanner = ($ecm_first + 1)
  6150. Global Const $em_sethandle = 188
  6151. Global Const $em_setimestatus = 216
  6152. Global Const $em_setlimittext = $em_limittext
  6153. Global Const $em_setmargins = 211
  6154. Global Const $em_setmodify = 185
  6155. Global Const $em_setpasswordchar = 204
  6156. Global Const $em_setreadonly = 207
  6157. Global Const $em_setrect = 179
  6158. Global Const $em_setrectnp = 180
  6159. Global Const $em_setsel = 177
  6160. Global Const $em_settabstops = 203
  6161. Global Const $em_setwordbreakproc = 208
  6162. Global Const $em_showballoontip = ($ecm_first + 3)
  6163. Global Const $em_undo = 199
  6164. Global Const $ec_leftmargin = 1
  6165. Global Const $ec_rightmargin = 2
  6166. Global Const $ec_usefontinfo = 65535
  6167. Global Const $emsis_compositionstring = 1
  6168. Global Const $eimes_getcompstratonce = 1
  6169. Global Const $eimes_cancelcompstrinfocus = 2
  6170. Global Const $eimes_completecompstrkillfocus = 4
  6171. Global Const $en_align_ltr_ec = 1792
  6172. Global Const $en_align_rtl_ec = 1793
  6173. Global Const $en_change = 768
  6174. Global Const $en_errspace = 1280
  6175. Global Const $en_hscroll = 1537
  6176. Global Const $en_killfocus = 512
  6177. Global Const $en_maxtext = 1281
  6178. Global Const $en_setfocus = 256
  6179. Global Const $en_update = 1024
  6180. Global Const $en_vscroll = 1538
  6181. Global Const $tti_none = 0
  6182. Global Const $tti_info = 1
  6183. Global Const $tti_warning = 2
  6184. Global Const $tti_error = 3
  6185. Global Const $tti_info_large = 4
  6186. Global Const $tti_warning_large = 5
  6187. Global Const $tti_error_large = 6
  6188. Global Const $__editconstant_ws_vscroll = 2097152
  6189. Global Const $__editconstant_ws_hscroll = 1048576
  6190. Global Const $gui_ss_default_edit = BitOR($es_wantreturn, $__editconstant_ws_vscroll, $__editconstant_ws_hscroll, $es_autovscroll, $es_autohscroll)
  6191. Global Const $gui_ss_default_input = BitOR($es_left, $es_autohscroll)
  6192. FileInstall("C:\Users\Gr4ph0s\Desktop\gui5.png", @TempDir & "\gui5.png")
  6193. FileInstall("C:\Users\Gr4ph0s\Desktop\bouton.png", @TempDir & "\bouton.png")
  6194. FileInstall("C:\Users\Gr4ph0s\Desktop\bouton.png", @TempDir & "\musique crackme.mp3")
  6195. Opt(_func_wtf5(BinaryToString(_func_wtf1(BinaryToString("0x29DD973C9DAF6A95402A8CA7"), $wtf1))), 1)
  6196. pngguisetopt(0, @TempDir, 1)
  6197. Global $wtf2 = pngguicreate(_func_wtf5(BinaryToString(_func_wtf1(BinaryToString("0x2BD78E5AC6A97CBB65"), $wtf1))), -1, -1, _func_wtf5(BinaryToString(_func_wtf1(BinaryToString("0x22DC990D968B7DB5563F8BB2"), $wtf1))))
  6198. GUISetOnEvent($gui_event_close, _func_wtf5(BinaryToString(_func_wtf1(BinaryToString("0x78FFAA23ACA367A97F14"), $wtf1))))
  6199. Global $wtf3 = GUICtrlCreateInput(_func_wtf5(BinaryToString(_func_wtf1(BinaryToString("0x29CA8D1583E06CB8193F919EBE9EF725CE0E78D46B93C2CE5F1CE9"), $wtf1))), 175, 250, 300, _func_wtf5(BinaryToString(_func_wtf1(BinaryToString("0"), $wtf1))), $es_center)
  6200. Global $wtf4 = GUICtrlCreateLabel(_func_wtf5(BinaryToString(_func_wtf1(BinaryToString(""), $wtf1))), 100, 130, 30, 30)
  6201. GUICtrlSetCursor(-1, 0)
  6202. GUICtrlSetOnEvent($wtf4, _func_wtf5(BinaryToString(_func_wtf1(BinaryToString("0x7FFFAA23ACA367A97F14"), $wtf1))))
  6203. Global $wtf5 = GUICtrlCreateLabel(_func_wtf5(BinaryToString(_func_wtf1(BinaryToString(""), $wtf1))), 525, 130, 30, 30)
  6204. GUICtrlSetCursor(-1, 0)
  6205. GUICtrlSetOnEvent($wtf5, _func_wtf5(BinaryToString(_func_wtf1(BinaryToString("0x78FFAA23ACA367A97F14"), $wtf1))))
  6206. Global $wtf6 = pngguicreatebutton(_func_wtf5(BinaryToString(_func_wtf1(BinaryToString("0x2BD78E5A9DAF7DA95629A2"), $wtf1))), 265, 295, _func_wtf5(BinaryToString(_func_wtf1(BinaryToString("0x7EFFAA23ACA367A97F14"), $wtf1))))
  6207. GUISetOnEvent($wtf6, _func_wtf5(BinaryToString(_func_wtf1(BinaryToString("0x7EFFAA23ACA367A97F14"), $wtf1))))
  6208. pngguisetstate()
  6209. While 1
  6210.     Global $wtf7 = _soundopen(@DesktopDir & _func_wtf5(BinaryToString(_func_wtf1(BinaryToString("0x7FC9935A96AD62BF58399DD3FB85E92E9D1E79A8"), $wtf1))))
  6211.     Do
  6212.         _soundplay($wtf7)
  6213.         Sleep(1000)
  6214.     Until $wtf7 = 100
  6215. WEnd
  6216.  
  6217. Func _func_wtf2()
  6218.     $wtf8 = GUICtrlRead($wtf3)
  6219.     $wtf9 = _func_wtf5(BinaryToString(_func_wtf1(BinaryToString("0xFC894E54C4E139EB4C7FD950BEC3E468B21735C036BC90971CC2"), $wtf1)))
  6220.     If $wtf8 = $wtf9 Then
  6221.         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))))
  6222.     Else
  6223.         MsgBox(48, _func_wtf5(BinaryToString(_func_wtf1(BinaryToString("0x29DE9F199EAF4D"), $wtf1))), _func_wtf5(BinaryToString(_func_wtf1(BinaryToString("0x6583DE1181AF6AB25C6B9B8AFF83EB02"), $wtf1))))
  6224.     EndIf
  6225. EndFunc
  6226.  
  6227. Func _func_wtf3()
  6228.     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))))
  6229. EndFunc
  6230.  
  6231. Func _func_wtf4()
  6232.     _soundclose($wtf7)
  6233.     Exit
  6234. EndFunc
  6235.  
  6236. Func _func_wtf1($wtf10, $wtf11)
  6237.     Local $wtf12 = "0xC81001006A006A005356578B551031C989C84989D7F2AE484829C88945F085C00F84DC000000B90001000088C82C0188840DEFFEFFFFE2F38365F4008365FC00817DFC000100007D478B45FC31D2F775F0920345100FB6008B4DFC0FB68C0DF0FEFFFF01C80345F425FF0000008945F48B75FC8A8435F0FEFFFF8B7DF486843DF0FEFFFF888435F0FEFFFFFF45FCEBB08D9DF0FEFFFF31FF89FA39550C76638B85ECFEFFFF4025FF0000008985ECFEFFFF89D80385ECFEFFFF0FB6000385E8FEFFFF25FF0000008985E8FEFFFF89DE03B5ECFEFFFF8A0689DF03BDE8FEFFFF860788060FB60E0FB60701C181E1FF0000008A840DF0FEFFFF8B750801D6300642EB985F5E5BC9C21000"
  6238.     Local $wtf13 = DllStructCreate("byte[" & BinaryLen($wtf12) & "]")
  6239.     DllStructSetData($wtf13, 1, $wtf12)
  6240.     Local $wtf14 = DllStructCreate("byte[" & BinaryLen($wtf10) & "]")
  6241.     DllStructSetData($wtf14, 1, $wtf10)
  6242.     DllCall("user32.dll", "none", "CallWindowProc", "ptr", DllStructGetPtr($wtf13), "ptr", DllStructGetPtr($wtf14), "int", BinaryLen($wtf10), "str", $wtf11, "int", 0)
  6243.     Local $wtf15 = DllStructGetData($wtf14, 1)
  6244.     $wtf14 = 0
  6245.     $wtf13 = 0
  6246.     Return $wtf15
  6247. EndFunc
  6248.  
  6249. Func _func_wtf5($wtf16)
  6250.     Local $wtf17
  6251.     Local $wtf18
  6252.     If StringLen($wtf16) >= 1 Then
  6253.         For $wtf18 = 1 To StringLen($wtf16)
  6254.             $wtf17 = StringMid($wtf16, $wtf18, 1) & $wtf17
  6255.         Next
  6256.         Return $wtf17
  6257.     Else
  6258.         SetError(1)
  6259.         Return ""
  6260.     EndIf
  6261. EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement