   Sending data between cpp / h files in MFC appl.
  Hi there.Im sitting here wondering over a problem.i got a msg_Data (listbox) in my maindlg and want to send data to it from another cpp file eg:logging.cppvoid readconfig(){FILE *fIn = fopen("config.ini", "r");// error controlif (fIn == NULL) {errorlog("ERROR : Config file could not be opened");} else {// if no errorslog("Read config file with success");m_msgData.AddString("Read config file with success");// todo// close filefclose(fIn);}return;}then it comes with 2 errors :--------------------Configuration: Updater - Win32 Debug--------------------Compiling...Filesystem.cppD:\c++ projects\Updater\Filesystem.cpp(53) : error C2065: 'm_msgData' : undeclared identifierD:\c++ projects\Updater\Filesystem.cpp(53) : error C2228: left of '.AddString' must have class/struct/union typeGenerating Code...Skipping... (no relevant changes detected)Updater.cppUpdaterDlg.cppLogging.cppError executing cl.exe.Creating browse info file...Updater.exe - 2 error(s), 0 warning(s)anyone know how i can send the string in m_msgData to the listbox in my UpdaterDlg.cpp ?[edited by - Bmsfx on February 16, 2004 6:20:37 AM]
  Are you totally sure your logging.cpp includes the header in which ''m_msgData'' was declared?? ;  ya i even included ALL .h file in my program just incase....and it aint working ;  Maybe you have some cyclic includes? That is like header_A.h and header_B.h are including each other. Sometimes you need to put in a few forward declarations to resolve cyclic inclusion. Just a thought. ;  You must get the pointer to the maindlg. The easiest (but perhaps not the best) way is to declare a static pointer to the dialog. ;quote:Original post by VolkerG  You must get the pointer to the maindlg. The easiest (but perhaps not the best) way is to declare a static pointer to the dialog.   and perhaps u can tell me how ?, or guide me to how its normally done, ill try search the web too, but as usual ill prolly end up without alot of ideas and samples from the pages that does absolutely nothing. ;  readconfig isn''t a member function. How can it get at any member variables? ;  if i do this in my Filesystem.cpp file i dont get any errors but ofcourse it dont send it to the updaterdlg listboxCListBox m_msgData;void readconfig(){FILE *fIn = fopen("config.ini", "r");// error controlif (fIn == NULL) {errorlog("ERROR : Config file could not be opened");} else {// if no errorslog("Read config file with success");m_msgData.AddString ("Read config file with success");// todo// close filefclose(fIn);}return;}any way to transfer it to the listbox in the updaterdlg? 