Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Closing an other '.exe'
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00761170
Message ID:
00761218
Views:
32
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform