CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 15 of 35

Hybrid View

  1. #1
    Join Date
    Feb 2009
    Location
    Portland, OR
    Posts
    1,488

    MS Visual Studio 2010 and support for Windows 9x and 2000

    I am seriously planning to switch to the MS Visual Studio 2010 but I just realized today after updating my project for the whole day that while trying to run it on Windows 2000 it produces this error:
    <Executable file path> is not a valid win32 application.
    Is it true that the code compiled with it will work only on Windows XP, Vista and Windows 7?

  2. #2
    Join Date
    Nov 2003
    Location
    Belgium
    Posts
    8,150

    Re: MS Visual Studio 2010 and support for Windows 9x and 2000

    Maybe you have build a 64 bit version of your application and Windows 2000 cannot run 64 bit executables. Build it as 32 bit and try again.
    Marc Gregoire - NuonSoft (http://www.nuonsoft.com)
    My Blog
    Wallpaper Cycler 3.5.0.97

    Author of Professional C++, 4th Edition by Wiley/Wrox (includes C++17 features)
    ISBN: 978-1-119-42130-6
    [ http://www.facebook.com/professionalcpp ]

  3. #3
    Join Date
    Feb 2009
    Location
    Portland, OR
    Posts
    1,488

    Re: MS Visual Studio 2010 and support for Windows 9x and 2000

    Quote Originally Posted by Marc G View Post
    Maybe you have build a 64 bit version of your application and Windows 2000 cannot run 64 bit executables. Build it as 32 bit and try again.
    No, it's not. Besides double-checking in the project properties I also ran the code on a 32-bit Windows XP platform and it ran just fine.

    Quote Originally Posted by S_M_A View Post
    Could this be related (4. Target Name)? http://qualapps.blogspot.com/2009/10...as-with-c.html
    I especially like this part:
    VS2010 introduces a new "Target Name" property in the General page of Configuration Properties. I still haven't figured out the rationale...
    I haven't either.... It took me about 3 hours to make one of my previous projects compile on VS 2010.

    OK, so I made an experiment. I compiled a simple Hello World console application using MS VS 2010.

    1. First, without MFC or ATL. Just the following line:
    Code:
    _tprintf(_T("Hello world!\n"));
    The size of the Release Unicode x86 build was around 6K. OK. I can live with that. But, if I run that code on Windows 2000 it simply shows the error "<Executable file path> is not a valid win32 application."

    2. Then if I do pretty much the same, Win32 console app with MFC and use the following lines:
    Code:
    CString s;
    s.Format(_T("Hello world!\n"));
    _tprintf(s);
    The size of the Release Unicode x86 build (with statically linked MFC libraries) mushrooms to, get ready for this, 1.54MB!!! Just for those 3 lines of code and a sh*t ton of MFC stuff that will never be used in this project. And obviously it doesn't run on Win2K either.


    All that is BAD!

  4. #4
    Join Date
    Jun 2010
    Location
    Germany
    Posts
    2,675

    Re: MS Visual Studio 2010 and support for Windows 9x and 2000

    Quote Originally Posted by ahmd View Post
    2. Then if I do pretty much the same, Win32 console app with MFC and use the following lines:
    Code:
    CString s;
    s.Format(_T("Hello world!\n"));
    _tprintf(s);
    The size of the Release Unicode x86 build (with statically linked MFC libraries) mushrooms to, get ready for this, 1.54MB!!! Just for those 3 lines of code and a sh*t ton of MFC stuff that will never be used in this project. And obviously it doesn't run on Win2K either.
    Did you try that with dynamic linking to MFC? This pretty sure wouldn't run on Win2k either, but I would be interested in the release EXE file size.

  5. #5
    Join Date
    Feb 2009
    Location
    Portland, OR
    Posts
    1,488

    Re: MS Visual Studio 2010 and support for Windows 9x and 2000

    Quote Originally Posted by Eri523 View Post
    Did you try that with dynamic linking to MFC? This pretty sure wouldn't run on Win2k either, but I would be interested in the release EXE file size.
    In that case it becomes 6.50K, but it won't start without "MSVCR100.DLL" on my XP or Vista without VS 2010 installed. And I'm sure there're more dependencies to it so if you add all of them up it will total to 1.5MB or even worse. On Win2K though it still results in the same "not a valid win32 application" error.

    On the side note, I link my code statically since otherwise you'll have to install DLLs anyway, which is a pain in the neck by itself. So why doing it?

    OK, one more test. The same console app with MFC compiled on MS VS 2008 (without SP1) weighs only 208K and does run on Windows 2000. So go figure what MS is trying to sell us?

    So, guys, don't rush to convert your projects. It may come with a caveat...

  6. #6
    Join Date
    Jun 2010
    Location
    Germany
    Posts
    2,675

    Re: MS Visual Studio 2010 and support for Windows 9x and 2000

    Quote Originally Posted by ahmd View Post
    In that case it becomes 6.50K, but it won't start without "MSVCR100.DLL" on my XP or Vista without VS 2010 installed. And I'm sure there're more dependencies to it so if you add all of them up it will total to 1.5MB or even worse. On Win2K though it still results in the same "not a valid win32 application" error.
    Ah, yes, that is about the file size I had expected in that case.

    The name MSVCR100.DLL looks to me as if it refers to the basic (funny term in that context, isn't it? ) VC++ runtime. The ones of them I have on my system for older VC++ versions range from 60 kB (how could they ever get it that small?) to 340 kB. The MFC runtime DLLs used to have names like MFC42.DLL and all have sizes slightly below 1 MB on my system. (Not counting the ones with similar names that obviously contain localisation stuff and are much smaller.)

    The massive file size bloat you observed when linking your "Hello world!" statically to MFC is some kind of mystery to me. I really can't imagine that all the MFC functions in total have dependecies on one another. The only other reason I can think of is that they all reside in a single obj module what IMO would imply that they have all been in a single compilation unit. And that is definitely not the recommended way to go.

    On the side note, I link my code statically since otherwise you'll have to install DLLs anyway, which is a pain in the neck by itself. So why doing it?
    Doesn't that pro edition have a tool that builds installation packages for you? I think earlier versions had. In that case it shouldn't be too much pain, at least not to the developer. But I have read in another thread these days that MS re-introduced a thing called "XCopy distribution strategy" (or something similar) together with VS 2010. This would mean, according to that thread, that all these DLLs get installed in the app directory instead of %windir%\system32. So linking dynamically wouldn't even save disk space. (Ok, you would save some space if your app is comprised of more than one EXE.) Maybe I'll dig that thread out at the end of this "CG pass" I'm in right now and post a question about that there.

    EDIT: The correct term for what I was talking about appears to be XCopy deployment model. The thread containing the discussion about that topic is here and the relevant postings start at post #7. This post also has a link to MSDN that clarifies things a bit. In particular that MSDN article says that the XCopy deployment model is only one of three options when linking dynamically. (Of course it says a lot more, but that was the core point I got there.)

    So go figure what MS is trying to sell us?
    Oh, they try to sell us lots of stuff! In a recent magazine article I read a speculation that MS might discontinue VBA in the future, making us want to buy their full-blown developer tools for that purpose. (That speculation was based on the fact that VBA hasn't been extended while changing from Office 2007 to Office 2010.) And you can bet you couldn't use the VS Express Editions for that...
    Last edited by Eri523; July 17th, 2010 at 08:53 PM.

  7. #7
    Join Date
    Jun 2006
    Posts
    25

    Re: MS Visual Studio 2010 and support for Windows 9x and 2000

    Quote Originally Posted by ahmd View Post
    2. Then if I do pretty much the same, Win32 console app with MFC and use the following lines:
    Code:
    CString s;
    s.Format(_T("Hello world!\n"));
    _tprintf(s);
    The size of the Release Unicode x86 build (with statically linked MFC libraries) mushrooms to, get ready for this, 1.54MB!!! Just for those 3 lines of code and a sh*t ton of MFC stuff that will never be used in this project. And obviously it doesn't run on Win2K either.
    All that is BAD!
    To address the static MFC size issue problem (not the Win2K problem) if you haven't already seen this, I thought I'd mention it. It will shrink your static MFC app back down to more reasonable size. See:

    http://tedwvc.wordpress.com/2010/05/...visual-c-2010/

  8. #8
    Join Date
    Feb 2009
    Location
    Portland, OR
    Posts
    1,488

    Re: MS Visual Studio 2010 and support for Windows 9x and 2000

    Quote Originally Posted by Ted. View Post
    To address the static MFC size issue problem (not the Win2K problem) if you haven't already seen this, I thought I'd mention it.
    Yeah, thanks. But I made my decision already. VS2010 is not worth it (at this point in time). It's way overblown and doesn't add much vs. VS 2008 w/o SP1. So I decided to stick with the latter one and quite like it (no need to adjust every single MFC project I make). Maybe in a couple of years when Windows 2000 support and the size of code don't matter anymore, I'd go with a new version of VS. I think Microsoft made a big mistake by doing all this with the Visual Studio, they clearly needed a switch to leave out all that new stuff.
    Last edited by ahmd; August 5th, 2010 at 05:09 PM.

  9. #9
    Join Date
    Jun 2006
    Posts
    25

    Re: MS Visual Studio 2010 and support for Windows 9x and 2000

    I dealt with the spin-off question earlier (EXE size). Now back to the original question - Visual C++ 2010 on Windows 2000 - here is my solution:

    http://tedwvc.wordpress.com/2010/11/...-windows-2000/

  10. #10
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,654

    Re: MS Visual Studio 2010 and support for Windows 9x and 2000

    Could this be related (4. Target Name)? http://qualapps.blogspot.com/2009/10...as-with-c.html
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    https://visualstudio.microsoft.com/vs

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured