"Paul Steele" <pa*********@acadiau.ca> wrote in message
news:uo**************@TK2MSFTNGP14.phx.gbl...
Is there any way to check for open Explorer windows and if any are found,
tell Windows Explorer to close them. I don't want a brute force method of
killing Explorer and letting it restart. I'd prefer something a little
less drastic. I suspect what I'm going to need is some API call such as
SendMessage. Anybody have any suggestions?
I found half the answer to my original question. By using a combination of
the Windows API calls FindWindow and SendMessage, it's quite simple to close
an open Exporer window:
int iHandle=Win32.FindWindow("ExploreWClass" ,windowName);
int j=Win32.SendMessage(iHandle, Win32.WM_SYSCOMMAND, Win32.SC_CLOSE,
0);
The part I haven't figured out is how to get the name of any open windows in
Explorer. Having just the class name is not enough to get the window
handle. Another API call I suspect...