Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have created an ATL control in a 64 bit unmanaged dll.

I want to use this control in a VC++ WinForms app.

When I run the application I get badimageformatexception.

Then I have created an VB app and a C# app. In both cases it works with no problem.
I have then tested my control with TstCon (MFC-64bit) provided by microsoft. The control was recognized with no problems and I was able to call some of its methods.

The only case where I was NOT able to make it work is VC++ Forms (I work with VS 2010 pro).

I have created a small test example.

Please download it from here:

https://rapidshare.com/files/2799321813/atl.zip

The ATL Control is located in atl_project_64 folder.
It is a simple control with 1 property (Number) and one event (OnChange).
I have followed all steps from here : http://msdn.microsoft.com/en-us/library/599w5e7x.aspx

Compile the project.

Then, I have created 2 WinForms apps for testing the control. The C# is working with no problems.
Dont forget to add the reference to Atl_project_64Lib. If you cannot find it in the list of Com objects, you may browse it to the folder where the dll is created.

However, VC++ project is not working. You will get badimageformatexception if you try to run it. Sometimes the error is raised when I press the button which sets the value of the property.

All are 64 bit.

Do you have any idea what I have done wrong ?

thanks,
mihai
Posted
Comments
walterhevedeich 6-Aug-11 9:52am    
Post the relevant code here instead of giving us a download link.

1 solution

I have found the solution ... It is possible to be a bug in VC++ 2010

http://stackoverflow.com/questions/6965952/64-bit-atl-control-does-not-work-with-vc-forms-app


thanks,

mihai
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900