ShowCursor(FALSE) should hide cursor!
- From: "Robby" <Robby@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 26 Dec 2005 12:56:02 -0800
Hello,
I am currently learning the CONNECT.C program on P. 277 of chapter 7 of
Petzold's book. My question is:
Why is it that after the WM_PAINT messge is processed, the cursor is still
visible? Here is the fragment of code:
case WM_PAINT:
hdc = BeginPaint(hwnd,&ps);
SetCursor(LoadCursor(NULL,IDC_WAIT));
ShowCursor(TRUE);
for(i = 0; i < iCount - 1; i++)
for(j = i + 1; j < iCount; j++)
{
MoveToEx(hdc,pt[i].x,pt[i].y,NULL);
LineTo (hdc,pt[j].x,pt[j].y);
}
ShowCursor(FALSE);
SetCursor(LoadCursor(NULL,IDC_CROSS));
EndPaint(hwnd,&ps);
return 0;
So, It seems that when the WM_PAINT begins, it sets the cursor to an hour
glass and shows the cursor as so:
SetCursor(LoadCursor(NULL,IDC_WAIT));
ShowCursor(TRUE);
And at the end of the WM_PAINT code the cursor is hidden and set to an arrow
by:
ShowCursor(FALSE);
SetCursor(LoadCursor(NULL,IDC_ARROW));
BUT BY NOW, THE CURSOR SHOUL BE HIDDEN ????
Then why is it still visible. Further more, I have read the set Cursor help
on msdn and it says:
"The cursor is a shared resource. A window should set the cursor shape only
when the cursor is in its client area or when the window is capturing mouse
input. In systems without a mouse, the window should restore the previous
cursor before the cursor leaves the client area or before it relinquishes
control to another window.
If your application must set the cursor while it is in a window, make sure
the class cursor for the specified window's class is set to NULL. If the
class cursor is not NULL, the system restores the class cursor each time the
mouse is moved. "
So I set the following property for the Window's classes member data hCursor
as so:
wndclass.hCursor = NULL;
But the cursor is still visible. ?????
Anyone.....
Merry XMAS everyone !!!!!
Ross
--
Best regards
Robert
.
- Follow-Ups:
- Re: ShowCursor(FALSE) should hide cursor!
- From: Doug Harrison [MVP]
- Re: ShowCursor(FALSE) should hide cursor!
- From: Alexander Grigoriev
- Re: ShowCursor(FALSE) should hide cursor!
- Prev by Date: Re: Workaround for MSVC 7.1 bug with references?
- Next by Date: Re: ShowCursor(FALSE) should hide cursor!
- Previous by thread: Printing Question
- Next by thread: Re: ShowCursor(FALSE) should hide cursor!
- Index(es):
Relevant Pages
|
|