Doomulation
?????????????????????????
I'm at a loss; there seems to be some BIG error, but I do not know what.
Look at this simple declaration (MFC):
When creating this dialog and then destructing it, wether it is on the heap or the stack, the CString objects here write PAST the actual object, causing stack corruption or memory corruption. See this snippet:
Yes, that's all I do! And yet it doesn't work. And I cannot figure out why! Does anyone have a clue? I have yet to try to start over with a new project, but...
I can replace those CStrings with other classes, and the same error occours. It happens within the constructors of those objects; native types such as int does not cause this problem. Anyone have ANY idea at all?
Look at this simple declaration (MFC):
Code:
// CCommandLauncherDlg dialog
class CCommandLauncherDlg : public CDialog
{
// Construction
public:
CCommandLauncherDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
enum { IDD = IDD_COMMANDLAUNCHER_DIALOG };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
// Implementation
protected:
HICON m_hIcon;
// Generated message map functions
virtual BOOL OnInitDialog();
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
DECLARE_MESSAGE_MAP()
virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
protected:
virtual void OnCancel();
virtual void OnOK();
public:
afx_msg void OnClose();
CString m_strCommand;
CString m_strCommand2;
afx_msg void OnBnClickedOk();
};
When creating this dialog and then destructing it, wether it is on the heap or the stack, the CString objects here write PAST the actual object, causing stack corruption or memory corruption. See this snippet:
Code:
CCommandLauncherDlg* pDlg = new CCommandLauncherDlg;
delete pDlg;
Yes, that's all I do! And yet it doesn't work. And I cannot figure out why! Does anyone have a clue? I have yet to try to start over with a new project, but...
I can replace those CStrings with other classes, and the same error occours. It happens within the constructors of those objects; native types such as int does not cause this problem. Anyone have ANY idea at all?
Last edited: