Platform SDK Shell >> Refresh the Explrorer after programmatic [un]registration of a NSE

by Chuck Chopp » Fri, 11 Mar 2005 09:37:54 GMT

Is there anything else special that RegSvr32.exe does beyond calling the
DllRegisterServer() & DllUnregisterServer() functions in a DLL that
implements a COM object?

The reason that I ask is that I'm looking at having an application program
deliberately call these 2 functions in a namespace extension DLL that I've
written. This all seems to be working OK w/respect to getting my NSE
registered or unregistered. However, there's one thing that I'm trying to
tidy up a bit.

The remaining task is to figure out how to tell all instances of the Windows
Explorer to refresh themselves upon the addition or removal of the NSE. It
seems that this must be done manually when RegSvr32 registers my NSE, but
when the NSE is unregistered, open instances of the Windows Explorer seem to
automatically remove my NSE's root folder from their displays within seconds
after RegSvr32 terminates. I've studied RegSvr32 while it works and have
monitored it with Spy++ and I don't see it generating any Windows
messages/events to trigger this. I suppose that rules out the SendMessage()
& PostMessage() API functions, but maybe there's something to be done with
SHChangeNotify() that can trigger this refresh of all instances of the explorer.

Any ideas?


TIA,

Chuck
--
Chuck Chopp

ChuckChopp (at) rtfmcsi (dot) com http://www.rtfmcsi.com

RTFM Consulting Services Inc. 864 801 2795 voice & voicemail
103 Autumn Hill Road 864 801 2774 fax
Greer, SC 29651

Do not send me unsolicited commercial email.


Platform SDK Shell >> RE: Refresh the Explrorer after programmatic [un]registration of a NSE

by v-raygon » Fri, 11 Mar 2005 13:34:27 GMT


We provide a sample code to describe what regsvr32 does inside. you may
find it at:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcsample/ht
ml/vcsamregsvrsampleinvokesselfregistrationcode.asp


explorer.

It does not send any message to notify shell to do the refresh. It is shell
who queries registry when demanded (eg. invalidate the view or open a
folder to cause an update on the tree....)

Thanks,
Rhett Gong [MSFT]
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.




Platform SDK Shell >> Refresh the Explrorer after programmatic [un]registration of a NSE

by Chuck Chopp » Fri, 11 Mar 2005 21:00:15 GMT





Thanks. That's helpful to have on hand just to verify what it is that
RegSvr32 is actually doing.


OK, then the shell must be doing some sort of automatic refresh at some time
interval. When I unregister my NSE while the shell is showing the contents
of the desktop namespace, my NSE's root folder immediately disappears.
Perhaps the shell is in fact monitoring the registry for NSE-related changes
and updates itself accordingly.

I'll just make a note that it may be necessary for the user to manually
refresh open instances of the explorer if the NSE gets dynamically
registered at some time after the user has logged on.


--
Chuck Chopp

ChuckChopp (at) rtfmcsi (dot) com http://www.rtfmcsi.com

RTFM Consulting Services Inc. 864 801 2795 voice & voicemail
103 Autumn Hill Road 864 801 2774 fax
Greer, SC 29651

Do not send me unsolicited commercial email.


Refresh the Explrorer after programmatic [un]registration of a NSE

by Chuck Chopp » Sat, 12 Mar 2005 03:52:54 GMT

Hmmm.... I found it. It wasn't in the RegSvr32 code... it was actually a
few lines of code within DllUnregisterServer() that's making the
SHChangeNotify() call to refresh the Explorer shell. All I needed to do was
to add this to the DllRegisterServer() function and it behaves exactly the
way I wanted it to behave.


--
Chuck Chopp

ChuckChopp (at) rtfmcsi (dot) com http://www.rtfmcsi.com

RTFM Consulting Services Inc. 864 801 2795 voice & voicemail
103 Autumn Hill Road 864 801 2774 fax
Greer, SC 29651

Do not send me unsolicited commercial email.