Assembly code snippets
Details
Title | Read only Editbox / white background / no caret |
---|---|
Author | smurf |
Submitted by: | smurf |
Date added: | 2002-04-06 18:04:44 |
Date modified: | 2002-04-06 18:06:10 |
Comments
The is a read only editbox that has a white background instead of the windows default color(greyish) and doesn't display a caret. Very useful to block user input but still be able to copy from it.
Snippet
.data
EditClass db "Edit",0
.data?
hEdit HANDLE ?
;// create read only editbox
.ELSEIF uMsg == WM_CREATE
invoke CreateWindowEx, WS_EX_CLIENTEDGE,
ADDR EditClass,
0,
WS_CHILD+WS_VISIBLE+ES_READONLY+ ES_MULTILINE,
30,30,300,100,
hWin,
0,
hInstance,
0
mov hEdit,eax
;// set white background color
.ELSEIF uMsg == WM_CTLCOLORSTATIC
mov eax,lParam
.if eax == hEdit
invoke GetStockObject, WHITE_BRUSH
ret
.endif
;// prevent the cursor from showing
.ELSEIF uMsg == WM_COMMAND
mov eax,wParam
shr eax,16
.if ax == EN_SETFOCUS
mov eax,lParam
.if eax == hEdit
invoke DestroyCaret
.endif
.endif
EditClass db "Edit",0
.data?
hEdit HANDLE ?
;// create read only editbox
.ELSEIF uMsg == WM_CREATE
invoke CreateWindowEx, WS_EX_CLIENTEDGE,
ADDR EditClass,
0,
WS_CHILD+WS_VISIBLE+ES_READONLY+ ES_MULTILINE,
30,30,300,100,
hWin,
0,
hInstance,
0
mov hEdit,eax
;// set white background color
.ELSEIF uMsg == WM_CTLCOLORSTATIC
mov eax,lParam
.if eax == hEdit
invoke GetStockObject, WHITE_BRUSH
ret
.endif
;// prevent the cursor from showing
.ELSEIF uMsg == WM_COMMAND
mov eax,wParam
shr eax,16
.if ax == EN_SETFOCUS
mov eax,lParam
.if eax == hEdit
invoke DestroyCaret
.endif
.endif