::CreateDialogIndirect messes with *MY* class memory

Tech-Archive recommends: Speed Up your PC by fixing your registry



Hi everybody!

I have some strange problems with my class memory in my mfc dialog app. It
is either really weird or its just my inexperiencedness with the vc++
stuff.

The main dialog class is derived from CDialog as usual and includes some
private member variables as following:
C / C++ Code:

class CMyDialog : public CDialog {
....
private:
CString m_sJustForMe;
....
}



My deepest wish is to use this variable for my applications functional
purposes. But somehow it (seen as a pointer) gets overwritten with a zero
in the initialization process of the dialog, which of course leads to an
access violation when dereferenced later. I figured that out by adding some
'spacer' to the member classes of the CMyDialog class:

C / C++ Code:

....
private:
int spacer [1024];
CString m_sJustForMe;
....



After recompilation the m_sJustForMe is (as it should be!) untouched and
instead the first two components of the int vector are zeroed while the
rest of the lot remains uninialized. So the mysterious access on my class
memory is symbol independent.

During a long debugging session I traced the wrongdoer down to be the Win32
call ::CreateDialogIndirect somewhere inside CDialog::DoModal.

My compilation system is vc++ .net and the application uses third party
ActiveX Controls.

Thanks in advance for your help out of my desperation.

All yours
torsten
.