scila1996 Posted June 19, 2015 Share Posted June 19, 2015 Sources file Copy.au3 expandcollapse popup#include <AutoItConstants.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <ProgressConstants.au3> #include <WindowsConstants.au3> #include <File.au3> $Form = GUICreate("Form1", 578, 229, 192, 124) $Src = GUICtrlCreateButton("Source", 32, 16, 105, 25) $Dest = GUICtrlCreateButton("Destination", 32, 56, 105, 25) $Input = GUICtrlCreateInput("", 160, 16, 385, 21) $Output = GUICtrlCreateInput("", 159, 59, 385, 21) $Copy = GUICtrlCreateButton("Copy Test", 32, 112, 105, 25) $Progress = GUICtrlCreateProgress(32, 176, 513, 25) GUISetState(@SW_SHOW) Func _ProcessGetWinEx($ivPid, $svClass = "", $svTitle = "", $svText = "", $ivReturnOnlyFirstMatch = False) $ivPid = ProcessExists($ivPid) If Not $ivPid Then Return(SetError(1, 0, 0)) Local $avwArray = WinList() Local $avRet[1] = [0] For $i = 1 To $avwArray[0][0] $avClass = DllCall("User32.dll", "int", "GetClassName", "hwnd", $avwArray[$i][1], "str", "", "int", 4096) If WinGetProcess($avwArray[$i][1]) = $ivPid Then If $svClass = "" Or (IsArray($avClass) And $avClass[2] = $svClass) Then If ($svTitle = "" Or StringInStr($avwArray[$i][0], $svTitle)) And ($svText = "" Or StringInStr(WinGetText($avwArray[$i][1]), $svText)) Then $avRet[0] += 1 ReDim $avRet[$avRet[0]+1] $avRet[$avRet[0]] = $avwArray[$i][1] If $ivReturnOnlyFirstMatch Then $avRet = $avret[1] ExitLoop EndIf EndIf EndIf EndIf Next Return $avRet EndFunc Func _CopyFile($Src, $Dest, $Prog) Local $PIDrun = Run(@ScriptDir & '\CopyPro.exe "' & $Src & '" "' & $Dest & '"', "", @SW_HIDE) Do GUICtrlSetData($Prog, WinGetTitle(_ProcessGetWinEx($PIDrun, "", "", "", True))) Until (Not ProcessExists($PIDrun)) MsgBox(64, "", "copy complete") FileDelete($Dest) EndFunc While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Src Do GUICtrlSetData($Input, FileOpenDialog("file src", "", "All File (*.*)", 0, "", $Form)) Until (StringCompare(GUICtrlRead($Input), "")) Case $Dest Do Dim $s For $i = 1 To StringLen(GUICtrlRead($Input)) $s = StringRight(GUICtrlRead($Input), $i) If (StringLeft($s, 1) = ".") Then ExitLoop Next GUICtrlSetData($Output, FileSaveDialog("file dest", "", "All File (*" & $s & ")", 0, "", $Form)) Until (StringCompare(GUICtrlRead($Output), "")) Case $Copy _CopyFile(GUICtrlRead($Input), GUICtrlRead($Output), $Progress) EndSwitch WEndSource Code file Copy_Pro.exe (Compiler with VS 2012) #include <Windows.h> #include <stdio.h> using namespace std; __int64 FileSize(const wchar_t* Fname) { LARGE_INTEGER ullSize; GetFileSizeEx(CreateFileW(Fname, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL), &ullSize); return ullSize.QuadPart; } int wmain(int argc, wchar_t *argv[3]) { if (!(argc == 3)) return 0; FILE *F_src, *F_dest; if (!(F_src = _wfopen(argv[1], L"rb"))) return 0; _wremove(argv[2]); if (!(F_dest = _wfopen(argv[2], L"ab"))) return 0; int s; __int64 Fsize = FileSize(argv[1]), Fs = 0; wchar_t* Buf[1024 * 100]; char title[4]; while (!feof(F_src)) { s = fread(Buf, 2, sizeof(Buf) / 2, F_src); Fs+=s; sprintf(title, "%d", (int)(((float)Fs / Fsize) * 200)); SetConsoleTitleA(title); fwrite(Buf, 2, s, F_dest); } fclose(F_src); fclose(F_dest); } Copy_Prog.zip Link to comment Share on other sites More sharing options...
barkeeper Posted July 16, 2015 Share Posted July 16, 2015 Awesome, thanks! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now