www.pudn.com > 20041201221023_vczx_progtemplate.rar > Splash.cpp


//////////////////////////////////////////////////
//类名:CSplashThread
//功能:显示启动画面
//作者:程红秀(chx20@163.com)
//组织:三峡大学计算机系
//日期:2004.8.11
//////////////////////////////////////////////////
#include "stdafx.h"
#include "..\resource.h"
#include "Splash.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////


IMPLEMENT_DYNCREATE(CSplashThread, CWinThread) //动态创建

BOOL CSplashThread::InitInstance()
{

// 说明:通常,系统内的每个线程都有自己的输入队列。本函数(既“连接线程输入函数”)允许线程和进程共享输入队列。连接了线程后,输入焦点、窗口激活、鼠标捕获、键盘状态以及输入队列状态都会进入共享状态

::AttachThreadInput(m_nThreadID, //欲连接线程的标识符(ID)
AfxGetApp()->m_nThreadID, //与idAttach线程连接的另一个线程的标识符
TRUE //TRUE(非零)连接,FALSE撤消连接
); //这个函数可以不用!!

m_pSplashDlg=new CLogoDlg;

m_pSplashDlg->Create(IDD_LOGO);
m_pSplashDlg->ShowWindow(SW_SHOW); //在这个用户界面线程中 创建对话框

return true;
}


void CSplashThread::HideSplash()
{
m_pSplashDlg->SendMessage(WM_CLOSE);
}

int CSplashThread::ExitInstance()
{

m_pSplashDlg->DestroyWindow();
delete m_pSplashDlg;

return CWinThread::ExitInstance();
}

BEGIN_MESSAGE_MAP(CSplashThread, CWinThread)
//{{AFX_MSG_MAP(CSplashThread)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()