#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>
$hGUI = GUICreate('_ControlGetType Demo')
$iButton = GUICtrlCreateButton('Button', 10, 20)
GUICtrlSetTip(-1, _ControlGetType(-1))
$iCheckBox = GUICtrlCreateCheckbox('CheckBox', 10, 50)
GUICtrlSetTip(-1, _ControlGetType(-1))
$iLabel = GUICtrlCreateLabel('Label', 10, 80)
GUICtrlSetTip(-1, _ControlGetType(-1))
$iEdit = GUICtrlCreateEdit('Edit', 10, 110, 100, 40)
GUICtrlSetTip(-1, _ControlGetType(-1))
$iInput = GUICtrlCreateInput('Input', 10, 160, 100, 30)
GUICtrlSetTip(-1, _ControlGetType(-1))
$iList = GUICtrlCreateList('List', 10, 200, 100, 40)
GUICtrlSetTip(-1, _ControlGetType(-1))
$iIcon = GUICtrlCreateIcon('shell32.dll', -5, 10, 240, 32, 32)
GUICtrlSetTip(-1, _ControlGetType(-1))
GUISetState(@SW_SHOW, $hGUI)
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Func _ControlGetType($hCtrl)
If Not IsHWnd($hCtrl) Then
$hCtrl = GUICtrlGetHandle($hCtrl)
EndIf
Local $sClassName = _WinAPI_GetClassName($hCtrl)
Local $iStyle = BitAND(_WinAPI_GetWindowLong($hCtrl, $GWL_STYLE), 0xF)
Switch $sClassName
Case 'Button'
Switch $iStyle
Case 0, $BS_DEFPUSHBUTTON ; BS_PUSHBUTTON = 0x0
Return 'Button'
Case $BS_3STATE, $BS_AUTO3STATE, $BS_CHECKBOX, $BS_AUTOCHECKBOX
Return 'Checkbox'
Case $BS_RADIOBUTTON, $BS_AUTORADIOBUTTON
Return 'Radio'
Case $BS_GROUPBOX
Return 'Groupbox'
Case $BS_PUSHBOX
Return 'Pushbox'
Case 8, $BS_OWNERDRAW ; BS_USERBUTTON = 0x0008
Return 'Owner-drawn button'
Case $BS_SPLITBUTTON, $BS_DEFSPLITBUTTON
Return 'Split button'
Case $BS_COMMANDLINK, $BS_DEFCOMMANDLINK
Return 'Command link'
EndSwitch
Case 'Edit'
Switch $iStyle
Case $ES_MULTILINE
Return 'Edit'
Case Else
Return 'Input'
EndSwitch
Case 'Static'
Switch $iStyle
Case $SS_ICON
Return 'Icon'
Case $SS_BITMAP
Return 'Pic'
Case Else
Return 'Label'
EndSwitch
EndSwitch
Return $sClassName
EndFunc