lippo
asked on
Use API to close a program?
You can close a program by pressing the Ctrl-Alt-Del.
How can I close a program by Win32 API?
How can I close a program by Win32 API?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I ran the example on my machine, but it doesn't work. Why? My machine is windows xp.
Thank you!
Thank you!
The first legal way is to post the main window a message telling it to close down
PostMessage(hMainWindow, WM_CLOSE, 0, 0L);
or the more illegal way is to terminate the process using TerminateProcess.
However for both of these methods you either need to main window handle, or the process id