Solved

how to diable ALT-F4 in win95

Posted on 1998-02-24
1
138 Views
Last Modified: 2010-04-06
Hi,
How to disable the Alt-F4 from terimating the program in win95 ?
from
hl ding
0
Comment
Question by:dhl
1 Comment
 
LVL 5

Accepted Solution

by:
inter earned 100 total points
ID: 1359766
This is how I do it in Delphi 2.0. You can close the prog from taskbar-rightclick-close but not via ALT-F4

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
    procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
    procedure FormKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
  private
    { Private declarations }
  public
    { Public declarations }
    KeyedClose : boolean;
  end;

var
  Form1: TForm1;

implementation

uses database, mainfrm;

{$R *.DFM}

procedure TForm1.FormCreate(Sender: TObject);
begin
  KeyedClose := True;
end;

procedure TForm1.FormCloseQuery(Sender: TObject;
  var CanClose: Boolean);
begin
 CanClose := KeyedClose;
 KeyedClose := True;
end;

procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  KeyedClose := True;
  if ssAlt in Shift then
    if (Key and vk_F4) <> 0 then
       KeyedClose := False;
end;

end.

0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
This video discusses moving either the default database or any database to a new volume.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

708 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

12 Experts available now in Live!

Get 1:1 Help Now