The Demo program that comes with SiComponents VCL Scheduling Agent is giving me the error "The parameter is incorrect".
The sample code (below) you provided another person in this forum gives the same error at the line: Triggers.UpdateTriggers;
What am I doing wrong? I have Windows XP with Delphi 2006.
Thanks
===============================
Code:
procedure TMainForm.Runnotepadexeeachdayat09001Click(Sender: TObject);
var
TriggerDetails: TTriggerDetails;
ST: TSystemTime;
begin
try
with Scheduler.CreateNewItem(Format('New task %d', [GetTickCount])) do
begin
ApplicationName := 'notepad.exe';
Triggers.Add;
Triggers[0].TriggerType := ttDaily;
// create start time data
DateTimeToSystemTime(Now, ST);
ST.wHour := 9;
ST.wMinute := 0;
ST.wSecond := 0;
ST.wMilliseconds := 0;
Triggers[0].StartTime := SystemTimeToDateTime(ST);
Triggers[0].BeginDate := Date;
Triggers[0].EndDate := Date + 30; // will be executed during 1 month
Triggers[0].HasEndDate := True;
TriggerDetails.Daily.DaysInterval := 1;
Triggers[0].Details := TriggerDetails; // trigger details must be changed only this way
// could be used UpdateTriggers and Save
Triggers.UpdateTriggers;
// to set-up a task for user w/o password
// use the code below
{Flags := Flags + [tfRunOnlyIfLoggedOn];
SetAccountInformation(GetOSUser, '');}
Save;
// or just Deactivate(True)
//Deactivate(True);
end;
finally
acRefresh.Execute;
end;
end;
===============================