有两种方法:
一种是showwindow(handle,sw_hide);
一种是这样:(BCB代码)
回复人:xycleo(虚竹) (2001-3-11 15:22:00) 得31分
下面的例子代码演示了在Windows95/98下怎样通过使用RegisterServiceProcess来把你的程序从CTRL-ALT-DEL对话框中隐藏起来。//------------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);
}
}
//-------------------------------------------------
一种是showwindow(handle,sw_hide);
一种是这样:(BCB代码)
回复人:xycleo(虚竹) (2001-3-11 15:22:00) 得31分
下面的例子代码演示了在Windows95/98下怎样通过使用RegisterServiceProcess来把你的程序从CTRL-ALT-DEL对话框中隐藏起来。//------------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);
}
}
//-------------------------------------------------
解决方案 »
- DBGridEh通过ini保存列宽和列位置
- 想买delphi 2005的最便宜的版本,是那一种?多少钱?
- 帮我一下忙好吗?非常感谢!
- 怎样将数据保存为Intel Hex格式的hex文件
- 我把参数传到一个prodedure 去执行,可是出错了,我看了好几遍了,大家帮忙
- 有难度的问题:谁知道怎样在程序运行时调出DBChart在设计时的Edit chart功能对话框
- !!!TWebBrowser是一个嵌入的OLE对象,如何初始化和终止化???
- syneditor如何获得选中文本的起始行号
- ADO连接,如何可以EDIT.TEXT中取得SA口令进行登录?(SQLSERVER2000)
- winexec()在D7中编译没有任何问题,可是在XE中运行就提示错误
- 如何在一个窗体内对动态产生的多个同名控件分别进行控制?
- 50分求winsock的delphi编程资料(中文),快拿分
procedure TfrmMain.FormCreate(Sender: TObject);
var
hTaskBar:Thandle; //window的任務條
TempHandle:Thandle; //window的桌面
begin
WindowState:=wsMaximized;
Color:=clBackground;
systemparametersinfo(spi_screensaverrunning,1,Nil,0); //使alt+tab,alt+ctrl+del失效
hTaskBar:=FindWindow('Shell_TrayWnd',Nil); //隱藏windows任務條
ShowWindow(hTaskBar,SW_HIDE);
TempHandle:=FindWindow('Progman',Nil); //隱藏windows的桌面
ShowWindow(TempHandle,SW_HIDE);
Test_wgTransparentButton.ControlStyle := Test_wgTransparentButton.ControlStyle + [csDoubleClicks];
end;procedure TfrmMain.FormClose(Sender: TObject;
var Action: TCloseAction);
var
hTaskBar:Thandle; //window的任務條
TempHandle:Thandle; //window的桌面
begin
systemparametersinfo(spi_screensaverrunning,0,Nil,0);//使alt+tab,alt+ctrl+del有效
hTaskBar:=FindWindow('Shell_TrayWnd',Nil); //恢復windows任務條
ShowWindow(hTaskBar,SW_SHOWNORMAL);
TempHandle:=FindWindow('Progman',Nil); //恢復windows桌面
ShowWindow(TempHandle,SW_SHOWNORMAL);
Action:=caFree; //手工釋放資源
end;
怎样才能使其不失效,但对话框内不显示该进程?
OpenProcess试过了,但不起作用
请各位帮忙,谢谢!
csdn里关于这个问题还有几百分可以拿!
可惜谁也没有拿到~~~
先定义
Function RegisterServiceProcess(dwProcessID,dwType:integer):integer;stdcall;external 'kernel32.dll';
然后使用函数:
RegisterServiceProcess(GetCurrentProcessID,1);例子如下:
implementation{$R *.DFM}Function RegisterServiceProcess(dwProcessID,dwType:integer):integer;stdcall;external 'kernel32.dll';procedure TForm1.FormCreate(Sender: TObject);
begin
RegisterServiceProcess(GetCurrentProcessID,1);
end;