[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 140
  • 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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