Archive: Killing all explorer windows


Killing all explorer windows
I guess this has been discussed before, but I can't find anything about this here (seems like stuff gets deleted pretty quick).

The problem is that I need to replace a .dll file that's used by the shell. In order to release it, all regentries are deleted, but sometimes open explorer windows also needs to be closed in order to delete the file.

I don't know what to search for when using FindWindow. Or is this better done with an external dll?

I could really need some help here :)

o_cee


Nothing gets deleted around here... Search the forum and you will find it if it has been discussed.

As far as I know there is no peacful way of restarting explorer. Most things that you think require explorer to be restarted can be done without it, especially in Windows NT and above. Try searching the web, I am sure you will not end up empty ended.


Well, I really don't need to restart explorer, just close down any active file browsing windows. (The dll is a plugin that acts on files right click menu, thus beeing activated when a file browser is open..)

No ideas? I don't need to close explorer.exe, not the entire process, just the filebrowsers.. Hope you understand what I mean.


o_cee


In that case all you need is a loop that finds any explorer windows (using FindWindow) and then send them WM_CLOSE. To find out the class name of explorer windows use Win32Spy. Both Windows XP and 98 explorer class name is "CabinetWClass" so it is a safe bet it is the same in all other versions of windows. I am not sure though that it is not used with any other windows... To find out the value of WM_CLOSE just use WinMessages.NSH. It defines all of Windows messages (SendMessage $R0 ${WM_CLOSE} 0 0).


Still don't get it right.

!Include WinMessages.NSH
Name ""
OutFile "exrunning.exe"
Section "Explorer running?"
FindWindow $R0 ExploreWClass
IsWindow $R0 ExRunning
Abort
ExRunning:
MessageBox MB_OK "ex running"
SendMessage $R0 ${WM_CLOSE} 0 0
SectionEnd

Win32Spy gives me "ExploreWClass" wich also is found by NSIS. But it doesn't accept the close command beeing sent anyway, absolutely nothing happens. Is there some difference with Windows XP?


Closing explorer windows doesn't work on Windows XP either...

I will keep looking.

Have you tried using UnregDll?


Yeah, but it still won't del the .dll if any windows are open..

Thanks for the help


o_cee


I am sorry but I have no more ideas... Try searching the web, I have no other suggestions.


I got a suggestion from a friend wich solved it.

SendMessage $R0 ${WM_SYSCOMMAND} 0xF060 0

0xF060 is SC_CLOSE.


:)

o_cee