Help us out a bit more... you've got a COM interop and a MFC client.... so where'd the .Net form come from?
Main Topics
Browse All TopicsI have created a 32-bit VB.NET COM interop and a 32-bit MFC client app. I am running the MFC client app on a 64-bit OS. I have registered the COM interop using regasm.exe with /CodeBase. When I run my MFC app, I can successfully call simple functions from the COM that return strings and show msgboxes. However, I receive an error (Object reference not set to an instance of an object) from within the COM when it executes the following line:
Dim afrm As New MyForm
(where MyForm is a .NET windows form I created in the dll).
This error only occurs on a 64-bit OS. My MFC app works wonderfully on 32-bit OS. I have tried registering the .tlb using regtlb.exe instead of regasm.exe, but I couldn't call any functions after that. Please help! I have just started learning about COM Interops, and I really need some guidance with this one.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Thanks for your comments. Just to update everyone, it turns out that I couldn't get the program running under my login to the 64-bit machine, but my boss can get it working under his login. So, it looks like a permissions problem. I really need to get this program running for everyone, not just my boss who would obviously have admin permissions, so I'm about to go into research mode again. Again, if someone has an idea of what I need to do, I would be very grateful for the help.
Hi, my apologies for not responding earlier. I was diverted from the project, and this is the first chance I've had to come back to it.
In response to your questions Lord Wabbit, MyForm is just a very simple VB.NET windows form that pops up a msgbox when clicked on, and moves two labels around on MouseMove. That is it. The form was created simply to show that I could integrate a VB.NET window into an MFC application via COM interop, whilst testing if the form still responds to mouse events. The form doesn't write to log files or access registries. The 64-bit machine that shows the error is running Windows Server 2003, while my development machine is 32-bit running windows XP.
However, I have been able to trace the bug down to the following line of code in MyForm.designer.vb:
Me.ClientSize = New System.Drawing.Size(252, 86)
Oddly enough, as soon as I removed this line of code, everything worked on both 32-bit and 64-bit machines, for all users. I really don't understand how removing this line of code could possibly fix the bug, but I think this shows that there is a problem with the form itself, and not with permissions or registrations as first thought. I will continue to dig deeper to see what exactly is going on here, and will post here if I have any more luck. Thanks again for your comments.
Business Accounts
Answer for Membership
by: LordWabbitPosted on 2009-07-31 at 05:08:58ID: 24988000
try changing the Platform to x86 under projct settings.