Re: ShowCursor(FALSE) should hide cursor!



Gee... A little bit of history goes along way!

So could of I have better said:

(In plain english, it loads a cursor type for the
current application!) Right!

And now I understand the use of WM_SETCURSOR !

Thanks alot guys.. your time is much appreciated!

--
Best regards
Robert


"Doug Harrison [MVP]" wrote:

> On Tue, 27 Dec 2005 22:26:02 -0800, "Robby"
> <Robby@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
>
> >Although, I fully appreciate your post and I would like to confirm to myself
> >that I am not absorbing this in a misleading way.
> >
> >The way I am understanding this, is that LoadCursor loads the specified
> >cursor resource from the executable (.EXE) file associated with an
> >application instance.
>
> If it's a predefined cursor, e.g. IDC_ARROW, then it comes from the OS.
>
> >(In plain english, it loads a cursor type for the
> >current window!) Right!
>
> The function LoadCursor does not have an HWND parameter, so that tells you
> the cursor it loads is not associated with a window. The same can be said
> for SetCursor. So, in what sense is a cursor associated with a window? A
> window sets the cursor for the process that created it in response to
> WM_SETCURSOR, and the cursor remains in effect for the process until
> another window belonging to the process changes it.
>
> >SetCursor, sets the cursor shape. The cursor must have been created by the
> >CreateCursor function or loaded by the LoadCursor or LoadImage function.
> >
> >So, so far, load the cursor with LoadCursor and then set its shape! Right!
> >
> >ShowCursor, shows the cursor. If I say, ShowCursor(True) the internal
> >display counter increments. If I say, ShowCursor(FALSE) the internal display
> >counter decrements. And any time the counter is negative, the cursor is
> >hidden.(I have experimented with this and I am surprised in that why Windows
> >chose this mechanism. (Why not simply say, ShowCursor(True) shows the cursor
> >and ShowCursor(FALSE) hides the cursor. Why must we add this "internal
> >counter and hide if negative stuff!")
> >
> >Anyways, I am sure there is a reason, but right now it is beyond me!
>
> It was really important back in the day when video cards didn't support the
> cursor in hardware. A software cursor must be hidden before drawing over
> the area where it resides, else you can get an effect known as "mouse
> droppings":
>
> http://catb.org/~esr/jargon/html/M/mouse-droppings.html
>
> Suppose you had two drawing functions, one which renders the background and
> the other the foreground. For safety reasons, each hides the cursor and
> restores it when done. Now suppose you wrote this function:
>
> void draw_everything()
> {
> draw_bk();
> draw_fg();
> }
>
> This would cause the cursor to flicker. You could fix it by bracketing the
> contents with hide/show cursor calls, but for that to work, the visibility
> state needs to be reference-counted. (I believe Windows always did the
> hiding/showing for you in BeginPaint/EndPaint, but other OS's did not.)
>
> --
> Doug Harrison
> Visual C++ MVP
>
.



Relevant Pages