#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 299, 136, 192, 114)
$Label1 = GUICtrlCreateLabel("禁止粘贴", 8, 8, 52, 17)
$Input1 = GUICtrlCreateInput("", 32, 48, 225, 21)
$wProcOld = GUIRegisterMsgEx($Input1, "_MyWindowProc") ;窗口子类化
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
GUIDelete($Form1)
Exit
EndSwitch
WEnd
Func GUIRegisterMsgEx($ctrID, $funcName) ;控件id,函数名
Local $wProcNew = DllCallbackRegister($funcName, "ptr", "hwnd;uint;long;ptr")
Local $wProcOld = _WinAPI_SetWindowLong(GUICtrlGetHandle($ctrID), $GWL_WNDPROC, DllCallbackGetPtr($wProcNew))
Return $wProcOld
EndFunc ;==>GUIRegisterMsgEx
Func _MyWindowProc($hWnd, $uiMsg, $wParam, $lParam)
Switch $uiMsg
Case $WM_PASTE
Return 0 ;不处理这个消息
EndSwitch
;向默认窗口进程传递未处理过的消息
Return _WinAPI_CallWindowProc($wProcOld, $hWnd, $uiMsg, $wParam, $lParam)
EndFunc ;==>_MyWindowProc
|