How to kill my own process

I want to be able, from code, to kill my process.  I just want to blast it out of the water -- just as if I had gone to Task Manager and used "End Process" there.  I've tried some things in my code like


I even wrote code to enumerate all windows open, look for my app's title, and then send that window a WM_CLOSE message.

But I am not killing it.

Now, I know that this must be because it launched some other process that is still active, and I shoudl really figure that out, and do something clean, but.... isn't there a way to definitively KILL myself?   Like Task Manager does.
Who is Participating?
jkrConnect With a Mentor Commented:
The simplest ways:


// or


Open in new window

Or in a broader sense regarding not only your own process:;en-us;178893& ("How To Terminate an Application "Cleanly" in Win32")
tullheadAuthor Commented:
I like simple!

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.