Close Program

How to close a external program, that means not a program created in delph, but ex. notebook.exe or something
kogerAsked:
Who is Participating?
 
BoRiSCommented:
koger

PostMessage(FindWindow(Nil, 'window caption'), WM_QUIT, 0, 0);

 Where "window caption" is the caption of the window that you
 are wanting to close...

Later
BoRiS
0
 
viktornetCommented:
What Boris told you is correct, but you can also use

SendMessage(FindWindow(Nil, 'Untitled - Notepad'),WM_CLOSE,0,0);//SendMessage

since sendmessage, doesn't leave it until it is send to the app, or whatever you are sending to...

Regards,
Viktor Ivanov
0
 
kogerAuthor Commented:
Great, but I don't know the Caption, but I know the path and filename of the program I want to close, is it perhaps possible somehow to extract the caption from a filename?
0
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.