Solved

VC++ button control with special character or symbol

Posted on 2010-09-23
5
683 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

821 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