Click here to Skip to main content
15,895,142 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: CTabCtrl and Scrolling Pin
Azghar Hussain7-Jul-05 0:54
professionalAzghar Hussain7-Jul-05 0:54 
Questionapproach to develope gave server application ? Pin
manxx6-Jul-05 21:09
manxx6-Jul-05 21:09 
GeneralSource Code creating Static Control at RunTime Pin
a_david1236-Jul-05 21:08
a_david1236-Jul-05 21:08 
GeneralRe: Source Code creating Static Control at RunTime Pin
Stlan6-Jul-05 22:34
Stlan6-Jul-05 22:34 
GeneralPlease help me! Pin
dSolariuM6-Jul-05 21:08
dSolariuM6-Jul-05 21:08 
GeneralSource Code creating Static Control at RunTime Pin
a_david1236-Jul-05 21:05
a_david1236-Jul-05 21:05 
GeneralRun-Time Check Failure #2 [edited] Pin
toxcct6-Jul-05 20:16
toxcct6-Jul-05 20:16 
GeneralRe: Run-Time Check Failure #2 Pin
Bob Stanneveld6-Jul-05 21:09
Bob Stanneveld6-Jul-05 21:09 
toxcct wrote:
Run-Time Check Failure #2 - Stack around the variable 'EditorOptions' was corrupted.

This means that some variable on your stack was overflowed or underflowed. Also that the program asserts when you leave the handler indicates that that the stack is corrupted in that function, not in the DoModal.


toxcct wrote:
::strcpy(m_strEditorVersion, EditorVersion);

I think that the problem is here. You call un unsafe C function on a variable with an uninitialized length! If my assumtions are correct, m_strEditorVersion is of type CString.

If I'm correct, see what the following gets you:
::strncpy(m_strEditorVersion.GetBufferSetLength(256), EditorVersion, 255);
m_strEditorVersion.ReleaseBuffer();


Your problem was because you were writing to a CString buffer that had a size which was too small. A better solution would be:
COptionsDlg::COptionsDlg(TEditorOptions& EditorOptions, <br />
                         CString         EditorVersion,<br />
                         CWnd*           pParent /* = NULL */)<br />
        : CDialog(COptionsDlg::IDD, pParent),<br />
          m_EditorOptions(EditorOptions),    // m_EditorOptions is defined as a TEditorOptions&<br />
          m_strEditorVersion(EditorVersion) <br />
{    // or just try:<br />
     // m_strEditorVersion = EditorVersion;<br />
     m_strDigitsInYears.Format("%d", m_EditorOptions._NbDigitsInYears);       <br />
     m_strDigitsInPhones.Format("%d", m_EditorOptions._NbDigitsInPhones);<br />
}<br />


May I ask why you use ::strcpy to copy CString contents?

Behind every great black man...
            ... is the police. - Conspiracy brother


Blog[^]
GeneralRe: Run-Time Check Failure #2 Pin
toxcct7-Jul-05 0:18
toxcct7-Jul-05 0:18 
GeneralRe: Run-Time Check Failure #2 Pin
Bob Stanneveld7-Jul-05 0:26
Bob Stanneveld7-Jul-05 0:26 
GeneralRe: Run-Time Check Failure #2 [edited] Pin
toxcct7-Jul-05 0:31
toxcct7-Jul-05 0:31 
GeneralRe: Run-Time Check Failure #2 Pin
Bob Stanneveld7-Jul-05 0:32
Bob Stanneveld7-Jul-05 0:32 
GeneralRe: Run-Time Check Failure #2 Pin
toxcct7-Jul-05 5:32
toxcct7-Jul-05 5:32 
GeneralRe: Run-Time Check Failure #2 Pin
Bob Stanneveld7-Jul-05 5:45
Bob Stanneveld7-Jul-05 5:45 
Questionhow to uninstall U disk Pin
6-Jul-05 18:35
suss6-Jul-05 18:35 
AnswerRe: how to uninstall U disk Pin
David Crow7-Jul-05 5:07
David Crow7-Jul-05 5:07 
Generalswitch() function Pin
Anonymous6-Jul-05 18:35
Anonymous6-Jul-05 18:35 
GeneralRe: switch() function Pin
khan++6-Jul-05 19:22
khan++6-Jul-05 19:22 
GeneralRe: switch() function Pin
Bob Stanneveld6-Jul-05 20:44
Bob Stanneveld6-Jul-05 20:44 
GeneralRe: switch() function Pin
Anonymous7-Jul-05 8:18
Anonymous7-Jul-05 8:18 
GeneralRe: switch() function Pin
Bob Stanneveld7-Jul-05 19:51
Bob Stanneveld7-Jul-05 19:51 
GeneralRe: switch() function Pin
Maximilien7-Jul-05 0:38
Maximilien7-Jul-05 0:38 
Questionhow to use mfc in win32 dll? Pin
gohappy_19996-Jul-05 18:05
gohappy_19996-Jul-05 18:05 
AnswerRe: how to use mfc in win32 dll? Pin
ThatsAlok6-Jul-05 20:23
ThatsAlok6-Jul-05 20:23 
GeneralVARIANT/COM Hell Pin
Christian Graus6-Jul-05 17:03
protectorChristian Graus6-Jul-05 17:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.