View previous topic :: View next topic |
Author |
Message |
partha
Joined: 10 May 2005 Posts: 5
|
Posted: Tue May 10, 2005 6:50 am Post subject: Error Modifying Trigger Type |
|
|
Hello,
I am using the following code with D7:
Task.Activate;
with Task.Triggers.Add do begin
TriggerType := ttDaily; // adding this line produces the error
BeginDate := ...;
EndDate := ...;
StartTime := ...;
Duration := ...;
Interval := ...;
end;
Task.Triggers.UpdateTriggers;
Task.Deactivate(True);
but I get an EOleSysError error "The parameter is incorrect". If I comment the line:
TriggerType := ttDaily;
everything works fine.
How can I overcome this problem?
thanks and regards,
Partha |
|
Back to top |
|
 |
isiticov Site Admin
Joined: 21 Nov 2002 Posts: 2129
|
Posted: Tue May 10, 2005 3:24 pm Post subject: |
|
|
You have to specify TriggerDetails when setting TriggerType to ttDaily:
Code: |
var
TriggerDetails: TTriggerDetails;
begin
with Scheduler.CreateNewItem(Format('New task %d', [GetTickCount])) do
begin
ApplicationName := ParamStr(0);
Triggers.Add;
Triggers[0].TriggerType := ttDaily;
Triggers[0].StartTime := IncHour(Now, 1);
Triggers[0].BeginDate := Date;
Triggers[0].EndDate := Date + 30;
Triggers[0].HasEndDate := False;
TriggerDetails.Daily.DaysInterval := 1; // check this line!
Triggers[0].Details := TriggerDetails; // check this line!
Triggers[0].Duration := 24 * 60;
Triggers[0].Interval := 10;
// could be used UpdateTriggers and Save
Triggers.UpdateTriggers;
Save;
// or just Deactivate(True)
//Deactivate(True);
end;
end; |
|
|
Back to top |
|
 |
|