#include once "window9.bi"

Function GadgetX(ByVal gadget As long) As Long Export
	Dim As RECT  r
	Dim As Point pt
	GetWindowRect(GadgetID(gadget),@r)
	pt.x = r.left: pt.y = r.top
	ScreenToClient(GetParent(GadgetID(gadget)),@pt)
	Return Cast(Long,pt.x)
End Function