Message Response

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Greetings,

Am creating a MFC API C++ application.

Am using Windows notification messages, with a message-map entry and
message-handler member function, that traps mouse movement message and draws
a rubber band.

But the user will only be using that zoom feature for a very small portion
of the time they are using the application. The rest of the time I will be
trapping Mouse Movement messages, and in my message-handler member function I
will be just be returning because he/she has not hit the zoom button yet.

Seem like I'm really wasting resources having this Mouse Movement message
enabled all the time. Is there some way to turn on/off message handing within
a member function of the CChild window. That way, when the User hits the
zoom button, that button's message handler function could "enable" the Mouse
Movement message handling for the rubber banding, then "disable" it when the
zoom is done.

Or am I just worried about wasting nano-seconds, that don't really cause any
grief.

Thanks,

Mike
 
mike east said:
Seem like I'm really wasting resources having this Mouse Movement message
enabled all the time. Is there some way to turn on/off message handing
within
a member function of the CChild window. That way, when the User hits the
zoom button, that button's message handler function could "enable" the
Mouse
Movement message handling for the rubber banding, then "disable" it when
the
zoom is done.

Or am I just worried about wasting nano-seconds, that don't really cause
any
grief.

Well, Windows sends some messages just because it can. ;-)

Seriously, most window procedures pass messages which they don't handle to
DefWindowProc() - the default window procedure. MFC is likely doing that
being your back. You could choose to process the messages when you need them
and pass them to DefWindowProc() when you don't.

Regards,
Will
 
Back
Top