Gentle people, This drives me nuts! Please consider the following pieces of code:
InitInstance:
szBkwMsg = "Message1"; <-----
ShowWindow( hWnd, nCmdShow );
UpdateWindow( hWnd );
SendMessage( hWnd, WM_COMMAND, IDM_BKW, 0 );
WndProc:
case IDM_BKW:
while (szInDs == "")
{
if (DialogBox(hInst, .... <-----
{
}
}
szBkwMsg = "Message2"; <-----
UpdateWindow( hWnd );
DialogBox(hInst, ... <-----
case WM_PAINT:
hdc = BeginPaint (hWnd, &ps);
TextOut(hdc, iTextx, iTexty, szBkwMsg, strlen(szBkwMsg));
EndPaint( hWnd, &ps );
return 0
Simple and straight forward I thought, but what happens is:
- "Message1" written in Initinstance shows up only after the call to the dialogbox in WndProc ("if (DialogBox(hInst, ...."). This would not hurt, but "Message2" developed a very peculiar behaviour. Watching the process in debug mode everything works fine. I can see "Message2" being processed and shown (after the call to a dialogbox). But executing the program outside debug or stopping the program after the call to the dialogbox for the first time "Message1" (!!!) is displayed.
I may be a novice in Windows programming, but I am an old warhorse in OS/370 event-driven programming and I have tried everything which came to my mind, but still:
- I need a dialogbox to show the message on the screen, and
- I always see "Message1" when not in debug-mode
Does anybody have an idea where I go wrong
Thanks a lot for yout interest!
e.g.gru

Weird behaviour of "Textout" ...
mwherman2000
yeltomw
Thank you! E.G.Gru
Lweek
e.g.gru
domi
No! UpdateWindow invalidates nothing. UpdateWindow updates only what was invalidated!
Can you post a sample code somewhere that I can check. Place a link to the project here, or send it by email.