|
Short story: Recreation of Task Manager's Applications tab shows how to properly terminate processes.
Longer description from old site: click here.
To be edited...
This sample, or the one from which it originally derived, was published (or at least peripherally mentioned) in the following article(s):
- Force Your Way to the Foreground, Ask the VB Pro, VBPJ, February 1999
- Is That App Hung? Find Out, Ask the VB Pro, VBPJ, September 2000
- Kill an App Gently, Desktop Developer, VSM, September 2001
This sample uses the following API calls:
Module Library Function CTaskList.cls kernel32
user32GetVersionEx
GetClassLong
GetClassName
GetForegroundWindow
GetParent
GetTopWindow
GetWindow
GetWindowLong
GetWindowText
GetWindowThreadProcessId
IsIconic
IsWindow
IsWindowVisible
LoadIcon
SendMessage
SendMessageTimeout
SetForegroundWindow
ShowWindowFTaskList.frm user32 GetWindowLong
GetWindowThreadProcessIdMCreatePicture.bas olepro32 OleCreatePictureIndirect MForceFore.bas user32 AttachThreadInput
GetForegroundWindow
GetParent
GetWindowThreadProcessId
IsIconic
IsWindowVisible
SetForegroundWindow
ShowWindowMHung.bas user32 IsWindow
SendMessageTimeoutMRunDialog.bas kernel32
shell32
user32GetVersionEx
#61
FindWindow
GetWindow
GetWindowRect
KillTimer
MoveWindow
SendMessage
SetForegroundWindow
SetTimer
ShowWindowMTermProc.bas kernel32
psapi
user32
vdmdbgCloseHandle
FormatMessage
GetPriorityClass
OpenProcess
SetPriorityClass
Sleep
TerminateProcess
WaitForSingleObject
EnumProcessModules
GetModuleBaseName
GetModuleFileNameEx
EnumWindows
GetClassName
GetWindowLong
GetWindowThreadProcessId
IsWindowVisible
PostMessage
VDMEnumProcessWOW
VDMEnumTaskWOWEx
VDMTerminateTaskWOWMVdmInfo.bas kernel32
psapi
vdmdbgCloseHandle
OpenProcess
EnumProcessModules
GetModuleBaseName
GetModuleFileNameEx
VDMEnumProcessWOW
VDMEnumTaskWowEx
VDMTerminateTaskWowSleeper.frm kernel32 Sleep Don't see what you're looking for? Here's a complete API cross-reference.
Please, enjoy and learn from this sample. Include its code within your own projects, if you wish. But, in order to insure only the most recent code is available to all, I ask that you don't share the sample by any form of mass distribution. Download TaskList.zip, 106Kb, Last Updated: Wednesday, February 13, 2002
The following resources may also be of interest: