|
-
November 5th, 2001, 01:58 PM
#1
Win 9x UNICODE
I want to write an UNICODE application that run
on windows 9x (not on windows NT).
Can everyones help me?.
Thank you.
-
November 5th, 2001, 02:29 PM
#2
Re: Win 9x UNICODE
First of all, Windows 95 does not support full UNICODE applications so you will have to build your application as ANSI.
Within your program, there is no problem working with UNICODE character arrays (even in an ANSI build), just use wchar_t* instead of char* and the appropriate wide run-time functions for dealing with UNICODE such as swprintf instead of sprintf, wcscmp instead of strcmp, etc.
You cannot use the MFC _T() MACRO anywhere that you want UNICODE since these will always evaluate to char * when building for Windows 95.
Many of the MFC classes do not support mixed mode use. For example the character data allocated for the CString object will always be ANSI so you can't use CString for your UNICODE strings. The same goes for classes like CStdioFile and in general, any class that uses CString.
Good luck.
All of your critical UNICODE programming will have to use the Win32 explicit wide character API. For example, to format a buffer and set the title of a window:
CWnd *pMyWindow;
// wchar_t* - NOT TCHAR *
wchar_t *pName = L"UNICODE WINDOW";
wchar_t *pBuffer[128];
// swprintf() - NOT sprintf() of _stprintf()
swprintf(pBuffer,L"My Window = %s"),pName);
// Note: using Win32 wide character API directly. Not using
// SetWindowText() MACRO or CWnd object which won't support UNICODE.
::SetWindowTextW(pMyWindow->m_hWnd,pBuffer);
The next problem that you will have is that not all of the Windows 95 wide character API functions actually work. They are all DEFINED but some of them are just do-nothing stubs. I don't know of anywhere that it is documented which functions work and which do not. I suspect that it it a dynamic subset of the entire API based on which version of IE you have installed. For example, the code above that uses SetWindowTextW() will always compile and run without error, but nowhere is it guaranteed that SetWindowTextW() will actually set the title of a window to the text you have supplied. I happen to know that this function does work on Windows 95, but every other API function that you want to use will have to be tested.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|