当前位置: 代码迷 >> 汇编语言 >> 初学汇编 遇到有关问题
  详细解决方案

初学汇编 遇到有关问题

热度:1842   发布时间:2013-02-26 00:00:00.0
初学汇编 遇到问题,请教大家
_ProcWinMain proc uses ebx edi esi,hWnd,uMsg,wParam,lParam
local @hDc:HDC
local @hbRush:HBRUSH

mov eax,uMsg
;*********************************************************
.if eax == WM_RBUTTONDOWN
call _Quit
;***********************************************************
.elseif eax == WM_CREATE
invoke CreateWindowEx,NULL,addr szEdit,\;创建Edit
  addr szPass,WS_CHILD or WS_VISIBLE,\
  0,0,65,18,hWnd,1,hInstance,NULL
mov hwndedit,eax
.elseif eax == WM_CTLCOLOREDIT;我想在这里设置Edit的背景颜色和字体颜色,这样没能成功
mov eax,wParam
mov @hDc,eax
invoke CreateSolidBrush,00FF0000H
mov hbRush,eax
invoke SetTextColor,addr @hDc,000000H
invoke SetBkColor,addr @hDc,00FFFFH
ret
.elseif eax == WM_CLOSE
invoke DestroyWindow,hWinMain
invoke PostQuitMessage,NULL
.else
invoke DefWindowProc,hWnd,uMsg,wParam,lParam
ret
.endif
;********************************************************************
xor eax,eax
ret

_ProcWinMain endp

------解决方案--------------------------------------------------------
没这样用过,但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. ”,
Assembly code
invoke SetTextColor,addr @hDc,000000Hinvoke SetBkColor,addr @hDc,00FFFFHret
  相关解决方案