Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/04/2021 in all areas

  1. Hello. You probably could use a Rich Text Edit Box and load a .rtf file or you could embed IE too with some HTML nice About page. I did something with PictureBox+RichEdit time ago and this is the result. It's minimalist. Saludos
    2 points
  2. Not wanting to brag, (actually I do), but I still have code I wrote in the seventies. It was punched onto cassette tape from my M68 dev board. I have no way of reading the tapes, but I still have the tapes. Actually, I imagine it wouldn't be too hard to knock up a reader with an Arduino dev board if push came to shove.
    2 points
  3. wolf9228

    Quick Download Tool

    ;The quick download tool surpasses the speed of the most powerful applications that feature ;multiple download of the same file ... the Url must be direct ... Thanks. ;Note the tool does not work on Windows servers ;Url to experiment ;https://download.microsoft.com/download/8/1/d/81d1f546-f951-45c5-964d-56bdbd758ba4/w2k3sp2_3959_usa_x64fre_spcd.iso The tool is faster than all programs, but the tool list should be changed to 1 KB each loop for those who want to experiment to do so. Quick Download Tool.zip ;The quick download tool surpasses the speed of the most powerful applications that feature ;multiple download of the same file ... the link must be direct ... Thanks. ;Note the tool does not work on Windows servers ;https://download.microsoft.com/download/8/1/d/81d1f546-f951-45c5-964d-56bdbd758ba4/w2k3sp2_3959_usa_x64fre_spcd.iso #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=Untitled.ico #AutoIt3Wrapper_Res_File_Add=NORMAL1.bmp,2,NORMAL,0 #AutoIt3Wrapper_Res_File_Add=PRESS1.bmp,2,PRESS,0 #AutoIt3Wrapper_Res_File_Add=OVER1.bmp,2,OVER,0 #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** $OSVersion = @OSVersion $BOOl = $OSVersion == "WIN_81" Or $OSVersion == "WIN_8" Or $OSVersion == "WIN_7" Or _ $OSVersion == "WIN_VISTA" Or $OSVersion == "WIN_XP" Or $OSVersion == "WIN_XPe" Or $OSVersion == "WIN_10" if Not $BOOl Then MsgBox(48,"Notice","The program is not intended to run on this system",10) Exit EndIf Global $HIntOpen = 0 , $Connect = 0 , $OriginalUrl = "" , $ThreadArray = 0,$FileA = "" , $BytesAtaTime = 4096 Global $OpenRequest = 0 , $Combo1 = 0 , $Winhttp = 0 , $PtrSize = 4 , $FileSize = 0 , $DwordSize = 4 Global $idLabe3 = 0,$idLabe4 = 0 , $idLabel = 0,$ButtonA = 0,$ButtonE = 0,$Progress = 0,$HGui= 0,$ButtonD = 0 Global $ButtonA = 0 , $ButtonB = 0 , $ButtonC = 0 ,$DownloadDir = @MyDocumentsDir,$Label2=0,$lpszHostName = 0 Global $NotifyStruct = 0 , $TagNotifyStruct = "" , $ProgressLoop = False , $DISPOSITION = "" , $szPath = 0 Global $MaxInt = 2147483647 , $InputBoxUrl = "" , $hLockDataPtr = 0 , $hFile = 0 Global $tagInfoSt = "INT StrLenA;INT StrLenB;INT ProcessID;INT Complete;INT Pause;" & _ "INT Error;INT MovePos;INT BytesAtaTime;INT FileSize;INT Cancel;PTR UrlA;PTR UrlB;" & _ "INT TimeNu;INT Remder;INT TimeNuPos;PTR FileName;INT StrLenC;PTR hFile;PTR FDir;" & _ "INT NuOfBytesRead;INT NuOfBytesWn;INT vBytesAtaTime;INT ContlThread;INT vContlThread" Global $WinhttphModule=0,$WriteFile=0,$CloseHandle=0,$WinHttpReadData=0,$WinHttpCloseHandle = 0 Global $xFileSize = 0 , $xOriginalUrl = "" , $NewSize1 = 0 , $DwnhFile = 0 , $DwnhFilePatch = "" Global $URL_COMPONENTS = 0 Global Const $GENERIC_EXECUTE = 0x20000000 Global Const $GENERIC_READ = 0x80000000 Global Const $GENERIC_WRITE = 0x40000000 Global Const $FILE_SHARE_DELETE = 0x00000004 Global Const $FILE_SHARE_READ = 0x00000001 Global Const $FILE_SHARE_WRITE = 0x00000002 Global Const $FILE_ATTRIBUTE_ARCHIVE = 0x00000020 Global Const $FILE_ATTRIBUTE_HIDDEN = 0x00000002 Global Const $FILE_ATTRIBUTE_READONLY = 0x00000001 Global Const $FILE_ATTRIBUTE_SYSTEM = 0x00000004 Global Const $CREATE_NEW = 1 Global Const $CREATE_ALWAYS = 2 Global Const $OPEN_EXISTING = 3 Global Const $OPEN_ALWAYS = 4 Global Const $TRUNCATE_EXISTING = 5 Global $GUI_DISABLE = 128 Global $GUI_ENABLE = (64) Global Const $SS_CENTERIMAGE = 0x0200 Global $WS_BORDER = 0x00800000 Global Const $SS_CENTER = 0x1 Global $CBS_DROPDOWNLIST = 0x0003 Global $WS_VSCROLL = 0x00200000 Global Const $CBN_SELCHANGE = 1 Global Const $BN_CLICKED = 0 Global Const $GUI_EVENT_CLOSE = -3 Global $WM_NOTIFY = 0x004E Global $WM_COMMAND = 0x0111 Global Const $GUI_RUNDEFMSG = 'GUI_RUNDEFMSG' Global Const $INVALID_HANDLE_VALUE = Ptr(-1) Global Const $ES_LEFT = 0 Global Const $ES_AUTOHSCROLL = 128 Global Const $GUI_BKCOLOR_TRANSPARENT = -2 Global Const $RDW_INVALIDATE = 0x0001 Global Const $RDW_UPDATENOW = 0x0100 Global $PointerSize = 4 , $ControlThread = DllStructCreate("INT TA;INT TB;INT TC") Global $User32Dll = _WinAPI_LoadLibrary("User32.dll"), $AsmVar = DllStructCreate("INT LOOP;PTR PtrAtPos;HWND CurrentHwnd") Global $StructButtonHover = 0 , $StructBHover = DllStructCreate( "INT COUNT;PTR BHOVER" ) , $StructBHSize = 32 Global $Kernel32dll = _WinAPI_LoadLibrary( "Kernel32.dll" ) , $StructBHoverPtr = DllStructGetPtr( $StructBHover ) Global $_GtPt=_WinAPI_GetProcAddress($User32Dll,"GetParent"),$_WnFPos=_WinAPI_GetProcAddress($User32Dll,"WindowFromPoint") Global $SdMsg =_WinAPI_GetProcAddress($User32Dll,"SendMessageW"),$RiWin =_WinAPI_GetProcAddress($User32Dll,"RedrawWindow") Global $G_CP =_WinAPI_GetProcAddress($User32Dll,"GetCursorPos"),$GKYState=_WinAPI_GetProcAddress($User32Dll,"GetKeyState") Global $Sleep =_WinAPI_GetProcAddress($Kernel32dll,"Sleep") ,$PositionsSt = DllStructCreate("INT POS[2]") , $ThreadPtr = 0 Global $NewStructButtonHover= 0,$PositionsStPtr= DllStructGetPtr($PositionsSt),$IsPss = LIsPress(),$IsNPss = LIsNotPress() Global $IsPssPtr = DllStructGetPtr($IsPss) , $IsNPssPtr = DllStructGetPtr($IsNPss),$MHover = LMHover(),$MNHover=LMNHover() Global $MHoverPtr = DllStructGetPtr( $MHover ) , $MNHoverPtr = DllStructGetPtr( $MNHover ) , $ThreadAdd = LoadThread( ) if @Compiled Then $NORMAL_hBMP = LoadBitmap_FromResources("NORMAL") $PRESS_hBMP = LoadBitmap_FromResources("PRESS") $OVER_hBMP = LoadBitmap_FromResources("OVER") Else $NORMAL_hBMP = LoadBitmap_FromFile("NORMAL1.bmp") $PRESS_hBMP = LoadBitmap_FromFile("PRESS1.bmp") $OVER_hBMP = LoadBitmap_FromFile("OVER1.bmp") EndIf $HGui = GUICreate(" Quick Download Tool ",831,180,10,200) GUISetBkColor(7237230) $ButtonA = CreateButtonHover ("Add Url", 5, 5,100, 35,$NORMAL_hBMP,$PRESS_hBMP,$OVER_hBMP,0xFFFFFF) $ButtonB = CreateButtonHover ("Download", 675 + 50, 5,100, 35,$NORMAL_hBMP,$PRESS_hBMP,$OVER_hBMP,0xFFFFFF) GUICtrl_SetState($ButtonB,$GUI_DISABLE) $Label2 = GUICtrlCreateLabel("",112, 10, 607, 30,BitOR($SS_CENTERIMAGE,$WS_BORDER,0x1000),0x00000200) GUICtrlSetBkColor($Label2,0xFFFFFF) $idLabel = GUICtrlCreateLabel("",530,50,296,35,BitOR($SS_CENTER,$SS_CENTERIMAGE,$WS_BORDER,0x1000),0x00000200) GUICtrlSetBkColor($idLabel, 0xFFFFFF) $idLabe3 = GUICtrlCreateLabel("",530,94,295,35,BitOR($SS_CENTER,$SS_CENTERIMAGE,$WS_BORDER,0x1000),0x00000200) GUICtrlSetBkColor($idLabe3, 0xFFFFFF) $sVar = RegRead("HKEY_CURRENT_USER\Software\Download","DownloadDir") if @error Then RegWrite("HKEY_CURRENT_USER\Software\Download", "DownloadDir", "REG_SZ", $DownloadDir) Else if FileExists($sVar) Then $DownloadDir = $sVar Else RegWrite("HKEY_CURRENT_USER\Software\Download", "DownloadDir", "REG_SZ", $DownloadDir) EndIf EndIf $vidLabe = GUICtrlCreateLabel("",5,137,519,35,BitOR($SS_CENTERIMAGE,$WS_BORDER,0x1000),0x00000200) GUICtrlSetBkColor($vidLabe, 0xFFFFFF) GUICtrlSetData($vidLabe,$DownloadDir) $Grb = GUICtrlCreateGroup("",530,130,295, 47) $Combo1 = GUICtrlCreateCombo("",535,143,285, 35,BitOR($CBS_DROPDOWNLIST,$WS_VSCROLL,$WS_BORDER)) GUICtrlSetOnEventEx($Combo1,$CBN_SELCHANGE,"SELCHANGE") $Text = "" $Text &= " downloding " & 1 & " KB in every Loop " & "|" For $i = 2 To 1024 Step 2 $Text &= " downloding " & $i & " KB in every Loop " & "|" Next GUICtrlSetData ($Combo1,$Text," downloding " & 4 & " KB in every Loop ") $Progress = GUICtrlCreateProgress(5, 50, 519, 36) $ButtonC = CreateButtonHover ("Stop", 100, 94,100, 35,$NORMAL_hBMP,$PRESS_hBMP,$OVER_hBMP,0xFFFFFF) GUICtrlSetOnEventEx($ButtonC,$BN_CLICKED,"ButtonC") GUICtrl_SetState($ButtonC,$GUI_DISABLE) $ButtonD = CreateButtonHover ("Select", 205, 95,120, 35,$NORMAL_hBMP,$PRESS_hBMP,$OVER_hBMP,0xFFFFFF) $ButtonE = CreateButtonHover ("Cancel", 5, 94,90, 35,$NORMAL_hBMP,$PRESS_hBMP,$OVER_hBMP,0xFFFFFF) GUICtrl_SetState($ButtonE,$GUI_DISABLE) $idLabe4 = GUICtrlCreateLabel("",330,94,193,35,BitOR($SS_CENTER,$SS_CENTERIMAGE,$WS_BORDER,0x1000),0x00000200) GUICtrlSetBkColor($idLabe4, 0xFFFFFF) GUISetState(@SW_SHOW) GUISwitch($HGui) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $ButtonA ButtonA() Case $ButtonB ButtonB() Case $ButtonC ;ButtonC() Case $ButtonD ButtonD() Case $ButtonE ButtonE() EndSwitch WEnd GUIDelete($HGui) Exit Func GUICtrl_SetState($Id,$State) GUICtrlSetState($Id,$State) GUICtrlSetState($Id - 1,$State) EndFunc Func ButtonA() $Pos = WinGetPos($HGui) $GuiH2 = GUICreate("Url input box",831,132,$Pos[0],$Pos[1],-1,-1,$HGui) GUISetBkColor(0x747474) $Label3 = GUICtrlCreateLabel("Url input box",265,8,300,30,BitOR($SS_CENTER,$SS_CENTERIMAGE)) GUICtrlSetColor($Label3, 0xFFFFFF) $Input12 = GUICtrlCreateInput("",5,5 + 40,819,30,BitOR($WS_BORDER,$ES_LEFT,$ES_AUTOHSCROLL),BitOR(0x00000200,0x00020000)) $ButtonA2 = CreateButtonHover("OK",315,45 + 45,90, 30,$NORMAL_hBMP,$PRESS_hBMP,$OVER_hBMP,0xFFFFFF) $ButtonB2 = CreateButtonHover("Cancel",415,45 + 45,90, 30,$NORMAL_hBMP,$PRESS_hBMP,$OVER_hBMP,0xFFFFFF) GUISetState(@SW_SHOW) GUISwitch($GuiH2) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE , $ButtonB2 DeleteButtonHover($ButtonA2) DeleteButtonHover($ButtonB2) GUIDelete($GuiH2) GUISwitch($HGui) ExitLoop Case $ButtonA2 $ProgressLoop = False $InputBox = GUICtrlRead($Input12) DeleteButtonHover($ButtonA2) DeleteButtonHover($ButtonB2) GUIDelete($GuiH2) GUISwitch($HGui) if StringLen($InputBox) Then $InputBoxUrl = StringStripWS($InputBox,1 + 2) GUICtrl_SetState($ButtonA,$GUI_DISABLE) GUICtrl_SetState($ButtonD,$GUI_DISABLE) $Return = NewThreadA($InputBoxUrl) if Not @error Or @error = 6 Then GUICtrlSetData($Label2,$OriginalUrl) $xFileSize = $FileSize $xOriginalUrl = $OriginalUrl if $FileSize <> 0 Then Select Case $FileSize < (1024) GUICtrlSetData($idLabel," File size " & StringLeft($FileSize,15) & " Byte ") Case $FileSize < (1024 * 1024) GUICtrlSetData($idLabel," File size " & StringLeft($FileSize /1024 ,15) & " Kilo Byte ") Case $FileSize < (1024 * 1024 * 1024) GUICtrlSetData($idLabel," File size " & StringLeft($FileSize /1024 / 1024 ,15) & " Mega Byte ") Case $FileSize < (1024 * 1024 * 1024 * 1024) GUICtrlSetData($idLabel," File size " & StringLeft($FileSize /1024 / 1024 / 1024 ,15) & " Giga Byte ") Case Else GUICtrlSetData($idLabel," File size " & StringLeft($FileSize /1024 / 1024 / 1024 / 1024 ,15) & " Terra Byte ") EndSelect Else GUICtrlSetData($idLabel," Unknown File size ") EndIf GUICtrl_SetState($ButtonB,$GUI_ENABLE) GUICtrl_SetState($ButtonE,$GUI_ENABLE) WinHttpCloseHandle($OpenRequest) WinHttpCloseHandle($Connect) WinHttpCloseHandle($HIntOpen) $HIntOpen = 0 $Connect = 0 $lpszHostName = 0 $szPath = 0 $ThreadArray = 0 Else Local $Error = @error GUICtrlSetData($Label2,"") GUICtrlSetData($idLabel,"") GUICtrlSetData($idLabe3,"") GUICtrlSetData($idLabe4,"") GUICtrl_SetState($ButtonA,$GUI_ENABLE) GUICtrl_SetState($ButtonB,$GUI_DISABLE) GUICtrl_SetState($ButtonE,$GUI_DISABLE) GUICtrl_SetState($ButtonC,$GUI_DISABLE) GUICtrl_SetState($ButtonD,$GUI_ENABLE) WinHttpCloseHandle($OpenRequest) WinHttpCloseHandle($Connect) WinHttpCloseHandle($HIntOpen) $HIntOpen = 0 $Connect = 0 $lpszHostName = 0 $szPath = 0 $ThreadArray = 0 ErrorFunc($Error,2) EndIf EndIf ExitLoop EndSwitch WEnd EndFunc Func ButtonB() GUICtrl_SetState($ButtonE,$GUI_DISABLE) GUICtrl_SetState($ButtonC,$GUI_ENABLE) GUICtrl_SetState($ButtonB,$GUI_DISABLE) GUICtrlSetState($Combo1,$GUI_DISABLE) $Return = NewThreadA($InputBoxUrl) if Not @error Or @error = 6 Then GUICtrlSetData($Label2,$OriginalUrl) if $FileSize <> 0 Then Select Case $FileSize < (1024) GUICtrlSetData($idLabel," File size " & StringLeft($FileSize,15) & " Byte ") Case $FileSize < (1024 * 1024) GUICtrlSetData($idLabel," File size " & StringLeft($FileSize /1024 ,15) & " Kilo Byte ") Case $FileSize < (1024 * 1024 * 1024) GUICtrlSetData($idLabel," File size " & StringLeft($FileSize /1024 / 1024 ,15) & " Mega Byte ") Case $FileSize < (1024 * 1024 * 1024 * 1024) GUICtrlSetData($idLabel," File size " & StringLeft($FileSize /1024 / 1024 / 1024 ,15) & " Giga Byte ") Case Else GUICtrlSetData($idLabel," File size " & StringLeft($FileSize /1024 / 1024 / 1024 / 1024 ,15) & " Terra Byte ") EndSelect Else GUICtrlSetData($idLabel," Unknown File size ") EndIf if $FileSize <> $xFileSize Or Not $xOriginalUrl == $OriginalUrl Then $Return = MsgBox(4 + 48,"Notice"," The download file has been modified, and from its source, do you want to download the file after modification? ",20,$HGui) if $Return = 7 Or $Return = -1 Then GUICtrlSetData($Label2,"") GUICtrlSetData($idLabel,"") GUICtrlSetData($idLabe3,"") GUICtrlSetData($idLabe4,"") GUICtrl_SetState($ButtonA,$GUI_ENABLE) GUICtrl_SetState($ButtonB,$GUI_DISABLE) GUICtrl_SetState($ButtonE,$GUI_DISABLE) GUICtrl_SetState($ButtonC,$GUI_DISABLE) GUICtrl_SetState($ButtonD,$GUI_ENABLE) WinHttpCloseHandle($OpenRequest) WinHttpCloseHandle($Connect) WinHttpCloseHandle($HIntOpen) $HIntOpen = 0 $Connect = 0 $lpszHostName = 0 $szPath = 0 $ThreadArray = 0 Return EndIf WinHttpCloseHandle($OpenRequest) WinHttpCloseHandle($Connect) WinHttpCloseHandle($HIntOpen) $HIntOpen = 0 $Connect = 0 $lpszHostName = 0 $szPath = 0 $ThreadArray = 0 $xFileSize = $FileSize $xOriginalUrl = $OriginalUrl ButtonB() Return EndIf WinHttpCloseHandle($OpenRequest) WinHttpCloseHandle($Connect) WinHttpCloseHandle($HIntOpen) $HIntOpen = 0 $Connect = 0 $lpszHostName = 0 $szPath = 0 $ThreadArray = 0 Else Local $Error = @error GUICtrlSetData($Label2,"") GUICtrlSetData($idLabel,"") GUICtrlSetData($idLabe3,"") GUICtrlSetData($idLabe4,"") GUICtrl_SetState($ButtonA,$GUI_ENABLE) GUICtrl_SetState($ButtonB,$GUI_DISABLE) GUICtrl_SetState($ButtonE,$GUI_DISABLE) GUICtrl_SetState($ButtonC,$GUI_DISABLE) GUICtrl_SetState($ButtonD,$GUI_ENABLE) WinHttpCloseHandle($OpenRequest) WinHttpCloseHandle($Connect) WinHttpCloseHandle($HIntOpen) $HIntOpen = 0 $Connect = 0 $lpszHostName = 0 $szPath = 0 $ThreadArray = 0 ErrorFunc($Error,2) Return EndIf if $FileSize = 0 Then $ProgressLoop = False $NewSize1 = 0 $Return = NewThreadB($InputBoxUrl) if @error Then $Error = @error GUICtrlSetData($Label2,"") GUICtrlSetData($idLabel,"") GUICtrlSetData($idLabe3,"") GUICtrlSetData($idLabe4,"") GUICtrl_SetState($ButtonA,$GUI_ENABLE) GUICtrl_SetState($ButtonB,$GUI_DISABLE) GUICtrl_SetState($ButtonE,$GUI_DISABLE) GUICtrl_SetState($ButtonC,$GUI_DISABLE) GUICtrl_SetState($ButtonD,$GUI_ENABLE) CloseAllThreadB() ErrorFunc($Error,2) Return EndIf GUICtrlSetData($Label2,$OriginalUrl) $Return = ProgressLoopB() if $Return Then GUICtrlSetData($idLabel,"") GUICtrlSetData($idLabe3,"") GUICtrlSetData($idLabe4,"") GUICtrlSetData($Progress,0) GUICtrl_SetState($ButtonA,$GUI_ENABLE) GUICtrl_SetState($ButtonB,$GUI_DISABLE) GUICtrl_SetState($ButtonE,$GUI_DISABLE) GUICtrl_SetState($ButtonC,$GUI_DISABLE) GUICtrl_SetState($ButtonD,$GUI_ENABLE) CloseAllThreadB() GUICtrlSetData($Label2," Download completed ") Return Else $Error = @error GUICtrlSetData($Label2,"") GUICtrlSetData($idLabel,"") GUICtrlSetData($idLabe3,"") GUICtrlSetData($idLabe4,"") GUICtrlSetData($Progress,0) GUICtrl_SetState($ButtonA,$GUI_ENABLE) GUICtrl_SetState($ButtonB,$GUI_DISABLE) GUICtrl_SetState($ButtonE,$GUI_DISABLE) GUICtrl_SetState($ButtonC,$GUI_DISABLE) GUICtrl_SetState($ButtonD,$GUI_ENABLE) CloseAllThreadB() ErrorFunc($Error,1) Return EndIf EndIf Local $MB = 1048576 , $NewSize = 0 Select Case $FileSize >= ($MB * 8) $Remainder = Mod($FileSize,8) $NewSize = (($FileSize - $Remainder) / 8) $NewSize1 = $NewSize + $Remainder Case $FileSize >= ($MB * 7) $Remainder = Mod($FileSize,7) $NewSize = (($FileSize - $Remainder) / 7) $NewSize1 = $NewSize + $Remainder Case $FileSize >= ($MB * 6) $Remainder = Mod($FileSize,6) $NewSize = (($FileSize - $Remainder) / 6) $NewSize1 = $NewSize + $Remainder Case $FileSize >= ($MB * 5) $Remainder = Mod($FileSize,5) $NewSize = (($FileSize - $Remainder) / 5) $NewSize1 = $NewSize + $Remainder Case $FileSize >= ($MB * 4) $Remainder = Mod($FileSize,4) $NewSize = (($FileSize - $Remainder) / 4) $NewSize1 = $NewSize + $Remainder Case $FileSize >= ($MB * 3) $Remainder = Mod($FileSize,3) $NewSize = (($FileSize - $Remainder) / 3) $NewSize1 = $NewSize + $Remainder Case $FileSize >= ($MB * 2) $Remainder = Mod($FileSize,2) $NewSize = (($FileSize - $Remainder) / 2) $NewSize1 = $NewSize + $Remainder Case Else $NewSize1 = $FileSize EndSelect $FreeSpace = DriveSpaceFree ($DownloadDir) if $FreeSpace < ($FileSize / 1048576) + ($NewSize1 / 1048576) Then if @error Then MsgBox(48,"Notice","The download folder partition could not be accessed",0,$HGui) GUICtrlSetData($Label2,"") GUICtrlSetData($idLabel,"") GUICtrlSetData($idLabe3,"") GUICtrlSetData($idLabe4,"") GUICtrl_SetState($ButtonA,$GUI_ENABLE) GUICtrl_SetState($ButtonB,$GUI_DISABLE) GUICtrl_SetState($ButtonE,$GUI_DISABLE) GUICtrl_SetState($ButtonC,$GUI_DISABLE) GUICtrl_SetState($ButtonD,$GUI_ENABLE) CloseAllThreadA() Return Else MsgBox(48,"Notice","There is no space for downloaded files on the Download folder partition",0,$HGui) GUICtrlSetData($Label2,"") GUICtrlSetData($idLabel,"") GUICtrlSetData($idLabe3,"") GUICtrlSetData($idLabe4,"") GUICtrl_SetState($ButtonA,$GUI_ENABLE) GUICtrl_SetState($ButtonB,$GUI_DISABLE) GUICtrl_SetState($ButtonE,$GUI_DISABLE) GUICtrl_SetState($ButtonC,$GUI_DISABLE) GUICtrl_SetState($ButtonD,$GUI_ENABLE) CloseAllThreadA() Return EndIf EndIf $FreeSpace = DriveSpaceFree (@SystemDir) if $FreeSpace < ($FileSize / 1048576) + ($NewSize1 / 1048576) Then MsgBox(48,"Notice","There is no space for the download process on the system partition",0,$HGui) GUICtrlSetData($Label2,"") GUICtrlSetData($idLabel,"") GUICtrlSetData($idLabe3,"") GUICtrlSetData($idLabe4,"") GUICtrl_SetState($ButtonA,$GUI_ENABLE) GUICtrl_SetState($ButtonB,$GUI_DISABLE) GUICtrl_SetState($ButtonE,$GUI_DISABLE) GUICtrl_SetState($ButtonC,$GUI_DISABLE) GUICtrl_SetState($ButtonD,$GUI_ENABLE) CloseAllThreadA() Return EndIf Select Case $FileSize >= ($MB * 8) $Remainder = Mod($FileSize,8) $NewSize = (($FileSize - $Remainder) / 8) $NewSize1 = $NewSize + $Remainder $ProgressLoop = False $Pointer = 0 $Return = NewThreadA($InputBoxUrl,$Pointer,$NewSize1) if @error Then $Error = @error GUICtrlSetData($Label2,"") GUICtrlSetData($idLabel,"") GUICtrlSetData($idLabe3,"") GUICtrlSetData($idLabe4,"") GUICtrl_SetState($ButtonA,$GUI_ENABLE) GUICtrl_SetState($ButtonB,$GUI_DISABLE) GUICtrl_SetState($ButtonE,$GUI_DISABLE) GUICtrl_SetState($ButtonC,$GUI_DISABLE) GUICtrl_SetState($ButtonD,$GUI_ENABLE) CloseAllThreadA() ErrorFunc($Error,2) Return EndIf $Pointer = $NewSize1 $Return = NewThreadA($InputBoxUrl,$Pointer,$NewSize) if @error Then $Error = @error GUICtrlSetData($Label2,"") GUICtrlSetData($idLabel,"") GUICtrlSetData($idLabe3,"") GUICtrlSetData($idLabe4,"") GUICtrl_SetState($ButtonA,$GUI_ENABLE) GUICtrl_SetState($ButtonB,$GUI_DISABLE) GUICtrl_SetState($ButtonE,$GUI_DISABLE) GUICtrl_SetState($ButtonC,$GUI_DISABLE) GUICtrl_SetState($ButtonD,$GUI_ENABLE) CloseAllThreadA() ErrorFunc($Error,2) Return EndIf $Pointer += $NewSize $Return = NewThreadA($InputBoxUrl,$Pointer,$NewSize) if @error Then $Error = @error GUICtrlSetData($Label2,"") GUICtrlSetData($idLabel,"") GUICtrlSetData($idLabe3,"") GUICtrlSetData($idLabe4,"") GUICtrl_SetState($ButtonA,$GUI_ENABLE) GUICtrl_SetState($ButtonB,$GUI_DISABLE) GUICtrl_SetState($ButtonE,$GUI_DISABLE) GUICtrl_SetState($ButtonC,$GUI_DISABLE) GUICtrl_SetState($ButtonD,$GUI_ENABLE) CloseAllThreadA() ErrorFunc($Error,2) Return EndIf $Pointer += $NewSize $Return = NewThreadA($InputBoxUrl,$Pointer,$NewSize) if @error Then $Error = @error GUICtrlSetData($Label2,"") GUICtrlSetData($idLabel,"") GUICtrlSetData($idLabe3,"") GUICtrlSetData($idLabe4,"") GUICtrl_SetState($ButtonA,$GUI_ENABLE) GUICtrl_SetState($ButtonB,$GUI_DISABLE) GUICtrl_SetState($ButtonE,$GUI_DISABLE) GUICtrl_SetState($ButtonC,$GUI_DISABLE) GUICtrl_SetState($ButtonD,$GUI_ENABLE) CloseAllThreadA() ErrorFunc($Error,2) Return EndIf $Pointer += $NewSize $Return = NewThreadA($InputBoxUrl,$Pointer,$NewSize) if @error Then $Error = @error GUICtrlSetData($Label2,"") GUICtrlSetData($idLabel,"") GUICtrlSetData($idLabe3,"") GUICtrlSetData($idLabe4,"") GUICtrl_SetState($ButtonA,$GUI_ENABLE) GUICtrl_SetState($ButtonB,$GUI_DISABLE) GUICtrl_SetState($ButtonE,$GUI_DISABLE) GUICtrl_SetState($ButtonC,$GUI_DISABLE) GUICtrl_SetState($ButtonD,$GUI_ENABLE) CloseAllThreadA() ErrorFunc($Error,2) Return EndIf $Pointer += $NewSize $Return = NewThreadA($InputBoxUrl,$Pointer,$NewSize) if @error Then $Error = @error GUICtrlSetData($Label2,"") GUICtrlSetData($idLabel,"") GUICtrlSetData($idLabe3,"") GUICtrlSetData($idLabe4,"") GUICtrl_SetState($ButtonA,$GUI_ENABLE) GUICtrl_SetState($ButtonB,$GUI_DISABLE) GUICtrl_SetState($ButtonE,$GUI_DISABLE) GUICtrl_SetState($ButtonC,$GUI_DISABLE) GUICtrl_SetState($ButtonD,$GUI_ENABLE) CloseAllThreadA() ErrorFunc($Error,2) Return EndIf $Pointer += $NewSize $Return = NewThreadA($InputBoxUrl,$Pointer,$NewSize) if @error Then $Error = @error GUICtrlSetData($Label2,"") GUICtrlSetData($idLabel,"") GUICtrlSetData($idLabe3,"") GUICtrlSetData($idLabe4,"") GUICtrl_SetState($ButtonA,$GUI_ENABLE) GUICtrl_SetState($ButtonB,$GUI_DISABLE) GUICtrl_SetState($ButtonE,$GUI_DISABLE) GUICtrl_SetState($ButtonC,$GUI_DISABLE) GUICtrl_SetState($ButtonD,$GUI_ENABLE) CloseAllThreadA() ErrorFunc($Error,2) Return EndIf $Pointer += $NewSize $Return = NewThreadA($InputBoxUrl,$Pointer,$NewSize) if @error Then $Error = @error GUICtrlSetData($Label2,"") GUICtrlSetData($idLabel,"") GUICtrlSetData($idLabe3,"") GUICtrlSetData($idLabe4,"") GUICtrl_SetState($ButtonA,$GUI_ENABLE) GUICtrl_SetState($ButtonB,$GUI_DISABLE) GUICtrl_SetState($ButtonE,$GUI_DISABLE) GUICtrl_SetState($ButtonC,$GUI_DISABLE) GUICtrl_SetState($ButtonD,$GUI_ENABLE) CloseAllThreadA() ErrorFunc($Error,2) Return EndIf Case $FileSize >= ($MB * 7) $Remainder = Mod($FileSize,7) $NewSize = (($FileSize - $Remainder) / 7) $NewSize1 = $NewSize + $Remainder $ProgressLoop = False $Pointer = 0 $Return = NewThreadA($InputBoxUrl,$Pointer,$NewSize1) if @error Then $Error = @error GUICtrlSetData($Label2,"") GUICtrlSetData($idLabel,"") GUICtrlSetData($idLabe3,"") GUICtrlSetData($idLabe4,"") GUICtrl_SetState($ButtonA,$GUI_ENABLE) GUICtrl_SetState($ButtonB,$GUI_DISABLE) GUICtrl_SetState($ButtonE,$GUI_DISABLE) GUICtrl_SetState($ButtonC,$GUI_DISABLE) GUICtrl_SetState($ButtonD,$GUI_ENABLE) CloseAllThreadA() ErrorFunc($Error,2) Return EndIf $Pointer = $NewSize1 $Return = NewThreadA($InputBoxUrl,$Pointer,$NewSize) if @error Then $Error = @error GUICtrlSetData($Label2,"") GUICtrlSetData($idLabel,"") GUICtrlSetData($idLabe3,"") GUICtrlSetData($idLabe4,"") GUICtrl_SetState($ButtonA,$GUI_ENABLE) GUICtrl_SetState($ButtonB,$GUI_DISABLE) GUICtrl_SetState($ButtonE,$GUI_DISABLE) GUICtrl_SetState($ButtonC,$GUI_DISABLE) GUICtrl_SetState($ButtonD,$GUI_ENABLE) CloseAllThreadA() ErrorFunc($Error,2) Return EndIf $Pointer += $NewSize $Return = NewThreadA($InputBoxUrl,$Pointer,$NewSize) if @error Then $Error = @error GUICtrlSetData($Label2,"") GUICtrlSetData($idLabel,"") GUICtrlSetData($idLabe3,"") GUICtrlSetData($idLabe4,"") GUICtrl_SetState($ButtonA,$GUI_ENABLE) GUICtrl_SetState($ButtonB,$GUI_DISABLE) GUICtrl_SetState($ButtonE,$GUI_DISABLE) GUICtrl_SetState($ButtonC,$GUI_DISABLE) GUICtrl_SetState($ButtonD,$GUI_ENABLE) CloseAllThreadA() ErrorFunc($Error,2) Return EndIf $Pointer += $NewSize $Return = NewThreadA($InputBoxUrl,$Pointer,$NewSize) if @error Then $Error = @error GUICtrlSetData($Label2,"") GUICtrlSetData($idLabel,"") GUICtrlSetData($idLabe3,"") GUICtrlSetData($idLabe4,"") GUICtrl_SetState($ButtonA,$GUI_ENABLE) GUICtrl_SetState($ButtonB,$GUI_DISABLE) GUICtrl_SetState($ButtonE,$GUI_DISABLE) GUICtrl_SetState($ButtonC,$GUI_DISABLE) GUICtrl_SetState($ButtonD,$GUI_ENABLE) CloseAllThreadA() ErrorFunc($Error,2) Return EndIf $Pointer += $NewSize $Return = NewThreadA($InputBoxUrl,$Pointer,$NewSize) if @error Then $Error = @error GUICtrlSetData($Label2,"") GUICtrlSetData($idLabel,"") GUICtrlSetData($idLabe3,"") GUICtrlSetData($idLabe4,"") GUICtrl_SetState($ButtonA,$GUI_ENABLE) GUICtrl_SetState($ButtonB,$GUI_DISABLE) GUICtrl_SetState($ButtonE,$GUI_DISABLE) GUICtrl_SetState($ButtonC,$GUI_DISABLE) GUICtrl_SetState($ButtonD,$GUI_ENABLE) CloseAllThreadA() ErrorFunc($Error,2) Return EndIf $Pointer += $NewSize $Return = NewThreadA($InputBoxUrl,$Pointer,$NewSize) if @error Then $Error = @error GUICtrlSetData($Label2,"") GUICtrlSetData($idLabel,"") GUICtrlSetData($idLabe3,"") GUICtrlSetData($idLabe4,"") GUICtrl_SetState($ButtonA,$GUI_ENABLE) GUICtrl_SetState($ButtonB,$GUI_DISABLE) GUICtrl_SetState($ButtonE,$GUI_DISABLE) GUICtrl_SetState($ButtonC,$GUI_DISABLE) GUICtrl_SetState($ButtonD,$GUI_ENABLE) CloseAllThreadA() ErrorFunc($Error,2) Return EndIf $Pointer += $NewSize $Return = NewThreadA($InputBoxUrl,$Pointer,$NewSize) if @error Then $Error = @error GUICtrlSetData($Label2,"") GUICtrlSetData($idLabel,"") GUICtrlSetData($idLabe3,"") GUICtrlSetData($idLabe4,"") GUICtrl_SetState($ButtonA,$GUI_ENABLE) GUICtrl_SetState($ButtonB,$GUI_DISABLE) GUICtrl_SetState($ButtonE,$GUI_DISABLE) GUICtrl_SetState($ButtonC,$GUI_DISABLE) GUICtrl_SetState($ButtonD,$GUI_ENABLE) CloseAllThreadA() ErrorFunc($Error,2) Return EndIf Case $FileSize >= ($MB * 6) $Remainder = Mod($FileSize,6) $NewSize = (($FileSize - $Remainder) / 6) $NewSize1 = $NewSize + $Remainder $ProgressLoop = False $Pointer = 0 $Return = NewThreadA($InputBoxUrl,$Pointer,$NewSize1) if @error Then $Error = @error GUICtrlSetData($Label2,"") GUICtrlSetData($idLabel,"") GUICtrlSetData($idLabe3,"") GUICtrlSetData($idLabe4,"") GUICtrl_SetState($ButtonA,$GUI_ENABLE) GUICtrl_SetState($ButtonB,$GUI_DISABLE) GUICtrl_SetState($ButtonE,$GUI_DISABLE) GUICtrl_SetState($ButtonC,$GUI_DISABLE) GUICtrl_SetState($ButtonD,$GUI_ENABLE) CloseAllThreadA() ErrorFunc($Error,2) Return EndIf $Pointer = $NewSize1 $Return = NewThreadA($InputBoxUrl,$Pointer,$NewSize) if @error Then $Error = @error GUICtrlSetData($Label2,"") GUICtrlSetData($idLabel,"") GUICtrlSetData($idLabe3,"") GUICtrlSetData($idLabe4,"") GUICtrl_SetState($ButtonA,$GUI_ENABLE) GUICtrl_SetState($ButtonB,$GUI_DISABLE) GUICtrl_SetState($ButtonE,$GUI_DISABLE) GUICtrl_SetState($ButtonC,$GUI_DISABLE) GUICtrl_SetState($ButtonD,$GUI_ENABLE) CloseAllThreadA() ErrorFunc($Error,2) Return EndIf $Pointer += $NewSize $Return = NewThreadA($InputBoxUrl,$Pointer,$NewSize) if @error Then $Error = @error GUICtrlSetData($Label2,"") GUICtrlSetData($idLabel,"") GUICtrlSetData($idLabe3,"") GUICtrlSetData($idLabe4,"") GUICtrl_SetState($ButtonA,$GUI_ENABLE) GUICtrl_SetState($ButtonB,$GUI_DISABLE) GUICtrl_SetState($ButtonE,$GUI_DISABLE) GUICtrl_SetState($ButtonC,$GUI_DISABLE) GUICtrl_SetState($ButtonD,$GUI_ENABLE) CloseAllThreadA() ErrorFunc($Error,2) Return EndIf $Pointer += $NewSize $Return = NewThreadA($InputBoxUrl,$Pointer,$NewSize) if @error Then $Error = @error GUICtrlSetData($Label2,"") GUICtrlSetData($idLabel,"") GUICtrlSetData($idLabe3,"") GUICtrlSetData($idLabe4,"") GUICtrl_SetState($ButtonA,$GUI_ENABLE) GUICtrl_SetState($ButtonB,$GUI_DISABLE) GUICtrl_SetState($ButtonE,$GUI_DISABLE) GUICtrl_SetState($ButtonC,$GUI_DISABLE) GUICtrl_SetState($ButtonD,$GUI_ENABLE) CloseAllThreadA() ErrorFunc($Error,2) Return EndIf $Pointer += $NewSize $Return = NewThreadA($InputBoxUrl,$Pointer,$NewSize) if @error Then $Error = @error GUICtrlSetData($Label2,"") GUICtrlSetData($idLabel,"") GUICtrlSetData($idLabe3,"") GUICtrlSetData($idLabe4,"") GUICtrl_SetState($ButtonA,$GUI_ENABLE) GUICtrl_SetState($ButtonB,$GUI_DISABLE) GUICtrl_SetState($ButtonE,$GUI_DISABLE) GUICtrl_SetState($ButtonC,$GUI_DISABLE) GUICtrl_SetState($ButtonD,$GUI_ENABLE) CloseAllThreadA() ErrorFunc($Error,2) Return EndIf $Pointer += $NewSize $Return = NewThreadA($InputBoxUrl,$Pointer,$NewSize) if @error Then $Error = @error GUICtrlSetData($Label2,"") GUICtrlSetData($idLabel,"") GUICtrlSetData($idLabe3,"") GUICtrlSetData($idLabe4,"") GUICtrl_SetState($ButtonA,$GUI_ENABLE) GUICtrl_SetState($ButtonB,$GUI_DISABLE) GUICtrl_SetState($ButtonE,$GUI_DISABLE) GUICtrl_SetState($ButtonC,$GUI_DISABLE) GUICtrl_SetState($ButtonD,$GUI_ENABLE) CloseAllThreadA() ErrorFunc($Error,2) Return EndIf Case $FileSize >= ($MB * 5) $Remainder = Mod($FileSize,5) $NewSize = (($FileSize - $Remainder) / 5) $NewSize1 = $NewSize + $Remainder $ProgressLoop = False $Pointer = 0 $Return = NewThreadA($InputBoxUrl,$Pointer,$NewSize1) if @error Then $Error = @error GUICtrlSetData($Label2,"") GUICtrlSetData($idLabel,"") GUICtrlSetData($idLabe3,"") GUICtrlSetData($idLabe4,"") GUICtrl_SetState($ButtonA,$GUI_ENABLE) GUICtrl_SetState($ButtonB,$GUI_DISABLE) GUICtrl_SetState($ButtonE,$GUI_DISABLE) GUICtrl_SetState($ButtonC,$GUI_DISABLE) GUICtrl_SetState($ButtonD,$GUI_ENABLE) CloseAllThreadA() ErrorFunc($Error,2) Return EndIf $Pointer = $NewSize1 $Return = NewThreadA($InputBoxUrl,$Pointer,$NewSize) if @error Then $Error = @error GUICtrlSetData($Label2,"") GUICtrlSetData($idLabel,"") GUICtrlSetData($idLabe3,"") GUICtrlSetData($idLabe4,"") GUICtrl_SetState($ButtonA,$GUI_ENABLE) GUICtrl_SetState($ButtonB,$GUI_DISABLE) GUICtrl_SetState($ButtonE,$GUI_DISABLE) GUICtrl_SetState($ButtonC,$GUI_DISABLE) GUICtrl_SetState($ButtonD,$GUI_ENABLE) CloseAllThreadA() ErrorFunc($Error,2) Return EndIf $Pointer += $NewSize $Return = NewThreadA($InputBoxUrl,$Pointer,$NewSize) if @error Then $Error = @error GUICtrlSetData($Label2,"") GUICtrlSetData($idLabel,"") GUICtrlSetData($idLabe3,"") GUICtrlSetData($idLabe4,"") GUICtrl_SetState($ButtonA,$GUI_ENABLE) GUICtrl_SetState($ButtonB,$GUI_DISABLE) GUICtrl_SetState($ButtonE,$GUI_DISABLE) GUICtrl_SetState($ButtonC,$GUI_DISABLE) GUICtrl_SetState($ButtonD,$GUI_ENABLE) CloseAllThreadA() ErrorFunc($Error,2) Return EndIf $Pointer += $NewSize $Return = NewThreadA($InputBoxUrl,$Pointer,$NewSize) if @error Then $Error = @error GUICtrlSetData($Label2,"") GUICtrlSetData($idLabel,"") GUICtrlSetData($idLabe3,"") GUICtrlSetData($idLabe4,"") GUICtrl_SetState($ButtonA,$GUI_ENABLE) GUICtrl_SetState($ButtonB,$GUI_DISABLE) GUICtrl_SetState($ButtonE,$GUI_DISABLE) GUICtrl_SetState($ButtonC,$GUI_DISABLE) GUICtrl_SetState($ButtonD,$GUI_ENABLE) CloseAllThreadA() ErrorFunc($Error,2) Return EndIf $Pointer += $NewSize $Return = NewThreadA($InputBoxUrl,$Pointer,$NewSize) if @error Then $Error = @error GUICtrlSetData($Label2,"") GUICtrlSetData($idLabel,"") GUICtrlSetData($idLabe3,"") GUICtrlSetData($idLabe4,"") GUICtrl_SetState($ButtonA,$GUI_ENABLE) GUICtrl_SetState($ButtonB,$GUI_DISABLE) GUICtrl_SetState($ButtonE,$GUI_DISABLE) GUICtrl_SetState($ButtonC,$GUI_DISABLE) GUICtrl_SetState($ButtonD,$GUI_ENABLE) CloseAllThreadA() ErrorFunc($Error,2) Return EndIf Case $FileSize >= ($MB * 4) $Remainder = Mod($FileSize,4) $NewSize = (($FileSize - $Remainder) / 4) $NewSize1 = $NewSize + $Remainder $ProgressLoop = False $Pointer = 0 $Return = NewThreadA($InputBoxUrl,$Pointer,$NewSize1) if @error Then $Error = @error GUICtrlSetData($Label2,"") GUICtrlSetData($idLabel,"") GUICtrlSetData($idLabe3,"") GUICtrlSetData($idLabe4,"") GUICtrl_SetState($ButtonA,$GUI_ENABLE) GUICtrl_SetState($ButtonB,$GUI_DISABLE) GUICtrl_SetState($ButtonE,$GUI_DISABLE) GUICtrl_SetState($ButtonC,$GUI_DISABLE) GUICtrl_SetState($ButtonD,$GUI_ENABLE) CloseAllThreadA() ErrorFunc($Error,2) Return EndIf $Pointer = $NewSize1 $Return = NewThreadA($InputBoxUrl,$Pointer,$NewSize) if @error Then $Error = @error GUICtrlSetData($Label2,"") GUICtrlSetData($idLabel,"") GUICtrlSetData($idLabe3,"") GUICtrlSetData($idLabe4,"") GUICtrl_SetState($ButtonA,$GUI_ENABLE) GUICtrl_SetState($ButtonB,$GUI_DISABLE) GUICtrl_SetState($ButtonE,$GUI_DISABLE) GUICtrl_SetState($ButtonC,$GUI_DISABLE) GUICtrl_SetState($ButtonD,$GUI_ENABLE) CloseAllThreadA() ErrorFunc($Error,2) Return EndIf $Pointer += $NewSize $Return = NewThreadA($InputBoxUrl,$Pointer,$NewSize) if @error Then $Error = @error GUICtrlSetData($Label2,"") GUICtrlSetData($idLabel,"") GUICtrlSetData($idLabe3,"") GUICtrlSetData($idLabe4,"") GUICtrl_SetState($ButtonA,$GUI_ENABLE) GUICtrl_SetState($ButtonB,$GUI_DISABLE) GUICtrl_SetState($ButtonE,$GUI_DISABLE) GUICtrl_SetState($ButtonC,$GUI_DISABLE) GUICtrl_SetState($ButtonD,$GUI_ENABLE) CloseAllThreadA() ErrorFunc($Error,2) Return EndIf $Pointer += $NewSize $Return = NewThreadA($InputBoxUrl,$Pointer,$NewSize) if @error Then $Error = @error GUICtrlSetData($Label2,"") GUICtrlSetData($idLabel,"") GUICtrlSetData($idLabe3,"") GUICtrlSetData($idLabe4,"") GUICtrl_SetState($ButtonA,$GUI_ENABLE) GUICtrl_SetState($ButtonB,$GUI_DISABLE) GUICtrl_SetState($ButtonE,$GUI_DISABLE) GUICtrl_SetState($ButtonC,$GUI_DISABLE) GUICtrl_SetState($ButtonD,$GUI_ENABLE) CloseAllThreadA() ErrorFunc($Error,2) Return EndIf Case $FileSize >= ($MB * 3) $Remainder = Mod($FileSize,3) $NewSize = (($FileSize - $Remainder) / 3) $NewSize1 = $NewSize + $Remainder $ProgressLoop = False $Pointer = 0 $Return = NewThreadA($InputBoxUrl,$Pointer,$NewSize1) if @error Then $Error = @error GUICtrlSetData($Label2,"") GUICtrlSetData($idLabel,"") GUICtrlSetData($idLabe3,"") GUICtrlSetData($idLabe4,"") GUICtrl_SetState($ButtonA,$GUI_ENABLE) GUICtrl_SetState($ButtonB,$GUI_DISABLE) GUICtrl_SetState($ButtonE,$GUI_DISABLE) GUICtrl_SetState($ButtonC,$GUI_DISABLE) GUICtrl_SetState($ButtonD,$GUI_ENABLE) CloseAllThreadA() ErrorFunc($Error,2) Return EndIf $Pointer = $NewSize1 $Return = NewThreadA($InputBoxUrl,$Pointer,$NewSize) if @error Then $Error = @error GUICtrlSetData($Label2,"") GUICtrlSetData($idLabel,"") GUICtrlSetData($idLabe3,"") GUICtrlSetData($idLabe4,"") GUICtrl_SetState($ButtonA,$GUI_ENABLE) GUICtrl_SetState($ButtonB,$GUI_DISABLE) GUICtrl_SetState($ButtonE,$GUI_DISABLE) GUICtrl_SetState($ButtonC,$GUI_DISABLE) GUICtrl_SetState($ButtonD,$GUI_ENABLE) CloseAllThreadA() ErrorFunc($Error,2) Return EndIf $Pointer += $NewSize $Return = NewThreadA($InputBoxUrl,$Pointer,$NewSize) if @error Then $Error = @error GUICtrlSetData($Label2,"") GUICtrlSetData($idLabel,"") GUICtrlSetData($idLabe3,"") GUICtrlSetData($idLabe4,"") GUICtrl_SetState($ButtonA,$GUI_ENABLE) GUICtrl_SetState($ButtonB,$GUI_DISABLE) GUICtrl_SetState($ButtonE,$GUI_DISABLE) GUICtrl_SetState($ButtonC,$GUI_DISABLE) GUICtrl_SetState($ButtonD,$GUI_ENABLE) CloseAllThreadA() ErrorFunc($Error,2) Return EndIf Case $FileSize >= ($MB * 2) $Remainder = Mod($FileSize,2) $NewSize = (($FileSize - $Remainder) / 2) $NewSize1 = $NewSize + $Remainder $ProgressLoop = False $Pointer = 0 $Return = NewThreadA($InputBoxUrl,$Pointer,$NewSize1) if @error Then $Error = @error GUICtrlSetData($Label2,"") GUICtrlSetData($idLabel,"") GUICtrlSetData($idLabe3,"") GUICtrlSetData($idLabe4,"") GUICtrl_SetState($ButtonA,$GUI_ENABLE) GUICtrl_SetState($ButtonB,$GUI_DISABLE) GUICtrl_SetState($ButtonE,$GUI_DISABLE) GUICtrl_SetState($ButtonC,$GUI_DISABLE) GUICtrl_SetState($ButtonD,$GUI_ENABLE) CloseAllThreadA() ErrorFunc($Error,2) Return EndIf $Pointer = $NewSize1 $Return = NewThreadA($InputBoxUrl,$Pointer,$NewSize) if @error Then $Error = @error GUICtrlSetData($Label2,"") GUICtrlSetData($idLabel,"") GUICtrlSetData($idLabe3,"") GUICtrlSetData($idLabe4,"") GUICtrl_SetState($ButtonA,$GUI_ENABLE) GUICtrl_SetState($ButtonB,$GUI_DISABLE) GUICtrl_SetState($ButtonE,$GUI_DISABLE) GUICtrl_SetState($ButtonC,$GUI_DISABLE) GUICtrl_SetState($ButtonD,$GUI_ENABLE) CloseAllThreadA() ErrorFunc($Error,2) Return EndIf Case Else $Pointer = 0 $ProgressLoop = False $NewSize1 = $FileSize $Return = NewThreadA($InputBoxUrl,$Pointer,$FileSize) if @error Then $Error = @error GUICtrlSetData($Label2,"") GUICtrlSetData($idLabel,"") GUICtrlSetData($idLabe3,"") GUICtrlSetData($idLabe4,"") GUICtrl_SetState($ButtonA,$GUI_ENABLE) GUICtrl_SetState($ButtonB,$GUI_DISABLE) GUICtrl_SetState($ButtonE,$GUI_DISABLE) GUICtrl_SetState($ButtonC,$GUI_DISABLE) GUICtrl_SetState($ButtonD,$GUI_ENABLE) CloseAllThreadA() ErrorFunc($Error,2) Return EndIf EndSelect GUICtrlSetData($Label2,$OriginalUrl) $Return = ProgressLoopA() if $Return Then GUICtrlSetData($Progress,0) GUICtrlSetState($Combo1,$GUI_DISABLE) GUICtrlSetData($ButtonC,"Stop grouping") Local $nFileName = "" , $Extension = "" if StringLen($DISPOSITION) Then $zFileName = $DISPOSITION $Extension = StringSplit($zFileName,".") $Extension = "." & $Extension[$Extension[0]] $nFileName = StringLeft($zFileName,(StringLen($zFileName) - StringLen($Extension))) Else $zFileName = StringSplit($OriginalUrl,"/") $zFileName = $zFileName[$zFileName[0]] $Extension = StringSplit($zFileName,".") $Extension = "." & $Extension[$Extension[0]] $nFileName = StringLeft($zFileName,(StringLen($zFileName) - StringLen($Extension))) EndIf DirCreate($DownloadDir) Local $i = 1 $DwnhFilePatch = $DownloadDir & "\" & $nFileName & $Extension While FileExists($DwnhFilePatch) $DwnhFilePatch = $DownloadDir & "\" & $nFileName & "(" & $i & ")" & $Extension If $ProgressLoop Then ExitLoop $i += 1 WEnd if $ProgressLoop Then GUICtrlSetData($Label2,"") GUICtrlSetData($idLabel,"") GUICtrlSetData($idLabe3,"") GUICtrlSetData($idLabe4,"") GUICtrlSetData($Progress,0) GUICtrl_SetState($ButtonA,$GUI_ENABLE) GUICtrl_SetState($ButtonB,$GUI_DISABLE) GUICtrl_SetState($ButtonE,$GUI_DISABLE) GUICtrl_SetState($ButtonC,$GUI_DISABLE) GUICtrl_SetState($ButtonD,$GUI_ENABLE) CloseAllThreadA() GUICtrlSetData($ButtonC,"Stop") GUICtrlSetState($Combo1,$GUI_ENABLE) Return EndIf $DwnhFile = _WinAPI_CreateFile($DwnhFilePatch,0) if Not($DwnhFile) Then MsgBox(16,"Error","file cannot be created in the download folder",0,$HGui) GUICtrlSetData($Label2,"") GUICtrlSetData($idLabel,"") GUICtrlSetData($idLabe3,"") GUICtrlSetData($idLabe4,"") GUICtrlSetData($Progress,0) GUICtrl_SetState($ButtonA,$GUI_ENABLE) GUICtrl_SetState($ButtonB,$GUI_DISABLE) GUICtrl_SetState($ButtonE,$GUI_DISABLE) GUICtrl_SetState($ButtonC,$GUI_DISABLE) GUICtrl_SetState($ButtonD,$GUI_ENABLE) CloseAllThreadA() GUICtrlSetData($ButtonC,"Stop") GUICtrlSetState($Combo1,$GUI_ENABLE) Return EndIf Local $nMovePos = 0 , $FArray[UBound($ThreadArray)][3] , $ExitLoop = False For $i = 0 To UBound($ThreadArray) - 1 $TempFile = $ThreadArray[$i][4] $TempFileSize = FileGetSize($TempFile) $nhFile = _WinAPI_CreateFile($TempFile,2,2) if Not ($nhFile) Or $ProgressLoop Then if Not ($nhFile) Then MsgBox(16,"Error","The spool file could not be opened",0,$HGui) For $j = 0 To UBound($FArray) - 1 if ($FArray[$j][0]) Then _WinAPI_CloseHandle($FArray[$j][0]) Next GUICtrlSetData($Label2,"") GUICtrlSetData($idLabel,"") GUICtrlSetData($idLabe3,"") GUICtrlSetData($idLabe4,"") GUICtrlSetData($Progress,0) GUICtrlSetState($ButtonA,$GUI_ENABLE) GUICtrlSetState($ButtonB,$GUI_DISABLE) GUICtrlSetState($ButtonE,$GUI_DISABLE) GUICtrlSetState($ButtonC,$GUI_DISABLE) GUICtrlSetState($ButtonD,$GUI_ENABLE) _WinAPI_CloseHandle($DwnhFile) FileDelete($DwnhFilePatch) CloseAllThreadA() GUICtrlSetState($Combo1,$GUI_ENABLE) GUICtrlSetData($ButtonC,"Stop") Return EndIf $FArray[$i][0] = $nhFile $FArray[$i][1] = $TempFileSize $FArray[$i][2] = $TempFile Next For $i = 0 To UBound($FArray) - 1 $nhFile = $FArray[$i][0] $TempFileSize = $FArray[$i][1] $FileA = $FArray[$i][2] if $ExitLoop Then ExitLoop Local $CopySize = 1048576 $BufferSt = DllStructCreate("BYTE[" & $CopySize & "]") $BufferStPtr = DllStructGetPtr($BufferSt) WatNextB(" Parts of the file are being collected ") While 1 if GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit if $ProgressLoop Then $ExitLoop = True ExitLoop EndIf Local $nBytesA = 0 , $nBytesB = 0 if $TempFileSize < $CopySize Then $CopySize = $TempFileSize $FreeSpace = DriveSpaceFree ($DownloadDir) if $FreeSpace <= ($nMovePos / 1048576) + ($NewSize1 / 1048576) Then if @error Then ErrorFunc($Error,14) Else ErrorFunc($Error,12) EndIf $ExitLoop = True ExitLoop EndIf _WinAPI_ReadFile($nhFile,$BufferStPtr,$CopySize,$nBytesA) _WinAPI_WriteFile($DwnhFile,$BufferStPtr,$nBytesA,$nBytesB) $nMovePos += $nBytesB Local $Text = "" Select Case $FileSize >= (1024 * 1024 * 1024 * 1024) Select Case $nMovePos < 1024 $Text = "" & StringLeft($nMovePos,7) & " Byte From " & StringLeft($FileSize / 1024 / 1024 / 1024 / 1024,7) & " Terra Byte " Case $nMovePos < (1024 * 1024) $Text = "" & StringLeft($nMovePos / 1024,7) & " Kilo Byte From " & StringLeft($FileSize / 1024 / 1024 / 1024 / 1024,7) & " Terra Byte " Case $nMovePos < (1024 * 1024 * 1024) $Text = "" & StringLeft($nMovePos / 1024 / 1024,7) & " Mega Byte From " & StringLeft($FileSize / 1024 / 1024 / 1024 / 1024,7) & " Terra Byte " Case $nMovePos < (1024 * 1024 * 1024 * 1024) $Text = "" & StringLeft($nMovePos / 1024 / 1024 / 1024,7) & " Giga Byte From " & StringLeft($FileSize / 1024 / 1024 / 1024 / 1024,7) & " Terra Byte " Case Else $Text = "" & StringLeft($nMovePos / 1024 / 1024 / 1024 / 1024,7) & " Terra Byte From " & StringLeft($FileSize / 1024 / 1024 / 1024 / 1024,7) & " Terra Byte " EndSelect Case $FileSize >= (1024 * 1024 * 1024) Select Case $nMovePos < 1024 $Text = "" & StringLeft($nMovePos,7) & " Byte From " & StringLeft($FileSize / 1024 / 1024 / 1024,7) & " Giga Byte " Case $nMovePos < (1024 * 1024) $Text = "" & StringLeft($nMovePos / 1024,7) & " Kilo Byte From " & StringLeft($FileSize / 1024 / 1024 / 1024,7) & " Giga Byte " Case $nMovePos < (1024 * 1024 * 1024) $Text = "" & StringLeft($nMovePos / 1024 / 1024,7) & " Mega Byte From " & StringLeft($FileSize / 1024 / 1024 / 1024,7) & " Giga Byte " Case $nMovePos < (1024 * 1024 * 1024 * 1024) $Text = "" & StringLeft($nMovePos / 1024 / 1024 / 1024,7) & " Giga Byte From " & StringLeft($FileSize / 1024 / 1024 / 1024,7) & " Giga Byte " EndSelect Case $FileSize >= (1024 * 1024) Select Case $nMovePos < 1024 $Text = "" & StringLeft($nMovePos,7) & " Byte From " & StringLeft($FileSize / 1024 / 1024,7) & " Mega Byte " Case $nMovePos < (1024 * 1024) $Text = "" & StringLeft($nMovePos / 1024,7) & " Kilo Byte From " & StringLeft($FileSize / 1024 / 1024,7) & " Mega Byte " Case $nMovePos < (1024 * 1024 * 1024) $Text = "" & StringLeft($nMovePos / 1024 / 1024,7) & " Mega Byte From " & StringLeft($FileSize / 1024 / 1024,7) & " Mega Byte " EndSelect Case $FileSize >= (1024) Select Case $nMovePos < 1024 $Text = "" & StringLeft($nMovePos,7) & " Byte From " & StringLeft($FileSize / 1024,7) & " Kilo Byte " Case $nMovePos < (1024 * 1024) $Text = "" & StringLeft($nMovePos / 1024,7) & " Kilo Byte From " & StringLeft($FileSize / 1024,7) & " Kilo Byte " EndSelect Case $FileSize >= 1 $Text = "" & StringLeft($nMovePos,7) & " Byte From " & StringLeft($FileSize,7) & " Byte " EndSelect GUICtrlSetData($Progress,(100 / $FileSize) * $nMovePos) GUICtrlSetData($idLabe3,$Text) Sleep(75) $Text = StringLeft((($nMovePos / $FileSize) * 100),4) $Text = " compiled " & $Text & "%" GUICtrlSetData($idLabe4,$Text) $TempFileSize -= $nBytesB if $TempFileSize = 0 Then ExitLoop WEnd _WinAPI_CloseHandle($nhFile) WatNextB(" Deleting the temporary file ") FileDelete($FileA) Next _WinAPI_CloseHandle($DwnhFile) GUICtrlSetData($idLabel,"") GUICtrlSetData($idLabe3,"") GUICtrlSetData($idLabe4,"") GUICtrlSetData($Progress,0) GUICtrl_SetState($ButtonA,$GUI_ENABLE) GUICtrl_SetState($ButtonB,$GUI_DISABLE) GUICtrl_SetState($ButtonE,$GUI_DISABLE) GUICtrl_SetState($ButtonC,$GUI_DISABLE) GUICtrl_SetState($ButtonD,$GUI_ENABLE) CloseAllThreadA() if Not ($ExitLoop) Then GUICtrlSetData($Label2," Download completed ") Else FileDelete($DwnhFilePatch) EndIf GUICtrlSetState($Combo1,$GUI_ENABLE) GUICtrlSetData($ButtonC,"Stop") $DwnhFile = 0 Return Else $Error = @error GUICtrlSetData($Label2,"") GUICtrlSetData($idLabel,"") GUICtrlSetData($idLabe3,"") GUICtrlSetData($idLabe4,"") GUICtrlSetData($Progress,0) GUICtrl_SetState($ButtonA,$GUI_ENABLE) GUICtrl_SetState($ButtonB,$GUI_DISABLE) GUICtrl_SetState($ButtonE,$GUI_DISABLE) GUICtrl_SetState($ButtonC,$GUI_DISABLE) GUICtrl_SetState($ButtonD,$GUI_ENABLE) CloseAllThreadA() ErrorFunc($Error,1) GUICtrlSetData($ButtonC,"Stop") GUICtrlSetState($Combo1,$GUI_ENABLE) Return EndIf EndFunc Func ButtonC($ControlID,$NotificationCode) $ProgressLoop = True EndFunc Func SELCHANGE($ControlID,$NotificationCode) $Text = StringReplace(GUICtrlRead($Combo1)," downloding ","") $Text = StringReplace($Text," KB in every Loop ","") GUICtrlSetState($Combo1,$GUI_DISABLE) GUICtrlSetState($ButtonC,$GUI_DISABLE) $BytesAtaTime = Int($Text) * 1024 if IsArray($ThreadArray) Then For $i = 0 To UBound($ThreadArray) - 1 $InfoStruct = $ThreadArray[$i][6] $hThread = $ThreadArray[$i][8] if IsDllStruct($InfoStruct) Then if $hThread And DllStructGetData($InfoStruct,"Complete") = 0 Then DllStructSetData($InfoStruct,"vContlThread",0) DllStructSetData($InfoStruct,"ContlThread",1) While 1 if DllStructGetData($InfoStruct,"Complete") Or _ DllStructGetData($InfoStruct,"vContlThread") Then ExitLoop WatNextA(" The new setting is taking effect ") WEnd DllStructSetData($InfoStruct,"BytesAtaTime",$BytesAtaTime) DllStructSetData($InfoStruct,"vBytesAtaTime",$BytesAtaTime) DllStructSetData($InfoStruct,"ContlThread",0) DllStructSetData($InfoStruct,"vContlThread",0) Else DllStructSetData($InfoStruct,"BytesAtaTime",$BytesAtaTime) DllStructSetData($InfoStruct,"vBytesAtaTime",$BytesAtaTime) EndIf EndIf Next EndIf GUICtrlSetState($ButtonC,$GUI_ENABLE) GUICtrlSetState($Combo1,$GUI_ENABLE) GUICtrlSetData($Label2,$OriginalUrl) EndFunc Func ButtonD() $path = SelectFolder(" Select download folder ",$HGui) if Not @error And FileExists($path) Then RegWrite("HKEY_CURRENT_USER\Software\Download", "DownloadDir", "REG_SZ",$path) $DownloadDir = $path GUICtrlSetData($vidLabe,$DownloadDir) Else if Not @error Then MsgBox(48,"Notice"," It is not possible to download to this path ",0,$HGui) EndIf EndFunc Func SelectFolder($Title,$HWND) $tag_browseinfo = "HWND hwndOwner;PTR pidlRoot;PTR pszDisplayName;" & _ "PTR lpszTitle;UINT ulFlags;PTR lpfn;PTR lParam;int iImage" $pszDisplayName = DllStructCreate("WCHAR[260]") $lpszTitle = DllStructCreate("WCHAR[100]") DllStructSetData($lpszTitle,1,$Title) $browseinfo = DllStructCreate($tag_browseinfo) DllStructSetData($browseinfo,"hwndOwner",$HWND) DllStructSetData($browseinfo,"pszDisplayName",DllStructGetPtr($pszDisplayName)) DllStructSetData($browseinfo,"lpszTitle",DllStructGetPtr($lpszTitle)) DllStructSetData($browseinfo,"ulFlags",BitOR(0x00000002,0x00000040)) $PIDLIST_ABSOLUTE = DllCall("Shell32.dll","long","SHBrowseForFolderW","ptr",DllStructGetPtr($browseinfo)) if @error Or Not $PIDLIST_ABSOLUTE[0] Then Return SetError(1,0,"") $pszPath = DllStructCreate("WCHAR[260]") $Return = DllCall("Shell32.dll","BOOL","SHGetPathFromIDListW","ptr",$PIDLIST_ABSOLUTE[0],"ptr",DllStructGetPtr($pszPath)) Return SetError(0,0,DllStructGetData($pszPath,1)) EndFunc Func ButtonE() GUICtrlSetData($Label2,"") GUICtrlSetData($idLabel,"") GUICtrlSetData($idLabe3,"") GUICtrlSetData($idLabe4,"") GUICtrl_SetState($ButtonA,$GUI_ENABLE) GUICtrl_SetState($ButtonB,$GUI_DISABLE) GUICtrl_SetState($ButtonE,$GUI_DISABLE) GUICtrl_SetState($ButtonC,$GUI_DISABLE) GUICtrl_SetState($ButtonD,$GUI_ENABLE) GUICtrlSetData($Progress,0) CloseAllThreadA() EndFunc Func WatNextA($Text = " Open Url ") GUICtrlSetData($Label2,$Text & " . ") Sleep(20) if GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit GUICtrlSetData($Label2,$Text & " . . ") Sleep(20) if GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit GUICtrlSetData($Label2,$Text & " . . . ") Sleep(20) if GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit GUICtrlSetData($Label2,$Text & " . . . . ") Sleep(20) if GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit GUICtrlSetData($Label2,"") EndFunc Func WatNextB($Text) GUICtrlSetData($Label2,$Text & " . ") Sleep(20) if GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit GUICtrlSetData($Label2,$Text & " . . ") Sleep(20) if GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit GUICtrlSetData($Label2,$Text & " . . . ") Sleep(20) if GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit GUICtrlSetData($Label2,$Text & " . . . . ") Sleep(20) if GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit EndFunc Func CloseAllThreadB() GUICtrlSetState($Combo1,$GUI_DISABLE) if IsArray($ThreadArray) Then GUICtrlSetData($Progress,0) For $i = 0 To UBound($ThreadArray) - 1 $OpenRequest = $ThreadArray[$i][1] $hThread = $ThreadArray[$i][8] $InfoStruct = $ThreadArray[$i][6] $hFile = $ThreadArray[$i][5] If $ProgressLoop Then WatNextB(" The multiple download process is completing ") if $hThread Then DllStructSetData($InfoStruct,"Cancel",1) While DllStructGetData($InfoStruct,"Complete") = 0 WatNextB(" The multiple download process is completing ") WEnd _WinAPI_CloseHandle($hThread) Else if $hFile Then _WinAPI_CloseHandle($hFile) if $OpenRequest Then WinHttpCloseHandle($OpenRequest) EndIf GUICtrlSetData($Progress,(100 / UBound($ThreadArray)) * ($i + 1)) Next Sleep(1000) GUICtrlSetData($Progress,0) Local $TestExists = False if $ProgressLoop Then For $i = 0 To UBound($ThreadArray) - 1 $FileA = $ThreadArray[$i][4] $hFile = $ThreadArray[$i][5] if FileExists($FileA) Then WatNextB(" Deleting the file ") _WinAPI_CloseHandle($hFile) FileDelete($FileA) GUICtrlSetData($Progress,(100 / UBound($ThreadArray)) * ($i + 1)) $TestExists = True EndIf Next if $TestExists Then GUICtrlSetData($Progress,100) EndIf Sleep(1000) if $Connect Then WinHttpCloseHandle($Connect) if $HIntOpen Then WinHttpCloseHandle($HIntOpen) $HIntOpen = 0 $Connect = 0 $lpszHostName = 0 $szPath = 0 $DwnhFile = 0 GUICtrlSetData($Label2,"") GUICtrlSetData($Progress,0) $ThreadArray = 0 GUICtrlSetState($Combo1,$GUI_ENABLE) EndIf GUICtrlSetState($Combo1,$GUI_ENABLE) EndFunc Func CloseAllThreadA() GUICtrlSetState($Combo1,$GUI_DISABLE) if IsArray($ThreadArray) Then GUICtrlSetData($Progress,0) For $i = 0 To UBound($ThreadArray) - 1 $OpenRequest = $ThreadArray[$i][1] $hThread = $ThreadArray[$i][8] $InfoStruct = $ThreadArray[$i][6] $hFile = $ThreadArray[$i][5] WatNextB(" The multiple download process is completing ") if $hThread Then DllStructSetData($InfoStruct,"Cancel",1) While DllStructGetData($InfoStruct,"Complete") = 0 WatNextB(" The multiple download process is completing ") WEnd _WinAPI_CloseHandle($hThread) Else if $hFile Then _WinAPI_CloseHandle($hFile) if $OpenRequest Then WinHttpCloseHandle($OpenRequest) EndIf GUICtrlSetData($Progress,(100 / UBound($ThreadArray)) * ($i + 1)) Next Sleep(1000) GUICtrlSetData($Progress,0) Local $TestExists = False For $i = 0 To UBound($ThreadArray) - 1 $FileA = $ThreadArray[$i][4] if FileExists($FileA) Then WatNextB(" Deleting the temporary files ") FileDelete($FileA) GUICtrlSetData($Progress,(100 / UBound($ThreadArray)) * ($i + 1)) $TestExists = True EndIf Next if $TestExists Then GUICtrlSetData($Progress,100) Sleep(1000) if $Connect Then WinHttpCloseHandle($Connect) if $HIntOpen Then WinHttpCloseHandle($HIntOpen) $HIntOpen = 0 $Connect = 0 $lpszHostName = 0 $szPath = 0 $DwnhFilePatch = "" $DwnhFile = 0 GUICtrlSetData($Label2,"") GUICtrlSetData($Progress,0) $ThreadArray = 0 GUICtrlSetState($Combo1,$GUI_ENABLE) EndIf GUICtrlSetState($Combo1,$GUI_ENABLE) EndFunc Func ProgressLoopB() GUICtrlSetState($Combo1,$GUI_ENABLE) $ProgressLoop = False if IsArray($ThreadArray) Then While 1 Local $CompleteAll = True , $MovePosAll = 0 For $i = 0 To UBound($ThreadArray) - 1 if GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit $InfoStruct = $ThreadArray[$i][6] $TimeNuPos = DllStructGetData($InfoStruct,"TimeNuPos") $Complete = DllStructGetData($InfoStruct,"Complete") $MovePos = DllStructGetData($InfoStruct,"MovePos") $MovePosAll += $MovePos + ($TimeNuPos * $MaxInt) $Error = DllStructGetData($InfoStruct,"Error") if $Error Then $ProgressLoop = True Return SetError(10,0,False) EndIf if Not ($Complete) Then $CompleteAll = False if Not $Complete Then $FreeSpace = DriveSpaceFree ($DownloadDir) if $FreeSpace <= ($MovePosAll / 1048576) + ($NewSize1 / 1048576) Then if @error Then Return SetError(14,0,False) Return SetError(12,0,False) EndIf $FreeSpace = DriveSpaceFree (@SystemDir) if $FreeSpace <= ($MovePosAll / 1048576) + ($NewSize1 / 1048576) Then Return SetError(13,0,False) EndIf Next Sleep(75) Local $Text = "" Select Case $MovePosAll < 1024 $Text = "" & StringLeft(($MovePosAll / 1024),7) & " Byte From " & " Unknown size " Case $MovePosAll < (1024 * 1024) $Text = "" & StringLeft($MovePosAll / 1024,7) & " Kilo Byte From " & " Unknown size " Case $MovePosAll < (1024 * 1024 * 1024) $Text = "" & StringLeft($MovePosAll / 1024 / 1024,7) & " Mega Byte From " & " Unknown size " Case $MovePosAll < (1024 * 1024 * 1024 * 1024) $Text = "" & StringLeft($MovePosAll / 1024 / 1024 / 1024,7) & " Giga Byte From " & " Unknown size " Case Else $Text = "" & StringLeft($MovePosAll / 1024 / 1024 / 1024 / 1024,7) & " Terra Byte From " & " Unknown size " EndSelect GUICtrlSetData($Progress,100) GUICtrlSetData($idLabe3,$Text) Sleep(75) $Text = " Download percentage is unknown " GUICtrlSetData($idLabe4,$Text) if GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit if $ProgressLoop Then Return SetError(11,0,False) if $CompleteAll Then ExitLoop WEnd EndIf Return SetError(0,0,True) EndFunc Func ProgressLoopA() $ProgressLoop = False GUICtrlSetState($Combo1,$GUI_ENABLE) if IsArray($ThreadArray) Then While 1 Local $CompleteAll = True , $MovePosAll = 0 For $i = 0 To UBound($ThreadArray) - 1 if GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit $InfoStruct = $ThreadArray[$i][6] $TimeNuPos = DllStructGetData($InfoStruct,"TimeNuPos") $Complete = DllStructGetData($InfoStruct,"Complete") $MovePos = DllStructGetData($InfoStruct,"MovePos") $MovePosAll += $MovePos + ($TimeNuPos * $MaxInt) $Error = DllStructGetData($InfoStruct,"Error") if $Error Then $ProgressLoop = True Return SetError(10,0,False) EndIf if Not ($Complete) Then $CompleteAll = False Next Sleep(75) Local $Text = "" Select Case $FileSize >= (1024 * 1024 * 1024 * 1024) Select Case $MovePosAll < 1024 $Text = "" & StringLeft($MovePosAll,7) & " Byte From " & StringLeft($FileSize / 1024 / 1024 / 1024 / 1024,7) & " Terra Byte " Case $MovePosAll < (1024 * 1024) $Text = "" & StringLeft($MovePosAll / 1024,7) & " Kilo Byte From " & StringLeft($FileSize / 1024 / 1024 / 1024 / 1024,7) & " Terra Byte " Case $MovePosAll < (1024 * 1024 * 1024) $Text = "" & StringLeft($MovePosAll / 1024 / 1024,7) & " Mega Byte From " & StringLeft($FileSize / 1024 / 1024 / 1024 / 1024,7) & " Terra Byte " Case $MovePosAll < (1024 * 1024 * 1024 * 1024) $Text = "" & StringLeft($MovePosAll / 1024 / 1024 / 1024,7) & " Giga Byte From " & StringLeft($FileSize / 1024 / 1024 / 1024 / 1024,7) & " Terra Byte " Case Else $Text = "" & StringLeft($MovePosAll / 1024 / 1024 / 1024 / 1024,7) & " Terra Byte From " & StringLeft($FileSize / 1024 / 1024 / 1024 / 1024,7) & " Terra Byte " EndSelect Case $FileSize >= (1024 * 1024 * 1024) Select Case $MovePosAll < 1024 $Text = "" & StringLeft($MovePosAll,7) & " Byte From " & StringLeft($FileSize / 1024 / 1024 / 1024,7) & " Giga Byte " Case $MovePosAll < (1024 * 1024) $Text = "" & StringLeft($MovePosAll / 1024,7) & " Kilo Byte From " & StringLeft($FileSize / 1024 / 1024 / 1024,7) & " Giga Byte " Case $MovePosAll < (1024 * 1024 * 1024) $Text = "" & StringLeft($MovePosAll / 1024 / 1024,7) & " Mega Byte From " & StringLeft($FileSize / 1024 / 1024 / 1024,7) & " Giga Byte " Case $MovePosAll < (1024 * 1024 * 1024 * 1024) $Text = "" & StringLeft($MovePosAll / 1024 / 1024 / 1024,7) & " Giga Byte From " & StringLeft($FileSize / 1024 / 1024 / 1024,7) & " Giga Byte " EndSelect Case $FileSize >= (1024 * 1024) Select Case $MovePosAll < 1024 $Text = "" & StringLeft($MovePosAll,7) & " Byte From " & StringLeft($FileSize / 1024 / 1024,7) & " Mega Byte " Case $MovePosAll < (1024 * 1024) $Text = "" & StringLeft($MovePosAll / 1024,7) & " Kilo Byte From " & StringLeft($FileSize / 1024 / 1024,7) & " Mega Byte " Case $MovePosAll < (1024 * 1024 * 1024) $Text = "" & StringLeft($MovePosAll / 1024 / 1024,7) & " Mega Byte From " & StringLeft($FileSize / 1024 / 1024,7) & " Mega Byte " EndSelect Case $FileSize >= (1024) Select Case $MovePosAll < 1024 $Text = "" & StringLeft($MovePosAll,7) & " Byte From " & StringLeft($FileSize / 1024,7) & " Kilo Byte " Case $MovePosAll < (1024 * 1024) $Text = "" & StringLeft($MovePosAll / 1024,7) & " Kilo Byte From " & StringLeft($FileSize / 1024,7) & " Kilo Byte " EndSelect Case $FileSize >= 1 $Text = "" & StringLeft($MovePosAll,7) & " Byte From " & StringLeft($FileSize,7) & " Byte " EndSelect GUICtrlSetData($Progress,(100 / $FileSize) * $MovePosAll) GUICtrlSetData($idLabe3,$Text) Sleep(75) $Text = StringLeft((($MovePosAll / $FileSize) * 100),4) $Text = " downloaded " & $Text & "%" GUICtrlSetData($idLabe4,$Text) if GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit if $ProgressLoop Then Return SetError(11,0,False) if $CompleteAll Then ExitLoop Else $FreeSpace = DriveSpaceFree ($DownloadDir) if $FreeSpace <= ($MovePosAll / 1048576) + ($NewSize1 / 1048576) Then if @error Then Return SetError(14,0,False) Return SetError(12,0,False) EndIf $FreeSpace = DriveSpaceFree (@SystemDir) if $FreeSpace <= ($MovePosAll / 1048576) + ($NewSize1 / 1048576) Then Return SetError(13,0,False) EndIf WEnd EndIf Return SetError(0,0,True) EndFunc Func ErrorFunc($Error,$Flag) if $Error = 1 Then MsgBox(16,"Error","The device is not connected to the network",0,$HGui) if $Error = 2 Then MsgBox(16,"Error","Could not open Url",0,$HGui) if $Error = 3 Then MsgBox(16,"Error","A link to the Internet could not be opened",0,$HGui) if $Error = 4 Then MsgBox(16,"Error","Unable to connect to the server",0,$HGui) if $Error = 5 Then MsgBox(16,"Error","Could not open Url",0,$HGui) if $Error = 6 Then MsgBox(16,"Error","File size could not be obtained",0,$HGui) if $Error = 7 Then MsgBox(16,"Error","Unable to make settings on the Url",0,$HGui) if $Error = 8 Then MsgBox(16,"Error","The request could not be sent to the server",0,$HGui) if $Error = 9 Then MsgBox(16,"Error","A file in the temporary files folder could not be opened",0,$HGui) if $Error = 10 Then MsgBox(16,"Error","The download process failed",0,$HGui) if $Error = 12 Then MsgBox(48,"Notice","There is no space for downloaded files on the Download folder partition",0,$HGui) if $Error = 13 Then MsgBox(48,"Notice","There is no space for the download process on the system partition",0,$HGui) if $Error = 14 Then MsgBox(48,"Notice","The download folder partition could not be accessed",0,$HGui) EndFunc Func NewThreadB($lpszUrl) if Not($Winhttp) Then $Winhttp = DllOpen("Winhttp.dll") if $ProgressLoop Then Return SetError(11,0,False) if Not InternetGetConnectedState() Then Return SetError(1,0,False) if Not IsDllStruct($lpszHostName) Then $URL_COMPONENTS = WinHttpCrackUrl($lpszUrl,StringLen($lpszUrl),0) if @error Then Return SetError(2,0,False) EndIf if Not($HIntOpen) Then $HIntOpen = WinHttpOpen("OPEN") if Not($HIntOpen) Then Return SetError(3,0,False) if Not IsArray($ThreadArray) Then Dim $IThreadArray[1][12] $ThreadArray = $IThreadArray Else ReDim $ThreadArray[UBound($ThreadArray) + 1][12] EndIf if Not $Connect Then $Connect = WinHttpConnect($HIntOpen,DllStructGetData($lpszHostName,1),0) if Not $Connect Then Return SetError(4,0,False) $ThreadArray[UBound($ThreadArray) - 1][0] = $Connect $OpenRequest = WinHttpOpenRequest($Connect,"GET",DllStructGetData($szPath,1)) if Not $OpenRequest Then Return SetError(5,0,False) $ThreadArray[UBound($ThreadArray) - 1][1] = $OpenRequest $Return = WinHttpSendRequest($OpenRequest) if Not $Return Then Return SetError(8,0,False) $Return = WinHttpReceiveResponse($OpenRequest) if Not $Return Then Return SetError(8,0,False) Local $vFileName = "" if StringLen($DISPOSITION) Then $zFileName = $DISPOSITION $Extension = StringSplit($zFileName,".") $Extension = "." & $Extension[$Extension[0]] $nFileName = StringLeft($zFileName,StringLen($zFileName) - StringLen($Extension)) $vFileName = StringLeft($nFileName,30) Else $zFileName = StringSplit($OriginalUrl,"/") $zFileName = $zFileName[$zFileName[0]] $Extension = StringSplit($zFileName,".") $Extension = "." & $Extension[$Extension[0]] $nFileName = StringLeft($zFileName,StringLen($zFileName) - StringLen($Extension)) $vFileName = StringLeft($nFileName,30) EndIf DirCreate($DownloadDir) Local $i = 1 $FileA = $DownloadDir & "\" & $vFileName & $Extension While FileExists($FileA) $FileA = $DownloadDir & "\" & $vFileName & "(" & $i & ")" & $Extension if $ProgressLoop Then Return SetError(11,0,False) $i += 1 WEnd $hFile = _WinAPI_CreateFile($FileA,0) if Not($hFile) Then Return SetError(9,0,False) $ThreadArray[UBound($ThreadArray) - 1][4] = $FileA $ThreadArray[UBound($ThreadArray) - 1][5] = $hFile Local $InfoStruct = DllStructCreate($tagInfoSt) $ThreadArray[UBound($ThreadArray) - 1][6] = $InfoStruct if Not $WinhttphModule Then $WinhttphModule = _WinAPI_LoadLibrary("Winhttp.dll") $WriteFile = _WinAPI_GetProcAddress($Kernel32dll,"WriteFile") $CloseHandle = _WinAPI_GetProcAddress($Kernel32dll,"CloseHandle") $WinHttpReadData = _WinAPI_GetProcAddress($WinhttphModule,"WinHttpReadData") $WinHttpCloseHandle = _WinAPI_GetProcAddress($WinhttphModule,"WinHttpCloseHandle") EndIf $hLockDataSt = DllStructCreate("BYTE[1048576]") $hLockDataPtr = DllStructGetPtr( $hLockDataSt ) DllStructSetData($InfoStruct,"BytesAtaTime" ,$BytesAtaTime) DllStructSetData($InfoStruct,"vBytesAtaTime",$BytesAtaTime) DllStructSetData($InfoStruct,"FileSize",$MaxInt) $ThreadArray[UBound($ThreadArray) - 1][9] = $hLockDataSt $ThreadArray[UBound($ThreadArray) - 1][7] = LoadFileDownLoad2() if $ProgressLoop Then Return SetError(11,0,False) $LoadFileDownLoad = $ThreadArray[UBound($ThreadArray) - 1][7] $ThreadArray[UBound($ThreadArray) - 1][8] = CreateThread(DllStructGetPtr($LoadFileDownLoad),DllStructGetPtr($InfoStruct)) Return SetError(0,0,True) EndFunc Func NewThreadA($lpszUrl,$Pointer = 0,$nFileSize = 0) if Not($Winhttp) Then $Winhttp = DllOpen("Winhttp.dll") if $nFileSize = 0 Then WatNextB(" Open Url ") Else WatNextB(" Set up the multiple download process") EndIf if $ProgressLoop Then Return SetError(11,0,False) if Not InternetGetConnectedState() Then Return SetError(1,0,False) if Not IsDllStruct($lpszHostName) Then $URL_COMPONENTS = WinHttpCrackUrl($lpszUrl,StringLen($lpszUrl),0) if @error Then Return SetError(2,0,False) EndIf if Not($HIntOpen) Then $HIntOpen = WinHttpOpen("OPEN") if Not($HIntOpen) Then Return SetError(3,0,False) if Not IsArray($ThreadArray) Then Dim $IThreadArray[1][12] $ThreadArray = $IThreadArray Else ReDim $ThreadArray[UBound($ThreadArray) + 1][12] EndIf if Not $Connect Then $Connect = WinHttpConnect($HIntOpen,DllStructGetData($lpszHostName,1),0) if Not $Connect Then Return SetError(4,0,False) $ThreadArray[UBound($ThreadArray) - 1][0] = $Connect $OpenRequest = WinHttpOpenRequest($Connect,"GET",DllStructGetData($szPath,1)) if Not $OpenRequest Then Return SetError(5,0,False) $ThreadArray[UBound($ThreadArray) - 1][1] = $OpenRequest Local $Range = "" if $Pointer Then $Range = "Range: bytes=" & $Pointer & "-" $Return = WinHttpSendRequest($OpenRequest,$Range,StringLen($Range)) if Not $Return Then Return SetError(8,0,False) $Return = WinHttpReceiveResponse($OpenRequest) if Not $Return Then Return SetError(8,0,False) if $nFileSize = 0 Then $DISPOSITION = WinHttpQueryHeaders($OpenRequest,47) if Not @error And IsString($DISPOSITION) Then $DISPOSITION = StringSplit($DISPOSITION,";") $DISPOSITION = $DISPOSITION[$DISPOSITION[0]] $DISPOSITION = StringSplit($DISPOSITION,"=") $DISPOSITION = $DISPOSITION[$DISPOSITION[0]] $DISPOSITION = StringReplace($DISPOSITION,'"',"") $DISPOSITION = StringReplace($DISPOSITION,"'","") if Not StringInStr($DISPOSITION,".") Then $DISPOSITION = "" Else $DISPOSITION = "" EndIf $OriginalUrl = WinHttpQueryOption($OpenRequest,34) if @error Then Return SetError(7,0,False) $FileSize = WinHttpQueryHeaders($OpenRequest,5) $FileSize = Abs(int($FileSize)) if Not($FileSize) Then Return SetError(6,0,False) $ThreadArray[UBound($ThreadArray) - 1][2] = $FileSize $ThreadArray[UBound($ThreadArray) - 1][3] = $OriginalUrl Return SetError(0,0,True) Else $ThreadArray[UBound($ThreadArray) - 1][2] = $nFileSize EndIf Local $vFileName = "" if StringLen($DISPOSITION) Then $zFileName = $DISPOSITION $Extension = StringSplit($zFileName,".") $Extension = "." & $Extension[$Extension[0]] $nFileName = StringLeft($zFileName,StringLen($zFileName) - StringLen($Extension)) $vFileName = StringLeft($nFileName,30) Else $zFileName = StringSplit($OriginalUrl,"/") $zFileName = $zFileName[$zFileName[0]] $Extension = StringSplit($zFileName,".") $Extension = "." & $Extension[$Extension[0]] $nFileName = StringLeft($zFileName,StringLen($zFileName) - StringLen($Extension)) $vFileName = StringLeft($nFileName,30) EndIf DirCreate(@TempDir & "\DownloadTool\" & $vFileName) Local $i = 1 $FileA = @TempDir & "\DownloadTool\" & $vFileName & "\" & $vFileName & "(" & $i & ").Data" While FileExists($FileA) $FileA = @TempDir & "\DownloadTool\" & $vFileName & "\" & $vFileName & "(" & $i & ").Data" if $ProgressLoop Then Return SetError(11,0,False) $i += 1 WEnd $hFile = _WinAPI_CreateFile($FileA,0) if Not($hFile) Then Return SetError(9,0,False) $ThreadArray[UBound($ThreadArray) - 1][4] = $FileA $ThreadArray[UBound($ThreadArray) - 1][5] = $hFile Local $InfoStruct = DllStructCreate($tagInfoSt) $ThreadArray[UBound($ThreadArray) - 1][6] = $InfoStruct if ($nFileSize > $MaxInt) Then Local $Remainder = Mod($nFileSize,$MaxInt) DllStructSetData($InfoStruct,"FileSize",$MaxInt) DllStructSetData($InfoStruct,"Remder",$Remainder) DllStructSetData($InfoStruct,"TimeNu",(($nFileSize - $Remainder) / $MaxInt)) Else DllStructSetData($InfoStruct,"FileSize",$nFileSize) EndIf if Not $WinhttphModule Then $WinhttphModule = _WinAPI_LoadLibrary("Winhttp.dll") $WriteFile = _WinAPI_GetProcAddress($Kernel32dll,"WriteFile") $CloseHandle = _WinAPI_GetProcAddress($Kernel32dll,"CloseHandle") $WinHttpReadData = _WinAPI_GetProcAddress($WinhttphModule,"WinHttpReadData") $WinHttpCloseHandle = _WinAPI_GetProcAddress($WinhttphModule,"WinHttpCloseHandle") EndIf $hLockDataSt = DllStructCreate("BYTE[1048576]") $hLockDataPtr = DllStructGetPtr( $hLockDataSt ) DllStructSetData($InfoStruct,"BytesAtaTime" ,$BytesAtaTime) DllStructSetData($InfoStruct,"vBytesAtaTime",$BytesAtaTime) $ThreadArray[UBound($ThreadArray) - 1][9] = $hLockDataSt $ThreadArray[UBound($ThreadArray) - 1][7] = LoadFileDownLoad() if $ProgressLoop Then Return SetError(11,0,False) $LoadFileDownLoad = $ThreadArray[UBound($ThreadArray) - 1][7] $ThreadArray[UBound($ThreadArray) - 1][8] = CreateThread(DllStructGetPtr($LoadFileDownLoad),DllStructGetPtr($InfoStruct)) Return SetError(0,0,True) EndFunc Func LoadFileDownLoad2() Local $OffSetInetHandle = $DwordSize Local $OffSetCancel = ($DwordSize * 9) Local $OffSetNuOfBytesRead = ($DwordSize * 19) Local $OffSetByteAtaTime = ($DwordSize * 7) Local $OffSetNuOfBytesWn = ($DwordSize * 20) Local $OffSetMovePos = ($DwordSize * 6) Local $OffSetComplete = ($DwordSize * 3) Local $OffSetFileSize = ($DwordSize * 8) Local $OffsetError = ($DwordSize * 5) Local $OffsetTimeNu = ($DwordSize * 12) Local $OffsetRemder = ($DwordSize * 13) Local $OffsetTimeNuPos = ($DwordSize * 14) Local $OffSetvByteAtaTime = ($DwordSize * 21) Local $OffSetControlThread = ($DwordSize * 22) Local $vOffSetControlThread = ($DwordSize * 23) Local $Complete,$JZCancel,$JZComplete,$JMPStart,$Start,$JZJMPStart,$Next,$JZNext,$JZComplete2,$JL2Next2,$Add,$JZAdd Local $Error,$JZError,$JMPStart2 , $Next2 , $JLNext2 , $JZError2 , $JMPEnd , $End , $JMPStart4 , $XComplete Local $Add , $JGAdd , $Add2 , $JGAdd2 , $JMPStart3 , $JMPStart4 , $Out , $JZOut , $Next3 , $JZNext3 , $JMPXComplete For $i = 1 To 2 $_ASMCode = "0x" ; $Start: // $Start = BinaryLen($_ASMCode) $_ASMCode &= "8B5C24" & Hex($OffSetInetHandle,2) ;mov ebx,[esp + $OffSetInetHandle] $_ASMCode &= "8B43" & Hex($OffSetControlThread,2) ;mov eax,[ebx + $OffSetFileSize] $_ASMCode &= "83F8" & Hex(0,2) ;CMP eax,0 $_ASMCode &= "74" & Hex(($Next3 - $JZNext3),2) ;JZ Next3 $JZNext3 = BinaryLen($_ASMCode) $_ASMCode &= "C643" & Hex($vOffSetControlThread,2) & Hex(1,2) ;mov [ebx + $vOffSetControlThread],1 $_ASMCode &= "B8" & HexBinary(3) ;mov eax,3 // 3 Milliseconds $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary($Sleep) ;mov eax,$Sleep $_ASMCode &= "FFD0" ;call eax $JMPStart4 = BinaryLen($_ASMCode) $_ASMCode &= "E9" & HexBinary(-(($JMPStart4 - $Start) + 5)) ;JMP $Start ; $Next3: // $Next3 = BinaryLen($_ASMCode) $_ASMCode &= "8B43" & Hex($OffSetFileSize,2) ;mov eax,[ebx + $OffSetFileSize] $_ASMCode &= "2B43" & Hex($OffSetMovePos,2) ;sub eax,[ebx + $OffSetMovePos] $_ASMCode &= "3B43" & Hex($OffSetByteAtaTime,2) ;CMP eax,[ebx + $OffSetByteAtaTime] $_ASMCode &= "7C" & Hex(($Next2 - $JLNext2),2) ;JL Next2 $JLNext2 = BinaryLen($_ASMCode) $_ASMCode &= "C643" & Hex($OffSetNuOfBytesRead,2) & Hex(0,2) ;mov [ebx + $OffSetNuOfBytesRead],0 $_ASMCode &= "83C3" & Hex($OffSetNuOfBytesRead,2) ;add ebx,$OffSetNuOfBytesRead $_ASMCode &= "53" ;push ebx $_ASMCode &= "8B5C24" & Hex($OffSetInetHandle + $PtrSize,2) ;mov ebx,[esp + $OffSetInetHandle] $_ASMCode &= "FF73" & Hex($OffSetByteAtaTime,2) ;push [ebx + $OffSetByteAtaTime] $_ASMCode &= "68" & HexBinary($hLockDataPtr) ;push $hLockDataPtr $_ASMCode &= "68" & HexBinary($OpenRequest) ;push $OpenRequest $_ASMCode &= "B8" & HexBinary($WinHttpReadData) ;mov eax,$WinHttpReadData $_ASMCode &= "FFD0" ;call eax $_ASMCode &= "83F8" & Hex(0,2) ;CMP eax,0 $_ASMCode &= "74" & Hex(($Error - $JZError),2) ;JZ Error $JZError = BinaryLen($_ASMCode) $_ASMCode &= "8B5C24" & Hex($OffSetInetHandle,2) ;mov ebx,[esp + $OffSetInetHandle] $_ASMCode &= "8B43" & Hex($OffSetNuOfBytesRead,2) ;mov eax,[ebx + $OffSetNuOfBytesRead] $_ASMCode &= "83F8" & Hex(0,2) ;CMP eax,0 $_ASMCode &= "74" & Hex(($Complete - $JZComplete),2) ;JZ Complete $JZComplete = BinaryLen($_ASMCode) $_ASMCode &= "68" & HexBinary(0) ;push lpOverlapped = 0 $_ASMCode &= "83C3" & Hex($OffSetNuOfBytesWn,2) ;add ebx,$OffSetNuOfBytesWn $_ASMCode &= "53" ;push ebx $_ASMCode &= "8B5C24" & Hex($OffSetInetHandle + $PtrSize + $PtrSize,2) ;mov ebx,[esp + $OffSetInetHandle] $_ASMCode &= "FF73" & Hex($OffSetNuOfBytesRead,2) ;push [ebx + $OffSetNuOfBytesRead] $_ASMCode &= "68" & HexBinary($hLockDataPtr) ;push $hLockDataPtr $_ASMCode &= "68" & HexBinary($hFile) ;push $hFile $_ASMCode &= "B8" & HexBinary($WriteFile) ;mov eax,$WriteFile $_ASMCode &= "FFD0" ;call eax $_ASMCode &= "8B5C24" & Hex($OffSetInetHandle,2) ;mov ebx,[esp + $OffSetInetHandle] $_ASMCode &= "8B43" & Hex($OffSetNuOfBytesRead,2) ;mov eax,[ebx + $OffSetNuOfBytesRead] $_ASMCode &= "0143" & Hex($OffSetMovePos,2) ;add [ebx + $OffSetMovePos],eax $_ASMCode &= "8B43" & Hex($OffSetMovePos ,2) ;mov eax,[ebx + $OffSetMovePos] $_ASMCode &= "3B43" & Hex($OffSetFileSize,2) ;CMP eax,[ebx + $OffSetFileSize] $_ASMCode &= "74" & Hex(($Add - $JZAdd),2) ;JZ Add $JZAdd = BinaryLen($_ASMCode) $_ASMCode &= "807B" & Hex($OffSetCancel,2) & Hex(1,2) ;CMP [ebx + $OffSetCancel],1 // Cancel $_ASMCode &= "74" & Hex(($Complete - $JZCancel),2) ;JZ $Complete; $JZCancel = BinaryLen($_ASMCode) $JMPStart2 = BinaryLen($_ASMCode) $_ASMCode &= "E9" & HexBinary(-(($JMPStart2 - $Start) + 5)) ;JMP $Start ;$Next2: // $Next2 = BinaryLen($_ASMCode) $_ASMCode &= "8943" & Hex($OffSetByteAtaTime,2) ;mov [ebx + $OffSetByteAtaTime],eax $JMPStart = BinaryLen($_ASMCode) $_ASMCode &= "E9" & HexBinary(-(($JMPStart - $Start) + 5)) ;JMP $Start ; Add: // $Add = BinaryLen($_ASMCode) $_ASMCode &= "8B5C24" & Hex($OffSetInetHandle,2) ;mov ebx,[esp + $OffSetInetHandle] $_ASMCode &= "B8" & HexBinary(0) ;mov eax,0 $_ASMCode &= "8943" & Hex($OffSetMovePos,2) ;mov [ebx + $OffSetMovePos],eax $_ASMCode &= "B8" & HexBinary(1) ;mov eax,1 $_ASMCode &= "0143" & Hex($OffsetTimeNuPos,2) ;add [ebx + $OffsetTimeNuPos],eax $_ASMCode &= "8B43" & Hex($OffSetvByteAtaTime,2) ;mov eax,[ebx + $OffSetvByteAtaTime] $_ASMCode &= "8943" & Hex($OffSetByteAtaTime,2) ;mov [ebx + $OffSetByteAtaTime],eax $JMPStart3 = BinaryLen($_ASMCode) $_ASMCode &= "E9" & HexBinary(-(($JMPStart3 - $Start) + 5)) ;JMP $Start ; Error: // $Error = BinaryLen($_ASMCode) $_ASMCode &= "8B5C24" & Hex($OffSetInetHandle,2) ;mov ebx,[esp + $OffSetInetHandle] $_ASMCode &= "C643" & Hex($OffsetError,2) & Hex(8,2) ;mov [ebx + $OffsetError],8 ; Complete: // $Complete = BinaryLen($_ASMCode) $_ASMCode &= "8B5C24" & Hex($OffSetInetHandle,2) ;mov ebx,[esp + $OffSetInetHandle] $_ASMCode &= "C643" & Hex($OffSetComplete,2) & Hex(1,2) ;mov [ebx + $OffSetComplete],1 $_ASMCode &= "68" & HexBinary($OpenRequest) ;push $OpenRequest $_ASMCode &= "B8" & HexBinary($WinHttpCloseHandle) ;mov eax,$WinHttpCloseHandle $_ASMCode &= "FFD0" ;call eax $_ASMCode &= "68" & HexBinary($hFile) ;push $hFile $_ASMCode &= "B8" & HexBinary($CloseHandle) ;mov eax,$CloseHandle $_ASMCode &= "FFD0" ;call eax $_ASMCode &= "C2" & Hex($PtrSize,2) & Hex(0,2) ;ret ($PtrSize) & "00" // Args Size Next $AddressSt = DllStructCreate("byte[" & BinaryLen($_ASMCode) & "]") DllStructSetData($AddressSt,1,$_ASMCode) Return $AddressSt EndFunc Func LoadFileDownLoad() Local $OffSetInetHandle = $DwordSize Local $OffSetCancel = ($DwordSize * 9) Local $OffSetNuOfBytesRead = ($DwordSize * 19) Local $OffSetByteAtaTime = ($DwordSize * 7) Local $OffSetNuOfBytesWn = ($DwordSize * 20) Local $OffSetMovePos = ($DwordSize * 6) Local $OffSetComplete = ($DwordSize * 3) Local $OffSetFileSize = ($DwordSize * 8) Local $OffsetError = ($DwordSize * 5) Local $OffsetTimeNu = ($DwordSize * 12) Local $OffsetRemder = ($DwordSize * 13) Local $OffsetTimeNuPos = ($DwordSize * 14) Local $OffSetvByteAtaTime = ($DwordSize * 21) Local $OffSetControlThread = ($DwordSize * 22) Local $vOffSetControlThread = ($DwordSize * 23) Local $Complete , $JZCancel,$JZComplete,$JMPStart,$Start,$JZJMPStart,$Next,$JZNext,$JZComplete2,$JL2Next2,$JZNext4 Local $Error , $JZError ,$JMPStart2,$Next2,$JLNext2,$JZError2,$JMPEnd,$End,$JMPStart4,$XComplete,$Next4,$JMPStart5 Local $Add , $JGAdd , $Add2 , $JGAdd2 , $JMPStart3 , $JMPStart4 , $Out , $JZOut , $Next3 , $JZNext3 , $JMPXComplete For $i = 1 To 2 $_ASMCode = "0x" ; $Start: // $Start = BinaryLen($_ASMCode) $_ASMCode &= "8B5C24" & Hex($OffSetInetHandle,2) ;mov ebx,[esp + $OffSetInetHandle] $_ASMCode &= "8B43" & Hex($OffSetControlThread,2) ;mov eax,[ebx + $OffSetFileSize] $_ASMCode &= "83F8" & Hex(0,2) ;CMP eax,0 $_ASMCode &= "74" & Hex(($Next4 - $JZNext4),2) ;JZ Next4 $JZNext4 = BinaryLen($_ASMCode) $_ASMCode &= "C643" & Hex($vOffSetControlThread,2) & Hex(1,2) ;mov [ebx + $vOffSetControlThread],1 $_ASMCode &= "B8" & HexBinary(3) ;mov eax,3 // 3 Milliseconds $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary($Sleep) ;mov eax,$Sleep $_ASMCode &= "FFD0" ;call eax $JMPStart5 = BinaryLen($_ASMCode) $_ASMCode &= "E9" & HexBinary(-(($JMPStart5 - $Start) + 5)) ;JMP $Start ; $Next4: // $Next4 = BinaryLen($_ASMCode) $_ASMCode &= "8B5C24" & Hex($OffSetInetHandle,2) ;mov ebx,[esp + $OffSetInetHandle] $_ASMCode &= "8B43" & Hex($OffSetFileSize,2) ;mov eax,[ebx + $OffSetFileSize] $_ASMCode &= "2B43" & Hex($OffSetMovePos,2) ;sub eax,[ebx + $OffSetMovePos] $_ASMCode &= "3B43" & Hex($OffSetByteAtaTime,2) ;CMP eax,[ebx + $OffSetByteAtaTime] $_ASMCode &= "7C" & Hex(($Next2 - $JLNext2),2) ;JL Next2 $JLNext2 = BinaryLen($_ASMCode) $_ASMCode &= "C643" & Hex($OffSetNuOfBytesRead,2) & Hex(0,2) ;mov [ebx + $OffSetNuOfBytesRead],0 $_ASMCode &= "83C3" & Hex($OffSetNuOfBytesRead,2) ;add ebx,$OffSetNuOfBytesRead $_ASMCode &= "53" ;push ebx $_ASMCode &= "8B5C24" & Hex($OffSetInetHandle + $PtrSize,2) ;mov ebx,[esp + $OffSetInetHandle] $_ASMCode &= "FF73" & Hex($OffSetByteAtaTime,2) ;push [ebx + $OffSetByteAtaTime] $_ASMCode &= "68" & HexBinary($hLockDataPtr) ;push $hLockDataPtr $_ASMCode &= "68" & HexBinary($OpenRequest) ;push $OpenRequest $_ASMCode &= "B8" & HexBinary($WinHttpReadData) ;mov eax,$WinHttpReadData $_ASMCode &= "FFD0" ;call eax $_ASMCode &= "83F8" & Hex(0,2) ;CMP eax,0 $_ASMCode &= "74" & Hex(($Error - $JZError),2) ;JZ Error $JZError = BinaryLen($_ASMCode) $_ASMCode &= "68" & HexBinary(0) ;push lpOverlapped = 0 $_ASMCode &= "83C3" & Hex($OffSetNuOfBytesWn,2) ;add ebx,$OffSetNuOfBytesWn $_ASMCode &= "53" ;push ebx $_ASMCode &= "8B5C24" & Hex($OffSetInetHandle + $PtrSize + $PtrSize,2) ;mov ebx,[esp + $OffSetInetHandle] $_ASMCode &= "FF73" & Hex($OffSetNuOfBytesRead,2) ;push [ebx + $OffSetNuOfBytesRead] $_ASMCode &= "68" & HexBinary($hLockDataPtr) ;push $hLockDataPtr $_ASMCode &= "68" & HexBinary($hFile) ;push $hFile $_ASMCode &= "B8" & HexBinary($WriteFile) ;mov eax,$WriteFile $_ASMCode &= "FFD0" ;call eax $_ASMCode &= "8B43" & Hex($OffSetNuOfBytesRead,2) ;mov eax,[ebx + $OffSetNuOfBytesRead] $_ASMCode &= "0143" & Hex($OffSetMovePos,2) ;add [ebx + $OffSetMovePos],eax $_ASMCode &= "8B43" & Hex($OffSetFileSize,2) ;mov eax,[ebx + $OffSetFileSize] $_ASMCode &= "3B43" & Hex($OffSetMovePos,2) ;CMP eax,[ebx + $OffSetMovePos] $_ASMCode &= "74" & Hex(($Complete - $JZComplete),2) ;JZ Complete $JZComplete = BinaryLen($_ASMCode) $_ASMCode &= "807B" & Hex($OffSetCancel,2) & Hex(1,2) ;CMP [ebx + $OffSetCancel],1 // Cancel $_ASMCode &= "74" & Hex(($XComplete - $JZCancel),2) ;JZ $XComplete; $JZCancel = BinaryLen($_ASMCode) $JMPStart2 = BinaryLen($_ASMCode) $_ASMCode &= "E9" & HexBinary(-(($JMPStart2 - $Start) + 5)) ;JMP $Start ; $Next2: // $Next2 = BinaryLen($_ASMCode) $_ASMCode &= "8943" & Hex($OffSetByteAtaTime,2) ;mov [ebx + $OffSetByteAtaTime],eax $JMPStart = BinaryLen($_ASMCode) $_ASMCode &= "E9" & HexBinary(-(($JMPStart - $Start) + 5)) ;JMP $Start ; Error: // $Error = BinaryLen($_ASMCode) $_ASMCode &= "8B5C24" & Hex($OffSetInetHandle,2) ;mov ebx,[esp + $OffSetInetHandle] $_ASMCode &= "C643" & Hex($OffsetError,2) & Hex(8,2) ;mov [ebx + $OffsetError],8 $_ASMCode &= "EB" & Hex(($XComplete - $JMPXComplete),2) ;JMP $XComplete $JMPXComplete = BinaryLen($_ASMCode) ; Complete: // $Complete = BinaryLen($_ASMCode) $_ASMCode &= "8B43" & Hex($OffsetTimeNuPos,2) ;mov eax,[ebx + $OffsetTimeNuPos] $_ASMCode &= "3943" & Hex($OffsetTimeNu,2) ;CMP [ebx + $OffsetTimeNu],eax $_ASMCode &= "7F" & Hex(($Add - $JGAdd),2) ;JG Add $JGAdd = BinaryLen($_ASMCode) ; XComplete: // $XComplete = BinaryLen($_ASMCode) $_ASMCode &= "8B5C24" & Hex($OffSetInetHandle,2) ;mov ebx,[esp + $OffSetInetHandle] $_ASMCode &= "C643" & Hex($OffSetComplete,2) & Hex(1,2) ;mov [ebx + $OffSetComplete],1 $_ASMCode &= "68" & HexBinary($OpenRequest) ;push $OpenRequest $_ASMCode &= "B8" & HexBinary($WinHttpCloseHandle) ;mov eax,$WinHttpCloseHandle $_ASMCode &= "FFD0" ;call eax $_ASMCode &= "68" & HexBinary($hFile) ;push $hFile $_ASMCode &= "B8" & HexBinary($CloseHandle) ;mov eax,$CloseHandle $_ASMCode &= "FFD0" ;call eax $_ASMCode &= "C2" & Hex($PtrSize,2) & Hex(0,2) ;ret ($PtrSize) & "00" // Args Size ; Add: // $Add = BinaryLen($_ASMCode) $_ASMCode &= "B8" & HexBinary(0) ;mov eax,0 $_ASMCode &= "8943" & Hex($OffSetMovePos,2) ;mov [ebx + $OffSetMovePos],eax $_ASMCode &= "B8" & HexBinary(1) ;mov eax,1 $_ASMCode &= "0143" & Hex($OffsetTimeNuPos,2) ;add [ebx + $OffsetTimeNuPos],eax $_ASMCode &= "8B43" & Hex($OffSetvByteAtaTime,2) ;mov eax,[ebx + $OffSetvByteAtaTime] $_ASMCode &= "8943" & Hex($OffSetByteAtaTime,2) ;mov [ebx + $OffSetByteAtaTime],eax $_ASMCode &= "8B43" & Hex($OffsetTimeNuPos,2) ;mov eax,[ebx + $OffsetTimeNuPos] $_ASMCode &= "3943" & Hex($OffsetTimeNu,2) ;CMP [ebx + $OffsetTimeNu],eax $_ASMCode &= "74" & Hex(($Next3 - $JZNext3),2) ;JZ Next3 $JZNext3 = BinaryLen($_ASMCode) $JMPStart3 = BinaryLen($_ASMCode) $_ASMCode &= "E9" & HexBinary(-(($JMPStart3 - $Start) + 5)) ;JMP $Start ; Next3: // $Next3 = BinaryLen($_ASMCode) $_ASMCode &= "8B43" & Hex($OffsetRemder,2) ;mov eax,[ebx + $OffsetRemder] $_ASMCode &= "83F8" & Hex(0,2) ;CMP eax,0 $_ASMCode &= "74" & Hex(($Out - $JZOut),2) ;JZ Out $JZOut = BinaryLen($_ASMCode) $_ASMCode &= "8943" & Hex($OffSetFileSize,2) ;mov [ebx + $OffSetFileSize],eax $_ASMCode &= "B8" & HexBinary(0) ;mov eax,0 $_ASMCode &= "8943" & Hex($OffsetRemder,2) ;mov [ebx + $OffsetRemder],eax $JMPStart4 = BinaryLen($_ASMCode) $_ASMCode &= "E9" & HexBinary(-(($JMPStart4 - $Start) + 5)) ;JMP $Start ; Out: // $Out = BinaryLen($_ASMCode) $_ASMCode &= "8B5C24" & Hex($OffSetInetHandle,2) ;mov ebx,[esp + $OffSetInetHandle] $_ASMCode &= "C643" & Hex($OffSetComplete,2) & Hex(1,2) ;mov [ebx + $OffSetComplete],1 $_ASMCode &= "68" & HexBinary($OpenRequest) ;push $OpenRequest $_ASMCode &= "B8" & HexBinary($WinHttpCloseHandle) ;mov eax,$WinHttpCloseHandle $_ASMCode &= "FFD0" ;call eax $_ASMCode &= "68" & HexBinary($hFile) ;push $hFile $_ASMCode &= "B8" & HexBinary($CloseHandle) ;mov eax,$CloseHandle $_ASMCode &= "FFD0" ;call eax $_ASMCode &= "C2" & Hex($PtrSize,2) & Hex(0,2) ;ret ($PtrSize) & "00" // Args Size Next $AddressSt = DllStructCreate("byte[" & BinaryLen($_ASMCode) & "]") DllStructSetData($AddressSt,1,$_ASMCode) Return $AddressSt EndFunc Func CreateThread($lpStartAddress,$lpParameter) Local $HANDLE = DllCall("Kernel32.dll","ptr","CreateThread","ptr",0,"int",0,"ptr", _ $lpStartAddress,"ptr",$lpParameter,"DWORD",0,"DWORD*",0) if @error Or $HANDLE[0] = 0 Then Return SetError(1,0,0) Return SetError(0,0,$HANDLE[0]) EndFunc Func InternetGetConnectedState() $BOOL = DllCall("Wininet.dll","DWORD","InternetGetConnectedState","DWORD*",0,"DWORD",0) if @error Then Return SetError(1,0,0) Return $BOOL[0] EndFunc Func WinHttpQueryOption($hInternet,$dwOption) Local $lpdwBufferLength = 10000 $DLLSDWORD = DllStructCreate("DWORD") DllStructSetData($DLLSDWORD,1,$lpdwBufferLength) $LPDWORDLENGTH = DllStructGetPtr($DLLSDWORD) $DLLSlpvBuffer = DllStructCreate("WCHAR[" & $lpdwBufferLength & "]") $lpvBuffer = DllStructGetPtr($DLLSlpvBuffer) $BOOL = DllCall($Winhttp,"BOOL","WinHttpQueryOption","HANDLE",$hInternet _ ,"DWORD",$dwOption,"ptr",$lpvBuffer,"ptr",$LPDWORDLENGTH) if @error Or $BOOL[0] = 0 Then Return SetError(1,0,0) Return SetError(0,0,DllStructGetData($DLLSlpvBuffer,1)) EndFunc Func WinHttpQueryHeaders($hRequest,$dwInfoLevel,$lpdwIndex = 0) Local $lpdwBufferLength = 1000 $DLLSDWORD = DllStructCreate("DWORD") DllStructSetData($DLLSDWORD,1,$lpdwBufferLength) $LPDWORDLENGTH = DllStructGetPtr($DLLSDWORD) $DLLSlpvBuffer = DllStructCreate("WCHAR[" & $lpdwBufferLength & "]") $lpvBuffer = DllStructGetPtr($DLLSlpvBuffer) $BOOL = DllCall($Winhttp,"BOOL","WinHttpQueryHeaders","HANDLE",$hRequest,"DWORD",$dwInfoLevel, _ "wstr","","ptr",$lpvBuffer,"ptr",$LPDWORDLENGTH,"DWORD",0) if @error Or $BOOL[0] = 0 Then Return SetError(1,0,0) Return SetError(0,0,DllStructGetData($DLLSlpvBuffer,1)) EndFunc Func WinHttpOpen($pwszUserAgent,$dwAccessType = 0,$lpszProxyName = "",$lpszProxyBypass = "",$dwFlags = 0) $HINTERNET = DllCall($Winhttp,"HANDLE","WinHttpOpen","wstr",$pwszUserAgent,"DWORD",$dwAccessType, _ "wstr",$lpszProxyName,"wstr",$lpszProxyBypass,"DWORD",$dwFlags) if @error Or Not ($HINTERNET[0]) Then Return SetError(1,0,0) Return SetError(0,0,$HINTERNET[0]) EndFunc Func WinHttpConnect($hSession,$pswzServerName,$INTERNET_PORT,$dwReserved = 0) $HINTERNET = DllCall($Winhttp,"HANDLE","WinHttpConnect","HANDLE",$hSession,"wstr",$pswzServerName, _ "DWORD",$INTERNET_PORT,"DWORD",$dwReserved) if @error Or Not ($HINTERNET[0]) Then Return SetError(1,0,0) Return SetError(0,0,$HINTERNET[0]) EndFunc Func WinHttpOpenRequest($hConnect,$pwszVerb,$pwszObjectName,$pwszVersion = "",$pwszReferrer = "",$ppwszAcceptTypes = 0,$dwFlags = 0) $HINTERNET = DllCall($Winhttp,"HANDLE","WinHttpOpenRequest","HANDLE",$hConnect,"wstr",$pwszVerb, _ "wstr",$pwszObjectName,"wstr",$pwszVersion,"wstr",$pwszReferrer,"ptr",$ppwszAcceptTypes,"DWORD",$dwFlags) if @error Or Not ($HINTERNET[0]) Then Return SetError(1,0,0) Return SetError(0,0,$HINTERNET[0]) EndFunc Func WinHttpSendRequest($hRequest,$pwszHeaders = "",$dwHeadersLength = 0,$lpOptional = 0, _ $dwOptionalLength = 0,$dwTotalLength = 0,$dwContext = 0) $HINTERNET = DllCall($Winhttp,"HANDLE","WinHttpSendRequest","HANDLE",$hRequest,"wstr",$pwszHeaders, _ "DWORD",$dwHeadersLength,"ptr",$lpOptional,"DWORD",$dwOptionalLength,"DWORD",$dwTotalLength,"ptr",$dwContext) if @error Or Not ($HINTERNET[0]) Then Return SetError(1,0,0) Return SetError(0,0,$HINTERNET[0]) EndFunc Func WinHttpReceiveResponse($hRequest) $HINTERNET = DllCall($Winhttp,"BOOL","WinHttpReceiveResponse","HANDLE",$hRequest,"ptr",0) if @error Or Not ($HINTERNET[0]) Then Return SetError(1,0,0) Return SetError(0,0,$HINTERNET[0]) EndFunc Func WinHttpCrackUrl($lpszUrl,$dwUrlLength,$dwFlags) $tagURL_COMPONENTS = "DWORD dwStructSize;ptr lpszScheme;DWORD dwSchemeLength;DWORD nScheme;ptr lpszHostName;" & _ "DWORD dwHostNameLength;DWORD nPort;ptr lpszUserName;DWORD dwUserNameLength;ptr lpszPassword;" & _ "DWORD dwPasswordLength;ptr lpszUrlPath;DWORD dwUrlPathLength;ptr lpszExtraInfo;DWORD dwExtraInfoLength" $URL_COMPONENTS = DllStructCreate($tagURL_COMPONENTS) $lpszHostName = DllStructCreate("WCHAR[1024]") $szPath = DllStructCreate("WCHAR[1024]") DllStructSetData($URL_COMPONENTS,"dwStructSize",DllStructGetSize($URL_COMPONENTS)) DllStructSetData($URL_COMPONENTS,"lpszHostName",DllStructGetPtr($lpszHostName)) DllStructSetData($URL_COMPONENTS,"lpszUrlPath",DllStructGetPtr($szPath)) DllStructSetData($URL_COMPONENTS,"dwUrlPathLength",1024) DllStructSetData($URL_COMPONENTS,"dwHostNameLength",1024) $Return = DllCall($Winhttp,"BOOL","WinHttpCrackUrl","wstr",$lpszUrl,"DWORD",$dwUrlLength _ ,"DWORD",$dwFlags,"ptr",DllStructGetPtr($URL_COMPONENTS)) if @error Or Not ($Return[0]) Then Return SetError(1,0,0) Return SetError(0,0,$URL_COMPONENTS) EndFunc Func WinHttpCloseHandle($hInternet) $BOOL = DllCall($Winhttp,"BOOL","WinHttpCloseHandle","HANDLE",$hInternet) if @error Or $BOOL[0] = 0 Then Return SetError(1,0,0) Return SetError(0,0,$BOOL[0]) EndFunc Func HexBinary($Value) Return Hex(Binary($Value)) EndFunc Func GUICtrlSetOnEventEx($Control_ID_HWnd,$NotificationCode,$Function) $handle = DLLCallbackRegister($Function,"none","int;int") if $handle = 0 Then Return False DllCallbackFree($handle) if IsHWnd($Control_ID_HWnd) Then $hWnd = $Control_ID_HWnd $ControlID = DllCall("user32.dll", "int", "GetDlgCtrlID", "hwnd", $hWnd) If @error Then Return False $ControlID = $ControlID[0] if Not ($ControlID) Then Return False Else $ControlID = $Control_ID_HWnd $hWnd = GUICtrlGetHandle($ControlID) if Not IsHWnd($hWnd) Then Return False EndIf $iNotificationCode = $NotificationCode if StringInStr($NotificationCode,"-") Then _ $iNotificationCode = StringReplace($NotificationCode,"-","A") if Not IsDllStruct($NotifyStruct) Then Local $count = 1 $Len = StringLen($Function) $TagNotifyStruct = _ "int count;WPARAM WPARAM;LPARAM LPARAM;int Test;int " & String($hWnd & $iNotificationCode) & _ ";HWND HWND" & String($count) & ";int ControlID" & String($count) & ";int NotificationCode" & _ String($count) & ";char Function" & String($count) & "[" & String($Len) & "]" $NotifyStruct = DllStructCreate($TagNotifyStruct) DllStructSetData($NotifyStruct,"count",$count) DllStructSetData($NotifyStruct,String($hWnd & $iNotificationCode),$count) DllStructSetData($NotifyStruct,"HWND" & String($count),$hWnd) DllStructSetData($NotifyStruct,"ControlID" & String($count),$ControlID) DllStructSetData($NotifyStruct,"NotificationCode" & String($count),$NotificationCode) DllStructSetData($NotifyStruct,"Function" & String($count),$Function) Else $count = DllStructGetData($NotifyStruct,String($hWnd & $iNotificationCode)) if ($count) Then Return False Local $count = DllStructGetData($NotifyStruct,"count") + 1 $Len = StringLen($Function) $TagNotifyStruct &= _ ";int " & String($hWnd & $iNotificationCode) & ";HWND HWND" & String($count) & _ ";int NotificationCode" & String($count) & ";int ControlID" & String($count) & _ ";char Function" & String($count) & "[" & String($Len) & "]" $iLength = DllStructGetSize($NotifyStruct) $iNotifyStruct = DllStructCreate($TagNotifyStruct) DllCall("kernel32.dll","none","RtlMoveMemory","ptr",DllStructGetPtr($iNotifyStruct) _ ,"ptr",DllStructGetPtr($NotifyStruct),"ulong_ptr",$iLength) $NotifyStruct = $iNotifyStruct DllStructSetData($NotifyStruct,"count",$count) DllStructSetData($NotifyStruct,String($hWnd & $iNotificationCode),$count) DllStructSetData($NotifyStruct,"HWND" & String($count),$hWnd) DllStructSetData($NotifyStruct,"ControlID" & String($count),$ControlID) DllStructSetData($NotifyStruct,"NotificationCode" & String($count),$NotificationCode) DllStructSetData($NotifyStruct,"Function" & String($count),$Function) EndIf GUIRegisterMsg($WM_NOTIFY,"OnEventExProc") GUIRegisterMsg($WM_COMMAND,"OnEventExProc") Return True EndFunc Func OnEventExProc($hWnd,$Msg,$wParam,$lParam) Select Case $Msg = $WM_NOTIFY Local $OnEventExtagNMHDR = "hwnd hWndFrom;uint_ptr IDFrom;INT Code" $tNMHDR = DllStructCreate($OnEventExtagNMHDR, $lParam) $MsgHwnd = DllStructGetData($tNMHDR, "hWndFrom") $MsgCode = DllStructGetData($tNMHDR, "Code") Case $Msg = $WM_COMMAND $MsgHwnd = $lParam $MsgCode = BitShift($wParam, 16) EndSelect $iMsgCode = $MsgCode if StringInStr($MsgCode,"-") Then _ $iMsgCode = StringReplace($MsgCode,"-","A") $count = DllStructGetData($NotifyStruct,String($MsgHwnd & $iMsgCode)) if Not ($count) Then Return $GUI_RUNDEFMSG DllStructSetData($NotifyStruct,"WPARAM",$wParam) DllStructSetData($NotifyStruct,"LPARAM",$lParam) $OnEvHWND = DllStructGetData($NotifyStruct,"HWND" & String($count)) $ControlID = DllStructGetData($NotifyStruct,"ControlID" & String($count)) $OnEvNotificationCode = DllStructGetData($NotifyStruct,"NotificationCode" & String($count)) $OnEvFunction = DllStructGetData($NotifyStruct,"Function" & String($count)) DllStructSetData($NotifyStruct,"Test",1) if ($MsgHwnd = $OnEvHWND And $MsgCode = $OnEvNotificationCode) Then _ Call($OnEvFunction,$ControlID,$OnEvNotificationCode) DllStructSetData($NotifyStruct,"Test",0) Return $GUI_RUNDEFMSG EndFunc Func OnEventExGetWParam($ControlID,$NotificationCode) $Test = DllStructGetData($NotifyStruct,"Test") if Not ($Test) Then Return False $hWnd = GUICtrlGetHandle($ControlID) if Not IsHWnd($hWnd) Then Return False $iNotificationCode = $NotificationCode if StringInStr($NotificationCode,"-") Then _ $iNotificationCode = StringReplace($NotificationCode,"-","A") $count = DllStructGetData($NotifyStruct,String($hWnd & $iNotificationCode)) if Not ($count) Then Return False Return DllStructGetData($NotifyStruct,"WPARAM") EndFunc Func OnEventExGetLParam($ControlID,$NotificationCode) $Test = DllStructGetData($NotifyStruct,"Test") if Not ($Test) Then Return False $hWnd = GUICtrlGetHandle($ControlID) if Not IsHWnd($hWnd) Then Return False $iNotificationCode = $NotificationCode if StringInStr($NotificationCode,"-") Then _ $iNotificationCode = StringReplace($NotificationCode,"-","A") $count = DllStructGetData($NotifyStruct,String($hWnd & $iNotificationCode)) if Not ($count) Then Return False Return DllStructGetData($NotifyStruct,"LPARAM") EndFunc Func OnEventExGetHWND($ControlID,$NotificationCode) $Test = DllStructGetData($NotifyStruct,"Test") if Not ($Test) Then Return False $hWnd = GUICtrlGetHandle($ControlID) if Not IsHWnd($hWnd) Then Return False $iNotificationCode = $NotificationCode if StringInStr($NotificationCode,"-") Then _ $iNotificationCode = StringReplace($NotificationCode,"-","A") $count = DllStructGetData($NotifyStruct,String($hWnd & $iNotificationCode)) if Not ($count) Then Return False Return DllStructGetData($NotifyStruct,"HWND" & String($count)) EndFunc Func _WinAPI_CloseHandle($hObject) Local $aResult = DllCall("kernel32.dll", "bool", "CloseHandle", "handle", $hObject) If @error Then Return SetError(@error, @extended, False) Return $aResult[0] EndFunc Func _WinAPI_CreateFile($sFileName, $iCreation, $iAccess = 4, $iShare = 0, $iAttributes = 0, $pSecurity = 0) Local $iDA = 0, $iSM = 0, $iCD = 0, $iFA = 0 If BitAND($iAccess, 1) <> 0 Then $iDA = BitOR($iDA, $GENERIC_EXECUTE) If BitAND($iAccess, 2) <> 0 Then $iDA = BitOR($iDA, $GENERIC_READ) If BitAND($iAccess, 4) <> 0 Then $iDA = BitOR($iDA, $GENERIC_WRITE) If BitAND($iShare, 1) <> 0 Then $iSM = BitOR($iSM, $FILE_SHARE_DELETE) If BitAND($iShare, 2) <> 0 Then $iSM = BitOR($iSM, $FILE_SHARE_READ) If BitAND($iShare, 4) <> 0 Then $iSM = BitOR($iSM, $FILE_SHARE_WRITE) Switch $iCreation Case 0 $iCD = $CREATE_NEW Case 1 $iCD = $CREATE_ALWAYS Case 2 $iCD = $OPEN_EXISTING Case 3 $iCD = $OPEN_ALWAYS Case 4 $iCD = $TRUNCATE_EXISTING EndSwitch If BitAND($iAttributes, 1) <> 0 Then $iFA = BitOR($iFA, $FILE_ATTRIBUTE_ARCHIVE) If BitAND($iAttributes, 2) <> 0 Then $iFA = BitOR($iFA, $FILE_ATTRIBUTE_HIDDEN) If BitAND($iAttributes, 4) <> 0 Then $iFA = BitOR($iFA, $FILE_ATTRIBUTE_READONLY) If BitAND($iAttributes, 8) <> 0 Then $iFA = BitOR($iFA, $FILE_ATTRIBUTE_SYSTEM) Local $aResult = DllCall("kernel32.dll", "handle", "CreateFileW", "wstr", $sFileName, "dword", $iDA, "dword", $iSM, _ "ptr", $pSecurity, "dword", $iCD, "dword", $iFA, "ptr", 0) If @error Or ($aResult[0] = $INVALID_HANDLE_VALUE) Then Return SetError(@error, @extended, 0) Return $aResult[0] EndFunc ;==>_WinAPI_CreateFile Func _WinAPI_ReadFile($hFile, $pBuffer, $iToRead, ByRef $iRead, $pOverlapped = 0) Local $aResult = DllCall("kernel32.dll", "bool", "ReadFile", "handle", $hFile, "ptr", $pBuffer, "dword", $iToRead, _ "dword*", 0, "ptr", $pOverlapped) If @error Then Return SetError(@error, @extended, False) $iRead = $aResult[4] Return $aResult[0] EndFunc Func _WinAPI_WriteFile($hFile, $pBuffer, $iToWrite, ByRef $iWritten, $pOverlapped = 0) Local $aResult = DllCall("kernel32.dll", "bool", "WriteFile", "handle", $hFile, "ptr", $pBuffer, "dword", $iToWrite, _ "dword*", 0, "ptr", $pOverlapped) If @error Then Return SetError(@error, @extended, False) $iWritten = $aResult[4] Return $aResult[0] EndFunc Func _WinAPI_LoadLibrary($sFileName) Local $aResult = DllCall("kernel32.dll", "handle", "LoadLibraryW", "wstr", $sFileName) If @error Then Return SetError(@error, @extended, 0) Return $aResult[0] EndFunc Func _WinAPI_GetProcAddress($hModule, $vName) Local $sType = "str" If IsNumber($vName) Then $sType = "word" ; if ordinal value passed Local $aResult = DllCall("kernel32.dll", "ptr", "GetProcAddress", "handle", $hModule, $sType, $vName) If @error Or Not $aResult[0] Then Return SetError(@error, @extended, 0) Return $aResult[0] EndFunc Func CreateButtonHover($Text,$L,$T,$W,$H,$NORMAL_hBMP,$PRESS_hBMP,$OVER_hBMP,$TEXTCOLOOR = 0,$Font = True) Local $tagButtonHover = "HWND HWNDA;HWND HWNDB;INT TPRESS;INT THOVER;PTR NORMAL;PTR OVER;PTR PRESS;INT MSGLOG" Local $STM_SETIMAGE_HOVER = 0x0172 , $SS_BITMAP_HOVER = 0x0000000E _ , $SS_REALSIZECONTROL_HOVER = 0x00000040 , $STN_CLICKED = 0 Local $SS_CENTERIMAGE = 0x0200 , $SS_CENTER = 0x01 $controlID1 = GUICtrlCreateLabel("",$L,$T,$W,$H,BitOR($SS_REALSIZECONTROL_HOVER,$SS_BITMAP_HOVER)) if @error Then Return SetError(1,0,0) GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT) $hWndA = GUICtrlGetHandle($controlID1) $controlID2 = GUICtrlCreateLabel($Text,$L,$T,$W,$H,BitOR($SS_CENTERIMAGE,$SS_CENTER)) if @error Then GUICtrlDelete($controlID1) Return SetError(2,0,0) EndIf $hWndB = GUICtrlGetHandle($controlID2) $MSGLOG = _WinAPI_MakeLong($controlID2,$STN_CLICKED) GUICtrlSetBkColor ( -1 , $GUI_BKCOLOR_TRANSPARENT) if ($TEXTCOLOOR) Then GUICtrlSetColor(-1,$TEXTCOLOOR) if Not(DllStructGetData($StructBHover,"COUNT")) Then $StructButtonHover = DllStructCreate($tagButtonHover) DllStructSetData($StructButtonHover,"NORMAL",$NORMAL_hBMP) DllStructSetData($StructButtonHover , "OVER" , $OVER_hBMP) DllStructSetData($StructButtonHover ,"PRESS", $PRESS_hBMP) DllStructSetData($StructButtonHover , "HWNDA" , $hWndA) DllStructSetData($StructButtonHover , "HWNDB" , $hWndB) DllStructSetData($StructButtonHover , "MSGLOG" , $MSGLOG) $ButtonHoverPtr = DllStructGetPtr( $StructButtonHover ) DllStructSetData($StructBHover,"BHOVER",$ButtonHoverPtr) DllStructSetData($StructBHover,"COUNT",1) Else ControlThread(1,True,True) $COUNT = DllStructGetData($StructBHover,"COUNT") $NewtagButtonHover = "BYTE [" & ($COUNT * $StructBHSize) & "];" & $tagButtonHover $NewStructButtonHover = DllStructCreate($NewtagButtonHover) $NewStructButtonHoverPtr = DllStructGetPtr( $NewStructButtonHover ) DllCall("kernel32.dll","none","RtlMoveMemory","ptr", $NewStructButtonHoverPtr, _ "ptr",DllStructGetPtr($StructButtonHover),"ulong_ptr",($COUNT * $StructBHSize)) DllStructSetData($NewStructButtonHover,"NORMAL",$NORMAL_hBMP) DllStructSetData($NewStructButtonHover , "OVER" , $OVER_hBMP) DllStructSetData($NewStructButtonHover ,"PRESS", $PRESS_hBMP) DllStructSetData($NewStructButtonHover , "HWNDA" , $hWndA) DllStructSetData($NewStructButtonHover , "HWNDB" , $hWndB) DllStructSetData($NewStructButtonHover , "MSGLOG" , $MSGLOG) DllStructSetData($StructBHover,"BHOVER",$NewStructButtonHoverPtr) DllStructSetData($StructBHover,"COUNT",$COUNT + 1) $StructButtonHover = $NewStructButtonHover $NewStructButtonHover = 0 ControlThread(1,False) EndIf _SendMessage($hWndA,$STM_SETIMAGE_HOVER,0,$NORMAL_hBMP) if Not($ThreadPtr) Then $ThreadPtr = DllStructGetPtr($ThreadAdd) CreateThread($ThreadPtr,0) EndIf Return SetError (0,$controlID1,$controlID2) EndFunc Func DeleteButtonHover($controlID) Local $tagButtonHover = "HWND HWNDA;HWND HWNDB;INT TPRESS;INT THOVER;PTR NORMAL;PTR OVER;PTR PRESS;INT MSGLOG" Local $ZStructButtonHoverPtr = DllStructGetPtr($StructButtonHover) , $FindTest = False, $YStructButtonHover,$YhWndB Local $XhWndB = GUICtrlGetHandle($controlID) if @error Then Return SetError(1,0,False) Local $COUNT = DllStructGetData($StructBHover,"COUNT") if @error Then Return SetError(2,0,False) if $COUNT = 1 Then $YStructButtonHover = DllStructCreate($tagButtonHover,$ZStructButtonHoverPtr) $YhWndB = DllStructGetData($YStructButtonHover,"HWNDB") if $YhWndB = $XhWndB Then ControlThread(1,True,True) DllStructSetData($StructBHover,"BHOVER",0) DllStructSetData($StructBHover,"COUNT",0) $StructButtonHover = 0 GUICtrlDelete($controlID - 1) GUICtrlDelete($controlID) ControlThread(1,False) Return SetError(0,0,True) EndIf Return SetError(3,0,False) EndIf For $Offset = 0 To ($COUNT - 1) $YStructButtonHover = DllStructCreate($tagButtonHover,$ZStructButtonHoverPtr + ($Offset * $StructBHSize)) $YhWndB = DllStructGetData($YStructButtonHover,"HWNDB") if $YhWndB = $XhWndB Then $FindTest = True ExitLoop EndIf Next if $FindTest = False Then Return SetError(4,0,False) ControlThread(1,True,True) Local $XStructButtonHover = DllStructCreate("BYTE [" & (($COUNT - 1) * $StructBHSize) & "]") Local $XStructButtonHoverPtr = DllStructGetPtr($XStructButtonHover) DllCall("kernel32.dll","none","RtlMoveMemory","ptr",$XStructButtonHoverPtr, _ "ptr" ,$ZStructButtonHoverPtr,"ulong_ptr" , ($Offset * $StructBHSize)) DllCall("kernel32.dll","none","RtlMoveMemory","ptr",$XStructButtonHoverPtr + ($Offset * $StructBHSize),"ptr", _ $ZStructButtonHoverPtr + (($Offset + 1) * $StructBHSize) ,"ulong_ptr",((($COUNT - ($Offset + 1))) * $StructBHSize)) DllStructSetData($StructBHover,"BHOVER",$XStructButtonHoverPtr) DllStructSetData($StructBHover,"COUNT",$COUNT - 1) $StructButtonHover = $XStructButtonHover GUICtrlDelete($controlID - 1) GUICtrlDelete($controlID) ControlThread(1,False) Return SetError(0,0,True) EndFunc Func _WinAPI_MakeLong($iLo, $iHi) Return BitOR(BitShift($iHi, -16), BitAND($iLo, 0xFFFF)) EndFunc Func LoadThread() Local $IntSize = 4 ,$JZEnd , $JZTA ,$CThread Local $OffSelpParameter = $PointerSize,$LOOPA,$End,$TA,$OffSetHwndA = 0,$TB,$JMPEND Local $JZEnd , $JMPTB , $LOOPB , $AsmVarPtr = DllStructGetPtr($AsmVar) , $JZCThread For $i = 1 To 2 $_ASMCode = "0x" $LOOPA = BinaryLen($_ASMCode) $_ASMCode &= "B8" & HexBinary(3) ;mov eax,3 // 3 Milliseconds $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary($Sleep) ;mov eax,$Sleep $_ASMCode &= "FFD0" ;call eax $_ASMCode &= "BF" & HexBinary($AsmVarPtr) ;mov edi,$AsmVarPtr $_ASMCode &= "BB" & HexBinary($StructBHoverPtr) ;mov ebx,$StructBHoverPtr $_ASMCode &= "8B13" ;mov edx,[ebx] $_ASMCode &= "8917" ;mov [edi],edx $_ASMCode &= "8B5B" & Hex($IntSize,2) ;mov ebx,[ebx + $IntSize] $_ASMCode &= "895F" & Hex($IntSize,2) ;mov [edi + $IntSize],ebx $_ASMCode &= "B8" & HexBinary($PositionsStPtr) ;mov eax,$PositionsStPtr $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary($G_CP) ;mov eax,GetCursorPos $_ASMCode &= "FFD0" ;call eax $_ASMCode &= "B8" & HexBinary($PositionsStPtr) ;mov eax,$PositionsStPtr $_ASMCode &= "FF70" & Hex($IntSize,2) ;push [eax + $IntSize] $_ASMCode &= "FF30" ;push [eax] $_ASMCode &= "B8" & HexBinary($_WnFPos) ;mov eax,WindowFromPoint $_ASMCode &= "FFD0" ;call eax $_ASMCode &= "8947" & Hex(($IntSize + $PointerSize),2) ;mov [edi + ($IntSize + $PointerSize)],eax $LOOPB = BinaryLen($_ASMCode) $_ASMCode &= "B8" & HexBinary($AsmVarPtr) ;mov eax,$AsmVarPtr $_ASMCode &= "8038" & Hex(0,2) ;CMP [eax],0 $_ASMCode &= "74" & Hex(($End - $JZEnd),2) ;JZ $End; $JZEnd = BinaryLen($_ASMCode) $_ASMCode &= "B8" & HexBinary($AsmVarPtr) ;mov eax,$AsmVarPtr $_ASMCode &= "8B58" & Hex($IntSize,2) ;mov ebx,[eax + $IntSize] $_ASMCode &= "8B3B" ;mov edi,[ebx] ; // Get HWNDA $_ASMCode &= "8B40" & Hex(($IntSize + $PointerSize),2) ;mov eax,[eax + ($IntSize + $PointerSize)] // Get CurrentHwnd $_ASMCode &= "3BF8" ;CMP edi,eax $_ASMCode &= "74" & Hex(($TA - $JZTA),2) ;JZ $JZTA; $JZTA = BinaryLen($_ASMCode) $_ASMCode &= "B8" & HexBinary($AsmVarPtr) ;mov eax,$AsmVarPtr $_ASMCode &= "8B58" & Hex($IntSize,2) ;mov ebx,[eax + $IntSize] $_ASMCode &= "53" ;push ebx $_ASMCode &= "B8" & HexBinary($MNHoverPtr) ;mov eax,$MNHoverPtr $_ASMCode &= "FFD0" ;call eax $_ASMCode &= "EB" & Hex(($TB - $JMPTB),2) ;JMP $TB $JMPTB = BinaryLen($_ASMCode) $TA = BinaryLen($_ASMCode) $_ASMCode &= "B8" & HexBinary($AsmVarPtr) ;mov eax,$AsmVarPtr $_ASMCode &= "8B58" & Hex($IntSize,2) ;mov ebx,[eax + $IntSize] $_ASMCode &= "53" ;push ebx $_ASMCode &= "B8" & HexBinary($MHoverPtr) ;mov eax,$MHoverPtr $_ASMCode &= "FFD0" ;call eax $TB = BinaryLen($_ASMCode) $_ASMCode &= "B8" & HexBinary($AsmVarPtr) ;mov eax,$AsmVarPtr $_ASMCode &= "8028" & Hex(1,2) ;sub [eax],1 $_ASMCode &= "8B58" & Hex($IntSize,2) ;mov ebx,[eax + $IntSize] $_ASMCode &= "83C3" & Hex($StructBHSize,2) ;add ebx,$StructBHSize $_ASMCode &= "8958" & Hex($IntSize,2) ;mov [eax + $IntSize],ebx $JMPLOOPB = BinaryLen($_ASMCode) $_ASMCode &= "E9" & HexBinary(-(($JMPLOOPB - $LOOPB) + 5)) ;JMP $LOOPB $End = BinaryLen($_ASMCode) $_ASMCode &= "B8" & HexBinary(DllStructGetPtr($ControlThread)) ;mov eax,$ControlThread $_ASMCode &= "8038" & Hex(1,2) ;CMP [eax],1 $_ASMCode &= "74" & Hex(($CThread - $JZCThread),2) ;JZ $CThread $JZCThread = BinaryLen($_ASMCode) $JMPLOOPA = BinaryLen($_ASMCode) $_ASMCode &= "E9" & HexBinary(-(($JMPLOOPA - $LOOPA) + 5)) ;JMP LOOPA $CThread = BinaryLen($_ASMCode) $_ASMCode &= "C640" & Hex($IntSize,2) & Hex(1,2) ;mov [eax + $IntSize],1 $_ASMCode &= "B8" & HexBinary(3) ;mov eax,3 // 3 Milliseconds $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary($Sleep) ;mov eax,$Sleep $_ASMCode &= "FFD0" ;call eax $JMPEND = BinaryLen($_ASMCode) $_ASMCode &= "E9" & HexBinary(-(($JMPEND - $End) + 5)) ;JMP End $_ASMCode &= "C2" & Hex($PointerSize,2) & Hex(0,2) ;ret ($PointerSize) & "00" // Args Size Next $Address = DllStructCreate("byte[" & BinaryLen($_ASMCode) & "]") DllStructSetData($Address,1,$_ASMCode) Return $Address EndFunc Func LMHover() ;Mouse Hover Local $OffSetTpress = 8 , $TA , $JZTA , $TB , $JMPTB , $OffSetStructBHoverPtr = $PointerSize For $i = 1 To 2 $_ASMCode = "0x" $_ASMCode &= "B8" & HexBinary(0x01) ;mov eax,$VK_LBUTTON $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary($GKYState) ;mov eax,GetKeyState $_ASMCode &= "FFD0" ;call eax $_ASMCode &= "25" & HexBinary(0x8000) ; and eax,0x8000 // bitwise AND // eax = BitAND(eax,0x8000) $_ASMCode &= "83F8" & Hex(0,2) ;CMP eax,0 $_ASMCode &= "74" & Hex(($TA - $JZTA),2) ;JZ $JZTA; $JZTA = BinaryLen($_ASMCode) $_ASMCode &= "FF7424" & Hex($OffSetStructBHoverPtr,2) ;push [esp + $OffSetStructBHoverPtr] $_ASMCode &= "B8" & HexBinary($IsPssPtr) ;mov eax,$IsPssPtr $_ASMCode &= "FFD0" ;call eax $_ASMCode &= "EB" & Hex(($TB - $JMPTB),2) ;JMP $JMPTD $JMPTB = BinaryLen($_ASMCode) $TA = BinaryLen($_ASMCode) $_ASMCode &= "FF7424" & Hex($OffSetStructBHoverPtr,2) ;push [esp + $OffSetStructBHoverPtr] $_ASMCode &= "B8" & HexBinary($IsNPssPtr) ;mov eax,$IsNPssPtr $_ASMCode &= "FFD0" ;call eax $TB = BinaryLen($_ASMCode) ;------------------------------// Return 0 //----------------------------------------------------------- $_ASMCode &= "B8" & HexBinary(0) ;mov eax,0 $_ASMCode &= "C2" & Hex($PointerSize,2) & Hex(0,2) ;ret ($PointerSize) & "00" // Args Size ;------------------------------// Return 0 //-------------------------------------------------------- Next $Address = DllStructCreate("byte[" & BinaryLen($_ASMCode) & "]") DllStructSetData($Address,1,$_ASMCode) Return $Address EndFunc Func LIsPress() Local $OffSetTpress = 8 , $OffSetStructBHoverPtr = $PointerSize , $OffSetPBmp = 24 Local $STM_SETIMAGE_HOVER=0x0172,$OffSetThover=12,$OffSetHwndA = 0,$OffSetHBmp = 20 Local $TA , $JZTA , $TB , $JZTB , $JMPTC1 , $TC , $JMPTC2 , $TC , $OffSetHwndB = 4 For $i = 1 To 2 $_ASMCode = "0x" $_ASMCode &= "8B5C24" & Hex($OffSetStructBHoverPtr,2) ;mov ebx,[esp + $OffSetStructBHoverPtr] $_ASMCode &= "8B43" & Hex($OffSetTpress,2) ;mov eax,[ebx + $OffSetTpress] $_ASMCode &= "83F8" & Hex(0,2) ;CMP eax,0 $_ASMCode &= "74" & Hex(($TA - $JZTA),2) ;JZ $JZTA; $JZTA = BinaryLen($_ASMCode) $_ASMCode &= "8B43" & Hex($OffSetThover,2) ;mov eax,[ebx + $OffSetThover] $_ASMCode &= "83F8" & Hex(0,2) ;CMP eax,0 $_ASMCode &= "74" & Hex(($TB - $JZTB),2) ;JZ $JZTB; $JZTB = BinaryLen($_ASMCode) $_ASMCode &= "EB" & Hex(($TC - $JMPTC1),2) ;JMP $JMPTC1 $JMPTC1 = BinaryLen($_ASMCode) $TB = BinaryLen($_ASMCode) $_ASMCode &= "8B43" & Hex($OffSetHBmp,2) ;mov eax,[ebx + $OffSetHBmp] $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary(0) ;mov eax,0 $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary($STM_SETIMAGE_HOVER) ;mov eax,$STM_SETIMAGE_HOVER $_ASMCode &= "50" ;push eax $_ASMCode &= "8B43" & Hex($OffSetHwndA,2) ;mov eax,[ebx + $OffSetHwndA] $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary($SdMsg) ;mov eax,SendMessageW $_ASMCode &= "FFD0" ;call eax $_ASMCode &= "B8" & HexBinary(BitOR($RDW_INVALIDATE,$RDW_UPDATENOW)) ;mov eax,BitOR($RDW_INVALIDATE,$RDW_UPDATENOW) $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary(0) ;mov eax,0 $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary(0) ;mov eax,0 $_ASMCode &= "50" ;push eax $_ASMCode &= "8B43" & Hex($OffSetHwndB,2) ;mov eax,[ebx + $OffSetHwndB] $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary($RiWin) ;mov eax,RedrawWindow $_ASMCode &= "FFD0" ;call eax $_ASMCode &= "C643" & Hex($OffSetThover,2) & Hex(1,2) ;mov [ebx + $OffSetThover],1 $_ASMCode &= "EB" & Hex(($TC - $JMPTC2),2) ;JMP $JMPTC2 $JMPTC2 = BinaryLen($_ASMCode) $TA = BinaryLen($_ASMCode) $_ASMCode &= "8B43" & Hex($OffSetPBmp,2) ;mov eax,[ebx + $OffSetPBmp] $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary(0) ;mov eax,0 $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary($STM_SETIMAGE_HOVER) ;mov eax,$STM_SETIMAGE_HOVER $_ASMCode &= "50" ;push eax $_ASMCode &= "8B43" & Hex($OffSetHwndA,2) ;mov eax,[ebx + $OffSetHwndA] $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary($SdMsg) ;mov eax,SendMessageW $_ASMCode &= "FFD0" ;call eax $_ASMCode &= "B8" & HexBinary(BitOR($RDW_INVALIDATE,$RDW_UPDATENOW)) ;mov eax,BitOR($RDW_INVALIDATE,$RDW_UPDATENOW) $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary(0) ;mov eax,0 $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary(0) ;mov eax,0 $_ASMCode &= "50" ;push eax $_ASMCode &= "8B43" & Hex($OffSetHwndB,2) ;mov eax,[ebx + $OffSetHwndB] $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary($RiWin) ;mov eax,RedrawWindow $_ASMCode &= "FFD0" ;call eax $_ASMCode &= "C643" & Hex($OffSetTpress,2) & Hex(1,2) ;mov [ebx + $OffSetTpress],1 $TC = BinaryLen($_ASMCode) ;------------------------------// Return 0 //----------------------------------------------------------- $_ASMCode &= "B8" & HexBinary(0) ;mov eax,0 $_ASMCode &= "C2" & Hex($PointerSize,2) & Hex(0,2) ;ret ($PointerSize) & "00" // Args Size ;------------------------------// Return 0 //----------------------------------------------------------- Next $Address = DllStructCreate("byte[" & BinaryLen($_ASMCode) & "]") DllStructSetData($Address,1,$_ASMCode) Return $Address EndFunc Func LIsNotPress() Local $OffSetPBmp = 24 , $OffSetTpress = 8 , $OffSetStructBHoverPtr = $PointerSize Local $STM_SETIMAGE_HOVER = 0x0172 , $OffSetThover = 12 , $SSenMsg , $IntSize = 4,$TC,$TD,$JZTD,$JZStopSendMsg Local $OffSetHwndB = 4 , $OffSetHBmp = 20 , $OffsetMsgLog = 28 , $OffSetHwndA = 0 , $TA,$JZTA,$JMPTB,$TB,$JZTC For $i = 1 To 2 $_ASMCode = "0x" $_ASMCode &= "8B5C24" & Hex($OffSetStructBHoverPtr,2) ;mov ebx,[esp + $OffSetStructBHoverPtr] $_ASMCode &= "8B43" & Hex($OffSetTpress,2) ;mov eax,[ebx + $OffSetTpress] $_ASMCode &= "83F8" & Hex(1,2) ;CMP eax,1 $_ASMCode &= "74" & Hex(($TA - $JZTA),2) ;JZ $JZTA; $JZTA = BinaryLen($_ASMCode) $_ASMCode &= "EB" & Hex(($TB - $JMPTB),2) ;JMP $JMPTB $JMPTB = BinaryLen($_ASMCode) $TA = BinaryLen($_ASMCode) $_ASMCode &= "B8" & HexBinary(DllStructGetPtr($ControlThread)) ;mov eax,$ControlThread $_ASMCode &= "8078" & Hex(($IntSize * 2),2) & Hex(1,2) ;CMP [eax + ($IntSize * 2)],1 $_ASMCode &= "74" & Hex(($SSenMsg - $JZStopSendMsg),2) ;JZ $StopSendMsg $JZStopSendMsg = BinaryLen($_ASMCode) $_ASMCode &= "8B43" & Hex($OffSetHwndB,2) ;mov eax,[ebx + $OffSetHwndB] $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary($_GtPt) ;mov eax,GetParent $_ASMCode &= "FFD0" ;call eax $_ASMCode &= "8BF8" ;mov edi,eax $_ASMCode &= "8B43" & Hex($OffSetHwndB,2) ;mov eax,[ebx + $OffSetHwndB] $_ASMCode &= "50" ;push eax $_ASMCode &= "8B43" & Hex($OffsetMsgLog,2) ;mov eax,[ebx + $OffsetMsgLog] $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary($WM_COMMAND) ;mov eax,$WM_COMMAND $_ASMCode &= "50" ;push eax $_ASMCode &= "57" ;push edi $_ASMCode &= "B8" & HexBinary($SdMsg) ;mov eax,SendMessageW $_ASMCode &= "FFD0" ;call eax $SSenMsg = BinaryLen($_ASMCode) ; StopSendMsg $_ASMCode &= "C643" & Hex($OffSetThover,2) & Hex(0,2) ;mov [ebx + $OffSetThover],0 $_ASMCode &= "C643" & Hex($OffSetTpress,2) & Hex(0,2) ;mov [ebx + $OffSetTpress],0 $TB = BinaryLen($_ASMCode) $_ASMCode &= "8B43" & Hex($OffSetThover,2) ;mov eax,[ebx + $OffSetThover] $_ASMCode &= "83F8" & Hex(1,2) ;CMP eax,1 $_ASMCode &= "74" & Hex(($TC - $JZTC),2) ;JZ $JZTC; $JZTC = BinaryLen($_ASMCode) $_ASMCode &= "C643" & Hex($OffSetThover,2) & Hex(1,2) ;mov [ebx + $OffSetThover],1 $_ASMCode &= "8B43" & Hex($OffSetHBmp,2) ;mov eax,[ebx + $OffSetHBmp] $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary(0) ;mov eax,0 $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary($STM_SETIMAGE_HOVER) ;mov eax,$STM_SETIMAGE_HOVER $_ASMCode &= "50" ;push eax $_ASMCode &= "8B43" & Hex($OffSetHwndA,2) ;mov eax,[ebx + $OffSetHwndA] $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary($SdMsg) ;mov eax,SendMessageW $_ASMCode &= "FFD0" ;call eax $_ASMCode &= "B8" & HexBinary(BitOR($RDW_INVALIDATE,$RDW_UPDATENOW)) ;mov eax,BitOR($RDW_INVALIDATE,$RDW_UPDATENOW) $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary(0) ;mov eax,0 $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary(0) ;mov eax,0 $_ASMCode &= "50" ;push eax $_ASMCode &= "8B43" & Hex($OffSetHwndB,2) ;mov eax,[ebx + $OffSetHwndB] $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary($RiWin) ;mov eax,RedrawWindow $_ASMCode &= "FFD0" ;call eax $TC = BinaryLen($_ASMCode) $_ASMCode &= "8B43" & Hex($OffSetTpress,2) ;mov eax,[ebx + $OffSetTpress] $_ASMCode &= "83F8" & Hex(3,2) ;CMP eax,3 $_ASMCode &= "74" & Hex(($TD - $JZTD),2) ;JZ $JZTD; $JZTD = BinaryLen($_ASMCode) ;------------------------------// Return 0 //----------------------------------------------------------- $_ASMCode &= "B8" & HexBinary(0) ;mov eax,0 $_ASMCode &= "C2" & Hex($PointerSize,2) & Hex(0,2) ;ret ($PointerSize) & "00" // Args Size ;------------------------------// Return 0 //----------------------------------------------------------- $TD = BinaryLen($_ASMCode) $_ASMCode &= "C643" & Hex($OffSetTpress,2) & Hex(0,2) ;mov [ebx + $OffSetTpress],0 ;------------------------------// Return 0 //----------------------------------------------------------- $_ASMCode &= "B8" & HexBinary(0) ;mov eax,0 $_ASMCode &= "C2" & Hex($PointerSize,2) & Hex(0,2) ;ret ($PointerSize) & "00" // Args Size ;------------------------------// Return 0 //----------------------------------------------------------- Next $Address = DllStructCreate("byte[" & BinaryLen($_ASMCode) & "]") DllStructSetData($Address,1,$_ASMCode) Return $Address EndFunc Func LMNHover() ;Mouse Not Hover Local $OffSetNBmp = 16 , $OffSetThover = 12 , $OffSetHwndA = 0 , $OffSetTpress = 8 , $STM_SETIMAGE_HOVER = 0x0172 Local $OffSetStructBHoverPtr = $PointerSize,$TA , $JZTA , $TB , $JZTB , $TC , $JMPTC,$OffSetHwndB = 4 For $i = 1 To 2 $_ASMCode = "0x" $_ASMCode &= "8B5C24" & Hex($OffSetStructBHoverPtr,2) ;mov ebx,[esp + $OffSetStructBHoverPtr] $_ASMCode &= "8B43" & Hex($OffSetThover,2) ;mov eax,[ebx + $OffSetThover] $_ASMCode &= "83F8" & Hex(0,2) ;CMP eax,0 $_ASMCode &= "74" & Hex(($TA - $JZTA),2) ;JZ $JZTA; $JZTA = BinaryLen($_ASMCode) $_ASMCode &= "8B43" & Hex($OffSetNBmp,2) ;mov eax,[ebx + $OffSetNBmp] $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary(0) ;mov eax,0 $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary($STM_SETIMAGE_HOVER) ;mov eax,$STM_SETIMAGE_HOVER $_ASMCode &= "50" ;push eax $_ASMCode &= "8B43" & Hex($OffSetHwndA,2) ;mov eax,[ebx + $OffSetHwndA] $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary($SdMsg) ;mov eax,SendMessageW $_ASMCode &= "FFD0" ;call eax $_ASMCode &= "B8" & HexBinary(BitOR($RDW_INVALIDATE,$RDW_UPDATENOW)) ;mov eax,BitOR($RDW_INVALIDATE,$RDW_UPDATENOW) $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary(0) ;mov eax,0 $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary(0) ;mov eax,0 $_ASMCode &= "50" ;push eax $_ASMCode &= "8B43" & Hex($OffSetHwndB,2) ;mov eax,[ebx + $OffSetHwndB] $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary($RiWin) ;mov eax,RedrawWindow $_ASMCode &= "FFD0" ;call eax $_ASMCode &= "C643" & Hex($OffSetThover,2) & Hex(0,2) ;mov [ebx + $OffSetThover],0 $TA = BinaryLen($_ASMCode) $_ASMCode &= "B8" & HexBinary(0x01) ;mov eax,$VK_LBUTTON $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary($GKYState) ;mov eax,GetKeyState $_ASMCode &= "FFD0" ;call eax $_ASMCode &= "25" & HexBinary(0x8000) ; and eax,0x8000 // bitwise AND // eax = BitAND(eax,0x8000) $_ASMCode &= "83F8" & Hex(0,2) ;CMP eax,0 $_ASMCode &= "74" & Hex(($TB - $JZTB),2) ;JZ $JZTB; $JZTB = BinaryLen($_ASMCode) $_ASMCode &= "C643" & Hex($OffSetTpress,2) & Hex(3,2) ;mov [ebx + $OffSetTpress],3 ;------------------------------// Return 0 //----------------------------------------------------------- $_ASMCode &= "B8" & HexBinary(0) ;mov eax,0 $_ASMCode &= "C2" & Hex($PointerSize,2) & Hex(0,2) ;ret ($PointerSize) & "00" // Args Size ;------------------------------// Return 0 //----------------------------------------------------------- $TB = BinaryLen($_ASMCode) $_ASMCode &= "C643" & Hex($OffSetTpress,2) & Hex(0,2) ;mov [ebx + $OffSetTpress],0 ;------------------------------// Return 0 //----------------------------------------------------------- $_ASMCode &= "B8" & HexBinary(0) ;mov eax,0 $_ASMCode &= "C2" & Hex($PointerSize,2) & Hex(0,2) ;ret ($PointerSize) & "00" // Args Size ;------------------------------// Return 0 //----------------------------------------------------------- Next $Address = DllStructCreate("byte[" & BinaryLen($_ASMCode) & "]") DllStructSetData($Address,1,$_ASMCode) Return $Address EndFunc Func ControlThread($Flag = 1,$BOOL = True , $Wait = False) ; $Flag = 1 Continue Thread Loop // $BOOL = True Or $BOOL = False ; $Flag = 2 Stop Msg Send // // $BOOL = True Or $BOOL = False ; $Wait True Or False Wait Start Continue Of Thread Loop Switch $Flag Case 1 DllStructSetData($ControlThread, "TA" , 0 ) DllStructSetData($ControlThread, "TB" , 0 ) if ($BOOL) Then DllStructSetData($ControlThread, "TA" , 1 ) if ($Wait) Then While DllStructGetData($ControlThread,"TB") == 0 WEnd Return True Else Return True EndIf Else DllStructSetData($ControlThread, "TA" , 0 ) DllStructSetData($ControlThread, "TB" , 0 ) Return True EndIf Case 2 if ($BOOL) Then DllStructSetData($ControlThread, "TC" , 1 ) Else DllStructSetData($ControlThread, "TC" , 0 ) EndIf Return True Case Else Return False EndSwitch EndFunc Func LoadBitmap_FromFile($sFileName) Return _WinAPI_LoadImage(_WinAPI_GetModuleHandle(0),$sFileName,0 ,0,0,0x0010) EndFunc Func LoadBitmap_FromResources($resource_Name) Return _WinAPI_LoadBitmap(_WinAPI_GetModuleHandle(0), $resource_Name) EndFunc Func _WinAPI_LoadBitmap($hInstance, $sBitmap) Local $sBitmapType = "int" If IsString($sBitmap) Then $sBitmapType = "wstr" Local $aResult = DllCall("user32.dll", "handle", "LoadBitmapW", "handle", $hInstance, $sBitmapType, $sBitmap) If @error Then Return SetError(@error, @extended, 0) Return $aResult[0] EndFunc Func _WinAPI_GetModuleHandle($sModuleName) Local $sModuleNameType = "wstr" If $sModuleName = "" Then $sModuleName = 0 $sModuleNameType = "ptr" EndIf Local $aResult = DllCall("kernel32.dll", "handle", "GetModuleHandleW", $sModuleNameType, $sModuleName) If @error Then Return SetError(@error, @extended, 0) Return $aResult[0] EndFunc Func _WinAPI_LoadImage($hInstance, $sImage, $iType, $iXDesired, $iYDesired, $iLoad) Local $aResult, $sImageType = "int" If IsString($sImage) Then $sImageType = "wstr" $aResult = DllCall("user32.dll", "handle", "LoadImageW", "handle", $hInstance, $sImageType, $sImage, "uint", $iType, _ "int", $iXDesired, "int", $iYDesired, "uint", $iLoad) If @error Then Return SetError(@error, @extended, 0) Return $aResult[0] EndFunc ;==>_WinAPI_LoadImage Func _WinAPI_RedrawWindow($hWnd, $tRect = 0, $hRegion = 0, $iFlags = 5) Local $aResult = DllCall("user32.dll", "bool", "RedrawWindow", "hwnd", $hWnd, "struct*", $tRect, "handle", $hRegion, _ "uint", $iFlags) If @error Then Return SetError(@error, @extended, False) Return $aResult[0] EndFunc Func _WinAPI_CreateCompatibleDC($hDC) Local $aResult = DllCall("gdi32.dll", "handle", "CreateCompatibleDC", "handle", $hDC) If @error Then Return SetError(@error, @extended, 0) Return $aResult[0] EndFunc Func _WinAPI_DeleteDC($hDC) Local $aResult = DllCall("gdi32.dll", "bool", "DeleteDC", "handle", $hDC) If @error Then Return SetError(@error, @extended, False) Return $aResult[0] EndFunc Func _WinAPI_SelectObject($hDC, $hGDIObj) Local $aResult = DllCall("gdi32.dll", "handle", "SelectObject", "handle", $hDC, "handle", $hGDIObj) If @error Then Return SetError(@error, @extended, False) Return $aResult[0] EndFunc Func _SendMessage($hWnd, $iMsg, $wParam = 0, $lParam = 0, $iReturn = 0, $wParamType = "wparam", $lParamType = "lparam", $sReturnType = "lresult") Local $aResult = DllCall("user32.dll", $sReturnType, "SendMessageW", "hwnd", $hWnd, "uint", $iMsg, $wParamType, $wParam, $lParamType, $lParam) If @error Then Return SetError(@error, @extended, "") If $iReturn >= 0 And $iReturn <= 4 Then Return $aResult[$iReturn] Return $aResult EndFunc ;==> Func WindowFromDC($hDC) $HWND = DllCall("User32.dll","ptr","WindowFromDC","ptr",$hdc) if @error Or $HWND[0] = 0 Then Return SetError(1,0,0) Return SetError(0,0,$HWND[0]) EndFunc
    1 point
  4. Actually, the problem this time was the exact opposite. You added a "$" where one should not have been. $string = "$Test" & $identifier & "_Time" Should have been $string = "Test" & $identifier & "_Time"
    1 point
  5. @TheXman, I think he’s giving you a compliment
    1 point
  6. Oh it's you again! Now that's not fair, I included the "$" this time! Now what am I ACTUALLY missing?
    1 point
  7. Just in case you wanted to see the test script that I created and it's output, I have posted it below. The API URL is a site used for testing HTTP JSON API requests (GET, POST, PUT, PATCH, & DELETE) and their JSON responses. #AutoIt3Wrapper_UseX64 = N ;Required because Ward's UDF uses the 32-bit DLL. #include <Constants.au3> #include <curl.au3> curl_post_example() Func curl_post_example() Local $hCurl = Null, _ $hReqHeaders = Null, _ $hRespBody = 1, _ $hRespHeaders = 2 Local $iRetCode = 0, _ $iRespCode = 0 Local $tByteBuffer = "" ;Create binary buffer and store http post data in it $tByteBuffer = DllStructCreate("byte buffer[1000];") If @error Then Exit MsgBox($MB_ICONERROR + $MB_TOPMOST, "ERROR", "Failed to create string buffer - @error = " & @error) $tByteBuffer.buffer = '{"fld1": "This is a test string", "fld2": true}' ;Initialize EasyCurl POST request and set options $hCurl = Curl_Easy_Init() $hReqHeaders = Curl_Slist_Append($hReqHeaders, "Content-Type: application/json") Curl_Easy_Setopt($hCurl, $CURLOPT_URL, "https://jsonplaceholder.typicode.com/posts") Curl_Easy_Setopt($hCurl, $CURLOPT_HTTPHEADER, $hReqHeaders) Curl_Easy_Setopt($hCurl, $CURLOPT_SSL_VERIFYPEER, 0) Curl_Easy_Setopt($hCurl, $CURLOPT_FOLLOWLOCATION, 1) Curl_Easy_Setopt($hCurl, $CURLOPT_WRITEFUNCTION, Curl_DataWriteCallback()) Curl_Easy_Setopt($hCurl, $CURLOPT_WRITEDATA, $hRespBody) Curl_Easy_Setopt($hCurl, $CURLOPT_HEADERFUNCTION, Curl_DataWriteCallback()) Curl_Easy_Setopt($hCurl, $CURLOPT_HEADERDATA, $hRespHeaders) Curl_Easy_Setopt($hCurl, $CURLOPT_POSTFIELDS, DllStructGetPtr($tByteBuffer)) ;Submit request $iRetCode = Curl_Easy_Perform($hCurl) If $iRetCode <> $CurlE_OK Then Exit MsgBox($MB_ICONERROR + $MB_TOPMOST, "ERROR", "Request failed." & @CRLF & $iRetCode & " " & Curl_Easy_StrError($iRetCode)) ;Display response info ConsoleWrite("Curl RetCode: " & $iRespCode & " " & Curl_Easy_StrError($iRetCode) & @CRLF) ConsoleWrite("HTTP Resp Code: " & Curl_Easy_GetInfo($hCurl, $CurlINFO_RESPONSE_CODE) & @CRLF) ConsoleWrite("Content Type: " & Curl_Easy_GetInfo($hCurl, $CurlINFO_CONTENT_TYPE) & @CRLF) ConsoleWrite("Content Size: " & Curl_Easy_GetInfo($hCurl, $CurlINFO_SIZE_DOWNLOAD) & @CRLF) ConsoleWrite(@CRLF & "Response Headers:" & @CRLF & BinaryToString(Curl_Data_Get($hRespHeaders), $SB_UTF8) & @CRLF) ConsoleWrite(@CRLF & "Response Body:" & @CRLF & BinaryToString(Curl_Data_Get($hRespBody) , $SB_UTF8) & @CRLF) ;Clean up Curl_Data_Cleanup($hRespBody) Curl_Data_Cleanup($hRespHeaders) Curl_Slist_Free_All($hReqHeaders) Curl_Easy_Cleanup($hCurl) EndFunc Console output: Curl RetCode: 0 No error HTTP Resp Code: 201 Content Type: application/json; charset=utf-8 Content Size: 66 Response Headers: HTTP/1.1 201 Created Date: Sun, 04 Apr 2021 19:16:34 GMT Content-Type: application/json; charset=utf-8 Content-Length: 66 Connection: keep-alive Set-Cookie: __cfduid=dafce47f575693fda672d549581698e381617563794; expires=Tue, 04-May-21 19:16:34 GMT; path=/; domain=.typicode.com; HttpOnly; SameSite=Lax X-Powered-By: Express X-Ratelimit-Limit: 1000 X-Ratelimit-Remaining: 999 X-Ratelimit-Reset: 1617563839 Vary: Origin, X-HTTP-Method-Override, Accept-Encoding Access-Control-Allow-Credentials: true Cache-Control: no-cache Pragma: no-cache Expires: -1 Access-Control-Expose-Headers: Location Location: http://jsonplaceholder.typicode.com/posts/101 X-Content-Type-Options: nosniff Etag: W/"42-Ii9+oWyCYDJs2O27gjmkyyjiao8" Via: 1.1 vegur CF-Cache-Status: DYNAMIC cf-request-id: 093fe9d5cb0000118d168d6000000001 Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" Report-To: {"max_age":604800,"group":"cf-nel","endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report?s=p6Ib9avjC%2BRZ95QeequJhUgrMYyRfdP8E9ozBaSKav3n8LqNyLiYuxucHEV1tpUp%2BIpcifjCY0ejYJOfvpZn3OM3vHGsRRmhvpofY0BDNHzLHCHIwk18oGDFwub9"}]} NEL: {"report_to":"cf-nel","max_age":604800} Server: cloudflare CF-RAY: 63acdf3619fb118d-MIA alt-svc: h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400 Response Body: { "fld1": "This is a test string", "fld2": true, "id": 101 }
    1 point
  8. @mLipok To get a list of frames, wouldn't the technique be the same as getting a list of any other element? My thinking is that it is the coder's responsibility to track which frame is currently active. Have you looked at the functionality of _WD_IsWindowTop? Perhaps you could accomplish your goal with _WD_ExecuteScript($sSession, "return window.self.name") or _WD_ExecuteScript($sSession, "return window.self.location")
    1 point
  9. I went and read about the libcurl C APIs and looked at the functions in the UDF lib to see exactly what they're doing. Then I created a small test example to confirm that what I've written below works. Okay, assuming that everything else in you original script was correct, there is one line missing. The following line should be added: Curl_Easy_Setopt($Curl, $CURLOPT_WRITEFUNCTION, Curl_DataWriteCallback()) ;<== This line should be added right before the following line Curl_Easy_Setopt($Curl, $CURLOPT_WRITEDATA, $Html) The 2 lines above will write the response to $Html and you can read it with Curl_Data_Get($Html). Or, if you want the response written to the file, then delete or comment out the 2 lines above and leave the 2 lines below: Curl_Easy_Setopt($Curl, $CURLOPT_WRITEFUNCTION, Curl_FileWriteCallback()) Curl_Easy_Setopt($Curl, $CURLOPT_WRITEDATA, $File) Looking at your original script, it looks like you were using the first pair of lines because you said your original parsing logic was using $Html, and it used to work. I'm quite sure that you can't have $CURLOPT_WRITEDATA write to a file and a variable in a single request. That's because the $CURLOPT_WRITEFUNCTION needs to be set to either Curl_FileWriteCallback() or Curl_DataWriteCallback(). When I tested it using both pairs of definitions, it just used the last one that was defined. And lastly. if you want the header info written to a variable, you can add the following two lines and retrieve it using Curl_Data_Get($Header). If you want it written to a file, then change the callback function and set the HEADERDATA value to a file handle. Curl_Easy_Setopt($Curl, $CURLOPT_HEADERFUNCTION, Curl_DataWriteCallback()) Curl_Easy_Setopt($Curl, $CURLOPT_HEADERDATA, $Header)
    1 point
  10. I’ll try that in the morning. Thanks. I assumed that the cURL UDF was splitting the results into $header and $html (for the body) but you know what they say about assuming... “don’t.”
    1 point
  11. Easy. You generate a sort index (1d array of integers) for each column you want sorted. These sort indexes should be calculated in advance just like the array itself. When you click a column header, the sorted array is displayed instantly. In my example, there is room for 40 rows in the listview. Showing 40 rows with or without an index makes only a very small difference. The sorted array will thus be displayed as fast as the unsorted array. There aren't really any good reasons not to use a virtual listview. True argumentum. Of course. Sorting an array of many rows directly in the listview will necessarily be slow. Even in real compiled code.
    1 point
  12. Here my version: #include <Array.au3> $gs_dummydata = "" $gs_dummydata &= "john,smith,12345" & @CRLF $gs_dummydata &= "josh,jones,34556,supervisor" & @CRLF $gs_dummydata &= "" & @CRLF ; empty line $gs_dummydata &= "zach,marks,98222,worker,extra column not expected" & @CRLF $gs_dummydata &= "jake,warren,10984,worker" & @CRLF ; (last line will actually be empty because of CRLF) $aS = StringSplitW($gs_dummydata, ",") _ArrayDisplay($aS) ; #FUNCTION# ====================================================================================== ; Name ................: StringSplitW() ; Version .............: v0.80 build 2011-05-05 beta ; Description .......: Splits a string into columns instead of rows as it is done by SplitString(), like a csv file to a 2d array ;-) ; Syntax ..............: StringSplitW($string, $delimiter, $max_width) ; Parameters ........: $string - string to split ; $delimiter - the delimter how to split the string ; Return values ....: Success - 2d array ; Failure 1 - either $string or $delimter is not set ; Failure 2 - array width exceeded ; Failure 3 - 2D array memory exceeded -> width + height > 0x5EFA ; Author ..............: UEZ ; Modified ............: ; Remarks ............: ; Related ..............: StringSplit() ; ================================================================================================= Func StringSplitW($string, $delimiter) If $string = "" Or $delimiter = "" Then Return SetError(1, 0, 0) Local $chk, $width, $i, $j, $k, $len, $max = 1, $max_width Local $aPos[1], $l = 0 Local $aSplit = StringSplit($string, @LF) $max_width = 0x5EFA - $aSplit[0] If $max_width < 1 Then Return SetError(3, 0, 0) Local $aVertical[$aSplit[0]][$max_width] For $k = 1 To $aSplit[0] $len = StringLen($aSplit[$k]) If $len > 1 Then $chk = StringReplace($aSplit[$k], $delimiter, $delimiter) $width = @extended If $width > $max_width Then Return SetError(2, 0, 0) If $width > $max Then $max = $width + 1 Switch $width Case 0 $aVertical[$l][0] = $aSplit[$k] Case Else Dim $aPos[$width * 2 + 2] $j = 1 $aPos[0] = 1 For $i = 0 To $width - 1 $aPos[$j] = StringInStr($aSplit[$k], $delimiter, 0, $i + 1) - 1 $aPos[$j + 1] = $aPos[$j] + 2 $j += 2 Next $aPos[UBound($aPos) - 1] = StringLen($aSplit[$k]) $j = 0 For $i = 0 To UBound($aPos) - 1 Step 2 $aVertical[$l][$j] = StringMid($aSplit[$k], $aPos[$i], $aPos[$i + 1] - $aPos[$i] + 1) $j += 1 Next EndSwitch $l += 1 EndIf Next ReDim $aVertical[$l][$max] Return $aVertical EndFunc Br, UEZ
    1 point
  13. Hi, Here is my version to "About Window" (not so simple, but cool ), it's used like an UDF function: #include <GUIConstants.au3> $Title = "About Info" $MainLabel = "My program Name" $CopyRLabel = "Copyright © " & @YEAR & " Company/Author. All rights reserved." $NameURL1 = "App Web Page" $URL1 = "http://www.autoitscript.com" $NameURL2 = "Email" $URL2 = "mailto:creat0rx@yahoo.com" $NameURL3 = "Some additional link" $URL3 = "http://personalwebpafe.com" $LinkColor = 0x0000FF $BkColor = 0xFFFFFF $hWnd = WinGetHandle(WinGetTitle("")) _About($Title, $MainLabel, $CopyRLabel, "v1.0", $NameURL1, $URL1, $NameURL2, $URL2, $NameURL3, $URL3, @AutoItExe, $LinkColor, $BkColor, -1, -1, -1, -1, $hWnd) Func _About($Title, $MainLabel, $CopyRLabel, $VerLabel, $NameURL1, $URL1, $NameURL2, $URL2, $NameURL3, $URL3, $IconFile="", $LinkColor=0x0000FF, $BkColor=0xFFFFFF, $Left=-1, $Top=-1, $Style=-1, $ExStyle=-1, $Parent=0) Local $OldEventOpt = Opt("GUIOnEventMode", 0) Local $OldRunErrOpt = Opt("RunErrorsFatal", 0) Local $GUI, $LinkTop=120, $Msg Local $CurIsOnCtrlArr[1] Local $LinkVisitedColor[4] = [3, $LinkColor, $LinkColor, $LinkColor] Local $LinkLabel[4] WinSetState($Parent, "", @SW_DISABLE) If $ExStyle = -1 Then $ExStyle = "" $GUI = GUICreate($Title, 320, 240, $Left, $Top, $Style, 0x00000080+$ExStyle, $Parent) GUISetBkColor($BkColor) GUICtrlCreateLabel($MainLabel, 40, 20, 280, 25, 1) GUICtrlSetFont(-1, 16) GUICtrlCreateIcon($IconFile, 0, 10, 20) GUICtrlCreateGraphic(5, 75, 310, 3, $SS_ETCHEDFRAME) For $i = 1 To 3 $LinkLabel[$i] = GUICtrlCreateLabel(Eval("NameURL" & $i), 150, $LinkTop, 145, 15, 1) GUICtrlSetCursor(-1, 0) GUICtrlSetColor(-1, $LinkColor) GUICtrlSetFont(-1, 9, 400, 0) $LinkTop += 30 Next GUICtrlCreateLabel("Program version: " & @LF & $VerLabel, 10, 130, 150, 35, 1) GUICtrlSetFont(-1, 10, 600, 0, "Tahoma") GUICtrlCreateLabel($CopyRLabel, 0, 220, 320, -1, 1) GUISetState(@SW_SHOW, $GUI) While 1 $Msg = GUIGetMsg() If $Msg = -3 Then ExitLoop For $i = 1 To 3 If $Msg = $LinkLabel[$i] Then $LinkVisitedColor[$i] = 0xAC00A9 GUICtrlSetColor($LinkLabel[$i], $LinkVisitedColor[$i]) ShellExecute(Eval("URL" & $i)) EndIf Next If WinActive($GUI) Then For $i = 1 To 3 ControlHover($GUI, $LinkLabel[$i], $i, $CurIsOnCtrlArr, 0xFF0000, $LinkVisitedColor[$i]) Next EndIf WEnd WinSetState($Parent, "", @SW_ENABLE) GUIDelete($GUI) Opt("GUIOnEventMode", $OldEventOpt) Opt("RunErrorsFatal", $OldRunErrOpt) EndFunc Func ControlHover($hWnd, $CtrlID, $CtrlNum, ByRef $CurIsOnCtrlArr, $HoverColor=0xFF0000, $LinkColor=0x0000FF) Local $CursorCtrl = GUIGetCursorInfo($hWnd) ReDim $CurIsOnCtrlArr[UBound($CurIsOnCtrlArr)+1] If $CursorCtrl[4] = $CtrlID And $CurIsOnCtrlArr[$CtrlNum] = 1 Then GUICtrlSetFont($CtrlID, 9, 400, 6) GUICtrlSetColor($CtrlID, $HoverColor) $CurIsOnCtrlArr[$CtrlNum] = 0 ElseIf $CursorCtrl[4] <> $CtrlID And $CurIsOnCtrlArr[$CtrlNum] = 0 Then GUICtrlSetFont($CtrlID, 9, 400, 0) GUICtrlSetColor($CtrlID, $LinkColor) $CurIsOnCtrlArr[$CtrlNum] = 1 EndIf EndFunc
    1 point
  14. For your inspiration - Here is my simple version of About window with active URL labels: #NoTrayIcon #include <Constants.au3> #include <GUIConstants.au3> Opt("GUICloseOnESC",1) Opt("GUIOnEventMode",1) $about = GuiCreate("About",215,150,-1,-1,BitOR($WS_CAPTION,$WS_SYSMENU)) GUISetOnEvent ($GUI_EVENT_CLOSE, "AboutOK" ) GUICtrlCreateIcon (@AutoItExe,-1,11,11) GUICtrlCreateLabel ("App name 1.0",59,11,135,20) GUICtrlSetFont (-1,10, 800, 0, "Arial") ; bold GUICtrlCreateLabel ("(c) 2005" & @CRLF & @CRLF & "Zedna",59,30,135,40) $email = GUICtrlCreateLabel ("author@somewhere.com",59,70,135,15) GuiCtrlSetFont($email, 8.5, -1, 4) ; underlined GuiCtrlSetColor($email,0x0000ff) GuiCtrlSetCursor($email,0) GUICtrlSetOnEvent(-1, "OnEmail") $www = GUICtrlCreateLabel ("www.autoitscript.com/forum/",59,85,140,15) GuiCtrlSetFont($www, 8.5, -1, 4) ; underlined GuiCtrlSetColor($www,0x0000ff) GuiCtrlSetCursor($www,0) GUICtrlSetOnEvent(-1, "OnWWW") GUICtrlCreateButton ("OK",65,115,75,23,BitOr($GUI_SS_DEFAULT_BUTTON, $BS_DEFPUSHBUTTON)) GUICtrlSetState (-1, $GUI_FOCUS) GUICtrlSetOnEvent(-1, "AboutOK") GUISetState(@SW_SHOW, $about) While 1 Sleep(100) WEnd Func OnEmail() Run(@ComSpec & " /c " & 'start mailto:author@somewhere.com?subject=Something', "", @SW_HIDE) EndFunc Func OnWWW() Run(@ComSpec & " /c " & 'start www.autoitscript.com/forum/', "", @SW_HIDE) EndFunc Func AboutOK() Exit EndFunc Func OnAutoItExit() GUIDelete($about) EndFunc
    1 point
×
×
  • Create New...