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 

"The parameteter is incorrect"

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



Joined: 15 Sep 2006
Posts: 5

PostPosted: Tue Jan 09, 2007 6:51 pm    Post subject: "The parameteter is incorrect" Reply with quote

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;
===============================
Back to top
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2103

PostPosted: Wed Jan 10, 2007 3:53 am    Post subject: Reply with quote

Could you please try to use Deactivate(True) instead of UpdateTriggers?
Back to top
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2103

PostPosted: Wed Jan 10, 2007 3:56 am    Post subject: Reply with quote

Btw: Does the demo project work the same on your PC?
Back to top
View user's profile Send private message
orlando



Joined: 15 Sep 2006
Posts: 5

PostPosted: Wed Jan 10, 2007 6:16 pm    Post subject: Reply with quote

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


Joined: 21 Nov 2002
Posts: 2103

PostPosted: Thu Jan 11, 2007 3:53 am    Post subject: Reply with quote

Under what kind of user you're logged? May be you're right, and this is permission issue.
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