Jump to content

Function to get Readonly attribute


mgsram
 Share

Recommended Posts

Hi,

I need to get the read only attribute of a control (say edit box, combo box etc). The control that I am talking about is a windows control and the control is not created using the AutoIt. Kindly let me know how to get the read only attribute of the control. I have tried using GUICtrlGetState but this doesn't seem to work (may be because the control is not created using Autoit).

Thanks in advance for your valuable time and help.

Link to comment
Share on other sites

What do you mean by "get the read only attribute"? You want to query the control to determine if it is set to read only? Or you want to actually set/unset the read only attribute? If you are looking to set/unset Read only attribute from an edit control in an external application, try this:

eg:

#Include <GuiEdit.au3>
opt("WinTitleMatchMode",2)

Run("Notepad")
$hWnd = ControlGetHandle("Notepad","","Edit1")

msgbox(0,"","Setting Notepads Edit control to read only")
_GUICtrlEdit_SetReadOnly($hWnd, True)

Sleep(5000)

msgbox(0,"","Setting back to normal")
_GUICtrlEdit_SetReadOnly($hWnd, False)
Link to comment
Share on other sites

Hello,

Thanks a lot for the reply. I want to query the control to determine if a control (like an edit control) is set to readonly. I need a function that can give me the information if the control is readonly. This control that I am talking about is not created using Autoit.

What do you mean by "get the read only attribute"? You want to query the control to determine if it is set to read only? Or you want to actually set/unset the read only attribute? If you are looking to set/unset Read only attribute from an edit control in an external application, try this:

eg:

#Include <GuiEdit.au3>
opt("WinTitleMatchMode",2)

Run("Notepad")
$hWnd = ControlGetHandle("Notepad","","Edit1")

msgbox(0,"","Setting Notepads Edit control to read only")
_GUICtrlEdit_SetReadOnly($hWnd, True)

Sleep(5000)

msgbox(0,"","Setting back to normal")
_GUICtrlEdit_SetReadOnly($hWnd, False)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...