#include once "window9.bi"

Function GetGadgetText Alias "GetGadgetText" (ByVal gadget As Integer,ByVal num As Byte=1) As String Export
	Dim As Integer L=GetWindowTextLength(GadgetID(gadget))
	Dim As Byte Ptr fbguiTextBuffer = Allocate (L+1)
	SendMessage(GadgetID(gadget),WM_GETTEXT,L+1,Cast(LPARAM,fbguiTextBuffer))
	Function = PeekS(fbguiTextBuffer)
	DeAllocate (fbguiTextBuffer)	
End Function
