S
shadow_x
Unregistered / Unconfirmed
GUEST, unregistred user!
代码:(这是拷贝的一个例子)
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, SvcMgr, Dialogs;
type
TService1 = class(TService)
procedure ServiceStart(Sender: TService;
var Started: Boolean);
procedure ServiceExecute(Sender: TService);
procedure ServiceStop(Sender: TService;
var Stopped: Boolean);
procedure ServicePause(Sender: TService;
var Paused: Boolean);
procedure ServiceContinue(Sender: TService;
var Continued: Boolean);
private
{ Private declarations }
fPaused : boolean;
public
function GetServiceController: TServiceController;
override;
{ Public declarations }
end;
var
Service1: TService1;
implementation
{$R *.DFM}
procedure ServiceController(CtrlCode: DWord);
stdcall;
begin
Service1.Controller(CtrlCode);
end;
procedure TService1.ServiceStop(Sender: TService;
var Stopped: Boolean);
begin
ServiceThread.Terminate;
fPaused := TRUE;
Stopped := TRUE;
end;
procedure TService1.ServicePause(Sender: TService;
var Paused: Boolean);
begin
Paused := True;
fPaused := TRUE;
end;
procedure TService1.ServiceContinue(Sender: TService;
var Continued: Boolean);
begin
Continued := True;
fPaused := FALSE;
end;
function TService1.GetServiceController: TServiceController;
begin
Result := ServiceController;
end;
procedure TService1.ServiceStart(Sender: TService;
var Started: Boolean);
begin
Started := TRUE;
end;
procedure TService1.ServiceExecute(Sender: TService);
begin
while not Terminateddo
begin
if not fPaused then
begin
Sleep(100);
showmessage('ok') //->这行代码不知道执行了没有??
end;
ServiceThread.ProcessRequests(FALSE);
end;
end;
end.
问题:showmessage那行的语句没有效果!
申明
1。编译时没有错误。
2。我在“开始->运行。。。”里安装了编译生成的EXE文件。project1.exe -install
3。我也在“开始->程序->管理工具->服务” 里找到了相关的服务项!可以启动,停止。。。
4。环境:Delphi 6.0,Windows 2000 server family
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, SvcMgr, Dialogs;
type
TService1 = class(TService)
procedure ServiceStart(Sender: TService;
var Started: Boolean);
procedure ServiceExecute(Sender: TService);
procedure ServiceStop(Sender: TService;
var Stopped: Boolean);
procedure ServicePause(Sender: TService;
var Paused: Boolean);
procedure ServiceContinue(Sender: TService;
var Continued: Boolean);
private
{ Private declarations }
fPaused : boolean;
public
function GetServiceController: TServiceController;
override;
{ Public declarations }
end;
var
Service1: TService1;
implementation
{$R *.DFM}
procedure ServiceController(CtrlCode: DWord);
stdcall;
begin
Service1.Controller(CtrlCode);
end;
procedure TService1.ServiceStop(Sender: TService;
var Stopped: Boolean);
begin
ServiceThread.Terminate;
fPaused := TRUE;
Stopped := TRUE;
end;
procedure TService1.ServicePause(Sender: TService;
var Paused: Boolean);
begin
Paused := True;
fPaused := TRUE;
end;
procedure TService1.ServiceContinue(Sender: TService;
var Continued: Boolean);
begin
Continued := True;
fPaused := FALSE;
end;
function TService1.GetServiceController: TServiceController;
begin
Result := ServiceController;
end;
procedure TService1.ServiceStart(Sender: TService;
var Started: Boolean);
begin
Started := TRUE;
end;
procedure TService1.ServiceExecute(Sender: TService);
begin
while not Terminateddo
begin
if not fPaused then
begin
Sleep(100);
showmessage('ok') //->这行代码不知道执行了没有??
end;
ServiceThread.ProcessRequests(FALSE);
end;
end;
end.
问题:showmessage那行的语句没有效果!
申明
1。编译时没有错误。
2。我在“开始->运行。。。”里安装了编译生成的EXE文件。project1.exe -install
3。我也在“开始->程序->管理工具->服务” 里找到了相关的服务项!可以启动,停止。。。
4。环境:Delphi 6.0,Windows 2000 server family