初学汇编 遇到问题,请教大家
_ProcWinMainprocuses ebx edi esi,hWnd,uMsg,wParam,lParam
local@hDc:HDC
local@hbRush:HBRUSH
moveax,uMsg
;*********************************************************
.if eax==WM_RBUTTONDOWN
call_Quit
;***********************************************************
.elseifeax ==WM_CREATE
invokeCreateWindowEx,NULL,addr szEdit,\;创建Edit
addr szPass,WS_CHILD or WS_VISIBLE,\
0,0,65,18,hWnd,1,hInstance,NULL
movhwndedit,eax
.elseifeax == WM_CTLCOLOREDIT;我想在这里设置Edit的背景颜色和字体颜色,这样没能成功
moveax,wParam
mov@hDc,eax
invokeCreateSolidBrush,00FF0000H
movhbRush,eax
invokeSetTextColor,addr @hDc,000000H
invokeSetBkColor,addr @hDc,00FFFFH
ret
.elseif eax ==WM_CLOSE
invokeDestroyWindow,hWinMain
invoke PostQuitMessage,NULL
.else
invoke DefWindowProc,hWnd,uMsg,wParam,lParam
ret
.endif
;********************************************************************
xoreax,eax
ret
_ProcWinMainendp
[解决办法]
没这样用过,但MSDN上说“If an application processes this message, it must return the handle of a brush. The system uses the brush to paint the background of the edit control. ”,
invoke SetTextColor,addr @hDc,000000Hinvoke SetBkColor,addr @hDc,00FFFFHret