Run the following code - move the mouse pointer to the desired control and press
F2.
IsEdit() will ascertain whether the control's contents are editable.
Code:
F2::
MouseGetPos,,,,CtrlID, 2
Result := IsEdit( CtrlID )
IfEqual, Result,-1, Msgbox, Not an Edit Control
IfEqual, Result, 0, Msgbox, Edit Control (Readonly)
IfEqual, Result, 1, Msgbox, Edit Control
Return
IsEdit( CtrlID=0x0 ) {
SendMessage, 0x00BA, 0, 0,, ahk_id %CtrlID% ; EM_GETLINECOUNT = 0x00BA
If (errorLevel > 0) {
ControlGet, Style, Style,,, ahk_id %CtrlID%
if (Style & 0x800) ; ES_READONLY = 0x800
Return 0
}
else
Return -1
Return 1
}
About IsEdit()
You have to pass the handle of a control and the function tries to fetch the line count of the control. SendMessage should probably fail if the control is not an EDIT or RichEDIT control. Next step involves ascertainment of whether the Edit control is Readonly or not.
IsEdit() shall return -1 for non-Edit controls, 0 for a readonly Edit control, and 1 for an editable Edit control.
PS: I have not tested it much except on Wordpad, Metapad, IE/WE address bar, Startmenu Run, Calculator, AHK GUI with a readonly Edit control.