Click here to Skip to main content
15,895,084 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Array of pointers on the heap? Pin
David Crow22-Oct-03 9:22
David Crow22-Oct-03 9:22 
GeneralRe: Array of pointers on the heap? Pin
Rickard Andersson2022-Oct-03 9:26
Rickard Andersson2022-Oct-03 9:26 
GeneralRe: Array of pointers on the heap? Pin
Rickard Andersson2022-Oct-03 9:35
Rickard Andersson2022-Oct-03 9:35 
GeneralRe: Array of pointers on the heap? Pin
David Crow22-Oct-03 9:59
David Crow22-Oct-03 9:59 
GeneralRe: Array of pointers on the heap? Pin
Jeryth30-Oct-03 10:54
Jeryth30-Oct-03 10:54 
AnswerRe: Array of pointers on the heap? Pin
Nitron23-Oct-03 8:07
Nitron23-Oct-03 8:07 
GeneralSubclassing a CListCtrl derived class in CDialog Pin
b_girl22-Oct-03 8:56
b_girl22-Oct-03 8:56 
GeneralRe: Subclassing a CListCtrl derived class in CDialog Pin
Atlantys22-Oct-03 11:19
Atlantys22-Oct-03 11:19 
My assumption is that you want to handle the scroll message in the dialog, not the listctrl itself. If you're trying to handle it in your listctrl, then it's a different setup (similar though, as most of the code will go into the listctrl class instead of the dialog). Anything application-specific goes in the dialog handler, and anything control-specific would go in the control handler.

In your dlg's DoDatExchange, you should have something like this
void CMyDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CMyDlg)
	DDX_Control(pDX, IDC_LIST, m_List);
....
}


That is where it is sub-classed. No need to use Subclass* etc.

You should also have this:
BEGIN_MESSAGE_MAP(CMyDlg, CDialog)
	//{{AFX_MSG_MAP(CMyDlg)
	ON_WM_VSCROLL()
...
END_MESSAGE_MAP()


This tells the system that this dialog handles the WM_SCROLL message. (this is what you forgot?)

Then, you have this function to actually handle the scroll:
void CMyDlg::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
	if (*(CSliderCtrl*)pScrollBar == m_List) {
//do stuff
	}
	CDialog::OnVScroll(nSBCode, nPos, pScrollBar);
}


Hope that fixes things.

You should also have the function declaration in the .h file, of course. Big Grin | :-D

If you're new to MFC, then you might want to use the "Add Windows Message Handler..." wizard (rclick on the dialog in the ClassView). It does all this for you automatically.


The kindest thing you can do for a stupid person, and for the gene pool, is to let him expire of his own dumb choices.
[Roger Wright on stupid people]

We're like private member functions
[John Theal on R&D]

We're figuring out the parent thing as we go though. Kinda like setting up Linux for the first time ya' know...
[Nitron]

GeneralRe: Subclassing a CListCtrl derived class in CDialog Pin
b_girl23-Oct-03 3:20
b_girl23-Oct-03 3:20 
Generalanother question about command.com Pin
includeh1022-Oct-03 8:23
includeh1022-Oct-03 8:23 
Generalc++ and c# in .NET Pin
HudsonKane22-Oct-03 7:56
HudsonKane22-Oct-03 7:56 
GeneralRe: c++ and c# in .NET Pin
Ryan_Roberts22-Oct-03 11:55
Ryan_Roberts22-Oct-03 11:55 
GeneralRe: c++ and c# in .NET Pin
HudsonKane23-Oct-03 10:09
HudsonKane23-Oct-03 10:09 
GeneralUpdating a list box w/ progress data Pin
jimNLX22-Oct-03 7:30
jimNLX22-Oct-03 7:30 
GeneralRe: Updating a list box w/ progress data Pin
David Crow22-Oct-03 7:43
David Crow22-Oct-03 7:43 
QuestionHow to open a notepad file in a edit box Pin
Deepak Samuel22-Oct-03 6:05
Deepak Samuel22-Oct-03 6:05 
AnswerRe: How to open a notepad file in a edit box Pin
David Crow22-Oct-03 7:52
David Crow22-Oct-03 7:52 
GeneralRe: How to open a notepad file in a edit box Pin
Deepak Samuel22-Oct-03 8:42
Deepak Samuel22-Oct-03 8:42 
GeneralRe: How to open a notepad file in a edit box Pin
David Crow22-Oct-03 8:48
David Crow22-Oct-03 8:48 
GeneralRe: How to open a notepad file in a edit box Pin
Atlantys22-Oct-03 11:30
Atlantys22-Oct-03 11:30 
GeneralProblem with editbox Pin
Deepak Samuel22-Oct-03 6:03
Deepak Samuel22-Oct-03 6:03 
GeneralRe: Problem with editbox Pin
Ravi Bhavnani22-Oct-03 6:12
professionalRavi Bhavnani22-Oct-03 6:12 
GeneralRe: Problem with editbox Pin
David Crow22-Oct-03 7:54
David Crow22-Oct-03 7:54 
GeneralQUESTION about bitwise shift operations Pin
va_dev22-Oct-03 5:49
va_dev22-Oct-03 5:49 
GeneralRe: QUESTION about bitwise shift operations Pin
David Crow22-Oct-03 8:05
David Crow22-Oct-03 8:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.