Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Overwriting WM_PAINT for a dialog box

0 views
Skip to first unread message

Anders And

unread,
Oct 22, 2000, 3:00:00 AM10/22/00
to
Hi!

I have a problem with a dialog box. It's a splash screen on which I want to
print information about the loading of my application.
What happens is that I can tell that my text is printed but then hidden
instantly again. I get an improved result when putting SplashPaint() below
EndPatin() with a DC found with GetDC(splashwindow), but this is not good
enough. First of all, the text is not printed initially. I could solve this,
yes, but it seems that when my window is asked to repaint entirely, my text
is ignored. If I draw another window partly on top of it, it works though.
Can anybody help me?

Kristian

Here is a piece of the code I am using:

static void SplashPaint(HDC hdc)
{
SetTextColor (hdc, RGB (0, 0, 0));
SetBkMode (hdc, TRANSPARENT);

for(int textline = 0; textline < TEXTLINECOUNT; textline++)
ExtTextOut (hdc, splashtextx, splashtexty + textline * 15, 0, NULL,
splashtext[textline], strlen (splashtext[textline]), NULL);
}

bool CALLBACK SplashDialogProc(HWND hwndDlg, UINT message, WPARAM wParam,
LPARAM lParam)
{
PAINTSTRUCT ps;
HDC hdc;

switch (message)
{
case WM_PAINT:
{
hdc = BeginPaint(hwndDlg, &ps);
SplashPaint(hdc); // I have tried with ps.hdc as well.
EndPaint(hwndDlg, &ps);
return true;
}
}
return false;
}


Petter Hesselberg

unread,
Oct 22, 2000, 3:00:00 AM10/22/00
to
You need to subclass the dialog. It is not enough to handle WM_PAINT in the
dialog function, which is a callback called by DefDlgProc at various points.

For more about subclassing, check out
http://www.wdj.com/archive/1103/feature.html.
--
Regards,
Petter
http://pethesse.home.online.no/


"Anders And" <A...@andeby.com> wrote in message
news:8sv08r$f2p$1...@news.inet.tele.dk...

0 new messages