?
Solved

hide program from ctrl+alt+del window

Posted on 2000-02-07
6
Medium Priority
?
213 Views
Last Modified: 2012-05-04
How do I hide my program from the close program dialog that pops when I press CTRL+ALT+DEL ?
0
Comment
Question by:drnadeem
  • 4
  • 2
6 Comments
 
LVL 12

Accepted Solution

by:
rwilson032697 earned 60 total points
ID: 2499027
You can do it like this:

    unit Unit1;

    interface

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

    type
      TForm1 = class(TForm)
        Button1: TButton;
        procedure FormDestroy(Sender: TObject);
        procedure FormCreate(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;

    var
      Form1: TForm1;

    implementation

    {$R *.DFM}
    const
      RSP_SIMPLE_SERVICE = 1;
      RSP_UNREGISTER_SERVICE = 0;

    function  RegisterServiceProcess(dwProcessID,dwType : DWORD) : DWORD;
    stdcall; external 'KERNEL32.DLL';

    procedure TForm1.FormDestroy(Sender: TObject);
    begin
      RegisterServiceProcess(GetCurrentProcessID,RSP_UNREGISTER_SERVICE);
    end;

    procedure TForm1.FormCreate(Sender: TObject);
    begin
      RegisterServiceProcess(GetCurrentProcessID,RSP_SIMPLE_SERVICE);
    end;

    end.

Cheers,

Raymond.
0
 
LVL 12

Expert Comment

by:rwilson032697
ID: 2499030
You may also want to remove the taskbar icon for your application. You can do that like this:

ShowWindow(Application.Handle, SW_HIDE);

Cheers,

Raymond.
0
 
LVL 1

Author Comment

by:drnadeem
ID: 2499278
This doesn't work, when I put it on the form.oncreate event handler. other part is OK. Any ideas?

ShowWindow(Application.Handle, SW_HIDE);

0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
LVL 1

Author Comment

by:drnadeem
ID: 2499297
This doesn't work, when I put it on the form.oncreate event handler. other part is OK. Any ideas?

ShowWindow(Application.Handle, SW_HIDE);

0
 
LVL 12

Expert Comment

by:rwilson032697
ID: 2499298
Here is another approach from my PAQs...

First create a unit ex. called RunFirst.pas, where the only conents is that the gobal variabel IsLibrary is set to true... hereby the Application thinks that it exists inside a DLL file, and will not create the icon. After this the IsLibrary variabel should be set to false in your project file (DPR).

Exampel:


unit RunFirst;



interface



implementation



initialization

  IsLibrary := True;

end.

I reset the IsLibrary just after telling the Application that it should not show my main form, like this :


begin

  Application.Initialize;

  Application.ShowMainForm := False; // You may not need this...

  IsLibrary := False;

  ...

end;


0
 
LVL 12

Expert Comment

by:rwilson032697
ID: 2499300
Here is another approach from my PAQs...

First create a unit ex. called RunFirst.pas, where the only conents is that the gobal variabel IsLibrary is set to true... hereby the Application thinks that it exists inside a DLL file, and will not create the icon. After this the IsLibrary variabel should be set to false in your project file (DPR).

Exampel:


unit RunFirst;



interface



implementation



initialization

  IsLibrary := True;

end.

I reset the IsLibrary just after telling the Application that it should not show my main form, like this :


begin

  Application.Initialize;

  Application.ShowMainForm := False; // You may not need this...

  IsLibrary := False;

  ...

end;


0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

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…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
There may be issues when you are trying to access Outlook or send & receive emails or due to Outlook crash which leads to corrupt or damaged PST file. To eliminate the corruption from your PST file, you need to repair the corrupt Outlook PST file. U…
The video will let you know the exact process to import OST/PST files to the cloud based Office 365 mailboxes. Using Kernel Import PST to Office 365 tool, one can quickly import numerous OST/PST files to Office 365. Besides this, the tool also comes…
Suggested Courses

601 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