Solved

VC++ button control with special character or symbol

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
VS2008 C++ memory leaks and how to fix them 7 185
linker errors gone with a clean build 2 51
L prefix in C++ 8 101
Tab order 16 53
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…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

762 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now