Click here to Skip to main content
15,888,286 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi All...
I am trying to disable mouse wheel for a combo box in C++(MFC).Can anyone help me?

What I have tried:

I tried using WM_MOUSEWHEEL but not upto the mark.
Posted
Updated 3-Feb-17 0:25am
Comments
Richard MacCutchan 3-Feb-17 7:16am    
"not upto the mark"
Means what?
Philippe Mori 3-Feb-17 10:10am    
Not a good idea to modify how controls are expected to works. People will hate your application.

1 solution

A common method would be deriving your own class from the MFC control and handling the message there using PreTranslateMessage (untested):
BOOL CMyComboBox::PreTranslateMessage(MSG* pMsg)
{
    return pMsg->message == WM_MOUSEWHEEL ? TRUE : CComboBox::PreTranslateMessage(pMsg);
}
 
Share this answer
 
Comments
Rais Shaikh 6-Feb-17 2:52am    
In that page I have Clistctrl also for that also it is disabling mouse wheel. How to make it specific for CCombobox. Thanks
Jochen Arndt 6-Feb-17 2:59am    
You have to derive you own combo box class (named CMyComboBox in my example) and handle the message there.

You may also handle it in the dialog class (which seems what you have done) but must then check which control is the recipient of the message and filter the message only when it is for the combo box(es).
Rais Shaikh 6-Feb-17 4:15am    
Thank You So much... I got it.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900