how to add ScrollBar to Dialog
I have added Vertical ScrollBar to my Dialog.I have added variable m_ScrollBarto to it and set its range.
m_ScrollBar.SetScrollRange(0,10);
I have to add Eventhandler to ScrollBar.How to add WM_VSCROLL message map
to it.If I press ctrl+w class wizard is not coming.How to open Class wizard Dialog Box. Can anyone suggest me.
Re: how to add ScrollBar to Dialog
Using ctrl+w to invoke class wizard only apply to VC6, are you using VC6?
Re: how to add ScrollBar to Dialog
Hi,
I am using Visual Studio 2005.
Re: how to add ScrollBar to Dialog
There is no similar ctrl+w class wizard in VS2005. However you can always hand-code the event handler code.
Copy below code to your class definition.
Code:
protected:
// Generated message map functions
afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
Copy below code to your class implementation.
Code:
BEGIN_MESSAGE_MAP(CScrollBarDlg, CPropertyPage)
ON_WM_HSCROLL()
ON_WM_VSCROLL()
END_MESSAGE_MAP()
void CScrollBarDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
}
void CScrollBarDlg::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
}