Does someone please have a filecopy with a progressbar routine.
Thanks in advance
Otto
#include "FWCE.ch"
//----------------------------------------------------------------------------//
function Main()
local oWnd, oPgr ,oTimer
DEFINE WINDOW oWnd TITLE "Progress Bars"
DEFINE TIMER oTimer OF oWnd INTERVAL 500 ;
ACTION StartCopy(oPgr,oWnd,oTimer)
ACTIVATE TIMER oTimer
@ 2, 8 SAY "FiveWin for Pocket PC" OF oWnd SIZE 150, 20
@ 4, 6 PROGRESS oPgr POS 0 OF oWnd SIZE 150, 15
@ 9, 6 BUTTON "Fine" OF oWnd SIZE 180, 30 ACTION oWnd:End()
ACTIVATE WINDOW oWnd
return nil
Function StartCopy(oMeter1 ,oWnd,oTimer)
local n
local hSource, hTarget
Local nBufSize := 80000
local nBytes, nFile := 0, nTotal := 0
local nTotSize := 0
Local cSource := "\\server\ori\risto.exe"
Local cDest := "risto\risto.EXE"
Local nLen := 0
Local lOk := .F.
Local cBuffer := ""
Local oIni
Local cDir := curdir()+ "\"
Local cFile := cDir + "COPY.TXT"
Local cText := "\\server\ori\risto.exe" + CRLF + ;
"risto\risto.EXE"
Local nX := 1
Local nR := 1
oTimer:DeActivate()
IF ! file(cFile)
MemoWrit( cFile, cText )
ENDIF
cText := memoread(cFile)
nR := mlcount(cText)
cSource := memoline(cText,,1)
cDest := alltrim(cDir + memoline(cText,,2))
cSource := alltrim(cSource)
IF ! file(cSource)
oTimer:Activate()
Return nil
ENDIF
hTarget = FCreate( cDest )
IF hTarget == - 1
oTimer:Activate()
return nil
ENDIF
cBuffer := Space( nBufSize )
hSource = FOpen( cSource )
IF hSource == -1
oTimer:Activate()
return nil
ENDIF
nLen := FSeek( hSource, 0, 2 ) / nBufSize
FSeek( hSource, 0, 0 )
oMeter1:SetRange( 0, nLen)
nFile := 0
while ( nBytes := FRead( hSource, @cBuffer, nBufSize ) ) > 0
FWrite( hTarget, cBuffer, nBytes )
oMeter1:nPosition ++
oMeter1:Refresh()
lOk := .T.
end
FClose( hSource )
FClose( hTarget )
IF lOk
IF FERASE(cSource) == - 1
MsgInfo("Non cancellato")
ELSE
// MsgInfo("File copiato")
ENDIF
ENDIF
oMeter1:nPosition := 0
oMeter1:Refresh()
oTimer:Activate()
return nil
Return to FiveWin for Pocket PC
Users browsing this forum: No registered users and 7 guests