Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Issuing a Kill Task or a reboot
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00461600
Message ID:
00462147
Vues:
20
>I have an external piece of software that is used for unattended offsite backups, unfortunately it regularly hangs but holds the telephone line open; thus resulting in a huge bill!
>
>I know that it should have always finished by 2am and want to check if it is still running - if it is I need to either kill the task or reboot the machine (effectively killing it).
>
>I appreciate I should change the software for one that dosn't hang but politics etc prohibits this.
>
>Any ideas would be welcomed
>
>Thanks

A description of ExitWindowsEx() may also be found in the API section here at the UT. It's entry #24.

Short of re-booting the computer, however, you could try to use the API to shut down the hung task. See FAQ#7773, "How do I close another application?", for details.

A problem here arises in that you must obtain the window handle of the hung application. If the window has title bar text that is not dynamic, it's fairly simple to use the FindWindow() function to obtain. See API entry #4 in the API section. One thing, however, that's missing in the description is that the title bar text must match exactly and is case sensitive.

If the title text is dynamic, you might want to look at FILE#447 ("Is a Windows Application Running?"). It allows for partial matches based on the known portion of the title bar and is not case sensitive.

If, however, the window does not have a title bar and thus no text, you would have to use FindWindow() passing the window's class name, instead of the title text. There are problems here too. First, you have to know what the class name is. In this case, a tool like Spy++ that comes with VS may provide some help. The second problem is that class names can and do change between versions. The windows used by VFP 5.0, 6.0, and the beta version of 7.0 are all different class names.
George

Ubi caritas et amor, deus ibi est
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform