Solved

Win32 Unicode Compatibility for Win95/98

Posted on 1998-08-29
6
316 Views
Last Modified: 2010-04-02
I'm planning on migrating my Win32 app to Unicode, but need to maintain compatibility with Win95/98 in a single executable.  Although the C Runtime Library Unicode functions (wcslen, wprintf etc.) are all supported in both NT and Win95/98, the Win32 library functions are not - the Windows 95/98 implementation of these functions only accept ANSI characters and no Unicode.

Question is:  Is there an easy way to implement this Win95/98 and NT Unicode support in a single executable?  The only way I can think of is to create my own "wrapper" functions for all Win32 calls, and to conditionally convert the arguments/returns to/from Unicode based on whether I'm running Win95/98.  Has anyone done this and wants to share their code?  Is there a pre-written library that I can buy or download that provides this conversion?

Surely I'm not the first to come across this huge limitation in Win95 and Win98!  I'm happy to give more points if you have a good solution!
0
Comment
Question by:tphipps
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 3

Expert Comment

by:xyu
ID: 1171560
Use MultiByteToWideChar & WideCharToMultiByte fuctions...

or You can go to http://www.geocities.com/SiliconValley/1741/
download Natlib template library... and look at nlstring.h/nlstring.cpp for SzToWide, SzToStd, etc. functions to convert between UNICODE/ASCII ....
0
 

Author Comment

by:tphipps
ID: 1171561
Good try xyu, but not what I'm looking for.  Converting the text from native to Unicode and vice-versa is not the problem.  The problem is the fact that I'd need to write a routine to do this for every one of the hundreds of Win32 function calls in order to get Win95 support.

Surely there's a better way...
0
 
LVL 1

Expert Comment

by:Arkadiy
ID: 1171562
Can you please be more specific? What functions are missing? I use Unicode for user-readable output, and TextOutW is indeed supported in 95 as well as in NT.

In case you _really_ need a solution, what about your own string class? it can return different string depending on the context:

class CMyString
{
...
   operator const char*(){return Ansi string}
   operator const WCHAR *(){return Unicode string}
...
}

You can even derive it from MFC strings, if you wish
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 13

Accepted Solution

by:
Mirkwood earned 50 total points
ID: 1171563
Whether you like it or not. Win95 & 98 do not support UNICODE.
Altough most functions are defined in win95/win98, they are just not implemented and return OK.
Officially win95/win98 were meant for users at home and not in office environments.
Win95/win98 does however support DBCS. Double byte Character system. That means that some character may be displayable on win95/win98.

Our approach is the following and it is more or less what you described. Our middle and bottom layers are completly unicode. We don't use the operating system to do string manipulation since that is not implemented on win95/98.
As soon as we go to the operating system we use defines. In WINNT the define just points to the OS directly. In win95, a conversion is made to the local DBCS system used.
BTW: we do the same with the C++ library functions to allow the software to be compiled with different C compilers. E.g. strncpy puts a 0 byte after the string on some compilers and on other compilers it does not.
0
 

Author Comment

by:tphipps
ID: 1171564
Thanks Mirkwood - looks like there's no easy solution to this - because you're talking about using #defines, your implementation sounds as if you need to have 2 executable sets - one for NT and another for Win95.

I hear MSFT is using a post-link tool to modify the output executable directly to support Win95 and Unicode.
0
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1171565
Thanks for the points.
Yes you are right. We have seperate installation for Win95 and WinNT. We did that since testing the OS on every function would decrease the performance. I now it's only one CMP and one JNE assembly statement but still. Some interfaces are also totally different (shell extensions for example) and on NT we log to the event log and handle security different.


0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

717 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