Hallo Kanashius und Racer,
zunächst möchte ich mich bei euch für eure Beiträge bedanken.
Ich glaube fast, das meine Frage etwas missverstanden wurde. ich will noch mal erklären:
Der Kopiervorgang läuft und die Progressbar wird auch angezeigt. Sobald ich aber i-ein anderes Fenster, manuell bewege, öffne, schließe oder das Progressbar-Fenster selber mit der Maus
anfasse, wird die Progressbar gestoppt (FehlerMeldung beim Anklicken des PB-Fensters: Not Responding). Der Kopiervorgang indes geht weiter.
Code
If FileExists($sSourceD) Then
Local $hProgressProc = DllCallbackRegister('_ProgressProc', 'bool', 'uint64;uint64;uint64;uint64;dword;dword;handle;handle;ptr')
ProgressOn('Kopieren', 'Copying' & @CRLF & "..." , '0%', -1, -1, $DLG_MOVEABLE)
If Not _WinAPI_CopyFileEx($sSourceD, $sDestinationD, 0, DllCallbackGetPtr($hProgressProc)) Then
_WinAPI_ShowLastError('Error copying' & $sSourceD)
EndIf
DllCallbackFree($hProgressProc)
ProgressOff()
Else
MsgBox($MB_ICONERROR, "Fehler", "Die Quelldatei wurde nicht gefunden.")
Exit
EndIf
; Schritt 2: Entpacke die ISO-Datei
$sValue1 = ShellExecuteWait("C:\Program Files\7-Zip\7z.exe", "x -aoa -y" & $sDestinationD & " -o" & $sDestinationExD)
If @error Then
MsgBox($MB_ICONERROR, "Fehler", "Fehler beim Entpacken der Datei. - " & $sValue1 & " - " & @error)
Exit
EndIf
MsgBox($MB_ICONINFORMATION, "Erfolg", "Die ISO-Datei wurde erfolgreich kopiert und entpackt. - " & $sValue1 & " - " & @error)
;##############################################################################################################################
Func _ProgressProc($iTotalFileSize, $iTotalBytesTransferred, $iStreamSize, $iStreamBytesTransferred, $iStreamNumber, $iCallbackReason, $hSourceFile, $hDestinationFile, $pData)
#forceref $iStreamSize, $iStreamBytesTransferred, $iStreamNumber, $iCallbackReason, $hSourceFile, $hDestinationFile, $pData
Local $iPercent = Round($iTotalBytesTransferred / $iTotalFileSize * 100)
If $iPercent = 100 Then
ProgressSet($iPercent, '', 'Complete')
Sleep(1500)
Else
ProgressSet($iPercent, $iPercent & '%')
EndIf
Sleep(10) ; to slow down to see the progress bar
If _IsPressed('1B') Then ;Abbruch wenn EXC-Taste gedrückt wird
Return $PROGRESS_CANCEL
Else
Return $PROGRESS_CONTINUE
EndIf
EndFunc ;==>_ProgressProc
Alles anzeigen