I was trying to send mouse positions to my status bar in
a larger program. I could not get them to write more than
one position to the status bar, then it stops changing.
To test why, I wrote a small window using one "Do Paint"
function first. I still got only one position print out
but nothing more. I then put in a "Do Paint1" and "2".
The WM_MOUSEMOVE would print out either "1" or "2" but not
both. It will print both lines if I keep it all in one
function. I would like to know why it won't run two
functions, one after another.
I'm sure I'm doing something dumb but I can't come up
with why I only get one position print and why a
second WM_MOUSEMOVE message doesn't seem to do anything.
I'm assuming that as the mouse moves, the program
should get more WM_MOUSEMOVE messages. I cut off the
returns in 1, 2, and then the case. No change. I can't
figure out why MMove will only do one and not both of
my functions either. It's all got to be tied together
some how.
I'm running AMD with SP1. Here's the case.
case WM_MOUSEMOVE:
wsprintf(szBuff1,"%s x=%04d y=%04d","Cursor Location",
LOWORD(lParam),HIWORD(lParam));
wsprintf(szBuff2,"%06s %04X %s x=%04d y=%04d","Msg = ",
message," ",LOWORD(lParam),HIWORD(lParam));
DoPaint1(hwndMain);
DoPaint2(hwndMain);
return 0;
and here's the 1 and 2.
HWND DoPaint1(HWND hwndMain)
{
GetWindowRect(hwndMain,&rc);
hDC = GetDC(hwndMain);
hDC = BeginPaint(hwndMain,&ps);
TextOut(hDC,124,50,szBuff1,29);
EndPaint(hwndMain, &ps);
ReleaseDC(hwndMain,hDC);
UpdateWindow(hwndMain);
ZeroMemory(szBuff1,sizeof(szBuff1));
return 0;
}
HWND DoPaint2(HWND hwndMain)
{
GetWindowRect(hwndMain,&rc);
hDC = GetDC(hwndMain);
hDC = BeginPaint(hwndMain,&ps);
TextOut(hDC,124,90,szBuff2,30);
EndPaint(hwndMain, &ps);
ReleaseDC(hwndMain,hDC);
UpdateWindow(hwndMain);
ZeroMemory(szBuff2,sizeof(szBuff2));
return 0;
}
If anyone wants the whole test program, I can zip it
and e-mail it on request. It's just a single window
with the above. Very basic. I put in the ZeroMem to
see what that would do. It did nothing.