Determine if Win Explorer windows are open
-
In VC++ and MFC: is it possible to find out that one or more Windows Explorer windows are open?
I think you could use the
EnumProcesses()
function as described in this sample[^].Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman
-
I think you could use the
EnumProcesses()
function as described in this sample[^].Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman
-
In VC++ and MFC: is it possible to find out that one or more Windows Explorer windows are open?
this might work: 1. EnumerateDesktopWindows to get a list of top-level windows 2. for each of those, use GetWindowProcessThreadId to get the process ID that owns the window. 3. follow the steps here http://stackoverflow.com/questions/4570174/how-to-get-process-name-in-c[^] to get the module name. 4. look for "explorer.exe"
-
I think that normally Explorer is permanently load in memory. My interest is that it opened a window or more windows,
Here is one way to do this - Use
EnumProcesses
to enumerate all running processes. For each process id returned, callGetProcessImageFileName
to check if it belongs to explorer.exe You will need to doOpenProcess
on the process id to get its handle. After you get the process id of explorer.exe, enumerate all open windows usingEnumWindows
. For each window handle returned, use it in the functionGetWindowThreadProcessId
to check if it belongs to explorer.exe This process of finding open explorer.exe windows could be time consuming. Another way to do this would be to write a Browser Helper Object (BHO) which explorer.exe windows will load on startup. In the BHO you can keep track of open explorer windows and more. Here is some more information on BHOs - Browser Helper Objects: The Browser the Way You Want It[^] Here is how to build a BHO using Visual Studio - Building Browser Helper Objects with Visual Studio 2005[^]«_Superman_» _I love work. It gives me something to do between weekends.
-
In VC++ and MFC: is it possible to find out that one or more Windows Explorer windows are open?
Hi, You could create a ShellWindows object[^] and call get_Count(); Something like this:
INT GetExplorerCount()
{
LONG lCount = 0;
IShellWindowsPtr shell;
shell.CreateInstance(__uuidof(ShellWindows));
shell->get_Count(&lCount);
return lCount;
}Don't forget to CoInitialize. Also keep in mind that Internet Explorer and Windows Explorer are integrated... you will need to add some code to filter out instances of IE. Control panel windows are also shell windows. Best Wishes, -David Delaune