⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 maskededit.asm

📁 这是asm驱动的开发包
💻 ASM
字号:
.code

;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
;                                       MaskedEditProc                                              
;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

MaskedEditProc proc uses edi ebx hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM

	invoke GetWindowLong, hWnd, GWL_USERDATA
	mov edi, eax
	mov ebx, [edi][256]

	; WM_NCDESTROY is the LAST message that a window will receive - 
	; therefore we must finally remove the old wndproc here
	.if uMsg == WM_NCDESTROY
		invoke free, edi

	.elseif uMsg == WM_CHAR

		invoke GetAsyncKeyState, VK_CONTROL		; allow clipboard works
		.if !( eax && 80000000h )
			mov eax, wParam
			and eax, 0FFh

			.if ( BYTE PTR [edi][eax] != TRUE) && !( eax == VK_BACK )
				xor eax, eax
				ret
			.endif
		.endif

	.endif

	invoke CallWindowProc, ebx, hWnd, uMsg, wParam, lParam

	ret

MaskedEditProc endp

;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
;                                    MaskEditControl                                                
;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

MaskEditControl proc uses esi edi ebx hwndEdit:HWND, pszMask:LPVOID, fOptions:BOOL

	; don't make a new mask if there is already one available
	invoke GetWindowLong, hwndEdit, GWL_WNDPROC
	mov ebx, eax

	.if ebx != MaskedEditProc
		invoke malloc, (256 + sizeof LPVOID)
		mov edi, eax
	.else
		invoke GetWindowLong, hwndEdit, GWL_USERDATA
		mov edi, eax
	.endif

	; build the mask lookup table. The method varies depending
	; on whether we want to allow or disallow the specified szMask characters
	mov esi, pszMask
	.if fOptions == TRUE
		invoke fZeroMemory, edi, 256
		xor ecx, ecx
		xor eax, eax
		.while BYTE PTR [esi][ecx] != 0
			mov al, [esi][ecx]
			mov BYTE PTR [edi][eax], TRUE
			inc ecx
		.endw
	.else
		invoke fFillMemory, edi, 256, TRUE
		xor ecx, ecx
		xor eax, eax
		.while BYTE PTR [esi][ecx] != 0
			mov al, [esi][ecx]
			mov BYTE PTR [edi][eax], FALSE
			inc ecx
		.endw	
	.endif

	; don't update the user data if it is already in place
	.if ebx != MaskedEditProc
		invoke SetWindowLong, hwndEdit, GWL_WNDPROC, addr MaskedEditProc
		mov [edi][256], eax
		invoke SetWindowLong, hwndEdit, GWL_USERDATA, edi
	.endif

	xor eax, eax
	inc eax
	ret

MaskEditControl endp

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -