How to hide the app under Windows9598 Do not let it appear in the CTRL-Alt-Del dialog?

zhaozj2021-02-17  82

A simple way to hide your app from the Ctrl-Alt-Del dialog is to go to the application's title. If the main window of a program is not headline, Windows95 does not put it in the CTRL-Alt-Del dialog. The best place to clear the title attribute 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;

Another way is to call the RegisterServiceProcess API function to register the program into a service mode program. RegisterServiceProcess is a function that is related but no official files in kernel32.dll. There is no prototype instructions for this function in the MS SDK header file, but can be found in Borland Import Libraries for C Builder. Obviously, the main purpose of this function is to create a service mode program. The reason why it is obvious because it does not say anything about this function in MSDN.

The following example code demonstrates how to hide your program from the Ctrl-ALT-Del dialog box under Windows95 / 98. File: // ------------ 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 ();}; file : // ----------- 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); FreeElibrary (Hkernellib);}} file: // -------------------------------------------------------------------------------------------------------------------------------------------------------- ------------------- Note: There is no RegisterServiceProcess function under Windows NT.

转载请注明原文地址:https://www.9cbs.com/read-31394.html

New Post(0)