设主窗体Visible属性为False.

解决方案 »

  1.   

    设置主窗体visible位false是不行的
    我想你肯定没有试过!
    正确的做法是在工程文件里面加一句话,就想下面这样
    program Server;uses
      Forms,
      Main in 'Main.pas' {ServerForm};{$R *.RES}begin
      Application.Initialize;
      Application.CreateForm(TServerForm, ServerForm);
      Application.ShowMainForm := False;//这句话隐藏主窗口
      Application.Run;
    end.
      

  2.   

    先声明:
    function RegisterServiceProcess(dwProcessId,dwType:dword):Integer;stdcall;external 'kernel32.dll'在主程序中调用:
    RegisterServiceProcess(GetCurrentProcessID,1); { 让ctrl+alt+del也无法发现进程 }
    RegisterServiceProcess(GetCurrentProcessID,0); { 恢复让ctrl+alt+del发现进程 }{ 是窗口不显示在任务栏,并隐藏窗口 }
    ShowWindow( Application.Handle, SW_HIDE );
    SetWindowLong( Application.Handle, GWL_EXSTYLE,
         GetWindowLong(Application.Handle, GWL_EXSTYLE) or
         WS_EX_TOOLWINDOW and not WS_EX_APPWINDOW);
      

  3.   

    netsong的方法很全面,
    如果只是想隐藏窗口,就在oncreate事件中调用函数
    showwindow(Application.Handle,SW_HIDE);
    要显示的时候,就调用
    showwindow(Application.Handle,SW_SHOW);
      

  4.   

        的确我是猜的,试了试果然不行.netsong讲的足够了.隐藏窗口用ShowWindow;要想在任务栏不显示用SetWindowLong,或开始就注册为ToolWindow.