View previous topic :: View next topic |
Author |
Message |
petrossa
Joined: 12 Aug 2008 Posts: 23
|
Posted: Sat Sep 13, 2008 5:30 pm Post subject: Setting Time using ITaskSettings interface |
|
|
Using any method/property that takes a date/time as documented format (The format for this string is PnYnMnDTnHnMn etc) throws an exception.
At first i quessed i did it wrong, but i ran the provided Delphi Demo and tried to set a setting it gave the same exception.
see screenshot www.petrossa.com/error.jpg
Every tasksetting accepting these strings gets weird. I got it to accept PT1M for DeleteExpiredTaskAfter, but then it throws an EndBoundary exception. The task enddate has been set. |
|
Back to top |
|
 |
petrossa
Joined: 12 Aug 2008 Posts: 23
|
Posted: Thu Sep 18, 2008 6:03 am Post subject: |
|
|
is there anyway of knowing if this post is under evaluation? |
|
Back to top |
|
 |
isiticov Site Admin
Joined: 21 Nov 2002 Posts: 2112
|
Posted: Thu Sep 18, 2008 7:17 am Post subject: |
|
|
yes, we're trying to reproduce this now. |
|
Back to top |
|
 |
isiticov Site Admin
Joined: 21 Nov 2002 Posts: 2112
|
Posted: Thu Sep 18, 2008 11:18 am Post subject: |
|
|
In C++ Demo project there is code under:
Code: | void __fastcall TMainForm::Runnotepadexeeachdayat09001Click(
TObject *Sender) |
which sets end date:
Code: | Task->Triggers->Items[0]->EndDate = Date() + 30; // will be executed during 1 month
Task->Triggers->Items[0]->HasEndDate = true; |
Does it raises this error? If not, do you set the EndDate using the same way? |
|
Back to top |
|
 |
petrossa
Joined: 12 Aug 2008 Posts: 23
|
Posted: Thu Sep 18, 2008 4:33 pm Post subject: |
|
|
EndDate in itself doesn't really cause any problems.
i use
FTask->Triggers->operator [](MultipleActionsIndex)->EndDate=TEndDate->AsDate();
where TEndDate is a TEdit decendant with a TDateTime as member, it returns a valid TDateTime at all times. And that works ok.
Just when i do:
FTask->TaskDefinition->Settings->Set_RestartInterval("PT10M");
or
FTask->TaskDefinition->Settings->Set_ExecutionTimeLimit("PT1H");
the exception as shown in the screenshot occurs.
I just mentioned enddate because at 1 time it accepted
FTask->TaskDefinition->Settings->Set_RestartInterval("PT1M");
but then threw a fit at enddate.
So the real prob is not enddate but all the functions which use the Formatstring just are not agreeable.
I never compiled the C++demo, i only compiled the DelphiDemo because it had Vista implemented. The screenshot is from the Delphi demo.
Addendum:
FTask->Triggers->operator [](CurAction)->GetStartVistaDateTime();
works perfect,
but
TDateTime Dt=FTask->Triggers->operator [](CurAction)->BeginDate;
throws:
class EConvertError Invalid argument to date decode, as do EndDate, StartTime. |
|
Back to top |
|
 |
isiticov Site Admin
Joined: 21 Nov 2002 Posts: 2112
|
Posted: Thu Sep 18, 2008 5:26 pm Post subject: |
|
|
Uhh, I thought you was referring any problem with our code.
You can try to pass fully encoded time string like: "P0DT0H1M". |
|
Back to top |
|
 |
petrossa
Joined: 12 Aug 2008 Posts: 23
|
Posted: Fri Sep 19, 2008 4:17 pm Post subject: |
|
|
well, first thing i did before posting was trying:
PT1H
PT2H0M
P0M3D
P0Y0M1DT0H0M
which didnt work. So thats why i compiled YOUR delphidemo, tried to set the expiration limit with using your Properties Interface on an already preexisting task set by the native Windows TaskScheduler interface.
Didnt change a letter to the code. That gave me exactly the same error, as shown in the screenshot www.petrossa.com/error.jpg which shows your demo as you can see. |
|
Back to top |
|
 |
|