Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Closing an other '.exe'
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00761170
Message ID:
00761218
Vues:
31
Initially you collect window handles for all running applications using GetWindow function.
Such handle allows to retrieve not only the window title but also -- through the process handle -- name of the executable file.

Before closing an application you usually check if it is not your own application, and it is not the Program Manager.

First the safest way is used:
= PostMessage(hWindow, WM_SYSCOMMAND, SC_CLOSE, 0)
it works better than
= PostMessage(hWindow, WM_QUIT, 0,0)
If it does not help then more radical tool is applied:
= TerminateProcess(hProcess, 0)
Win API functions used:
CloseHandle
GetActiveWindow
GetWindow
GetWindowText
GetWindowTextLength
GetWindowThreadProcessId
IsWindow
IsWindowVisible
OpenProcess
PostMessage
TerminateProcess
Sample code: Terminating all running applications from the VFP
http://www.news2news.com/vfp/?example=243
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform