Click here to Skip to main content
15,894,315 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralDragging rectangle Pin
Anonymous22-Dec-04 8:19
Anonymous22-Dec-04 8:19 
GeneralRe: Dragging rectangle Pin
David Crow22-Dec-04 9:03
David Crow22-Dec-04 9:03 
GeneralRe: Dragging rectangle Pin
Anonymous22-Dec-04 11:45
Anonymous22-Dec-04 11:45 
GeneralRe: Dragging rectangle Pin
John R. Shaw22-Dec-04 16:05
John R. Shaw22-Dec-04 16:05 
GeneralVC6 function template problems Pin
peterchen22-Dec-04 7:47
peterchen22-Dec-04 7:47 
GeneralRe: VC6 function template problems Pin
Antti Keskinen22-Dec-04 13:04
Antti Keskinen22-Dec-04 13:04 
GeneralRe: VC6 function template problems Pin
peterchen22-Dec-04 19:53
peterchen22-Dec-04 19:53 
GeneralSetWindowText gives me headache Pin
toxcct22-Dec-04 7:02
toxcct22-Dec-04 7:02 
Hi everybody,

I've got a strange behavior with my code.
I have a dialog-based program, which opens another dialog (modal) when the user click on the right menu item.
There, OnInitDialog() is called before the new dialog is displayed, and it it there where I initialize my dialog depending on how the dialog was created.
I do a set of LoadString() to display the texts of the dialog in the correct language. but after loading the strings, SetWindowText() crashes.
here is the code :
Call of the new dialog :
<font color=#0000FF>void</font> CFactEditorDlg::OnFileOpen() {
    COpenFilesDlg dlg(m_strDBFile, m_strDestFile);
    <font color=#0000FF>if</font> (dlg.DoModal() == IDOK) {
        <font color=#008000>//...</font>
    }
}

New dialog's initialisation :
BOOL COpenFilesDlg::OnInitDialog() {
    CDialog::OnInitDialog();
    <font color=#008000>//...</font>
    CString strWindowText;
    strWindowText.LoadString(IDS_OFD_FACT_RECSTAT);    m_psrFact->SetWindowText(strWindowText);
    strWindowText.LoadString(IDS_OFD_DB_RECSTAT);      m_psrDataBase->SetWindowText(strWindowText);
    strWindowText.LoadString(IDS_OFD_PROMPT);          m_psFactPrompt->SetWindowText(strWindowText);
                                                       m_psDBPrompt->SetWindowText(strWindowText);
<font color=#FF0000>-></font>  strWindowText.LoadString(IDS_OFD_PREVIEW_BTN);     m_pbPreviewFact->SetWindowText(strWindowText);
    <font color=#008000>//...</font>
}

The real place having problem :
<font color=#0000FF>void</font> CWnd::SetWindowText(LPCTSTR lpszString) {
<font color=#FF0000>-></font>  ASSERT(::IsWindow(m_hWnd));

    <font color=#0000FF>if</font> (m_pCtrlSite == NULL)
        ::SetWindowText(m_hWnd, lpszString);
    <font color=#0000FF>else</font>
        m_pCtrlSite->SetWindowText(lpszString);
}

what does it mean ???
few day ago, this code was working well, and today, when i was updating another class of the program (which have no relation of any order with this one), it stops me there now...

can anyone help of any kind please ?



TOXCCT >>> GEII power
[toxcct][VisualCalc]
GeneralRe: SetWindowText gives me headache Pin
David Crow22-Dec-04 8:18
David Crow22-Dec-04 8:18 
GeneralRe: SetWindowText gives me headache Pin
toxcct22-Dec-04 8:31
toxcct22-Dec-04 8:31 
GeneralRe: SetWindowText gives me headache Pin
toxcct22-Dec-04 8:45
toxcct22-Dec-04 8:45 
GeneralRe: SetWindowText gives me headache Pin
David Crow22-Dec-04 9:00
David Crow22-Dec-04 9:00 
GeneralRe: SetWindowText gives me headache Pin
Rick York22-Dec-04 13:05
mveRick York22-Dec-04 13:05 
GeneralRe: SetWindowText gives me headache Pin
toxcct22-Dec-04 18:43
toxcct22-Dec-04 18:43 
GeneralRe: SetWindowText gives me headache Pin
David Crow23-Dec-04 2:11
David Crow23-Dec-04 2:11 
GeneralPhone Number Format Pin
Anonymous22-Dec-04 6:31
Anonymous22-Dec-04 6:31 
GeneralRe: Phone Number Format Pin
David Crow22-Dec-04 8:13
David Crow22-Dec-04 8:13 
GeneralRe: Phone Number Format Pin
Anonymous22-Dec-04 9:36
Anonymous22-Dec-04 9:36 
GeneralScrollbar doesn't scroll all the way Pin
Budric B.22-Dec-04 4:49
Budric B.22-Dec-04 4:49 
GeneralChanging screen resolution in windows xp Pin
Mohammad A Gdeisat22-Dec-04 4:41
Mohammad A Gdeisat22-Dec-04 4:41 
GeneralRe: Changing screen resolution in windows xp Pin
David Crow22-Dec-04 5:07
David Crow22-Dec-04 5:07 
GeneralRe: Changing screen resolution in windows xp Pin
Mohammad A Gdeisat22-Dec-04 7:38
Mohammad A Gdeisat22-Dec-04 7:38 
GeneralStrange CTypedPtrArray error Pin
Polly Parrot22-Dec-04 3:31
Polly Parrot22-Dec-04 3:31 
Generalinserting bmp in file Pin
verma-rahul22-Dec-04 3:07
verma-rahul22-Dec-04 3:07 
GeneralRe: inserting bmp in file Pin
David Crow22-Dec-04 5:04
David Crow22-Dec-04 5:04 

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.