After I've designed a dialog with say, a ListBox... How do I connect the resource (display) with the CListBox variable in my main dialog class ?
Printable View
After I've designed a dialog with say, a ListBox... How do I connect the resource (display) with the CListBox variable in my main dialog class ?
I don't quite understand you, can you be more specific?? Possibly posting some minimal yet complete code? [please see my signature below....]
Take a look here. It's similar.
The code is too complex to paste, but here is the problem:
I created a dialog Project. In the main dialog I placed a ListBox control.
I want to add a varaiable to the control so I can update the information displayed in it. I tried using the class wizard, which creates the control variable. But I can't access the variable from within my main dialog even though it is a member of that dialog.
I was thinking that if I declare the CListBox m_listBox in the public section of the main dialog, and then attach is to the visual control, it might work. At least, it would help me understand it a little more if it doesn't work.
Understand now ?
Yeah, that's what I was looking for. I've done it before but couldn't remember. What DDX function is used for a CListBox ? DDX_Text isn't the right one...
Nevermind... Found it. DDX_Control. :-)
I'm still having the same problem...
So I can't access the ListBox in that function. They are both declared in the public section of the same dialog. What's the deal?Code:
CDialog {
...
public:
CListBox m_ListBox;
static BOOL CALLBACK GetWndName(HWND hWnd, LPARAM lParam){
m_ListBox.AddString("HEY!");
return TRUE;
}
...
}