when i set the EM_READONLY style for my editbox the box is grayed out. is there a way i can make my editbox readonly without is turning gray on me?
Posted on 2002-02-13 17:27:36 by smurf
KetilO posted examples on the board about this...
If you don't find them with the search function, they are included in the RadASM projects package.
Posted on 2002-02-13 17:36:16 by JCP
i was doing searches on the board before i did this post and strangely ES_READONLY wouldnt show any posts. anyways i had to search every post of kitilO's and finally found it way back. and it was actually bazik who posted the solution. the reason i couldnt figure it out is that for some reseason you need to intercept the wm_ctlcolorstatic instead of the wm_ctlcoloredit which i would have never figured out. why MS does this makes no sence really.

thanks readiosys

edit: duh no wonder i was searching for EM_READONLY :(
Posted on 2002-02-13 18:05:35 by smurf


[...]
.if uMsg == WM_CREATE

invoke GetStockObject, DEFAULT_GUI_FONT
mov hFont, eax

invoke CreateWindowEx, 0, addr szStaticClass, addr szStaticTitle, WS_CHILD or WS_VISIBLE,
5, 5, 40, 15, hWin, 0, 400000h, 0
invoke SendMessage, eax, WM_SETFONT, hFont, 0

invoke CreateWindowEx, 0, addr szStaticClass, addr szStaticAuthor, WS_CHILD or WS_VISIBLE,
5, 25, 40, 15, hWin, 0, 400000h, 0
invoke SendMessage, eax, WM_SETFONT, hFont, 0

invoke CreateWindowEx, 0, addr szStaticClass, addr szStaticTarget, WS_CHILD or WS_VISIBLE,
5, 45, 40, 15, hWin, 0, 400000h, 0
invoke SendMessage, eax, WM_SETFONT, hFont, 0

invoke CreateWindowEx, 0, addr szEditClass, 0, WS_CHILD or WS_VISIBLE or WS_BORDER or ES_READONLY,
50, 5, 240, 15, hWin, TXT_TITLE, 400000h, 0
push eax
invoke SendMessage, eax, WM_SETTEXT, 0, addr szCrkTitle
pop eax
invoke SendMessage, eax, WM_SETFONT, hFont, 0

invoke CreateWindowEx, 0, addr szEditClass, 0, WS_CHILD or WS_VISIBLE or WS_BORDER or ES_READONLY,
50, 25, 240, 15, hWin, TXT_AUTHOR, 400000h, 0
push eax
invoke SendMessage, eax, WM_SETTEXT, 0, addr szCrkAuthor
pop eax
invoke SendMessage, eax, WM_SETFONT, hFont, 0

invoke wsprintf, addr szTargetBuffer, addr szTargetMask, addr szCrkTarget, nSize

invoke CreateWindowEx, 0, addr szEditClass, 0, WS_CHILD or WS_VISIBLE or WS_BORDER or ES_READONLY,
50, 45, 240, 15, hWin, TXT_TARGET, 400000h, 0
push eax
invoke SendMessage, eax, WM_SETTEXT, 0, addr szTargetBuffer
pop eax
invoke SendMessage, eax, WM_SETFONT, hFont, 0

invoke CreateWindowEx, 0, addr szEditClass, 0, WS_CHILD or WS_VISIBLE or WS_BORDER or ES_READONLY or ES_MULTILINE,
5, 65, 285, 115, hWin, TXT_INFO, 400000h, 0
push eax
invoke SendMessage, eax, WM_SETTEXT, 0, addr szCrkInfo
pop eax
invoke SendMessage, eax, WM_SETFONT, hFont, 0

invoke CreateWindowEx, 0, addr szButtonClass, addr szButtonApply, WS_CHILD or WS_VISIBLE,
5, 185, 80, 30, hWin, CMD_APPLY, 400000h, 0
invoke SendMessage, eax, WM_SETFONT, hFont, 0

invoke CreateWindowEx, 0, addr szButtonClass, addr szButtonCancel, WS_CHILD or WS_VISIBLE,
210, 185, 80, 30, hWin, CMD_CANCEL, 400000h, 0
invoke SendMessage, eax, WM_SETFONT, hFont, 0

invoke CreateWindowEx, 0, addr szStaticClass, addr szCopyright, WS_CHILD or WS_VISIBLE or WS_DISABLED,
90, 200, 115, 15, hWin, 0, 400000h, 0
invoke SendMessage, eax, WM_SETFONT, hFont, 0

[COLOR=darkblue]
.elseif uMsg == WM_CTLCOLORSTATIC

invoke GetWindowLong, lParam, GWL_ID

.if (eax == TXT_TITLE || eax == TXT_AUTHOR || eax == TXT_TARGET || eax == TXT_INFO)

invoke GetStockObject, WHITE_BRUSH
ret

.endif
[/COLOR]
[...]
Posted on 2002-02-15 16:04:46 by bazik