UnRegisterShellEvent returns False
Posted: Thu Sep 07, 2006 9:37 am
Hi,
I've an application which uses several dll's depending on profiles etc. In one of the dll's I use RegisterShellEvent & UnRegisterShellEvent:
WriteToLog(Self, Format('Trying to monitor %s', [GetDataFile]), llTrace);
FActive := RegisterShellEvent(
ShellEvent,
GetDataFileDir,
false,
[seItemCreated, seItemChanged, seItemDeleted]
);
if FActive then
WriteToLog(Self, Format('Started monitoring of %s', [GetDataFile]), llTrace);
procedure TClientPrid.Stop;
begin
WriteToLog(Self, Format('Trying to unmonitor %s', [GetDataFile]), llTrace);
if UnRegisterShellEvent(ShellEvent) then
WriteToLog(Self, Format('Finished monitoring of %s', [GetDataFile]), llTrace);
FActive := False;
end;
In the log file, I see that the monitoring starten, but I see also that it never got to the finished point. ie I see the logmsg 'Trying to unmonitor', but not the message 'Finished monitoring' so I assume the UnRegisterShellEvent returns false.
I do also get an AV when destroying the dll. (normal I guess with the above issue)
Is there a way to find out why the UnRegister fails?
Thanks in advance
I've an application which uses several dll's depending on profiles etc. In one of the dll's I use RegisterShellEvent & UnRegisterShellEvent:
WriteToLog(Self, Format('Trying to monitor %s', [GetDataFile]), llTrace);
FActive := RegisterShellEvent(
ShellEvent,
GetDataFileDir,
false,
[seItemCreated, seItemChanged, seItemDeleted]
);
if FActive then
WriteToLog(Self, Format('Started monitoring of %s', [GetDataFile]), llTrace);
procedure TClientPrid.Stop;
begin
WriteToLog(Self, Format('Trying to unmonitor %s', [GetDataFile]), llTrace);
if UnRegisterShellEvent(ShellEvent) then
WriteToLog(Self, Format('Finished monitoring of %s', [GetDataFile]), llTrace);
FActive := False;
end;
In the log file, I see that the monitoring starten, but I see also that it never got to the finished point. ie I see the logmsg 'Trying to unmonitor', but not the message 'Finished monitoring' so I assume the UnRegisterShellEvent returns false.
I do also get an AV when destroying the dll. (normal I guess with the above issue)
Is there a way to find out why the UnRegister fails?
Thanks in advance