如果不是在进程管理器里面隐藏,那么看你想干什么了。1。showwindow(application.handle,sw_hide);2。别用任何form,就在主线程里面循环监测消息队列。一个*.dpr文件足够写一个这样的程序。uses windows,messages,sysutils;var msg:tmsg; begin while getmessage(msg,0,0,0) do begin case msg.message of //这里你可以监测接受的消息,便于和其他进程通信。 else begin translatemessage(msg); dispatchmessage(msg); end; end; end;end;
windows,messages,sysutils;var
msg:tmsg;
begin
while getmessage(msg,0,0,0) do
begin
case msg.message of
//这里你可以监测接受的消息,便于和其他进程通信。
else
begin
translatemessage(msg);
dispatchmessage(msg);
end;
end;
end;end;
showwindow(form1.handle,sw_hide);
showwindow(application.handle,sw_hide);两句都不能少了。或者:
在工程文件中加入:
Application.ShowMainForm := false;
program Project1;uses
Forms,windows,Dialogs,
Unit1 in 'Unit1.pas' {Form1};{$R *.res}begin
Application.Initialize;
showmessage('1111');
Application.Run;
end.
Application.ShowMainForm := false; 或者
showwindow(form1.handle,sw_hide);//隐藏窗体showwindow(application.handle,sw_hide);//隐藏工程
Form.Create中写:
Setwindowlong(Application.handle,GWL_EXSTYLE,WS_EX_TOOLWINDOW);
WindowState:=wsMinimized;