How to use the right and middle mouse buttons
An example straight from one of my dialogs:
BEGIN_MSG_MAP(CSrGeneralDlg)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
COMMAND_ID_HANDLER(IDOK, OnOK)
COMMAND_ID_HANDLER(IDCANCEL, OnCancel)
COMMAND_ID_HANDLER(IDC_APPLY, OnApply)
COMMAND_CODE_HANDLER(EN_CHANGE, OnEditChange)
COMMAND_HANDLER(IDC_AUTOGAIN, BN_CLICKED, OnAutoGainClicked)
END_MSG_MAP()
// Handler prototypes:
// LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL&
bHandled);
// LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL&
bHandled);
// LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL
&rbHandled);
LRESULT OnOK(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &rbHandled);
LRESULT OnCancel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL
&rbHandled);
LRESULT OnApply(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &rbHandled);
LRESULT OnEditChange(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL
&rbHandled);
LRESULT OnAutoGainClicked(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL
&rbHandled);
Beware of line wraps... Also, read the help on the various macros.
--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================
Quote:
> Thanks for answering me...
> As my class wizard is not working with ATL (I don't know why) I need to
know
> how to manually declare the handlers WM_RBUTTONDOWN, WM_RBUTTONUP,
> WM_MBUTTONDOWN and WM_MBUTTONUP
> Thanks
> > Just for clarification, your class must derive from CMessageMap
> > (usually via CWindowImpl<>) in order for the wizard to show up.
> > --
> > =====================================
> > Alexander Nickolov
> > Microsoft MVP [VC], MCSD
> > MVP VC FAQ: http://www.mvps.org/vcfaq
> > =====================================
> > > Greets,
> > > The "ClassWizard" does not allow one to easily deal with ATL
objects
> > in
> > > that fashion. It is mainly more useful for creating ActiveX controls
> with
> > > MFC.
> > > With regards to what you seek, switch to the ClassView pane on the
> > > workspace area, select the class that implements the control or
window,
> > > right click, then choose "Add Windows Message Handler" from the
context
> > > menu. This will allow one to select from a fairly decently sized list
> of
> > > messages to handle.
> > > Regards,
> > > Joe
> > > > Thanks for answering me...
> > > > As my class wizard is not working with ATL (I don't know why) I need
> to
> > > know
> > > > how to manually declare the handlers WM_RBUTTONDOWN, WM_RBUTTONUP,
> > > > WM_MBUTTONDOWN and WM_MBUTTONUP
> > > > Thanks
> > > > nico
> > > > > Install message handlers for WM_RBUTTONDOWN,
> > > > > WM_MBUTTONDOWN, etc.
> > > > > --
> > > > > =====================================
> > > > > Alexander Nickolov
> > > > > Microsoft MVP [VC], MCSD
> > > > > MVP VC FAQ: http://www.mvps.org/vcfaq
> > > > > =====================================
> > > > > > How could I use the mouse buttons in my ATL class? How ould the
> > > > functions
> > > > > > look like?
> > > > > > Thanks