Code archives/BlitzPlus Gui/GetGadgetAtPosition

This code has been declared by its author to be Public Domain code.

Download source code

GetGadgetAtPosition by JoshK2010
You have to recompile win32maxgui with the hwnd map made public for this to work.
SuperStrict

Import maxgui.drivers

?win32
Import pub.win32

Extern "win32"
	Function WindowFromPoint:Int(x:Int,y:Int)
EndExtern

Function GetGadgetFromHwnd:TGadget(hwnd:Int)
	Return TGadget(TWindowsGUIDriver.GadgetMap.valueforkey(TIntWrapper.Create(hwnd)))
EndFunction

Function GetGadgetAtPosition:TGadget(x:Int,y:Int)
	Return GetGadgetFromHwnd(WindowFromPoint(x,y))
EndFunction
?

Comments

None.

Code Archives Forum