Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
MediaCopy method is distribution
Message
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Titre:
MediaCopy method is distribution
Divers
Thread ID:
00643976
Message ID:
00643976
Vues:
50
Hi everybody,

I've just received control on Distribution application. This application is quite complicated, but here is one method, which looks suspicious to me:
lparameter thefile,themedia
nDistErr = 0
*:Save current error handler here
*:REV 9/10/01 SBB Now adding code to save the current (Nancy's) error handler &
*:setting special handler for media copying.  The error handler will be reset
*:at the end of this method
local lcOldOnError, SavePointer, theDrive
* Save the original error handler
lcOldOnError = on("ERROR")
* code to which the error handling routine applies
on error do DistErr with ;
	error( ), message( ), message(1), program( ), lineno( )
*:Check media types here and use the proper drive designator
*:Check for media type
select MediaTmp
locate for themedia = MediaTmp.media_code
if !empty(MediaTmp.drive)
	theDrive=alltrim(MediaTmp.drive)+":"
else
	theDrive="A:"
endif

*:Add loop here in to retry copy if error found
do while .t.
*:Set error number to 0
	nDistErr=0
	SavePointer=thisform.mousepointer
	thisform.mousepointer=11
	copy file (thefile) to (theDrive)
	thisform.mousepointer=SavePointer

	if nDistErr>0 && Error copying file

		nanswer=MyYesNo("Error Reading/Writing to Drive during copy" + theDrive + chr(13)+"Retry?")
		if nanswer = 6 &&Yes
			loop
		else
			=messagebox("Error Reading Drive " + iif(empty(MediaTmp.drive),'A',alltrim(MediaTmp.drive))+":"+chr(13)+;
				"Cannot Complete this job...",0,"Distribution")
			exit
		endif
	else
		exit
	endif
enddo
*REV 9/10/01 SBB
* Reset the original error handler
on error &lcOldOnError &&	ON ERROR  && restore system error handler
I believe, on some systems if drive is not ready, we'll see the system level error (Windows error) and not VFP error. I have IsDriveReady function, which uses WSH. Do you think, I should re-write this method?

What would be your suggestions?

Thanks in advance.
If it's not broken, fix it until it is.


My Blog
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform