Hi,
I am tring to build a unicode app to work on win 98/nt/xp.
Built a sample MFC application in Visual Studio 2005 Team suite Beta 2. A unicode dialog app with a button. When run on windows 98 it shows this message.
Installed VCredist_x86 and .NET framework 2.0 latest versions downloaded from web. Also coped mfc80u.dll to the exe folder.
Microsoft Visual C++ RuntimeLibrary
Runtime Error!
This application has requested the runtime to terminate it in an unusual
way. Please contact the application's support team for more information.
I tried with Express Edition and Windows Forms it works in windows 98.
Thanks,

Visual Studio 2005 MFC Applications on Windows 98
Adama
I belive it could be releated to using AfxLoadLibrary calls in the code.
Thanks,
janoman
Project Properties - Configuration Properties - C/C++ - Preprocessor - Preprocessor Definitions
GAL
This is probably expected behavior. Windows 95/98/Millenium OS's have very limited Unicode support.
You can build your app to be non-Unicode for Win9x OS's or try using MSLU (Microsoft Layer for Unicode). This is a component that lays on top of Win9x OS's and translates Unicode API calls into the ANSI API calls that those OS's support.
http://msdn.microsoft.com/library/default.asp url=/library/en-us/mslu/winprog/microsoft_layer_for_unicode_on_windows_95_98_me_systems.asp
I hope this is helpful,
-Ron Pihlgren
VC++ Test Team
_LorenzoSJB_
#undef _AFXEXT
#undef _AFXDLL
john c tivey
Follow the steps:
1. http://msdn.microsoft.com/library/default.asp url=/library/en-us/mslu/winprog/compiling_your_application_with_the_microsoft_layer_for_unicode.asp
2. Make MFC Lib as Static. Project Settings -> configuration settings -> general
3. Project Settings -> configuration settings -> runtime lib, as /MT for release /MTd for debug.
4. If you are converting from older project settings to unicode, _AFXDLL will be inherited. I am not able to remove it so in stdafx.h add
#ifdef _AFXDLL
#undef _AFXDLL
#endif
5. Copy your exe, unicows.dll + msvcrt 2 dlls.
It worked perfectly for me. But I dont have any idea about the toolkit. The toolkit should be also build on smiliar project settings. I guess it may not be compactable.
Did you set
#define WINVER 0x400 in stdafx.h
Target Platform Value to set
--------------- ------------
Microsoft Windows 95 WINVER=0x0400
and Windows NT 4.0 (and later)
Microsoft Windows 98 _WIN32_WINDOWS=0x0410
and Windows NT 4.0 (and later) WINVER=0x0400
Windows NT 4.0 (and later) _WIN32_WINNT=0x0400
WINVER=0x0400
Windows 98 and Windows NT 5.0 WINVER=0x0500
(and later)
Internet Explorer 3.0 _WIN32_IE=0x0300
(and later)
Internet Explorer 4.0 _WIN32_IE=0x0400
(and later)
Internet Explorer 5.0 _WIN32_IE=0x0500
(and later)
Setting a WINVER of 0x0500 implies _WIN32_IE=0x0400
Examining the headers will reveal which platforms implement the
various technologies. This section can help to decode the headers.
In the header files,
information protected by Implemented in
------------------------ --------------
#if _WIN32_WINNT >= 0x0400 Windows NT 4.0 and later.
It is not implemented on
Windows 95.
#if _WIN32_WINDOWS >= 0x0410 Windows 98 and later: Image
may not run on Windows 95.
#if _WIN32_WINNT >= 0x0500 Windows NT 5.0 and later: Image
may not run on Windows 95.
#if WINVER >= 0x0410 Windows 98 and later.
#if WINVER >= 0x0500 Windows NT 5.0 and later.
#if _WIN32_IE >= 0x0300 Internet Explorer 3.0
and later.
#if _WIN32_IE >= 0x0400 Internet Explorer 4.0
and later.
#ifdef _WIN32_WINCE Microsoft Windows CE 1.0
and later. (Note that some Windows
CE platforms may not support all
APIs.)
NonExisto
vbvan you might have some invalid resources for Windows 98. If you have any resources with id greater than 32767 you will get this invalid format error.
You can use code resscan.cpp from KB article Q271442 (no longer on microsoft site but you can find it in older MSDN or VC 2002 help files) to determine any invalid resources for Windows 98.
William Fields
http://www.microsoft.com/globaldev/handson/dev/mslu_announce.mspx
http://msdn.microsoft.com/msdnmag/issues/01/10/MSLU/
Ted.
reformist
Perfect it works for a application created in VS 2005. I did a sample dialog MFC with static linking it is working in 98. But when I try to compile my application created in VC6 and converted to VC8 I get the below error with change DLL from shared to static.. I tried to duplicate settings from the sample VC8 App it doesn't help me...
C:\Program Files\Microsoft Visual Studio 8\VC\atlmfc\include\afxver_.h(77) : fatal error C1189: #error : Please use the /MD switch for _AFXDLL builds
afxver.h code.....
/////////////////////////////////////////////////////////////////////////////
// Special configurations
// _AFXEXT implies _AFXDLL
#if
defined(_AFXEXT) && !defined(_AFXDLL)#define _AFXDLL
#endif
#if
defined(_AFXDLL) && !defined(_DLL) #error Please use the /MD switch for _AFXDLL builds#endif
#if
defined(_AFXDLL) && !defined(_MT) #error Please use the /MD switch (multithreaded DLL C-runtime)#endif
Thanks,
Mr Steve
By the way, how to view the help file of VS2002 After install MSDN2005 shipped with VS2005, it was totally replaced by MSDN2005 (it didn't appear in StartMenu or option-help in VS2002) But the help file are still on the hard disc (lots of hxi&hxs files without assosiation with any soft).
(I'd like to see Q271442 in the help file of VS2002 since I can't find it on the net)
moondancer10
How does Widows forms application built on Express edition with unicode application runs on 9x while MFC apps wont run
We are tring to port applications from VC6 to VC8 only for unicode support and single EXE. How to create single app for 9x and NT.
Thanks
A. L.
Crash info.
SAMPLEVC8 caused an exception 40000015H in module MSVCR80.DLL at 017f:7c37380c.
Registers:
EAX=00000000 CS=017f EIP=7c37380c EFLGS=00000202
EBX=7c3fe9b0 SS=0187 ESP=0063f2ac EBP=7c37380c
ECX=00000000 DS=0187 ESI=00000000 FS=649f
EDX=8198c01c ES=0187 EDI=8198fbd0 GS=0000
Bytes at CS:EIP:
e8 2a 44 00 00 c3 a1 68 1a 40 7c 85 c0 74 02 ff
Stack dump:
7c37380c 8198fbd0 0063f5ec 7c3fe9b0 0063f2b0 00000000 0063f580 7c377c54 7c3f25a0 ffffffff 0063f590 7c39a773 8198bfbc bff9dbc8 0063f5ec 00000000
before adding unicows samplevc8.exe is 32k and after that it is 52k now.
any other information would be helpful
Thanks,
Jose_Az
If you don't do the above then the MSVCR80.DLL and MFC80U.DLL will be still looking for Unicode versions of the API functions which are just stubs under Windows 98.
There is one other way to get around this if you truly need the DLL based versions of the CRT and MFC in your project. You can look here (it was authored by me, so if you have any questions please post them here)
http://blogs.msdn.com/michkap/articles/478235.aspx
BryanCTG
Thanks very much, Ted. My resource file has some top level menu with ID larger than 32768 which cause the problem.
Thanks for your advise, Microsoft Visual. That really helps!
Some other issue with 98:
I find that CFileDialog will not appear in Win98 when I call Domodal (This occurs only when the app is complied with VS2002 or VS2005, VC6 is OK), is that because of the same reason in http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=168836&SiteID=1 (I tried to change WINVER & _WIN32_WINNT to 0x410, but that didn't take effect, CFileDialog will determine the size of OFN by itself)
(Once I debugged into the source, and find that CFileDialog::DoModal use COMMDLG_AFXCTXFUNC(BOOL,GetSaveFileNameW,(LPOPENFILENAMEW unnamed1),(unnamed1)) to call GetSaveFileName, which in turn use AfxGetModuleState())
bundybear
Hi, Ted.
Once I tried to use MSLU in my app, but failed. My app (release mode) use static link with crt&mfc (also static link with Xtreme toolkit pro). I added following lines in "Properties-Linker-Input-Addtional Dependency":
/nod:kernel32.lib /nod:advapi32.lib /nod:user32.lib /nod:gdi32.lib /nod:shell32.lib /nod:comdlg32.lib /nod:version.lib /nod:mpr.lib /nod:rasapi32.lib /nod:winmm.lib /nod:winspool.lib /nod:vfw32.lib /nod:secur32.lib /nod:oleacc.lib /nod:oledlg.lib /nod:sensapi.lib unicows.lib kernel32.lib advapi32.lib user32.lib gdi32.lib shell32.lib comdlg32.lib version.lib mpr.lib rasapi32.lib winmm.lib winspool.lib vfw32.lib oleacc.lib oledlg.lib uafxcw.lib libcmt.lib
I also add following code in the App:
HMODULE LoadUnicowsProc(void)
{
HMODULE hMod=LoadLibraryA("unicows.dll");
if (hMod==0)
{
MessageBoxA(NULL,"Unicows.dll Unicode wrapper not found !",
NULL,MB_ICONSTOP|MB_OK);
_exit(-1);
}
return hMod;
}
#ifdef _cplusplus
extern "C" {
#endif
extern FARPROC _PfnLoadUnicows = (FARPROC) &LoadUnicowsProc;
#ifdef _cplusplus
}
#endif
I asked others to test the app on win98, but 98 gave the following error message similar to (which is the same as the one before I use MSLU) :
...EXE is broken, please reinstall it, then run again
Windows cann't run this app, because its format is invalid
here is some stuff from linker:
Processed /NODEFAULTLIB:kernel32.lib
...
Processed /NODEFAULTLIB:sensapi.lib
Starting pass 1
Processed /DEFAULTLIB:uafxcw.lib
Processed /DEFAULTLIB:libcmt.lib
Processed /DEFAULTLIB:msimg32.lib
Processed /DEFAULTLIB:comctl32.lib
Processed /DEFAULTLIB:shlwapi.lib
Processed /DEFAULTLIB:uuid.lib
Processed /DEFAULTLIB:ole32.lib
Processed /DEFAULTLIB:oleaut32.lib
Processed /DEFAULTLIB:urlmon.lib
Processed /DEFAULTLIB:comsuppw.lib
Processed /DEFAULTLIB:XTP9601LibStaticu.lib
Processed /NODEFAULTLIB:libc.lib
Processed /DEFAULTLIB:OLDNAMES
Processed /NODEFAULTLIB:libc.lib
Processed /DEFAULTLIB:libcpmt
Processed /NODEFAULTLIB:libc.lib
Processed /NODEFAULTLIB:libc.lib
Processed /NODEFAULTLIB:libc.lib
Processed /DEFAULTLIB:PackageFileSU.lib
Processed /DEFAULTLIB:PicFormatsSU.lib
Processed /NODEFAULTLIB:libc.lib
Processed /NODEFAULTLIB:libc.lib
Processed /NODEFAULTLIB:libc.lib
Processed /NODEFAULTLIB:libc.lib
Processed /NODEFAULTLIB:libc.lib
Searching libraries
Searching D:\Microsoft Visual Studio 8\VC\PlatformSDK\lib\unicows.lib:
Found __imp__FindResourceW@12
Referenced in TextConv.obj....
It seems the linker correctly link with unicows.lib as the first one.
But when I use exescope to view the exe, some unicode api still exsit:
kernel32.dll:(EnumResourceLanguagesW)
advapi32.dll:(SetFileSecurityW,GetFileSecurityW);
shlwapi.dll:(PathFindFileNameW,..)
any suggestions thanks!