Is there a way I can find out if a given path is on a drive on the user's PC vs. a remote drive on a LAN. The path could be a UNC, a mapped drive, a local drive or no drive spec. The UNC could still be the local machine.
My question is how to find a child window!
well, I know that I can use FindWindow("hwndclass", NULL); but how to find a child window of a program? I tried using FindWindow() but it couldn't recognize the child window... is there any way?
FindWindowEx allows you to specify a parent handle, and will search only for children of that parent window.
So you find the parent window, then call FindWindowEx using the parent window handle as the starting search point.
There is one VERY important caveat:
FindWindowEx will ONLY find FIRST generation children.
Suppose for example, your top level window is a dialog box. The Dialog has a frame control. The window you want to find is a child of the frame.
Calling FindWindowEx using the parent will find the frame. But it will not find your desired window, because it only searches direct children.
So your strategy in this case would be:
1) Get dialog handle.
2) Use dialog handle as parent and find handle to the frame.
3) Then use the frame handle, NOT the dialog handle, as the new parent and continue the search.
This will now find your target because it is a direct child of the frame, not the dialog.
Because windows hierarchies can be complex, you need to use a tool like Spy which can show the relationships of a window. Then base you search strategy based on how Spy shows you the windows are related.
but does this also work with a popup window?
I mean, many programs have option window... let's take Yahoo for example, if I click on option from the menu then a popup window will come and disable the main yahoo list, so can I also use FindWindowEx to find this popup window?
Well, usually the use of FindWindowEx implies that you are finding and possibly manipulating windows in a program external to your own program, because you should already inherently know how to find all windows your own program creates.
So, assuming you are doing what I think you are doing, the answer is yes, because the popup is modal to the browser window that spawned it, but it is not modal to your own program. So yes, you can still execute code and should be able to find it. Again, use Spy to help you design the strategy to find the popup.
I have a program that creates a browser window and then navigates to a site page that displays a popup modal dialog. I have no problems finding the login dialog, and entering the login automatically.
So I think the answer to your question is yes, unless you are doing something really weird.
when I try using spy++ then I found that the class of the windows is #32770 (Dialog) and the window caption is option, and when I use FindWindow() and use SendMessage() to close it, nothing happen!
HWND optionwindow =::FindWindow(NULL, "option");
or HWND optionwindow =::FindWindow("#32770", NULL);
or even HWND optionwindow =::FindWindow("#32770", "option");
I'm writing again since nobody has answered my previous post about the strange error I get under win98/ME and 2000 (debug assertion failure at daocore.cpp @ line 453, but the code actually works perfect under winxp sp2.