Page 1 of 1

"The parameteter is incorrect"

Posted: Tue Jan 09, 2007 6:51 pm
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;
===============================

Posted: Wed Jan 10, 2007 3:53 am
by isiticov
Could you please try to use Deactivate(True) instead of UpdateTriggers?

Posted: Wed Jan 10, 2007 3:56 am
by isiticov
Btw: Does the demo project work the same on your PC?

Posted: Wed Jan 10, 2007 6:16 pm
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?

Posted: Thu Jan 11, 2007 3:53 am
by isiticov
Under what kind of user you're logged? May be you're right, and this is permission issue.