回复 5# afan
API怎么搞?
下面这样不行,A大帮看看。
#include <GUIComboBox.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiEdit.au3>
Global Const $GWL_STYLE = -16
Global $isReadOnly = 1
$Form = GUICreate("test", 200, 150)
$hEdit = GUICtrlCreateEdit("赐予我力量吧!", 20, 40, 160, 30, BitOR($ES_READONLY, $ES_AUTOVSCROLL, $ES_AUTOHSCROLL))
$Button1 = GUICtrlCreateButton("改变只读状态", 10, 90, 85, 40)
$Button2 = GUICtrlCreateButton("获取只读状态", 110, 90, 85, 40)
GUISetState()
While 1
$msg = GUIGetMsg()
Switch $msg
Case $GUI_EVENT_CLOSE
ExitLoop
Case $Button1
$isReadOnly = BitXOR($isReadOnly, 1)
_GUICtrlEdit_SetReadOnly($hEdit, $isReadOnly)
Case $Button2
Local $result = DllCall("User32.dll", "dword", "GetWindowLong", "hwnd", $Form, "int", $GWL_STYLE)
If BitAND($result[0], $ES_READONLY) = $ES_READONLY Then
MsgBox(0, "Edit控件样式", "只读")
Else
MsgBox(0, "Edit控件样式", "可写")
EndIf
EndSwitch
WEnd
|