tfRunOnlyIfLoggedOn Flag
tfRunOnlyIfLoggedOn Flag
SiComponents seems to have trouble clearing the tfRunOnlyIfLoggedOn flag in the Flags property of TTaskItem. I need my task to run even if the user is not logged in, so I need to clear this flag which seems to get set by default. I'm currently testing using the Delphi Demo app, but everytime I clear the this flag it simply ignores the instruction and resets it. I've verified that the Demo code is actually attempting to clear the flag, the change just won't seem to stick. Any ideas?
Thanks
Thanks
Thank you for your information. We've found the reason for this. There is error in sources. For all who have registered version please modify sources of procedure TTaskItem.SetFlags(const Value: TTaskFlags); as following:
the last line of procedure before end; must be:
the last line of procedure before end; must be:
Code: Select all
OleCheck((FInterface as ITask).SetFlags(pdwFlags));
How about the Demo?
I'm using the demo version of VCL Scheduling Agent and having troubles with this issue. Has the demo code been updated?
Here's an example of my code:
Thanks,
Randy
Here's an example of my code:
Code: Select all
procedure TForm1.Button1Click(Sender: TObject);
var
TriggerDetails: TTriggerDetails;
ST: TSystemTime;
begin
TaskScheduler1.Active :=true;
with TaskScheduler1.CreateNewItem(Format('New task %d', [GetTickCount])) do
begin
ApplicationName := '\\rpm_server3\rpm1\public\osver.exe';
// create start time data
DateTimeToSystemTime(Now, ST);
ST.wHour := 1;
ST.wMinute := 0;
ST.wSecond := 0;
ST.wMilliseconds := 0;
SetAccountInformation('REELL\**********','**********');
Flags := Flags - [tfRunOnlyIfLoggedOn];
Triggers.Add;
Triggers[0].TriggerType := ttOnce;
Triggers[0].StartTime := SystemTimeToDateTime(ST);
Triggers[0].BeginDate := Date+1;
TriggerDetails.Daily.DaysInterval := 1;
Triggers[0].Details := TriggerDetails; // trigger details must be changed only this way
// could be used UpdateTriggers and Save
Triggers.UpdateTriggers;
Save;
// or just Deactivate(True)
//Deactivate(True);
end;
TaskScheduler1.Active := false;
end;
Randy
Still having trouble
I downloaded the demo again and tried it. Same problem. I then removed the Delphi package and reinstalled it. Same problem. Removed the component from the canvas. Still problem. Recommendations?
By the way - that's a very fast response. If I can get this to work I'll be buying a copy.
Thanks,
Randy
By the way - that's a very fast response. If I can get this to work I'll be buying a copy.
Thanks,
Randy