Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
CloseButton and ExitProcess
Message
De
20/04/2011 08:45:21
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Installation et configuration
Titre:
CloseButton and ExitProcess
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01507897
Message ID:
01507897
Vues:
120
I use ExitProcess() to be able to test for an 'errorlevel' in the batchfile. As it is now, I can manage that it returns 2 if the app is quit via ESC or a Quit-button. It will produce no value (giving errorlevel 0) if there's an oncontrolled break (e.g. a crash) and in all other conditions a 1. This 1 is produced if the Windows Task Manager ends the app, but it is also produced if the CloseButton (see property Closeable) is chosen.
*	Visual FoxPro doesn't natively provide a method to return an error level 
*	to the operating system when terminating. It can be done using a call to the 
*	Win32 API call ExitProcess(). VFP will immediately terminate and will return 
*	the value of the parameter as the error level.
DECLARE ExitProcess in Win32API INTEGER ExitCode
*
*	0 = Uncontrolled break, for example a crash.
*	1 = Quit via [x] in upperright corner or via Windows Task Manager.
*	2 = Quit via Quit-button or via ESC.
ExitProcess( iif( m.glUserQuit, 2, 1 ) )
Who knows of a way to see that the CloseButton was pressed?
Groet,
Peter de Valença

Constructive frustration is the breeding ground of genius.
If there’s no willingness to moderate for the sake of good debate, then I have no willingness to debate at all.
Let's develop superb standards that will end the holy wars.
"There are three types of people: Alphas and Betas", said the beta decisively.
If you find this message rude or offensive or stupid, please take a step away from the keyboard and try to think calmly about an eventual a possible alternative explanation of my message.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform