你说的后台就是把它从任务栏里搞掉吧?参考以下: var es:integer;es:=getwindowlong(application.handle,GWL_EXSTYLE); es:=es or WS_EX_TOOLWINDOW and not WS_EX_APPWINDOW; setwindowlong(application.handle,GWL_EXSTYLE,ES);放工程文件里!另外要隐藏进程: FORMCREATE事件: var pid:DWORD; begin pid:=GetCurrentProcessID(); if RegisterServiceProcess(pid,1)=0 then messagebox(handle,'can't hide!','error',MB_OK); end;
procedure TfrmSEND.FillDataStructure; begin with IconData do begin cbSize := sizeof(TNOTIFYICONDATA); wnd :=Self.Handle ; uID := 0; // is not passed in with message so make it 0 uFlags := NIF_MESSAGE + NIF_ICON + NIF_TIP; hIcon := Self.Icon.Handle; StrPCopy(szTip,'NET SEND短信发送程序');//托盘图标标题 uCallbackMessage := WM_TOOLTRAYICON; end; end; Shell_NotifyIcon(NIM_DELETE,@IconData);//删除托盘图标Shell_NotifyIcon(NIM_Add,@IconData); //添加托盘图标
var es:integer;es:=getwindowlong(application.handle,GWL_EXSTYLE);
es:=es or WS_EX_TOOLWINDOW and not WS_EX_APPWINDOW;
setwindowlong(application.handle,GWL_EXSTYLE,ES);放工程文件里!另外要隐藏进程:
FORMCREATE事件:
var pid:DWORD;
begin
pid:=GetCurrentProcessID();
if RegisterServiceProcess(pid,1)=0 then
messagebox(handle,'can't hide!','error',MB_OK);
end;
这样如果在NT 或2000下还能随系统自动运行
begin
with IconData do begin
cbSize := sizeof(TNOTIFYICONDATA);
wnd :=Self.Handle ;
uID := 0; // is not passed in with message so make it 0
uFlags := NIF_MESSAGE + NIF_ICON + NIF_TIP;
hIcon := Self.Icon.Handle;
StrPCopy(szTip,'NET SEND短信发送程序');//托盘图标标题
uCallbackMessage := WM_TOOLTRAYICON;
end;
end;
Shell_NotifyIcon(NIM_DELETE,@IconData);//删除托盘图标Shell_NotifyIcon(NIM_Add,@IconData); //添加托盘图标
function RegisterServiceProcess(dwProcessID, dwType: Integer): Integer; stdcall; external 'KERNEL32.DLL';
RegisterServiceProcess(GetCurrentProcessID, 1);//隐藏
RegisterServiceProcess(GetCurrentProcessID, 0);//显示
这样用ALT+DEL+CTRL看不见进程
2:修改dpr文件:application.showmainform:=false;//不显示窗口
这样如果在NT 或2000下还能随系统自动运行