MASM32编程实现窗口渐入渐出效果
2009-10-12 09:37:53 来源:WEB开发网注:如果
1、窗口使用了窗口边界;
2、窗口已经可见仍要显示窗口;
3、窗口已经隐藏仍要隐藏窗口。
函数调用将失败。
演示代码(下载地址:download.csdn.net/source/636309):
;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; FileName:AninWin.asm
; Author:PurpleEndurer
;Functiion:DemothewaytouseAnimateWindow()
; DevEnv:WinXPSP2+MASM32v7
;log
;------------------------------
;2008-09-18Created!
;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
.586
.modelflat,stdcall
optioncasemap:none
;------------------
incbothmacroincl
included:masm32includeincl.inc
includelibd:masm32libincl.lib
endm
included:masm32includewindows.inc
incbothkernel32
incbothuser32
incbothgdi32
incbothcomctl32
incbothshell32
;prototypes
DlgProc PROTO:HWND,:UINT,:WPARAM,:LPARAM
;.const
IDD_dlgSetState equ 1000
.data
g_szAnimWindb"AnimateWindow",0
g_szUser32Dlldb"user32.dll",0
.data?
hInstance HINSTANCE?
pAnimateWindow DD?
.code
start:
invokeGetModuleHandle,NULL
mov[hInstance],eax
invokeDialogBoxParam,[hInstance],IDD_dlgSetState,NULL,OFFSETDlgProc,NULL
invokeExitProcess,NULL
invokeInitCommonControls
DlgProcprochWnd:HWND,wMsg:UINT,lParam:LPARAM,wParam:WPARAM
.ifwMsg==WM_INITDIALOG
;---获取AnimateWindow()地址
invokeSendMessage,[hWnd],WM_SETTEXT,NULL,OFFSETg_szAnimWin
invokeGetModuleHandle,OFFSETg_szUser32Dll
invokeGetProcAddress,eax,OFFSETg_szAnimWin
mov[pAnimateWindow],eax
;---如果取得地址,则渐入显示对话框窗口
.if[pAnimateWindow]
pushAW_BLEND+AW_ACTIVATE
push400h ;time
push[hWnd];windowHandle
call[pAnimateWindow]
.endif
invokeInvalidateRect,hWnd,0,TRUE
.elseifwMsg==WM_CLOSE
;---如果取得地址,则渐出关闭对话框窗口
.if[pAnimateWindow]
pushAW_BLEND+AW_HIDE
push400h
push[hWnd]
call[pAnimateWindow]
.endif
invokeEndDialog,[hWnd],NULL
.else
moveax,FALSE
ret
.endif
xoreax,eax
ret
DlgProcendp
endstart
;;;;;;;;;;;
;rsrc.rc
;;;;;;;;;;;
#include"masm32includeresource.h"
#defineIDC_lblAppInfo 3009
#defineIDD_dlgSetState 1000
IDD_dlgSetStateDIALOG10,10,120,114
STYLE0x0004|DS_CENTER|WS_CAPTION|DS_SYSMODAL|WS_SYSMENU|WS_VISIBLE|WS_OVERLAPPED|DS_MODALFRAME|DS_3DLOOK
CAPTION"GetColor"
FONT9,"宋体"
{
LTEXT "purpleendurer@163.comn2004.04.02广西河池n开发环境:MASM32V8",IDC_lblAppInfo,0,75,105,30,WS_DISABLED+SS_CENTER
}
更多精彩
赞助商链接