You would also need the reference to that
CDialog
object because
m_ListCtrl
is a declared identifier, and also instantiated object, there.
This is also quite logical if you consider that it would be impossible for the compiler to guess which
m_ListCtrl
you mean if at any time you got more than one object of
CDialog
. The reference to the specific
CDialog
object is therefor required.
It should be something like:
m_CDialog.m_ListCtrl.InsertItem(0, _T("TESTING"))
By the way, it would be much more safe to provide a method for adding a value from the dialog itself. This means you would create a
CDialog.AddListItem(...)
. If you expose
m_ListCtrl
directly, other code can manipulate this control completely. With the your own method exposed from
CDialog
you prevent this and external code can only add a value, but not delete items, change the font or make any other unwanted changes to the list control.
Good luck!