
HELP: Dialog Is not showing its contents...
When I did this, I created a dialog that contained a single static
control (no caption bar), and I did the following:
(a) created the dialog as a modeless dialog
(b) dynamically resized the static control to the size of
the bitmap
(c) dynamically resized the dialog control to enclose the
static control
This is a sketch of the key routine for my splashscreen. c_Image is a
CStatic variable (mine was more complex as I had a CStatic that
painted its own picture and did palette management; I've replaced all
that with a SetBitmap call here)
BOOL CSplashScreen::OnInitDialog()
{
CDialog::OnInitDialog();
// Use LR_CREATEDIBSECTION to avoid mapping to 16-bit color
HBITMAP hbmp = (HBITMAP)::LoadImage(AfxGetInstanceHandle(),
MAKEINTRESOURCE(IDB_SMALLSPLASH),
IMAGE_BITMAP,
0, 0,
LR_CREATEDIBSECTION |
LR_DEFAULTCOLOR |
LR_SHARED);
BITMAP bmpinfo;
CBitmap * bmp = ::CBitmap::FromHandle(hbmp);
bmp->GetBitmap(&bmpinfo);
CRect r(0, 0, bmpinfo.bmWidth, bmpinfo.bmHeight);
c_Image.SetWindowPos(NULL, 0, 0, r.Width, r.Height(),
SWP_NOZORDER);
CalcWindowRect(&r);
SetWindowPos(NULL, 0, 0, r.Width(), r.Height(),
SWP_NOZORDER | SWP_NOMOVE);
CenterWindow(); // recenter now that it is resized
c_Image.SetBitmap(bmp);
GetParent()->EnableWindow(FALSE);
EnableWindow(TRUE);
SetTimer(1, TIME_DELTA * 1000, NULL);
count = 0;
::SetFocus(NULL);
return FALSE;
Quote:
}
On Thu, 06 Jan 2000 09:35:52 -0500, "Antonio L. Negron"
Quote:
>That is exactly what I want to do... BUT... it says in the "more info"
>section that "The Splash Screen component will not work in a
>dialog-based application" and my app is dialog-based. Anyway, what I'm
>trying to do should be simple enough and should be working, right? How
>can I solve this problem? I have no idea what could be going on since I
>already did what my limited knowledge of MFC allows me to do! HEEELP!!!
>PS: Thanks for the replies!
>> Ah! The plot thickens! So, there is only one control on the dialog, and it is a static
>> control (bitmap)? I don't see where you told it to display a bitmap, nor what bitmap you
>> intend to display!
>> Just look at the menu Project | Add to Project | Components and Controls | Visual C++
>> Components | Splash Screen. I think you'll be happy
Joseph M. Newcomer [MVP]
Web: http://www3.pgh.net/~newcomer
MVP Tips: http://www3.pgh.net/~newcomer/mvp_tips.htm