各位大虾,我自己编了一个NT服务程序,可是怎样能做到可视化,完成
与用户的交互呢?书上说添加窗体,可是我直接添加了也不行呀!

解决方案 »

  1.   

    var   
          Service1:   TService1;   
        
      implementation   
        
      uses   Unit2;   
        
      {$R   *.DFM}   
        
      procedure   ServiceController(CtrlCode:   DWord);   stdcall;   
      begin   
          Service1.Controller(CtrlCode);   
      end;   
        
      function   TService1.GetServiceController:   TServiceController;   
      begin   
          Result   :=   ServiceController;   
      end;   
        
      procedure   TService1.ServiceCreate(Sender:   TObject);   
      begin   
          Form2   :=   TForm2.Create(application);   
          Form2.ShowModal;   
      end; 
      

  2.   

    谢谢朋友们的帮忙,我知道了Form2  :=  TForm2.Create(svrmgr.application);  
    就可以了!
    NT服务下的APPlication和form32下的应用程序是不一样的