[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now


How to close applications?

Posted on 1999-01-20
Medium Priority
Last Modified: 2010-04-06
How to close running application with my programm?
I am using Delphi 3.
Question by:kaloyan
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 27

Expert Comment

ID: 1362488
hi kaloyan,

if you know the WindowTitle of the App you want to close, you can do it with this code

procedure TForm1.Button1Click(Sender: TObject);
  TheHandle : THandle;
  TheHandle := Findwindow(NIL, 'Microsoft Excel'); {Excel, no open documents}
  If TheHandle > 0 then SendMessage(TheHandle,WM_CLOSE,0,0);

LVL 20

Expert Comment

ID: 1362489
If you want the program to ask the user whether the modified file shall be saved, use meikl's solution, otherwise send a WM_QUIT instead of a WM_CLOSE.

Regards, Madshi.

Accepted Solution

zwarte earned 10 total points
ID: 1362490
for a very easy solution use:

if you add this anywhere in you code, your application stops right there.

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question