Jump to content

How to find class name for WinWaitActive?


Recommended Posts

Hi! You can get window class name by using _WinAPI_GetClassName function:
 https://www.autoitscript.com/autoit3/docs/libfunctions/_WinAPI_GetClassName.htm 

You'll need to give as first parameter at least a window title or a window handle.

If you don't know already before the window title, you can still obtain the window handle by using WinGetHandle function on an active window:

$hWnd = WinGetHandle("[ACTIVE]")

 

Edited by AlessandroAvolio
Link to comment
Share on other sites

The window has several controls. No program can currently read your mind and select the control you think. What you can do instead is have the list of all the controls. You can use the function WinGetClassList() that retrieves the classes from a window. :) 

#include <MsgBoxConstants.au3>

Main()

Func Main()

    ; Run Wordpad
    Run("write")

    ; Wait 10 seconds for the Notepad window to appear.
    Local $hWnd = WinWait("[CLASS:WordPadClass]", "", 10)

    ; Retrieve the classlist of the Wordpad window using the handle returned by WinWait.
    Local $sClassList = WinGetClassList($hWnd)

    ; Display the classlist.
    MsgBox($MB_SYSTEMMODAL, "", $sClassList)

    ; Close the Wordpad window using the handle returned by WinWait.

    WinClose($hWnd)

EndFunc

 

Link to comment
Share on other sites

1 hour ago, AlessandroAvolio said:

The window has several controls. No program can currently read your mind and select the control you think. What you can do instead is have the list of all the controls.

Who said anything about controls?  I think he just wants to know the class of the window so he can WinWait for it to show up.

Code hard, but don’t hard code...

Link to comment
Share on other sites

26 minutes ago, JockoDundee said:

Who said anything about controls?  I think he just wants to know the class of the window so he can WinWait for it to show up.

I'm sorry,I thought I was speaking to op... in fact at first I couldn't understand your answer, I ended up believing the author was asking me something more specific, with the help of a screenshot. I thought you were talking about controls having noticed a red box around RICHEDIT50W in the screenshot.  

Edited by AlessandroAvolio
Link to comment
Share on other sites

2 hours ago, AlessandroAvolio said:

with the help of a screenshot. I thought you were talking about controls having noticed a red box around RICHEDIT50W in the screenshot.  

No worries.  It wasn’t my screenshot, if it was I would have circled the class field.  OP probably figured it out by now.

Code hard, but don’t hard code...

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...