首页
社区
课程
招聘
[求助]iPicture使用的一个奇怪问题
发表于: 2007-1-3 12:12 4554

[求助]iPicture使用的一个奇怪问题

2007-1-3 12:12
4554
以下是我根据 CCDebuger 提供的注册机模板提取出的使用iPicture的核心代码:
.386
.model flat, stdcall
option casemap :none   ; case sensitive

include		windows.inc
include		masm32.inc
include		user32.inc 
include		kernel32.inc
include		comctl32.inc 
include		comdlg32.inc
include		gdi32.inc
include		shell32.inc
include		oleaut32.inc
include		ole32.inc

includelib	masm32.lib
includelib	user32.lib 
includelib	kernel32.lib
includelib	comctl32.lib 
includelib	comdlg32.lib 
includelib	gdi32.lib
includelib	shell32.lib
includelib	oleaut32.lib
includelib	ole32.lib

include		patch.inc
include		BmpFrom.inc

    WndProc          PROTO :DWORD,:DWORD,:DWORD,:DWORD

.data
    dlgname      db "M",0
    ScrollSpeed  dd 10         ; Timeout (in milliseconds) for scroller update
    rectLogo     RECT <0,0,270,78>
    LogBrush     LOGBRUSH <>

.data?
    hInstance    dd ?
    hDC          dd ?
    hLogoBmp     dd ?
    hDCLogo      dd ?
    hOldLogo     dd ?  

.code
start:

	invoke GetModuleHandle,NULL
	mov hInstance,eax
	invoke InitCommonControls
	invoke CoInitialize,NULL
	invoke DialogBoxParam,hInstance,ADDR dlgname,0,ADDR WndProc,0  ; load the main window
	invoke CoUninitialize           ; all done with COM
	invoke ExitProcess,eax

WndProc proc hWnd:HWND,uMsg:DWORD,wParam:DWORD,lParam:DWORD

	.if uMsg == WM_INITDIALOG
		invoke BmpFromResource,hInstance,50             ; Load logo bitmap into memory
		mov hLogoBmp,eax                                ; Save it's handle
			; Setup up our text scroller
;		invoke SetTimer,hWnd,1,ScrollSpeed,0
		invoke GetDC,hWnd
		mov	hDC,eax
		invoke CreateCompatibleDC,hDC
		mov	hDCLogo,eax
		invoke SelectObject,hDCLogo,hLogoBmp
		mov hOldLogo,eax

    .elseif uMsg == WM_LBUTTONDOWN

;	.elseif uMsg == WM_TIMER
		invoke BitBlt,hDC,0,0,rectLogo.right,rectLogo.bottom,hDCLogo,0,0,SRCCOPY
	.elseif uMsg == WM_DESTROY
		invoke DeleteObject,hLogoBmp
		invoke DeleteDC,hDCLogo
		invoke ReleaseDC,hWnd,hDC
	.elseif uMsg == WM_CLOSE
		invoke EndDialog,hWnd,0   ; end the program
	.endif
	xor eax,eax 
	ret
WndProc endp
end start

资源文件:
#include "/masm32/include/resource.h"
M DIALOGEX 0,0,174,40
FONT 8,"Arial"
STYLE 0x00CA0802
EXSTYLE 0x00000000
BEGIN

END
50 IMAGE DISCARDABLE "logo.jpg"
60 ICON DISCARDABLE "icon.ico"

    我的问题是:BitBlt那一行放在初始化段(uMsg == WM_INITDIALOG)为什么不起作用?必须放在另一个消息处理段里面(如uMsg == WM_LBUTTONDOWN、uMsg == WM_TIMER等)就可以起作用?
其余所需文件在附件中:

[课程]FART 脱壳王!加量不加价!FART作者讲授!

上传的附件:
收藏
免费 0
支持
分享
最新回复 (2)
雪    币: 2506
活跃值: (1000)
能力值: (RANK:990 )
在线值:
发帖
回帖
粉丝
2
要显示图片用这个库吧,里面有示例源码,很简单的。
上传的附件:
2007-1-3 14:30
0
雪    币: 253
活跃值: (250)
能力值: ( LV9,RANK:210 )
在线值:
发帖
回帖
粉丝
3
谢谢 CCDebuger 大侠的热心帮助!

    看来显示图片的部分最经典的位置是放在uMsg == WM_PAINT分支中,放在uMsg == WM_INITDIALOG分支中就是显示不出来,这可能与Windows的运行机制有关吧。
2007-1-3 16:51
0
游客
登录 | 注册 方可回帖
返回
//