SiComponents Home Page SiComponents Forums
Here you will be able to get help and share your experience
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Error Modifying Trigger Type

 
Post new topic   Reply to topic    SiComponents Forums Forum Index -> VCL Scheduling Agent
View previous topic :: View next topic  
Author Message
partha



Joined: 10 May 2005
Posts: 5

PostPosted: Tue May 10, 2005 6:50 am    Post subject: Error Modifying Trigger Type Reply with quote

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
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2103

PostPosted: Tue May 10, 2005 3:24 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    SiComponents Forums Forum Index -> VCL Scheduling Agent All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by p h p B B  © 2001, 2005 p h p B B  Group