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
Solved

Disable Closing application...

Posted on 1997-11-11
4
226 Views
Last Modified: 2012-05-04
Hello people,

how do make my program stop reacting on alt-f4 and the "cross".

i am writing a program for a network wich receives messages and the pop's up. i don't want my users to close the program
the mayonly hide it.

canclose := false in the CanClose event doesn't work then windows95 will not shutdown. since the program get's loaded every time the computer boots this is no good.

and i want the program to stop when it gets the message to reboot the system.

thanx for your time
0
Comment
Question by:mories
  • 2
  • 2
4 Comments
 
LVL 3

Accepted Solution

by:
Pegasus100397 earned 150 total points
ID: 1349944
Mories,

on the MAIN form of the application, set biSystemMenu (under BorderIcons) to FALSE, this will disable closing.

Good luck with your project!
Pegasus
0
 
LVL 1

Author Comment

by:mories
ID: 1349945
thank you very much, for the quick answer...
0
 
LVL 1

Author Comment

by:mories
ID: 1349946
the cross disappears, but pressing alt-f4 on the keyboard still close the app..
0
 
LVL 3

Expert Comment

by:Pegasus100397
ID: 1349947
Oh ok! Sorry about missing the Alt-F4 part.

When the main form recieves the WM_CLOSE windows message it's "default" action is just to close the application (if the main form is showing). We need to inhibit this action by "handling" (ignoring) the WM_CLOSE message, thereby preventing the application from shutting down.

In the Private declarations section of the main form, let's declare the message handler:

procedure WMCLOSE(Var: TWMClose);
       Message WM_CLOSE;

now in the IMPLEMENTATION section let's put the actual code to handle the WM_CLOSE message:

procedure TForm1.WMCLOSE(Var Msg: TWMClose);
begin
Msg.Result := 0;   {If you want the app to ignore the close command}

* or *

Form1.Close   {if you REALLY wanted to close it}
end;

Good luck with your project!
Pegasus
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

809 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