l32" (ByVal hFile As Long, ByVal lpBuffer As Long, ByVal nNumberOfBytesToWrite As Long, lpNumberOfBytesWritten As Long, ByVal lpOverlapped As Long) As Long
Private Declare Function ReadFile Lib "kernel32" (ByVal hFile As Long, ByVal lpBuffer As Long, ByVal nNumberOfBytesToRead As Long, lpNumberOfBytesRead As Long, ByVal lpOverlapped As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private Declare Function GetLastError Lib "kernel32" () As Long
Private Declare Function SetEndOfFile Lib "kernel32" (ByVal hFile As Long) As Long
Private Declare Function StrFormatByteSize Lib "shlwapi" Alias _
"StrFormatByteSizeA" (ByVal dw As Long, ByVal pszBuf As String, ByRef _
cchBuf As Long) As String
''''Private Type OVERLAPPED
'''' Internal As Long
'''' InternalHigh As Long
'''' offset As Long
'''' OffsetHigh As Long
'''' hEvent As Long
''''End Type
Private Const OFS_MAXPATHNAME = 128
Private Type OFSTRUCT
cBytes As Byte
fFixedDisk As Byte
nErrCode As Integer
Reserved1 As Integer
Reserved2 As Integer
szPathName(OFS_MAXPATHNAME) As Byte
End Type
Private Const OF_CREATE = &H1000
Private Const OF_WRITE = &H1
Private Const OF_READ = &H0
Private Const FILE_END = 2
Private Const FILE_BEGIN = 0
Private bolStop As Boolean
Private bolReady As Boolean
Private myCount As clsCount
Private myIni As clsIniFile
Private bolUnload As Boolean
Private Sub cmdCopy_Click()
Call SetControl(True)
Call CopyFile
Call SetControl(False)
If chkShutdown.Value = 1 Then
dlgShutDown.Show vbModal
End If
End Sub
Private Sub cmdFrom_Click()
On Error Resume Next
dlgFile.FileName = textFrom.Text
dlgFile.ShowOpen
If Err.Number = 0 Then
textFrom.Text = dlgFile.FileName
End If
On Error GoTo 0
End Sub
Private Sub cmdStop_Click()
Call SetControl(False)
End Sub
Private Sub cmdTo_Click()
On Error Resume Next
dlgFile.FileName = textTo.Text
dlgFile.ShowOpen
If Err.Number = 0 Then
textTo.Text = dlgFile.FileName
End If
lblInfo.Enabled = True
On Error GoTo 0
End Sub
Private Sub Form_Load()
Set myCount = New clsCount
Set myIni = New clsIniFile
myIni.IniFileName = "Copy.ini"
myIni.CurrentSection = "Copy"
textFrom.Text = myIni.IniString("From")
textTo.Text = myIni.IniString("To")
bolStop = False
bolReady = True
bolUnload = True
Call SetControl(False)
End Sub
Private Sub SetControl(bolCopying As Boolean)
Dim myCtl As Control
On Error Resume Next
For Each myCtl In Controls
myCtl.Enabled = Not bolCopying
If TypeOf myCtl Is Label Then
myCtl.Enabled = True
End If
Next myCtl
cmdStop.Enabled = bolCopying
bolStop = Not bolCopying
End Sub
Private Sub CopyFile()
Dim lngFrom As Long
Dim lngTo As Long
Const c_BufSize As Long = 8 * 1024
Dim myResult As OFSTRUCT
''''Dim myOverLapped As OVERLAPPED
Dim lngTotal As Long
Dim lngCurrent As Long
Dim lngCopy As Long
Dim buf(0 To c_BufSize - 1) As Byte
Dim lCount As Long
Dim lBlankCount As Long
Dim strRate As String
Dim lStart As Long
bolReady = False
On Error Resume Next
On Error GoTo CopyErr