|
Using Functions That Have No Unicode Equivalents
Windows functions that have not been exported in a Unicode version have
typically been replaced by more powerful or extended functions that do support
Unicode. If you are porting code that calls the OpenFile function, for example, you can support Unicode by using the CreateFile or CreateFileEx function instead.
If a function has no Unicode equivalent, you can map characters to and from
8-bit character sets before and after the function call. For example, the
number-formatting functions atoi and itoa use only the digits 0 through 9. Normally, mapping Unicode to 8-bit
characters could cause loss of data, but you can avoid this by making your code type
independent and conditionalizing the expressions. For example, the following
statements are type dependent and should be changed to support Unicode.
char str[4];
num = atoi(str);
These statements could be rewritten as follows to make them type independent.
TCHAR tstr[4];
CHAR strTmp[SIZE];
#ifdef UNICODE
wcstombs(strTmp, (const wchar_t *) tstr, sizeof(strTmp));
num = atoi(strTmp);
#else
num = atoi(tstr);
#endif
In this example, the wcstombs function is the standard C function that translates Unicode to ASCII. The
example relies on the fact that the digits 0 through 9 can always be translated
from Unicode to ASCII, even if some of the surrounding text cannot. The atoi function stops at any character that is not a digit. You can use the LCMapString function if you need to process text that includes the native digits provided
for some of the scripts in Unicode.
| Last news from Greatis Software |
 |
|
Nostalgia .Net |
|
.Net is powerful, but not all-powerful, so sometimes we need to use Win32 API for our .Net applications. It's simple enough with Platform Invoke if you have Win32 skill, but we do not always have time to dig the ancient documentation, declare the special types that are compatible with Win32, find the values of the Win32's constants and so on. Nostalgia .Net offers several simple-to-use classes, and components that will allow you to forget about the headache of Win32 and just use the power of Win32 in your application the same way as you use the native. Net classes. More » |
| Recommended software for developers |
 |
|
Ultimate Pack |
|
Component pack for Delphi and C++ Builder that contains runtime form designer, runtime object inspector, print suite and much more for the very special price. More » |
 |
|
Form Designer .Net |
|
Unique runtime form design solution that allows to edit any form in .Net WinForms application at runtime with full source codes for only 300 euro! More » |
 |
|
Print Suite .Net |
|
Print Suite .Net is a set of components for easy printing texts, images and grids from your WinForms applications. Full C# source codes are available More » |
 |
|
Gradient Controls .Net |
|
Gradient Controls .Net offers controls with gradient background feature. Labels, panels and so on... Full C# source codes are available More » |
 |
|
Greatis iGrid |
|
iGrid plots drawing grid right over your desktop, so you can use it everywhere, with any drawing application without any special plugins for different graphic editors. More » |
All the contacts and projectsDmitry Vasiliev (just.dmitry)
Related LinksSoftware for Visual Studio .NET developers Software for Delphi and C++ Builder developers Software for Visual Basic 6 developers Delphi Tips&Tricks MegaDetailed.NET More Online Helps Win32 Programmer's Reference Win32 Multimedia Programmer's Reference OLE Programmer's Reference Microsoft Windows Pen API Programmer's Reference Microsoft Windows Sockets 2 Reference Microsoft Windows Telephony API (TAPI) Programmer's Reference Unix Manual Pages
|