我想问一下,怎样用NetScheduleJobAdd设置程序的运行方式,还有在什么年什么月份运行
下面有代码,是抄的!
------------------------
unit insjob;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TAT_INFO = record
JobTime: DWord;
DaysOfMonth: DWord;
DaysOfWeek: UCHAR;
Flags: UCHAR;
Command: PWideChar;
end;
PAT_INFO = ^TAT_INFO;
NET_API_STATUS = LongInt;
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
function NetScheduleJobAdd(ServerName: PWideChar; Buffer: PAT_INFO; var JobID: PDWord): NET_API_STATUS;stdcall;
var
Form1: TForm1;
implementation
{$R *.DFM}
function NetScheduleJobAdd; external 'netapi32.dll' name 'NetScheduleJobAdd';
procedure TForm1.Button1Click(Sender: TObject);
var
ATInfo
AT_Info;
jobid
Dword;
begin
getmem(atinfo,sizeof(TAt_info));
getmem(jobid,sizeof(dword));
atinfo^.jobtime:=3*60*60*1000+15*60*1000;//miliseconds from midnight to 3:15
atinfo^.DaysOfMonth:=4294967295; //我想在2003年1月15日运行要怎样设置这里的值?
atinfo^.DaysOfWeek:=255;
atinfo^.command:='c:/showok.exe';
atinfo^.flags:=8; //我想只运行一次就删除任务,要怎样设置!
if NetScheduleJobAdd(nil,atinfo,jobid)<>2 then
showmessage('ok');
freemem(atinfo);
end;
end.
------------------------------------------
atinfo^.DaysOfMonth:=4294967295; //我想在2003年1月15日运行要怎样设置这里的值?
atinfo^.flags:=8; //我想只运行一次就删除任务,要怎样设置(应该在这里设置吧)!
帮忙!!!!!