Skip to content
⌘ NSIS Forum Archive

Closing all explorer windows (not explorer.exe itself)

8 posts

chasetoys#

Closing all explorer windows (not explorer.exe itself)

Hey folks:

I'm using NSIS, and I have the exact same problem as covered in the following forum link. That is, I want to close down all explorer.exe windows, though not explorer.exe itself.

Here's the link:

Are you a developer who uses NSIS to distribute your application? Are you a Winamp plug-in developer who wants to use NSIS to distribute your plug-in? Have suggestions for other people like you? This is the place.


Here's the code (which I tried, and no explorer windows are closed... ideas?):

!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_SYSCOMMAND} 0xF060 0
SectionEnd
Afrow UK#
You got the class name wrong. kichik even said in that topic what the class name is.


FindWindow $R0 CabinetWClass
IsWindow $R0 0 +3
SendMessage $R0 ${WM_SYSCOMMAND} 0xF060 0
Goto -3
This will close all Windows Explorer windows.

-Stu
Takhir#
On my XP class is ExploreWClass
The same on 2003. And script works correct 🙂
CabinetWClass is MyComputer window class.
Afrow UK#
I tried ExploreWClass but it doesn't work. For me (XP) EnumWindows and RealGetWindowClass returned CabinetWClass.

-Stu
galil#
If you open explorer using Start>Programs or [WinKey]+E then you get the ExploreWClass class (Has Folder Tree View on by default)

If the opened explorer window doesn't have Tree View, the class is CabinetWClass.

So the script should be checking both.
chasetoys#
Thank you to everyone!!

This works great, and writes my dll & registers it without a hitch, and works great for uninstallation too!

I'm very happy with NSIS, and moreover, the great community here 🙂.

-chasetoys