改天再发上来。。。 做个记号。 #include <WinAPI.au3>
If not IsDeclared("WM_CHAR") Then CONST $WM_CHAR = 0x102
If not IsDeclared("WM_PASTE") Then CONST $WM_PASTE = 0x302
If not IsDeclared("WM_SETTEXT") Then CONST $WM_SETTEXT = 0xc
$hGUI = GUICreate("Test", 200, 100)
$iIptTest = GUICtrlCreateInput("", 20, 20, 160, 20)
$hIpt = GUICtrlGetHandle(-1)
$hIptProc = DllCallbackRegister("_IptProc", "int", "hWnd;uint;wparam;lparam")
$pIptProc = DllCallbackGetPtr($hIptProc)
$hOldProc = _WinAPI_SetWindowLong($hIpt, -4, $pIptProc)
GUISetState()
Do
Until guiGetMsg() = -3
Func _IptProc($hWnd, $iMsg, $wParam, $lParam)
ConsoleWrite("0x" & Hex($iMsg) & @CRLF)
If $iMsg = $WM_CHAR Then
If $wparam <> 8 And StringRegExp(Chr($wparam), "") = 0 Then
_WinAPI_MessageBeep(2)
Return False
EndIf
ElseIf $iMsg = $WM_PASTE Then
If StringRegExp(ClipGet(), "[\x20-\x7f]") Then Return False
ElseIf $iMsg = $WM_SETTEXT Then
_WinAPI_MessageBeep(2)
Return False
EndIf
Return _WinAPI_CallWindowProc($hOldProc, $hWnd, $iMsg, $wParam, $lParam)
EndFunc ;==>_IptProc()代码能不能修改成只能前17位是数字 第18位可以是数字和字母?
页:
1
[2]