#include once "window9.bi"

Function GetGadgetState(ByVal NumberGadget As Integer) As Integer Export
  Dim As HWND GID=GetProp(GadgetID(NumberGadget),"addparam60000"),GID1=Cast(HWND,GadgetID(NumberGadget))
  If GadgetClass(GID)=14 Then '"MSCTLS_UPDOWN32"
    return  SendMessage(GID,WM_USER+104,0,0)
  ElseIf GadgetClass(GID1)=8 Then 'ProgressBar
    Return SendMessage(GID1,(WM_USER+8),0,0)
  Else
    If  IsDlgButtonChecked(GetParent(GId1),NumberGadget )=BST_CHECKED Then
      Return 1
    ElseIf IsDlgButtonChecked(GetParent(GId1),NumberGadget )=BST_INDETERMINATE Then
      Return 2
    ElseIf IsDlgButtonChecked(GetParent(GID1),NumberGadget )=BST_UNCHECKED Then
      Return 0
    End If
  End If
End Function

