Click here to Skip to main content
15,881,027 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
C++
LRESULT CUIWindowPage::OnMouseWheel(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
  ??
}
Posted
Updated 16-Dec-15 17:58pm
v4
Comments
Sergey Alexandrovich Kryukov 17-Dec-15 1:59am    
The question makes no sense. Write what you want to happen on mouse wheel event.
—SA
Member 12192742 17-Dec-15 22:58pm    
I have ATL Dialog where there is a vertical Scrollbar which is working fine with mouse clicking on scrollbar and then drag and drop on scroll area region , but I am not able to scroll the same dialog with mouse wheel. Please help me providing how to implement mouse wheel functionality so that the dialog can be scrolled.
Member 12192742 17-Dec-15 23:06pm    
LRESULT CRichBiasWindowPage::OnVerticalScrollBar( UINT uMsg, WPARAM wParam , LPARAM lParam, BOOL& bHandled )
{
int iScrollCode = (int)LOWORD(wParam);
SCROLLINFO si = {sizeof(SCROLLINFO), SIF_ALL, 0, 0, 0, 0,0};

GetScrollInfo (SB_VERT, &si);
int iVertPos = si.nPos;
switch (iScrollCode)
{
case SB_LINEUP:
si.nPos = iVertPos;
if(si.nPos < SCROLL_LINEMINRANGE)
{

si.nPos = 0;
}
else
{
si.nPos -= SCROLL_LINEMINRANGE;
}
break;
case SB_PAGEUP: //user clicks middle of scroll bar
si.nPos = iVertPos;
if(si.nPos < SCROLL_PAGEMINRANGE)
{

si.nPos = 0;
}
else
{
si.nPos -= SCROLL_PAGEMINRANGE;
}
break;
case SB_LINEDOWN:
si.nPos = iVertPos;
if(si.nPos > (SCROLL_MAX - SCROLL_LINEMINRANGE))
{

si.nPos = SCROLL_MAX;
}
else
{
si.nPos += SCROLL_LINEMINRANGE;
}
break;
case SB_PAGEDOWN: //user clicks middle of scroll bar
si.nPos = iVertPos;
if(si.nPos > (SCROLL_MAX - SCROLL_PAGEMINRANGE))
{

si.nPos = SCROLL_MAX;
}
else
{
si.nPos += SCROLL_PAGEMINRANGE;
}
break;
case SB_THUMBTRACK:
si.nPos = (int)HIWORD(wParam);
break;

case WM_MOUSEWHEEL:
if ((short )GET_WHEEL_DELTA_WPARAM(wParam) > 0)
{

}
break;
if ((short)GET_WHEEL_DELTA_WPARAM(wParam) < 0)
{

}
break;


}
SetScrollPos(SB_VERT, si.nPos, FALSE);
ScrollWindow(0, (iVertPos - si.nPos)*SCROLL_VARIANCE, NULL, NULL);
return 1;
}
Member 12192742 17-Dec-15 23:10pm    
OnVerticalScrollBar function is working fine for clicking and drag drop on scroll bar in scrollbar region to scroll the dialog. But I want something like:
LRESULT CUIWindowPage::OnMouseWheel(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
??
}

So that I can scroll the same dialog using my mousewheel.
Member 12192742 18-Dec-15 23:42pm    
Please provide solution for the issue,I didn't found any function anywhere which can scroll the ATL Dialog with the help of mousewheel.

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