Sign in to follow this  
Followers 0
therks

Getting the active GUI.

6 posts in this topic

Is there anyway to get a handle to the GUI which is current/active/switched to?

Like the return value from GUISwitch. If you pass GUISwitch a valid GUI handle, it returns the handle to the GUI that was previously "active". I tried just passing a bogus handle to GUISwitch, something like:

Func GUIGetCurrent()
  $hCurrent = GUISwitch(WinGetHandle(''))
  GUISwitch($hCurrent)
  Return $hCurrent
EndFunc

But that didn't work. Any ideas? Or is this not possible?

Share this post


Link to post
Share on other sites



Is there anyway to get a handle to the GUI which is current/active/switched to?

Like the return value from GUISwitch. If you pass GUISwitch a valid GUI handle, it returns the handle to the GUI that was previously "active". I tried just passing a bogus handle to GUISwitch, something like:

Func GUIGetCurrent()
  $hCurrent = GUISwitch(WinGetHandle(''))
  GUISwitch($hCurrent)
  Return $hCurrent
EndFuncoÝ÷ Ø­¶­v'gßÛp¢¹(y«®+-+'¢Úh²Èïêº^Z­iº.¶Øb±«­¢+ØÀÌØí¡
ÕÉɹÐô]¥¹Ñ!¹±¡]¥¹ÑQ¥Ñ± ÌäìÌäì¤

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Opt("WinTitleMatchMode", 4)

WinGetHandle( "active")

"active" matches the currently active window (same as "" in the default WinTitleMatchMode).

Edited by quaizywabbit

[u]Do more with pre-existing apps![/u]ANYGUIv2.8

Share this post


Link to post
Share on other sites

I think I may have misrepresented what I want...

I don't want the active (ie: currently in use) window (which is what both your replies will net me). I want the "current" GUI window. ie: The handle to the GUI that would receive the next control. It's not urgent, nor even important at the moment, I was just wondering if it was possible.

Thanks anyway.

Share this post


Link to post
Share on other sites

I think I may have misrepresented what I want...

I don't want the active (ie: currently in use) window (which is what both your replies will net me). I want the "current" GUI window. ie: The handle to the GUI that would receive the next control. It's not urgent, nor even important at the moment, I was just wondering if it was possible.

Thanks anyway.

Have you looked at IsChild / GetParent APIs maybe?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

No I have not (yet). Sorry for the (very delayed) reply. That is a good idea, you've got me thinking now...

Something like this (pseudo code):

Func GetCurrent
  $dummy = GuiCtrlCreateDummy
  $parent = DllCall(... GetParent of $dummy)
  GuiCtrlDelete($dummy)
  return $parent
EndFunc

Thanks for the idea Smoke!

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  
Followers 0