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 

DeleteTrigger issue

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



Joined: 27 Jan 2012
Posts: 10

PostPosted: Thu Mar 08, 2012 4:14 am    Post subject: DeleteTrigger issue Reply with quote

Running on Windows XP, when a task has more than 1 trigger, deleting any trigger except the last one will generate OLE error 80004005. E.g.

- task has 3 triggers
- run DeleteTrigger(0) to delete the first trigger
- deactivate task
- OLE error 80004005 is raised

or

- task has 3 triggers
- run DeleteTrigger(1) to delete the second trigger
- deactivate task
- OLE error 80004005 is raised

I tried saving the changes immediately after deleting the trigger, and this seems to resolve the issue, but I don't know for sure if this is the right way to go about it.

Before:
procedure TTriggers.Delete(Index: Integer);
begin
if not Self.FTaskItem.FTaskManager.RunningVistaOrLater then
begin
with FTaskItem.FInterface as ITask do
OleCheck(DeleteTrigger(Word(Index)));
Items[Index].Free;
end
else
FTaskItem.FTaskDefinition.Triggers.Remove(Word(Index+1));
end;


After:
procedure TTriggers.Delete(Index: Integer);
begin
if not Self.FTaskItem.FTaskManager.RunningVistaOrLater then
begin
with FTaskItem.FInterface as ITask do
OleCheck(DeleteTrigger(Word(Index)));

with FTaskItem.FInterface as IPersistFile do
OleCheck(Save(nil, True));

Items[Index].Free;
end
else
FTaskItem.FTaskDefinition.Triggers.Remove(Word(Index+1));
end;
Back to top
View user's profile Send private message
yeohray



Joined: 27 Jan 2012
Posts: 10

PostPosted: Thu Mar 08, 2012 4:23 am    Post subject: Reply with quote

Look like I should have done the following instead:

- task has 3 triggers
- run DeleteTrigger(0) to delete the first trigger
- save task
- deactivate trigger
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