Win9x The hidden program does not appear in the Ctrl+alt+del dialog box

Source: Internet
Author: User
Tags header

windows95/98 How do I hide an application and not let it appear in the Ctrl-alt-del dialog box?

An easy way to hide your application from the Ctrl-alt-del dialog box is to go to the application title. If the main window of a program is not titled, Windows95 does not put it in the Ctrl-alt-del dialog box. The best place to clear the caption properties is in the WinMain function.

WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
   try
   {
      Application->Title = "";
      Application->Initialize();
      Application->CreateForm(__classid(TForm1), &Form1);
      Application->Run();
   }
   catch (Exception &exception)
   {
      Application->ShowException(&exception);
   }
   return 0;
}

Alternatively, call the registerserviceprocess API function to register the program as a service-mode program. RegisterServiceProcess is a function that is relevant in Kernel32.dll but does not have an official file. There is no prototype description of the function in the MS SDK header file, but it is found in the Borland import libraries for C + + Builder. Obviously, the primary purpose of this function is to create a service mode program. Obviously, it's because MSDN doesn't actually say anything about this function.

The following example code demonstrates how to use RegisterServiceProcess to hide your program from the Ctrl-alt-del dialog box under WINDOWS95/98.

------------Header File------------------------------
typedef DWORD (__stdcall *pregfunction) (DWORD, DWORD);
Class Tform1:public Tform
{
__published:
TButton *button1;
Private
HINSTANCE Hkernellib;
Pregfunction registerserviceprocess;
Public
__fastcall TForm1 (tcomponent* Owner);
__fastcall ~tform1 ();
};
-----------CPP File------------------------------
#include "Unit1.h"
#define RSP_SIMPLE_SERVICE 1
#define RSP_UNREGISTER_SERVICE 0
__fastcall Tform1::tform1 (tcomponent* Owner)
: Tform (Owner)
{
Hkernellib = LoadLibrary ("kernel32.dll");
if (hkernellib)
{
RegisterServiceProcess = (pregfunction) GetProcAddress (Hkernellib, "registerserviceprocess");
if (registerserviceprocess)
RegisterServiceProcess (GetCurrentProcessId (), rsp_simple_service);
}
}
__fastcall Tform1::~tform1 ()
{
if (hkernellib)
{
if (registerserviceprocess)
RegisterServiceProcess (GetCurrentProcessId (), rsp_unregister_service);
FreeLibrary (Hkernellib);
}
}
//-------------------------------------------------

Note: There is no registerserviceprocess function under Windows NT.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.