Gui in a class

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
teadrinker
Posts: 4389
Joined: 29 Mar 2015, 09:41
Contact:

Re: Gui in a class

21 Oct 2019, 13:08

toralf wrote: But what I need is the hwnd of the GUI. Since the object is registered with the hwnd of the GUI

Code: Select all

inst := new MyGui

class MyGui
{
   __New() {
      Gui, New, +hwndhGui
      Gui, Add, Button, hwndhButton gMyGui.On_Button, Click to see handles
      Gui, Add, Text, y+10 Right, % "Button HWND: " . hButton
      Gui, Add, Text, wp Right, % "Gui HWND: " . hGui
      Gui, Show, w300 h100
   }
   
   On_Button() {
      MsgBox, % Format("This: {:#x}`nGui HWND: {:#x}`nA_Gui: {:#x}", this
                                                                   , DllCall("GetAncestor", "Ptr", this, "UInt", GA_ROOT := 2, "Ptr")
                                                                   , A_Gui)
   }
}

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: pgeugene and 80 guests