StartImage.DLL使用说明
一、库的引入
库包含以下物件,请按照要求将以下库映入到项目中
- StartImage.dll
- StartImage.lib
- StartImage.h
二、注意事项
需要展示的图片大小需要设置为400*300像素的bmp图像,并且放入到C盘根目录,取名为“StartImage.bmp”
三、用法
1、实例化
头文件中实例化对象,在APP的主函数中。(就是CXXXXAPP的那个类中)
//TestStartBmp.h中
class CXXXXXXXXApp: public CWinApp
{
public:
...//other function
// 声明对象
CStartImageApp *m_StartImg;
...//other function
};
2、打开开机动画
在初始化函数(InitInstance)中的打开主函数界面之前,实例化工具,并调用open函数
BOOL CXXXXXXXXApp::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
}
3、关闭开机动画
关闭动画是需要在程序所有功能都初始化完成之后才调用的,由于我们的dll对象值在APP界面进行了构造,并不是所有其他页面都能调用到,所以我们采用全局查找的方式,来查找刚刚构造的dll对象
// 在需要的地方调用如下两句代码,可以随时调用CloseThis函数。
if (((CXXXXXXXXApp*)AfxGetApp())->m_StartImg != NULL)
((CXXXXXXXXApp*)AfxGetApp())->m_StartImg->CloseThis();
4、显示进度
进度是在0-100之间,传递一个0-100之间的数字即可
if (((CXXXXXXXXApp*)AfxGetApp())->m_StartImg != NULL)
((CXXXXXXXXApp*)AfxGetApp())->m_StartImg->UpdateProgress((i + 1) * 10);
作者:Abraverman
时间::2021年9月4日11:48:59
骑虎难下!