Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. P/Invoke problem in migrating 32 bit to 64bit application!

P/Invoke problem in migrating 32 bit to 64bit application!

Scheduled Pinned Locked Moved C#
helpcsharptutorial
2 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    TaiZhong
    wrote on last edited by
    #1

    I have an application that calls win32 Dlls in c# with P/Invoke. The application works fine in the 32-bit window XP. When I migrate it to the 64-bit window XP( virtual machine ), the application fail to load win32 DLLs and with an error message of {"An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)"}. Anyone know whats the problem and how to solve this problem. Any help is appreciated. Thanks.

    M 1 Reply Last reply
    0
    • T TaiZhong

      I have an application that calls win32 Dlls in c# with P/Invoke. The application works fine in the 32-bit window XP. When I migrate it to the 64-bit window XP( virtual machine ), the application fail to load win32 DLLs and with an error message of {"An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)"}. Anyone know whats the problem and how to solve this problem. Any help is appreciated. Thanks.

      M Offline
      M Offline
      Mike Dimmick
      wrote on last edited by
      #2

      You cannot load 32-bit DLLs in a 64-bit process. If you want to run your .NET program on a 64-bit machine but cannot provide 64-bit versions of native DLLs it uses, you should force it to run in a 32-bit process. (You will obviously lose the address-space benefits of running in a 64-bit process.) To do this, change the Platform Target property on the Build tab of Project Properties from 'Any CPU' (the default) to 'x86'. You may want to consider generating a separate configuration for your project. Go to Build, Configuration Manager and in the Active Solution Platform drop-list, select <New...>. Then select 'x86' from the 'select new platform' drop-list and click OK.

      DoEvents: Generating unexpected recursion since 1991

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups