Results 1 to 3 of 3

Thread: An attempt was made to load a program with an incorrect format

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2013
    Posts
    9

    An attempt was made to load a program with an incorrect format

    Hi

    I really could do with some help here as I am going absolutely round in circles trying to solve it. I have two computers, one PC running VS2008 that I use to develop my apps on and another without VS. The latter runs XP Pro 32bit and the former runs Vista 32bit.

    I have written a small app that calls into a third party DLL for some sensors that I have, it is very simple just two DLL imports and then I attempt to read the data from the sensors and put them in a label.

    The app works on my PC with Visual Studio without an issue but refuses to load (breaks when the DLL is called, passes the imports) on my second PC and gives the "An attempt was made to load a program with an incorrect format (Exception from HRESULT: 0x8007000B)" error. Every bit of research I have done points this down to a mismatch between trying to call a 32bit DLL from a 64bit OS, how can I get that error if both of my OS's are 32 bit! I have tried recompiling the program to be x86 rather than AnyCPU but that makes no difference. I have also repaired my .net frameworks. Both PC's have the same .net frameworks except for PC #2 has 1.1 but my first does not have any the 1.x frameworks. I can't see that would be a problem as it works on the PC's without the 1.x frameworks. I don't have the source for the DLL but I understand it was written in C++.

    Does anyone have any ideas I could try please?

    Thanks.

  2. #2
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,245

    Re: An attempt was made to load a program with an incorrect format

    My guess would be is that the dll is the 'program' with the incorrect format.
    As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"

    Reviews: "dunfiddlin likes his DataTables" - jmcilhinney

    Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!

  3. #3

    Thread Starter
    New Member
    Join Date
    Jan 2013
    Posts
    9

    Re: An attempt was made to load a program with an incorrect format

    Quote Originally Posted by dunfiddlin View Post
    My guess would be is that the dll is the 'program' with the incorrect format.
    Looks like you were right, I have run the DLL through the dependancy walker and it says that "No PE signature found. This file appears to be a 16-bit DOS module". Got to say I am surprised with that one as the DLL I was told was quite new.

    Still slightly confused as to why it would work on one 32 bit PC with a newer OS and not an older OS 32 bit PC?

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