Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

how to terminate a Delphi application?

Posted on 2000-05-09
8
Medium Priority
?
4,544 Views
Last Modified: 2012-06-27
How do I immediatly terminate a Delphi application in formCreate?
application.terminate does not immediatly termiantes an application.
0
Comment
Question by:jorge_c
[X]
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
8 Comments
 
LVL 6

Expert Comment

by:edey
ID: 2793280
in an event driven system, nothing happens "immediatly", do you want to give the impression it does?

GL
Mike
0
 
LVL 1

Expert Comment

by:bcoleman
ID: 2793316
try 'halt'
0
 

Expert Comment

by:Dippen
ID: 2793344
Use a global boolean variable, for instance called RunApplication, and declare it publically in the main unit.
Then, in the formCreate, you set the variable to False if the application shouldn't be launched at all. Finally, somewhere in the project source (.dpr file), add the lines:

if not RunApplication then begin
  application.terminate;
  exit;
end;

The lines should be added somewhere after the Application.CreateForm statements and (important) before
the Application.Run statement!

Another solution is to move the code that does the checking from the formCreate method to the project source...

Hope this helps!

Regards, Daniel
0
Technology Partners: 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!

 
LVL 20

Accepted Solution

by:
Madshi earned 200 total points
ID: 2793358
It's much easier! Simply call "ExitProcess(0)". This works always perfectly, regardless where you put it in your code...

Regards, Madshi.
0
 
LVL 20

Expert Comment

by:Madshi
ID: 2793364
P.S: Halt works in some cases and in some not, I don't remember where it didn't work. Anyway, it doesn't matter, ExitProcess works always.
0
 

Author Comment

by:jorge_c
ID: 2793420
Thanks for all you answers. calling ExitProcess(0) works great for me.
Now, how do I give the points to Madshi?
0
 
LVL 20

Expert Comment

by:Madshi
ID: 2793480
First reject Dippen's answer. Then you can accept my comment as the answer.

Thank you...   :-)
0
 

Author Comment

by:jorge_c
ID: 2793491
calling ExitProcess(0) works better for me since I have to call it from different places in my code.
0

Featured Post

Technology Partners: 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

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

721 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