Click here to Skip to main content
15,923,689 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, i'm trying to create a rich edit control in windows, following these very straightforward instructions here [http://msdn.microsoft.com/en-us/library/hh298375(v=vs.85).aspx[^], which are very straightforward, but when i try to compile, it tells me that MSFTEDIT_CLASS defines a unicode string, "RICHEDIT50W". I have no intention of using unicode in my program but in searching, i found no counterpart, "RICHEDIT50A". is there a non-unicode richedit 4.1 class? or am i gonna have to rewrite my entire appication to use unicode?

Edit: I just realized i worded my question entirely incorrectly, and everywhere that i said the word unicode, i meant the use of wide character strings. Is there a version of richedit 4.1 that does not utilize wide character strings?


EDIT: wow, one google search using phrase wide characters instead of the phrase unicode and i find the answer i'm looking.

<a href="http://cboard.cprogramming.com/windows-programming/54614-why-i-cant-use-richedit-4-1-a.html">http://cboard.cprogramming.com/windows-programming/54614-why-i-cant-use-richedit-4-1-a.html</a>[<a href="http://cboard.cprogramming.com/windows-programming/54614-why-i-cant-use-richedit-4-1-a.html" target="_blank" title="New Window">^</a>]

specifically states that 4.1 was not available in anything but unicode. at least now i know. i'll just use 3.0 until a future time when i decide to rewrite my program for unicode. Thanks SAKryukov for putting up with my nonsense for awhile.
Posted
Updated 30-Aug-11 5:36am
v4

1 solution

Yes and no. RTF is a very old format, created well before Unicode was introduced. Take your Unicode-enabled Windows and type some Unicode characters in Wordpad.exe. Save it. Look at the RTF using some plain-text editor — you will see no trace of Unicode. The same RTF has different interfaces; when the application is run on Unicode-enabled system, you can copy text and it will be paste as Unicode. You can make the component non-Unicode by not defining _UNICODE in your project. See http://www.i18nguy.com/unicode/c-unicode.html[^].

Now, let's see if it makes any sense. If you already provide Rich text control to the user, the use can type anything. Then you use the produced formatted text somehow and what? — if the user types text using Unicode code point using installed input method, do you want these characters to be converted to '?' characters?

No, these days using non-Unicode strings cannot be self-consistent, especially with RTF where the user cannot immediately detect that Unicode is not supported, will continue typing and — what a frustration! Think about it. This is possible, but incorrect.

[EDIT]

In principle, you can filter each and every typed character and allow only certain subset of characters. A bid hassle. Supporting Unicode is much easier.

Again, what you type in Rich text editor is internally not Unicode. But when you save it as text, it will be saved as Unicode text, or in non-Unicode compilation, with '?' replacing non-ANSI characters.

—SA
 
Share this answer
 
v2
Comments
FatalCatharsis 29-Aug-11 22:45pm    
well, i have two comments here. 1) i don't have _UNICODE defined in my project and it won't even give me the option of creating the rich text component, because it does not seem to have an ANSI counterpart and 2) I have already written the rest of my program using ANSI characters. It isn't that i have anything against unicode. shoot, in hindsight, i really wish i had decided to go full unicode, or even better, used the functions and types compatible with both, but hadn't read about it until after i'd already written up a huge project in windows. So my question now is, is there anyway to create a version 4.1 richtext control for ANSI, or will i need to start trawling through and revising my code to be unicode? cause i have seen that there are lower versions that do support ansi, but i figured it would be better to be up to date.
Sergey Alexandrovich Kryukov 30-Aug-11 11:22am    
I would just warn you, your efforts to stay with ANSI might not save your time but eat up extra time and create frustration. Just be careful in this decision...
--SA
FatalCatharsis 30-Aug-11 11:14am    
So either way, i'm going to have to use wide character strings in it, regardless of unicode or making up some way of converting it to ANSI by filtering. Which was my question. Actually now that i think about it, no it wasn't. i've been using wide character strings and unicode interchangably, which isn't true, i don't think. Let me reword my question. Is it possible to create a rich edit controls that utilizes ANSI character strings rather the wide-character strings? yeh that sounds better, i'll edit my main question.
RaisKazi 30-Aug-11 11:38am    
Very well explained. 5!
Sergey Alexandrovich Kryukov 30-Aug-11 11:38am    
Thank you.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900