Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Terminating application - preventing

Posted on 2001-07-24
6
Medium Priority
?
159 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 200 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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…
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, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

597 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