The zoom scroll bar control is based on the standard scroll bar common control. All the command controls always send notification messages to their parent window. So, your CExtZoomScrollBar
zoom scroll bar sends the WM_HSCROLL
messages to its parent CExtStatusControlBar
status bar window. The ZoomScrollBar sample application has the CMainFrame::CMyStatusBar
status bar class which is defined locally in the scope of the CMainFrame
class:
class CMyStatusBar : public CExtStatusControlBar
{
protected:
virtual LRESULT WindowProc( UINT message, WPARAM wParam, LPARAM lParam )
{
if( message == WM_HSCROLL || message == WM_VSCROLL )
return GetParent()->GetDlgItem(AFX_IDW_PANE_FIRST)->SendMessage( message, wParam, lParam );
return CExtStatusControlBar::WindowProc( message, wParam, lParam );
}
}; // class CMyStatusBar
As you can see, the
WindowProc()
virtual method simply redirects the scrolling messages to the child window of the main frame. This child window has the
AFX_IDW_PANE_FIRST
standard dialog control identifier. This child window is the view window in SDI frame based applications. The
CFrameWnd
class automatically detects its child window with the
AFX_IDW_PANE_FIRST
dialog control identifier and resizes it to cover entire center area of the frame which is free of any control bars placed near the frame borders. The view window inside the SDI frame window always have the
AFX_IDW_PANE_FIRST
dialog control identifier. You can redirect the scrolling messages to main frame window instead of view:
class CMyStatusBar : public CExtStatusControlBar
{
protected:
virtual LRESULT WindowProc( UINT message, WPARAM wParam, LPARAM lParam )
{
if( message == WM_HSCROLL || message == WM_VSCROLL )
return GetParentFrame()->SendMessage( message, wParam, lParam );
return CExtStatusControlBar::WindowProc( message, wParam, lParam );
}
}; // class CMyStatusBar