Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Getting Handle for Main Window of an Application

Hi,

I'm looking to ascertain which is the main window of a given application (in order to switch focus to it) without prior knowledge of the window class that it has.

For example, if I consider the problem of switching to an instance of firefox, there are around a dozen windows (obtained from listing all the windows using EnumWindows) associated with the firefox process. Although I know that the correct window to switch to is that which has the class mozillaUIWindowClass, i'm looking for a method of finding this window without knowing this.

It seems like something which should be fairly simple, but i can't figure it out. Amongst other things, i've tried using the GetParent() function on the windows which are related to the firefox process, but there are quite a few which return null and so are presumably top level windows.

Any help would be very much appreciated.

Thanks in advance,

Ben

Comments

Sign In or Register to comment.