Changing the Cursor
3 messages in this thread
Craig,
I assume that you in fact returned TRUE in your first code snippet to stop
further processing !
I looked around a little and found an article "Static Controls" on the MSDN CD,
below I paste the relevant paragraph:
>>Static controls might be called "no input controls" because they accept no
input from the user. If the user moves the mouse over a static control, Windows
sends the control a WM_NCHITTEST message. The static control returns an
HTTRANSPARENT value to Windows, which then sends the WM_NCHITTEST message to
the static control's parent window. As a result of this processing, the parent
window of the static control receives all mouse events. Static controls do not
provide any notifications to their parent windows; in other words, they do not
send any WM_COMMAND messages.<<
So if you don't like your second approach, you have to subclass that static
control and to handle OnNcHitTest. First call the original handler, and when it
returns HTTRANSPARENT, you could change it to HTCLIENT.
ThomasZ
It's not so much that I don't like it, I'm just not sure how much code should
go into a function that gets called everytime the mouse is moved. I think it
might be ok, because if the system is busy, then the messages would just pile
up, and be processed when the system was free again. And when the system is
free, who cares how much background work is being done ( to a point ). Is this
true?
Would it be considered a kludgy way of doing it if I stuck to the PtInRect way
of doing it?
P.S. I should have looked through the MSDNCD, but didn't. Thanks for looking
it up and forwarding it to me.
\Thx->CraigL
Labatt Breweries of Canada
Craig,
if you knew how much processing is done when the mouse moves, you wouldn't care
at all about this little check ! With every mouse move, the underlying
window(s) get a least three messages, WM_NCHITTEST, WM_SETCURSOR and
WM_MOUSEMOVE. If the associated processing really takes a lot of time, the rate
of these messages just will slow down a little.
ThomasZ