我的下列程序在启动服务时,提示错误,不能启动!不知道错在哪儿,谢谢!!
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.
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.
如何编写WindowsNT服务?
调用函数 :ShellExec(路径,nil,nil,SW_SHOW);
有几个参数我记不得了,反正一个是路径名,最后一个是SW_SHOW,其他的都用0或者是nil.