The scroll bar’s context menu can be enabled by updating the source code for the following 3 methods:
void CExtScrollBar::OnContextMenu(CWnd* pWnd, CPoint point)
{
ASSERT_VALID( this );
CScrollBar::OnContextMenu( pWnd, point );
}
void CExtScrollBar::OnRButtonDown(UINT nFlags, CPoint point)
{
ASSERT_VALID( this );
if( ! m_bCompleteRepaint )
{
CScrollBar::OnRButtonDown( nFlags, point );
return;
}
MSG _msg;
::memset( &_msg, 0, sizeof(MSG) );
_msg.hwnd = m_hWnd;
_msg.message = WM_RBUTTONDOWN;
_msg.wParam = WPARAM(nFlags);
_msg.lParam = MAKELPARAM( point.x ,point.y );
if( ! ScrollBar_OnMouseClickMsg( &_msg ) )
CScrollBar::OnRButtonDown( nFlags, point );
}
bool CExtScrollBar::ScrollBar_OnMouseClickMsg(
MSG * pMSG
)
{
ASSERT_VALID( this );
ASSERT( pMSG != NULL );
bool bRetVal = true;
bool bRightClickMsg = false;
switch( pMSG->message )
{
case WM_LBUTTONDOWN:
ScrollBar_TrackMouseLButtonDown( pMSG );
break;
case WM_RBUTTONDOWN:
bRightClickMsg = true;
case WM_RBUTTONUP:
case WM_RBUTTONDBLCLK:
//bRetVal = false;
case WM_LBUTTONUP:
case WM_LBUTTONDBLCLK:
case WM_MBUTTONDOWN:
case WM_MBUTTONUP:
case WM_MBUTTONDBLCLK:
{
CExtPopupMenuTipWnd * pATTW =
OnAdvancedPopupMenuTipWndGet();
if( pATTW != NULL )
pATTW->Hide();
if( bRightClickMsg )
{
POINT pt;
::GetCursorPos( &pt );
SendMessage( WM_CONTEXTMENU, WPARAM(m_hWnd), MAKELPARAM(pt.x,pt.y) );
}
}
break;
default:
bRetVal = false;
break;
} // switch( pMSG->message )
return bRetVal;
}
And all the commands of this context menu work correctly because the
CExtScrollBar
class has the same part sizes as the scroll bar common control. But the
Scroll Here menu command causes repainting of the scroll bar common control in the default windows style. The scroll bar common control is very specific. Like all the other old common controls introduced before Windows 95, this common control changes its state without any notification messages. It also repaints itself not via the standard
WM_PAINT
message. Prof-UIS completely handles all the mouse and keyboard messages of all the old common controls present in Windows 3x. We cannot enable the default scroll bar’s context menu. But we can assume your message as a feature request. We will need to code our own context menu and ask our translators to translate it.