Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Progress bar on COPY FILE
Message
 
 
À
05/12/2000 15:24:39
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00448749
Message ID:
00449633
Vues:
9
>>Has anyone managed to create something that shows the progress of a file copy from VFP6.0?
>
>You can do this all natively in VFP.
>
>Try somethign like this:
>
>
lcFile = getfile()
>
>_screen.AddObject('pbar', 'progressbar')
>_screen.pbar.nValue = 0
>_screen.pbar.Visible = .T.
>ADIR(aSize, lcFile)
>_screen.pBar.nMaxValue = aSize[2]
>
>lnH = FOPEN(lcFile)
>lnH2 = FCREATE('c:\dest.txt')
>
>FOR lnI = 1 to aSize[2]
>	FWRITE(lnH2, FREAD(lnH, 1024), 1024)
>	_screen.pBar.nValue = _screen.pBar.nValue + 1
>ENDFOR
>
>FCLOSE(lnH)
>FCLOSE(lnH2)
>
>DEFINE CLASS progressbar AS container
>
>	Width = 324
>	Height = 55
>	BackStyle = 0
>	BorderWidth = 0
>	nvalue = 0
>	ccaption = ""
>	nmaxvalue = 100
>	Name = "progressbar"
>
>	ADD OBJECT cntbar AS container WITH ;
>		Top = 19, ;
>		Left = 6, ;
>		Width = 312, ;
>		Height = 31, ;
>		SpecialEffect = 1, ;
>		Name = "cntBar"
>
>	ADD OBJECT lblstatus AS label WITH ;
>		AutoSize = .T., ;
>		BackStyle = 0, ;
>		Caption = "Status", ;
>		Height = 17, ;
>		Left = 10, ;
>		Top = 0, ;
>		Width = 37, ;
>		Name = "lblStatus"
>
>	ADD OBJECT shpbar AS shape WITH ;
>		Top = 23, ;
>		Left = 10, ;
>		Height = 24, ;
>		Width = 304, ;
>		BorderStyle = 0, ;
>		BackColor = RGB(0,0,128), ;
>		Name = "shpBar"
>
>	PROCEDURE ccaption_assign
>		LPARAMETERS vNewVal
>		*To do: Modify this routine for the Assign method
>		THIS.ccaption = m.vNewVal
>		this.lblStatus.Caption = m.vNewVal
>	ENDPROC
>
>	PROCEDURE nvalue_assign
>		LPARAMETERS vNewVal
>		*To do: Modify this routine for the Assign method
>		THIS.nvalue = m.vNewVal
>		if vNewVal => 0 and this.nMaxValue > 0
>			this.shpBar.Width = (vNewVal / this.nMaxValue) * 304
>		else
>			this.shpBar.Width = 0
>		endif
>	ENDPROC
>
>	PROCEDURE updatebar
>		LPARAMETERS vNewVal
>		*To do: Modify this routine for the Assign method
>		THIS.nvalue = m.vNewVal
>		if vNewVal => 0 and this.nMaxValue > 0
>			this.shpBar.Visible = .T.
>			this.shpBar.Width = (vNewVal / this.nMaxValue) * 304
>		else
>			this.shpBar.Visible = .F.
>		endif
>	ENDPROC
>ENDDEFINE
Mike,

I tried this code on quite a big dbf file, and it doesn't seem to work. The system just hangs up...
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform