#Include once "window9.bi"

Function UndoEditor(ByVal gadget As Integer) As Integer Export
  Return SendMessage(GadgetID(gadget),EM_UNDO,0,0)
End Function

Function RedoEditor(ByVal gadget As Integer) As Integer Export
  Return SendMessage(GadgetID(gadget),1108,0,0)
End Function

Function PasteEditor(ByVal gadget As Integer, ByVal text As String , ByVal param As BOOL=1) As Integer Export
  Return SendMessage(GadgetID(gadget),EM_REPLACESEL,param,Cast(LPARAM,StrPtr(Text)))
End Function

Function CanUndoEditor(ByVal gadget As Integer) As Integer Export
  Return SendMessage(GadgetID(gadget),EM_CANUNDO,0,0)
End Function

Function CanRedoEditor(ByVal gadget As Integer) As Integer Export
  Return SendMessage(GadgetID(gadget),(&H400 + 85),0,0)
End Function

Function EmptyUndoBufferEditor(ByVal gadget As Integer) As Integer Export
  Return SendMessage(GadgetID(gadget),EM_EMPTYUNDOBUFFER,0,0)
End Function

Function SetModifyEditor(ByVal gadget As Integer, ByVal flag As Integer=0) As Integer Export
  Return SendMessage(GadgetID(gadget),em_SetModify,flag,0)
End Function

Function SetPasswordChar(ByVal gadget As Integer, ByVal CharCode As UBYTE=0) As Integer Export
  Return SendMessage(GadgetID(gadget),em_SetPasswordChar,CharCode,0)
End Function

Function GetPasswordChar(ByVal gadget As Integer) As UByte Export
  Return SendMessage(GadgetID(gadget),em_GetPasswordChar,0,0)
End Function

Function GetModifyEditor(ByVal gadget As Integer) As Integer Export
  Return SendMessage(GadgetID(gadget),em_GetModify,0,0)
End Function

Function GetRectEditor(ByVal gadget As Integer, ByVal rect As RECT Ptr) As integer Export
  Return SendMessage(GadgetID(gadget),EM_GetRect,0,Cast(LPARAM,rect))  
End Function

Function SetLimitTextEditor(ByVal gadget As Integer, ByVal limit As Integer=0) As integer Export
  Return SendMessage(GadgetID(gadget),em_LimitText,limit,0)  
End Function

Function SetRectEditor(ByVal gadget As Integer, ByVal rect As RECT Ptr) As integer Export
  Return SendMessage(GadgetID(gadget),EM_SetRect,0,Cast(LPARAM,rect))  
End Function

