oemxp 发表于 2009-11-14 13:40:42

请问如何禁止复制文本框里的文本

本帖最后由 oemxp 于 2009-11-14 22:28 编辑

下面是自动换行和不让编辑,请问如何不让复制文本框里的内容?

$Edit = GUICtrlCreateEdit("", 0, 0, 640, 480, $WS_VSCROLL+$ES_READONLY)

下面这个软件就不能用鼠标操作文本框,但下面这个也不完美,用键盘还是可以操作的

http://www.autoitx.com/attachment.php?aid=MTIzNnwzNDhmMDI5YXwxMjU4MTA1MDE1fDM5NjVsQkhNTUJPM3lwZkVWSm5SQnFGMXJWN3ZMdkxrV3dtM1hUa0ZTOThiT1lz

lanfengc 发表于 2009-11-14 18:23:35

While 1
        Sleep(200)
        clearclp()
WEnd

Func clearclp()
        ClipPut("")       
EndFunc

在你的程序的While循环里加上清空剪切板的操作。能达到相同的目的

oemxp 发表于 2009-11-14 20:07:50

本帖最后由 oemxp 于 2009-11-14 20:17 编辑

楼上的兄弟,谢谢,但我试了无效,windows2003操作系统。
下面这个软件就不能用鼠标操作文本框,但下面这个也不完美,用键盘还是可以操作的

http://www.autoitx.com/attachment.php?aid=MTIzNnwzNDhmMDI5YXwxMjU4MTA1MDE1fDM5NjVsQkhNTUJPM3lwZkVWSm5SQnFGMXJWN3ZMdkxrV3dtM1hUa0ZTOThiT1lz

afan 发表于 2009-11-14 20:29:44

本帖最后由 afan 于 2009-11-14 20:43 编辑

让其失去焦点,不能选择
或者
直接改用Label控件岂不更好

oemxp 发表于 2009-11-14 21:14:57


上图为软件效果,文本很多要有滚动条,用Label控件不太合适!~

pusofalse 发表于 2009-11-14 21:16:51

#include <WinAPI.au3>
#include <GUIEdit.au3>
#include <WindowsConstants.au3>

$hGUI = GUICreate("Test", 400, 300)
$iEdit = GUICtrlCreateEdit("", 5, 5, 390, 290, bitOR($WS_VSCROLL, $ES_WANTRETURN))
$hC = DllCallbackRegister("_EditProc", "int", "hWnd;uint;wparam;lparam")
$hOEC = _WinAPI_SetWindowLong(GUICtrlGetHandle($iEdit), -4, DllCallbackGetPtr($hC))

GUISetState()
Do
Until GUIGetMsg() = -3

Func _EditProc($hWnd, $iMsg, $iwParam, $ilParam)
        If $iMsg = $WM_COPY Then Return 1
        Return _WinAPI_CallWindowProc($hOEC, $hWnd, $iMsg, $iwParam, $ilParam)
EndFunc        ;==>_EditProc

oemxp 发表于 2009-11-14 21:32:43

楼上的代码CPU占用100分100,且我要显示的正常字符也显示不出来了

pusofalse 发表于 2009-11-14 21:34:15

Re 7#:
你的测试方法有问题,或者你的AU3版本有问题。

oemxp 发表于 2009-11-14 21:40:18

本帖最后由 oemxp 于 2009-11-14 21:55 编辑

可以了调试好了!是我AU3版本太老了,原来你的代码是右键有复制,但复制不进去剪切板!真是非常非常感谢!~

catcher 发表于 2009-11-14 21:50:46


pusofalse 发表于 2009-11-14 21:16 http://www.autoitx.com/images/common/back.gif
这个代码可以的啊,非常好!
虽然右键可以复制,但不会记录你的操作,粘贴到的内容是你在此次复制之前的内容。
收下。

oemxp 发表于 2009-11-14 22:22:47

新问题,以下代码CPU占用100分100如何解决,这回绝对不是AU3版本的问题了!

#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_icon=图标项1_1.ico
#AutoIt3Wrapper_outfile=软件说明必看.exe
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Res_Comment=就要当网管 www.91dwg.com 说明文件
#AutoIt3Wrapper_Res_Description=就要当网管 www.91dwg.com 说明文件
#AutoIt3Wrapper_Res_LegalCopyright=就要当网管 www.91dwg.com 说明文件
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#Region ;**** 参数创建于 AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_UseAnsi=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include "resources.au3"
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIConstants.au3>
#include <IE.au3>
#include <WindowsConstants.au3>
#notrayicon

$oIE = _IECreateEmbedded ()
$GUI = GUICreate("说明必看 就要当网管 www.91dwg.com", 640, 480, 76, 40)
$GUIX = GUICtrlCreateObj($oIE, 10, 68, 0, 0)
$iEdit = GUICtrlCreateEdit("test", 5, 5, 390, 290, bitOR($WS_VSCROLL, $ES_WANTRETURN))
$hC = DllCallbackRegister("_EditProc", "int", "hWnd;uint;wparam;lparam")
$hOEC = _WinAPI_SetWindowLong(GUICtrlGetHandle($iEdit), -4, DllCallbackGetPtr($hC))

Opt("GUIOnEventMode", 1)
GUISetOnEvent($GUI_EVENT_CLOSE, "Event") ;关闭
GUISetState(@SW_SHOW)
Do
Until GUIGetMsg() = -3   

Func _ReduceMemory($i_PID = -1)
      If $i_PID <> -1 Then
                Local $ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $i_PID)
                Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', $ai_Handle)
                DllCall('kernel32.dll', 'int', 'CloseHandle', 'int', $ai_Handle)
      Else
                Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', -1)
      EndIf

      Return $ai_Return
EndFunc   ;==>_ReduceMemory

Func _EditProc($hWnd, $iMsg, $iwParam, $ilParam)
      If $iMsg = $WM_COPY Then Return 1
      Return _WinAPI_CallWindowProc($hOEC, $hWnd, $iMsg, $iwParam, $ilParam)
EndFunc      ;==>_EditProc

Func Event()
        Switch @GUI_CtrlId
        Case $GUI_EVENT_CLOSE
        Exit
        EndSwitch
EndFunc

While 1
        Sleep(10)
        _ReduceMemory(@AutoItPID)
WEnd

oemxp 发表于 2009-11-14 22:28:16

晕,自己搞好了,去掉下面这两句就OK了

Do
Until GUIGetMsg() = -3

wangwen916 发表于 2009-11-15 03:12:35

梦游路过................

johnwenyao 发表于 2009-11-21 14:48:01

呵呵,下来看看啊。

damoo 发表于 2014-3-23 23:42:06

这个实现有意思
页: [1] 2
查看完整版本: 请问如何禁止复制文本框里的文本