Jump to content

Getting the active GUI.


therks
 Share

Recommended Posts

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?

Link to comment
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¥Ñ± ÌäìÌäì¤
Link to comment
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.

Link to comment
Share on other sites

  • Moderators

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.

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

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...