Solved

Terminating application - preventing

Posted on 2001-07-24
6
156 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
[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
6 Comments
 
LVL 27

Accepted Solution

by:
kretzschmar earned 50 total points
ID: 6311809
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
ID: 6311879
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
ID: 6311883
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
Industry Leaders: 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 5

Expert Comment

by:Gwena
ID: 6314738
listening  :-)
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6321295
Hello, TomazB, are you already alive??
0
 

Author Comment

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

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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
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…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

718 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