Solved

VC++ button control with special character or symbol

Posted on 2010-09-23
5
680 Views
Last Modified: 2012-05-10
Using Visual Studio 2005, I added a symbol, a triangle character "¿", to the caption of a button control.
It looks fine in the resource editor, so does in test dialog view.
But when the project is built and run, the symbol just appears as a question mark.
I tried changing the font property of the dialog box without luck.
Am I missing something?
Thank you.
0
Comment
Question by:jhp333
  • 3
  • 2
5 Comments
 
LVL 7

Author Comment

by:jhp333
ID: 33748725
The symbol does not appear correctly in the body of this post either.
"¿"
0
 
LVL 33

Accepted Solution

by:
pgnatyuk earned 500 total points
ID: 33754230
This project supports Unicode character set?
Probably, not. You can make a small test Unicode project aside and check everything there.
Check the codepage set for the dialog resource.

You can change the window text with SetWindowText function. Or, if it is a dialog, SetDlgItemText. Try to use these function to modify the button caption.

This symbol you use for the button caption should be presented in the font you use for this GUI control.

Use MessageBox function with a text that will contain the same special character and  see if it works.

0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 33754270
For Copyright symbol:

// 0xA9 is the hex for copyright symbol.
const LPCWSTR lpszCopyright = L"Copyright \xA9 cool";

0
 
LVL 7

Author Comment

by:jhp333
ID: 33757154
Thank you for your answer.
You're right, the project doesn't support Unicode. But SetDlgItemText fixes the problem, even when the symbol is not in the font for the dialog box. So I guess it's an issue with the resource editor.
Do you have any idea why it's fine when used with SetDlgItemText but not with the resource editor?

Copyright symbol is a single byte character and doesn't make any problem. Also I can just copy and paste it without using the escaping you suggested.
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 33757311
I've said, check the code page set for the resource file.
The standard page is 1252 - English. I think, if you will set it in your project, it will work too.
Extended characters (from 128) are different for different code pages.

I do not use the resource editor for GUI. Maybe, only for small test applications.
Localization is a very long story. If you wish you can read everything yourself from the source documents:
MSDN. Developing International Software
http://msdn.microsoft.com/en-us/library/cc307362.aspx
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
In Easy String Encryption Using CryptoAPI in C++ (http://www.experts-exchange.com/viewArticle.jsp?aid=1193) I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question