Controls don't display Unicode Text
I'm trying to figure out this Unicode thing and it isn't working. I can get Unicode text to display in a CRichEdit control but nothing else. This is what I am using in other controls and it just gives me garbage:
Code:
m_cStatic.SetWindowText(m_sUnicodeText);
m_cLictBox.SetWindowText(m_sUnicodeText);
m_cGroupBox.SetWindowText(m_sUnicodeText);
m_cEdit.SetWindowText(m_sUnicodeText);
m_cComboBox.SetWindowText(m_sUnicodeText);
m_cCheckBox.SetWindowText(m_sUnicodeText);
m_cButton.SetWindowText(m_sUnicodeText);
I know that with a Rich Edit control I have to be using version 2.0 and I have to use some special messages to set the text. Is this the same way? If so what messages do I use?
P.S. Yes I have it set up with UNICODE and _UNICODE and I don't have _MBCS defined and I am using LPCTSTR and TCHAR and _T() etc.
Re: Controls don't display Unicode Text
You don't have to do anything special. If you are using _UNICODE , then your app will link to widechar version of Win32 APIs and that's all you need.
Can you zip the project and attach ?
Re: Controls don't display Unicode Text
If you have UNICODE defined, the code you have shown should work. The SetWindowText function differs when you have UNICODE defined:
Code:
BOOL WINAPI SetWindowTextA ( HWND hWnd, LPCSTR lpString );
BOOL WINAPI SetWindowTextW ( HWND hWnd, LPCWSTR lpString );
#ifdef UNICODE
#define SetWindowText SetWindowTextW
#else
#define SetWindowText SetWindowTextA
#endif
Maybe this article can help.
1 Attachment(s)
Re: Controls don't display Unicode Text
I figured that was the case. The trouble is it isn't working. It doesn't even work if I explicitly call the wide versions. Here is the whole project all zipped up. I'm (trying) to use Microsoft Layer For Unicode so the project is only likely to compile if you have updated your Platform SDK. The DLL for the layer in the sdk (unicows.dll) has to go in the same dirrectory as the EXE for the program to run. Thanx for helping.
Re: Controls don't display Unicode Text
Oops !! Where is the attachment ?
BTW, not sure if that attachment is gonna help. You are running 9x, right ?
Re: Controls don't display Unicode Text
Are you setting/do you have, an appropiate font in the controls? A font capable of displaying the unicode text you want to display?
Re: Controls don't display Unicode Text
Sorry I goofed, I'v added the attachment to the post above now. It didn't take the first time.
Re: Controls don't display Unicode Text
Quote:
Originally Posted by Doctor Luz
Are you setting/do you have, an appropiate font in the controls? A font capable of displaying the unicode text you want to display?
meaning??? I'm confused. Let me explain. This is the testing grounds. Once I know what I am doing I will need to be able to display unicode text from any language in nearly any control because I will be converting a rather large program to make it unicode compatable. Users will need to be able to support text from basicaly any language. How, if I need to, do I set up a font to do that?
Re: Controls don't display Unicode Text
you forgot to attach the "res" folder.
Well, it is difficult to have an universal unicode font. Perhaps Arial unicode is the more complete I know but I doubt it supports every language.
Re: Controls don't display Unicode Text
OK. I added the resources. Sorry. As far as the font goes, I'll try switching it to Arial and see what it does. Is there a special way to do this to make it support Unicode? I'll go for it and see what happens.
Re: Controls don't display Unicode Text
I'm getting 8 compiler errors and I have problems with some libraries.
Re: Controls don't display Unicode Text
Do you have the Updated Platform SDK? If not it's available at msdn.microsoft.com but it takes a while to download even with a realy fast connection.
Re: Controls don't display Unicode Text
I'm not %100 positive that I didn't have some open lines of code when I sent that off either. If the errors are on lines that are obviously incomplete just delete the lines.
Re: Controls don't display Unicode Text
Quote:
Originally Posted by Doctor Luz
I'm getting 8 compiler errors and I have problems with some libraries.
tsk tsk...Dr Luz that is not an adequte problem description :) What are the errors?
Complies fine for me VC6.0 + 2003 SDK
/after changing the lib path [killing the dependency path in the proj file] for the unicode library that is :)
Re: Controls don't display Unicode Text
Quote:
Originally Posted by Crenshaw
Do you have the Updated Platform SDK? If not it's available at msdn.microsoft.com but it takes a while to download even with a realy fast connection.
I suppose that is the problem. I recently had to reinstall VC and I don't have updated the platform SDK yet.