Microsoft Visual C++ MFC. Win95 WinNT


CSplashWnd - 3


}

 

return FALSE; // message not handled

}

 

BOOL CSplashWnd::Create(CWnd* pParentWnd /*= NULL*/)

{

if (!m_bitmap.LoadBitmap(IDB_SPLASH))

return FALSE;

 

BITMAP bm;

m_bitmap.GetBitmap(&bm);

 

return CreateEx(0, AfxRegisterWndClass(0,

AfxGetApp()->LoadStandardCursor(IDC_ARROW)),

NULL, WS_POPUP | WS_VISIBLE, 0, 0, bm.bmWidth,

bm.bmHeight, pParentWnd->GetSafeHwnd(), NULL);

}

 

void CSplashWnd::HideSplashScreen()

{

// Destroy the window, and update the mainframe.

DestroyWindow();

AfxGetMainWnd()->UpdateWindow();

}

 

void CSplashWnd::PostNcDestroy()

{

// Free the C++ class.

delete this;

}

 

int CSplashWnd::OnCreate(LPCREATESTRUCT lpCreateStruct)

{

if (CWnd::OnCreate(lpCreateStruct) == -1)

return -1;

 

// Center the window.

CenterWindow();

 

// Set a timer to destroy the splash screen.

SetTimer(1, 750, NULL);

 

return 0;

}

 

void CSplashWnd::OnPaint()

{

CPaintDC dc(this);

 

CDC dcImage;

if (!dcImage.CreateCompatibleDC(&dc))

return;

 

BITMAP bm;

m_bitmap.GetBitmap(&bm);

 

// Paint the image.

CBitmap* pOldBitmap = dcImage.SelectObject(&m_bitmap);

dc.BitBlt(0, 0, bm.bmWidth, bm.bmHeight,

&dcImage, 0, 0, SRCCOPY);

dcImage.SelectObject(pOldBitmap);

}

 

void CSplashWnd::OnTimer(UINT nIDEvent)

{

// Destroy the splash screen window.

HideSplashScreen();

}

Splash.cpp . .




- -  - -  - -