"The parameteter is incorrect"

This forum is designated to discuss SiComponents Scheduling Agent.
Post Reply
orlando
Posts: 5
Joined: Fri Sep 15, 2006 9:50 pm

"The parameteter is incorrect"

Post by orlando »

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;
===============================
isiticov
Site Admin
Posts: 2383
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

Could you please try to use Deactivate(True) instead of UpdateTriggers?
Best regards,
Igor Siticov.
isiticov
Site Admin
Posts: 2383
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

Btw: Does the demo project work the same on your PC?
Best regards,
Igor Siticov.
orlando
Posts: 5
Joined: Fri Sep 15, 2006 9:50 pm

Post by orlando »

isiticov wrote:Could you please try to use Deactivate(True) instead of UpdateTriggers?
I tried that and still received the same message.

And yes, the demo program gave the same error.

Is there a permissions issue in XP that I need to look at?
isiticov
Site Admin
Posts: 2383
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

Under what kind of user you're logged? May be you're right, and this is permission issue.
Best regards,
Igor Siticov.
Post Reply