Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
I want to close a VFP app when it loses focus, but...
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00421030
Message ID:
00421886
Vues:
18
>>>nothing I thought would work did. The ThisForm.LostFocus() event doesn't fire when the user changes to another application, only when they change to another form within a vfp app. ThisForm.DeActivate() works the same way. I couldn't find any events at the _VFP level that would do this. I'm not sure a Windows API call would do it either, since VFP doesn't appear to be able to sense it.
>>>
>>>Foxheads, how are you doing this?
>>
>>Jerry,
>>
>>AFAIK, the only way to do this may be pretty hit and miss. What I'd do is use a timer to check the value returned by GetForegroundWindow(). This function returns the window handle of the window the user is currently working in. By comparing this against VFP's main window handle (as returned by MainhWnd() in Foxtools).
>
>Opps! Besides relating the timer failures, I forgot to mention that my when my app loses focus it doesn't seem to communicate to it's child windows that it (hence they) have lost focus. That's the problem and there is no "LostFocus" event for the _VFP object.
>JLK

I haven't used it, but Bela Bodecs has a bbTimer class here that is supposed to fire more reliably than the native VFP timer. Might be worth a shot.
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform