Jump to content

Find a window by the name of one of his controls

Recommended Posts


I am trying to get a handle to the main Google Desktop floating window. However it has no window name and no text in it. It has a classname, but it is different depending on which computer you are! That is, in every computer where the GoogleDesktop is installed, the classname of the floating search window is different!

The only information that seems to always be the same is that the floating window contains an edit box called _GD_QueryEdit_1 (or something like that, I don't remenber right now). So I tried to search select the edit box by putting an empty window name and text on the Control functions, but this does not work. I also tried a similar trick with WinGetHandle, but it does not work either. I also tried to use a "partial" classname (because the classnames of the floating window always start with "ATT:" but it cannot find the window either.

So is there some other solution or is there a way to find a window by knowing the name of one of its controls?



Link to post
Share on other sites

This is an interesting problem. I would suggest using WinList() and then something like ControlSetText() on every window until there's no @Error:

Local $I, $WinHandle, $WinList = WinList()
For $I = 1 To $WinList[0][0]
    ControlSetText($WinList[$I][1], '', '_GD_QueryEdit_1', 'The desired text')
    If Not @Error Then
        $WinHandle = $WinList[$I][1]

If Not $WinHandle Then MsgBox(0x30, 'Error', 'The window was not found.')

If you don't want to modify the window or its controls in any way, simply replace ControlSetText() above with any other command that accepts a control ID and throws an @Error when that control doesn't exist.

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...