我的下列程序在启动服务时,提示错误,不能启动!不知道错在哪儿,谢谢!!
unit Start1;interfaceuses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, SvcMgr, Dialogs;type
  TTapStart = class(TService)
    procedure ServiceExecute(Sender: TService);
  private
    { Private declarations }
  public
    function GetServiceController: TServiceController; override;
    { Public declarations }
  end;var
  TapStart: TTapStart;implementation{$R *.DFM}procedure ServiceController(CtrlCode: DWord); stdcall;
begin
  TapStart.Controller(CtrlCode);
end;function TTapStart.GetServiceController: TServiceController;
begin
  Result := ServiceController;
end;procedure TTapStart.ServiceExecute(Sender: TService);
begin
 WinExec(Pchar(getcurrentdir+'\Tap.exe'),SW_SHOW);
 end;end.

解决方案 »

  1.   

    http://expert.csdn.net/Expert/topic/1112/1112612.xml?temp=.1130182
    如何编写WindowsNT服务?
      

  2.   

    引用单元 ShellApi
    调用函数 :ShellExec(路径,nil,nil,SW_SHOW);
    有几个参数我记不得了,反正一个是路径名,最后一个是SW_SHOW,其他的都用0或者是nil.
      

  3.   

    to DelUser(探索者),我用过的,根本不行,编译不过去!
      

  4.   

    to DelUser(探索者),我用过的,根本不行,编译不过去!
      

  5.   

    to qiqi97(飞翔的小菜鸟)你给的那个连接根本没有讲到这个问题!
      

  6.   

    1、路径对了没有?强烈建议使用GetModuleFileName(NULL,...)得到运行路径。2、服务缺省情况下是不允许有用户界面的,如果想有用户界面,必须指定SERVICE_INTERACTIVE_PROCESS标志,我不知道在TService里边是哪一个属性。3、因为服务没有用户界面,也就是没有建立窗口,所以没有线程消息循环。如果想在服务里边启动程序的话,必须先建立一个线程,再在线程里边调用ShellExecuteEx函数,然后指定标志SEE_MASK_FLAG_DDEWAIT,见MSDN说明:The SEE_MASK_FLAG_DDEWAIT flag must be specified if the thread calling ShellExecuteEx does not have a message loop or if the thread or process will terminate soon after ShellExecuteEx returns. Under such conditions, the calling thread will not be available to complete the DDE conversation, so it is important that ShellExecuteEx complete the conversation before returning control to the caller. Failure to complete the conversation can result in an unsuccessful launch of the document.URL : http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/structures/shellexecuteinfo.asp=================嘿嘿,我的确认为使用TService不够正宗,直接使用API才叫正宗!=================你发了一个帖子,叫什么“CSDN有没有高手?”,没有人有责任为你答问题,爱答就答,不爱答就不答,关你什么事?而且那个问题放在非技术区,非技术区的分数是不算到专家分里边的,我Faint!
      

  7.   

    那位高手能说一下什么时候能用到编写WINDOW NT 服务