CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2010
    Posts
    9

    Visual C++ x64 woes

    Hello all!

    So I was pointed to this place after asking in the WinApi forum. I use Visual Studio 2008. I made a windows form program that works perfectly under the 32bit compiler. But when I changed the platform to x64, these things stopped working (they don't do anything):

    MessageBox
    CreateWindow
    DialogBox

    And when I call GetLastError, I get 193 (0xC1) which, according to MSDN, is:

    ERROR_BAD_EXE_FORMAT
    193 (0xC1)

    %1 is not a valid Win32 application.

    I have Windows 7 professional 64 bit edition and an x64 architecture for my CPU.

    My suspicion is that I only have the 32 bit header files for WinApi.

    Can anyone enlighten me?

    Thanks in advance!
    Last edited by SweetCorn; April 13th, 2010 at 09:39 AM.

  2. #2
    Join Date
    May 2000
    Location
    KY, USA
    Posts
    18,652

    Re: Visual C++ x64 woes

    Did you compiled the application for x64? Or did you just copy it? One of the main reasons for this error is that there is a mismatch between the application and supporting dll's.....for example, a 64-bit process trying to load a 32-bit dll and vice-versa....

  3. #3
    Join Date
    Apr 2010
    Posts
    9

    Re: Visual C++ x64 woes

    Yeah that sounds right. When the solution was created it was set to use the Win32 platform, and following some instructions on MSDN, I just used the configuration manager to change the platform to x64. How would I create/modify a project so that it uses 64 bit dlls? I didn't really see about 32/64 bit when creating a project (I usually create empty projects).

    Update:

    So according to wiki, System32 contains the 64bit versions of the dlls on a 64bit windows. And my compiler does indeed load dlls from that folder. And all my header files are loaded from the right place. So why the error?

    Update:

    I found out what was wrong: I had a manifest file to use windows xp visual styles. I copied and pasted stuff from MSDN. It was geared towards 32bit apps.
    Last edited by SweetCorn; April 15th, 2010 at 05:44 PM.

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