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.
Setting Time using ITaskSettings interface
In C++ Demo project there is code under:
which sets end date:
Does it raises this error? If not, do you set the EndDate using the same way?
Code: Select all
void __fastcall TMainForm::Runnotepadexeeachdayat09001Click(
TObject *Sender)
Code: Select all
Task->Triggers->Items[0]->EndDate = Date() + 30; // will be executed during 1 month
Task->Triggers->Items[0]->HasEndDate = true;
Best regards,
Igor Siticov.
Igor Siticov.
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.
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.
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.
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.