#undef WINVER //取消原有版本定义,重新定义版本 #define WINVER 0x5000 //为了使AnimateWindow函数可用 #include <afxwin.h> |
SetTimer(1, 3000, NULL); //设定定时器1,定时3秒 |
BOOL CSplashWnd::OnCreate(LPCREATESTRUCT lpcs) { CenterWindow(); //窗口位于屏幕中心 AnimateWindow(GetSafeHwnd(), 500, AW_BLEND); //淡入图片0.5秒 return true; } |
void CSplashWnd::OnClose() { AnimateWindow(GetSafeHwnd(), 500, AW_BLEND | AW_HIDE); //淡出图片0.5秒 CWnd::OnClose(); } |
BOOL CSplashWnd::OnEraseBkgnd(CDC *pDC) { DDB mSplashBitmap; mSplashBitmap.DisplayDDB(pDC, IDB_SPLASH); //显示位图资源IDB_SPLASH return true; } |
void CSplashWnd::OnTimer(UINT nIDEvent) { KillTimer(1); //关闭定时器1 PostMessage(WM_CLOSE, 0, 0); //发送关闭窗口信息 } |