Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 138
  • Last Modified:

Close Program

How to close a external program, that means not a program created in delph, but ex. notebook.exe or something
0
koger
Asked:
koger
1 Solution
 
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

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now