non-class member function problem

This is a discussion on non-class member function problem within the Windows Programming forums, part of the Platform Specific Boards category; hi
i wanna set a value for a CEdit control on a dlgbox, from within a non-class member function which ...

Ya, create an object of the class and create the window first, then you can add items to the list. You can't add items to a nonexistant window.
Just make a function or something.
If the dialog is created then you can mess around with it all you want.

It is. So long as you create it before.
Common belief may be that when you do

Code:

CServerDlg sd;

It also creates the window. But it doesn't.
It actually creates the dialog when you do

Code:

sd.DoModal();

Therefore, you can't just do

Code:

CServerDlg sd;
sd.m_clrecvd.InsertString(-1, szServerW);

Because the window (or its child window [or controls]) have not been created yet.
The solution is to do what I posted above. Call Create to create the dialog first, THEN add your strings to the list.
Then you have to emulate the behavior of DoModal yourself because it will ASSERT if you've created the dialog before the call to the function.