以下是部分代码,运行起来之后就是一黑色的图片,不知是哪里出的错
(以下代码的出处: http://blog.csdn.net/doudouhuy/article/details/4218548 )
.elseif eax==WM_PAINT
invoke LoadBitmap,hInstance,ID_BMP2124
mov hRealBmp,eax
invoke GetObject,eax,sizeof BITMAP,offset bmpInfo
invoke GetDesktopWindow
invoke GetDC,eax
mov hDesktopDC ,eax
invoke CreateCompatibleDC,hDesktopDC
mov hSrcDc ,eax
invoke CreateCompatibleBitmap,hDesktopDC ,bmpInfo.bmWidth,bmpInfo.bmHeight
mov hSrcBitmap ,eax
invoke SelectObject,hSrcDc,hSrcBitmap
invoke SetBkColor,hSrcDc,00FFFFFFh
invoke CreateCompatibleDC,hDesktopDC
mov hMaskDC ,eax
invoke CreateBitmap,bmpInfo.bmWidth,bmpInfo.bmHeight,1,1,0
mov hMaskBmp ,eax
invoke SelectObject,hMaskDC,hMaskBmp
mov hOldMaskBmp ,eax
invoke BitBlt,hMaskDC,0,0,bmpInfo.bmWidth,bmpInfo.bmHeight,hSrcDc,0,0,SRCCOPY
invoke SetBkColor,hSrcDc,0
invoke SetTextColor,hSrcDc,00FFFFFFh
invoke BitBlt,hSrcDc,0,0,bmpInfo.bmWidth,bmpInfo.bmHeight,hMaskDC,0,0,SRCAND
invoke GetDC,hWnd
mov hdcMainWnd ,eax
invoke SetBkColor,hdcMainWnd,00FFFFFFh
invoke SetTextColor,hdcMainWnd,0
invoke BitBlt,hdcMainWnd,0,0,bmpInfo.bmWidth,bmpInfo.bmHeight,hMaskDC,0,0,SRCAND
invoke BitBlt,hdcMainWnd,0,0,bmpInfo.bmWidth,bmpInfo.bmHeight,hSrcDc,0,0,SRCPAINT
------最佳解决方案--------------------------------------------------------
invoke SetTextColor,hSrcDc,00FFFFFFh ;
这句设置了有什么用呢?
又不显示text(这个是指DrawText或控件上的string)
可能我说的不清楚,同时windows画图方面知道的有限,lz在琢磨下呢
------其他解决方案--------------------------------------------------------
该回复于2012-11-24 09:57:59被管理员删除
------其他解决方案--------------------------------------------------------
以下是全部代码
主要是参考下面的例子 http://blog.csdn.net/doudouhuy/article/details/4218548
.386
.model flat,stdcall
option casemap:none
include windows.inc
include user32.inc
includelib user32.lib
include kernel32.inc
includelib kernel32.lib
include gdi32.inc
includelib gdi32.lib
IDD_DLG1000 equ 1000
IDC_BTN1001 equ 1001
IDC_IMG1002 EQU 1002
ID_BMP2124 equ 1074
.data?
hInstance dd ?
bmpInfo BITMAP <>
.code
_ProcDlgMain proc uses ebx edi esi ,hWnd,wMsg,wParam,lParam
LOCAL hRealBmp:dword
LOCAL hMaskBmp:dword
LOCAL hDesktopDC:dword
LOCAL hSrcDc:dword
LOCAL hMaskBmpDc:dword
LOCAL hMaskDC:dword
LOCAL hdcMainWnd:dword
LOCAL hOldMaskBmp:dword
LOCAL hSrcBitmap:dword
mov eax,wMsg
.if eax==WM_CLOSE
invoke EndDialog,hWnd,NULL
.elseif eax==WM_INITDIALOG
; invoke LoadBitmap,hInstance,ID_BMP2124
; mov hRealBmp,eax
ret
; invoke GetDC,hWnd
; mov hDesktopDC,eax
; invoke CreateCompatibleDC, hDesktopDC
; mov hSrcDc,eax
; invoke SelectObject,hSrcDc,hRealBmp
;
;
; invoke SetBkColor,hSrcDc,00FFFFFFh
; invoke CreateCompatibleDC, hDesktopDC
; mov hMaskBmpDc,eax