库包含以下物件,请按照要求将以下库映入到项目中
需要展示的图片大小需要设置为400*300像素的bmp图像,并且放入到C盘根目录,取名为“StartImage.bmp”
头文件中实例化对象,在APP的主函数中。(就是CXXXXAPP的那个类中)
//TestStartBmp.h中
class CTestStartBmpApp : public CWinApp
{
public:
...//other function
// 声明对象
CStartImageApp *m_StartImg;
...//other function
};
在初始化函数(InitInstance)中的打开主函数界面之前,实例化工具,并调用open函数
BOOL CTestStartBmpApp::InitInstance()
{
...// other function
SetRegistryKey(_T("应用程序向导生成的本地应用程序"));
m_StartImg = new CStartImageApp();
m_StartImg->OpenThis();
Sleep(10);
// 这是主函数的模态框构造,需要再次之前调用OpenThis函数
CTestStartBmpDlg dlg;
m_pMainWnd = &dlg;
INT_PTR nResponse = dlg.DoModal();
...// other function
}
关闭动画是需要在程序所有功能都初始化完成之后才调用的,由于我们的dll对象值在APP界面进行了构造,并不是所有其他页面都能调用到,所以我们采用全局查找的方式,来查找刚刚构造的dll对象
#include "TestStartBmp.h"
// 在需要的地方调用如下两句代码,可以随时调用CloseThis函数。
if (((CTestStartBmpApp*)AfxGetApp())->m_StartImg != NULL)
((CTestStartBmpApp*)AfxGetApp())->m_StartImg->CloseThis();
作者:Abraverman
时间::2021年9月4日11:48:59
骑虎难下!
原文:https://www.cnblogs.com/Abraverman/p/15226217.html