none
CEdit - GetWindowText

    Question

  • Hi,

        I am developing a VC++ application (Visual Studio .NET 2003 Service Pack 1, MFC shared, MBCS character set). In a dialog box I have an CExtEdit control. My default keyboard setting in Windows is EN-US. Now I switch the keyboard to Romanian (RO) and I enter the following romanian characters: ŞŢ. The characters are entering and displaying fine in the edit control, but whne I call GetWindowText() in dialog's OnOK method, instead of ŞŢ characters I get ST.
        And the strange thing is that this only happens in Release build, in Debug builds I can retrive the  ŞŢ characters using GetWindowText.

    What's wrong ?

    Zoli
    Tuesday, February 20, 2007 11:16 AM

Answers

  • Since it works in Debug and not in Release you should check what is different between the two configurations (make sure they both use the same character set). It's hard to make a diagnosis without seeing the code. So can you post it here, at least snippets?

    Tuesday, February 20, 2007 11:22 AM

All replies

  • Sorry, the control is CEdit not CExtEdit
    Tuesday, February 20, 2007 11:20 AM
  • Since it works in Debug and not in Release you should check what is different between the two configurations (make sure they both use the same character set). It's hard to make a diagnosis without seeing the code. So can you post it here, at least snippets?

    Tuesday, February 20, 2007 11:22 AM
  • Salut,

    The code is simple:

     

    void CTextModDialog::OnOK() {

      CString cs;

      GetDlgItem(IDC_S)->GetWindowText(cs);

      CDialog::OnOK();

    }

    If you give me a mail address I can send you the project configuration file to have a look.

    Tuesday, February 20, 2007 11:41 AM