UnRegisterShellEvent returns False

delphi package - easy access to shell apis
Post Reply
zifnabbe
Posts: 7
Joined: Wed May 03, 2006 2:04 pm

UnRegisterShellEvent returns False

Post by zifnabbe »

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
zifnabbe
Posts: 7
Joined: Wed May 03, 2006 2:04 pm

Post by zifnabbe »

Mmm, I noticed that in version 1.3o of madShell the UnregisterShellEvent will always return false...

Did some further debugging and see that something else must be causing the AV, the debugging log just pointed me to a wrong assumption.

Would be nice to let the UnRegisterShellEvent return true at a certain moment.

Regards
madshi
Site Admin
Posts: 10339
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

Just checked the source code and you're right, UnregisterShellEvent always returns false! :sceptic:

Will change that in the next build - thanks for the report!

So the AV is not caused by madShell?
zifnabbe
Posts: 7
Joined: Wed May 03, 2006 2:04 pm

Post by zifnabbe »

So the AV is not caused by madShell?
Nope, not caused by madshell, the shellevents are working fine.
Post Reply