Solved

Terminating application - preventing

Posted on 2001-07-24
6
151 Views
Last Modified: 2010-04-06
I would like to control when user is allowed to close my application either trough Alt-F4 or normaly trough app.
I need to prevent closing of app while I initialise my program (conecting to TCP, loading data etc.).  
0
Comment
Question by:TomazB
6 Comments
 
LVL 27

Accepted Solution

by:
kretzschmar earned 50 total points
Comment Utility
just fill out the onclosequery-event

as long it is not allowed,
set there the canclose-var to false
0
 
LVL 2

Expert Comment

by:FrodoBeggins
Comment Utility
Yes, you need to handle OnCloseQuery event on your main form and set the parameter CanClose to False. That ensures that your app will not die by ExitProcess(...) function (e.g. by pressing Alt+F4).
But your process still can be terminated by TerminateProcess(...) function (by any other process, e.g. Task Manager). There is no way to be 100% sure your app will not be colsed in this way.

Rgds,
Frodo
0
 
LVL 2

Expert Comment

by:FrodoBeggins
Comment Utility
Anyway, no matter the way your application is closed, all the resources will be freed (by Windows). Only if you need to do some specific cleanup there may be a problem

Rgds,
Frodo
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 5

Expert Comment

by:Gwena
Comment Utility
listening  :-)
0
 
LVL 27

Expert Comment

by:kretzschmar
Comment Utility
Hello, TomazB, are you already alive??
0
 

Author Comment

by:TomazB
Comment Utility
Yes, Yes, sorry for delay. I was out of town for two days.
Thank's kretzschmar!
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

743 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now