Registriert seit: 26. Jul 2005
Ort: Wolfsburg
9 Beiträge
Delphi 7 Professional
|
Re: Problem bei TJclTaskTrigger
31. Jul 2008, 09:46
Hallo,
versuchs mal so:
Delphi-Quellcode:
procedure TForm1.Button2Click(Sender: TObject);
var
myTask:TJclTaskSchedule;
ATask:TJclScheduledTask;
piNewTrigger:Word;
ppTrigger:ITaskTrigger;
pTrigger:_TASK_TRIGGER;
myYear:Word;
myMonth:Word;
myDay:Word;
myTriggerTypeUnion:TRIGGER_TYPE_UNION;
myWeekly:TWeekly;
begin
myTask:=TJclTaskSchedule.Create;
ATask:=myTask.Add('Test Task');
ATask.ApplicationName:='C:\Windows\notepad.exe';
ATask.WorkingDirectory:='C:\windows\';
//ATask.AccountName:='';
//ATask.Password:='';
ATask.ScheduledWorkItem.CreateTrigger(piNewTrigger,ppTrigger);
DecodeDate(Now,myYear,myMonth,myDay);
ZeroMemory(@pTrigger, sizeof(TASK_TRIGGER));
pTrigger.cbTriggerSize:=sizeof(TASK_TRIGGER);;
pTrigger.Reserved1:=0;
pTrigger.wBeginYear:=myYear;
pTrigger.wBeginMonth:=myMonth;
pTrigger.wBeginDay:=myDay;
pTrigger.wEndYear:=0;
pTrigger.wEndMonth:=0;
pTrigger.wEndDay:=0;
pTrigger.wStartHour:=10;
pTrigger.wStartMinute:=00;
pTrigger.MinutesDuration := 0;
pTrigger.MinutesInterval := 0;
pTrigger.rgFlags := 0;
pTrigger.TriggerType:= TASK_TIME_TRIGGER_DAILY;
MyWeekly.WeeksInterval:=1;
MyWeekly.rgfDaysOfTheWeek:= TASK_SUNDAY +
TASK_MONDAY +
TASK_TUESDAY +
TASK_WEDNESDAY +
TASK_THURSDAY +
TASK_FRIDAY +
TASK_SATURDAY;
MyTriggerTypeUnion.Weekly:=MyWeekly;
pTrigger.Type_:= MyTriggerTypeUnion;
pTrigger.Reserved2:=0;
pTrigger.wRandomMinutesInterval := 0;
ppTrigger.SetTrigger(pTrigger);
ATask.Save;
FreeAndNil(myTask);
end;
Gruß Frank
|
|
Zitat
|