| 发表于:2007-05-20 10:42:33 楼主 |
我的思路很简单,建一个win窗口,在wm_create消息时获取窗口设备场景,createcompatibledc一份设备场景hdcback做幕后处理,在hdcback中绘画完后,invalidaterect主窗口。等待进入wm_paint消息处理,用bitblt把hdcback传给win窗口。 思路有问题么?。。。 下面是部分代码: _wndmainproc proc uses ebx edi esi, \ hwnd:dword,umsg:dword,wparam:dword,lparam:dword local @stps:paintstruct local @hdc:dword local @hbrush:dword mov eax,umsg .if eax == wm_create mov eax,hwnd mov hwinmain,eax call _init ;******************************************************************** .elseif eax == wm_paint invoke beginpaint,hwnd,addr @stps mov @hdc,eax invoke drawtext,hdcback,addr szclassname,-1,addr @stps.rcpaint,\ dt_singleline or dt_center or dt_vcenter mov eax,@stps.rcpaint.right sub eax,@stps.rcpaint.left mov ecx,@stps.rcpaint.bottom sub ecx,@stps.rcpaint.top invoke bitblt,@hdc,@stps.rcpaint.left,@stps.rcpaint.top,eax,ecx,\ hdcback,@stps.rcpaint.left,@stps.rcpaint.top,srccopy invoke endpaint,hwnd,addr @stps ;******************************************************************** .elseif eax == wm_close call _quit ;******************************************************************** .else invoke defwindowproc,hwnd,umsg,wparam,lparam ret .endif xor eax,eax ret _wndmainproc endp _init proc local @hdc:dword local @strect:rect local @hbrush:dword invoke getclientrect,hwinmain,addr @strect invoke getdc,hwinmain mov @hdc,eax invoke createcompatibledc,@hdc mov hdcback,eax invoke createhatchbrush,hs_diagcross,88888 invoke selectobject,hdcback,eax invoke deleteobject,eax invoke fillrect,hdcback,addr @strect,@hbrush invoke drawtext,hdcback,addr szclassname,-1,addr @strect,\ dt_singleline or dt_center or dt_vcenter mov eax,@strect.right sub eax,@strect.left mov ecx,@strect.bottom sub ecx,@strect.top invoke bitblt,hdcback,@strect.left,@strect.top,eax,ecx,\ @hdc,@strect.left,@strect.top,srccopy invoke releasedc,hwinmain,@hdc invoke invalidaterect,hwinmain,addr @strect,-1 ret _init endp |
|
|
|
|