怎样把程序加到后台服务中去(0分)

  • 主题发起人 主题发起人 sunlp
  • 开始时间 开始时间
S

sunlp

Unregistered / Unconfirmed
GUEST, unregistred user!
怎样把程序加到后台服务中去
用程序实现
 
在Delphi中新建“Service Application”,代码如下:
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, SvcMgr, Dialogs;

type
TService1 = class(TService)
private
{ Private declarations }
public
function GetServiceController: TServiceController; override;
{ Public declarations }
end;

var
Service1: TService1;

implementation

{$R *.DFM}

procedure ServiceController(CtrlCode: DWord); stdcall;
begin
Service1.Controller(CtrlCode);
end;

function TService1.GetServiceController: TServiceController;
begin
Result := ServiceController;
end;

end.


注意,如果要与桌面交互,请将Interactive属性设置为True
 
后退
顶部