Jump to content
Sign in to follow this  
Keymaker

Get handle to a window

Recommended Posts

Keymaker

I am writing a "wrapper" program for an audio player using AutoIT. I need the window handle so I can manipulate the windows controls. Unfortunately, the player's window title changes depending on which song or track is playing so I can't reliably use that to get the window handle.

The Process name does not change though. Is there a way I can get the window handle if I know the process name?

Thanks

Keymaker

Share this post


Link to post
Share on other sites
Jos

Have you checked with the supplied au3info.exe to see if you can identify the window on any other unique information?

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Keymaker

Have you checked with the supplied au3info.exe to see if you can identify the window on any other unique information?

Jos

Hello Jos,

Yes, I did. It has the ubiquitous #32770 as the class label.

However, the controls in the window are relatively unique, so if if there was way to enumerate the controls of a window, I could check all the windows of class #32770 and see which one had a certain control. That may be another option and any suggestions on how to acomplish that are welcome.

Thanks

Keymaker

Share this post


Link to post
Share on other sites
zfisherdrums

Hello Jos,

Yes, I did. It has the ubiquitous #32770 as the class label.

However, the controls in the window are relatively unique, so if if there was way to enumerate the controls of a window, I could check all the windows of class #32770 and see which one had a certain control. That may be another option and any suggestions on how to acomplish that are welcome.

Thanks

Keymaker

I like your workaround. Check out WinGetClassList for control class enumeration.

What may also work is to send a command to a control that you are reasonably assured will be unique to your app. For example, sending ControlGetHandle( "[CLASS:#32770]", "", "Play" ). If it returns a valid handle, you can obtain the parent window using _WinAPI_GetParent().

Hope this helped,

Zach Fisher...

Share this post


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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.