473,326 Members | 2,048 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

COM Interop - Cannot instantiate objects

I'm trying to use some classes defined in a COM component that I did not
create. I have successfully created the RCW via Tlbimp.exe and referenced
it in my project. All is well until I run the project and it chokes with an
"Invalid access to memory location." error when I try to instantiate an
object like so:

AecXSchedule30.AecAnchorTagToEntClass anchor = new
AecXSchedule30.AecAnchorTagToEntClass();

I'm not sure where the best place for me to start looking for the answer
lies. I'm currently pouring over more COM Interop doc material than I ever
even wanted to know existed. Am I missing something so basic? Anybody have
a clue as to where I should start looking? Thanks.
--
Bobby C. Jones
www.AcadX.com
Nov 15 '05 #1
4 1940
Bobby,

The two things I can think of off the top of my head are a) is the
object properly registered on the machine you are running this on and b)
have you set the threading model of the current thread correctly?

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com

"Bobby C. Jones" <bo****@acadx.com> wrote in message
news:Oo**************@TK2MSFTNGP12.phx.gbl...
I'm trying to use some classes defined in a COM component that I did not
create. I have successfully created the RCW via Tlbimp.exe and referenced
it in my project. All is well until I run the project and it chokes with an "Invalid access to memory location." error when I try to instantiate an
object like so:

AecXSchedule30.AecAnchorTagToEntClass anchor = new
AecXSchedule30.AecAnchorTagToEntClass();

I'm not sure where the best place for me to start looking for the answer
lies. I'm currently pouring over more COM Interop doc material than I ever even wanted to know existed. Am I missing something so basic? Anybody have a clue as to where I should start looking? Thanks.
--
Bobby C. Jones
www.AcadX.com

Nov 15 '05 #2
Nicholas,
A) I have some VB6 code that consumes it with no problem, so I know that
it's registered properly.

B) I haven't set up any threads if that's what you mean.

I'm still looking over COM Interop docs and finding nada.

Thanks again!
--
Bobby C. Jones
www.AcadX.com

"Nicholas Paldino [.NET/C# MVP]" <ni**************@exisconsulting.com> wrote
in message news:%2****************@TK2MSFTNGP11.phx.gbl...
Bobby,

The two things I can think of off the top of my head are a) is the
object properly registered on the machine you are running this on and b)
have you set the threading model of the current thread correctly?

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com

Nov 15 '05 #3
Are you using Visual Studio? If yes, you can try to right click on your
project in solution explore, and select "Add Reference". Select "COM" in the
shown dialog. Pick your COM object, you will be able to use it like any
class.

This is most fool proof way to use COM object in C#. Nerver have any problem
to me.
"Bobby C. Jones" <bo****@acadx.com> wrote in message
news:Oo**************@TK2MSFTNGP12.phx.gbl...
I'm trying to use some classes defined in a COM component that I did not
create. I have successfully created the RCW via Tlbimp.exe and referenced
it in my project. All is well until I run the project and it chokes with an "Invalid access to memory location." error when I try to instantiate an
object like so:

AecXSchedule30.AecAnchorTagToEntClass anchor = new
AecXSchedule30.AecAnchorTagToEntClass();

I'm not sure where the best place for me to start looking for the answer
lies. I'm currently pouring over more COM Interop doc material than I ever even wanted to know existed. Am I missing something so basic? Anybody have a clue as to where I should start looking? Thanks.
--
Bobby C. Jones
www.AcadX.com

Nov 15 '05 #4
I found the problem and it had absolutely nothing at all to do with the RCW.
It was my own mistake elsewhere, imagine that. Thanks for all your help.
--
Bobby C. Jones
www.AcadX.com
Nov 15 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: keefah | last post by:
Hi, I'm writing a C# web app that uses Outlook to send email. I use a reference to the Microsoft Outlook 11.0 Object Library, but it's giving me problems. I tracked down some stuff on the Net...
1
by: Nadav | last post by:
Hi, Introduction *************** I have a system build of a collection of 'Native COM objects' and '.NET COM interop' objects, all of the COM objects are managed through a 'Native COM' layer,...
1
by: C# beginner | last post by:
Hi folks, When we instantiate COM objects from our .NET code and use them, when we no longer need the COM objects do we have to dispose of them explicitly? If so, how? or do the COM objects also...
8
by: Z D | last post by:
Hello, I'm having a strange problem that is probably due to my lack of understanding of how threading & COM Interop works in a WinForms.NET application. Here's the situation: I have a 3rd...
2
by: Andrew S. Giles | last post by:
OK, Ive run my head into this wall for too long. I need help. I am developing an applicaiton in C# to present a user with a GUI to specify a configurable list of machines that he wants to listen...
5
by: C# newbie with big problems | last post by:
Ok, I've tried everything I could come up with but nothing is working. I am creating an application which needs to post information into an excel document. I have not yet had a chance to play with...
1
by: Brendan Grant | last post by:
I’ve got a C# library that I’ve built into a COM component that will be used from a VC++ 6 application and while the creation of the COM object side of things seem to be working fine, using the...
2
by: RonS | last post by:
I am attempting to use a COM Interop inside my .NET Web Service. This same COM Interop works just fine in a VB.NET application. I've followed the guidance given in...
0
by: jan.loucka | last post by:
We're running Windows Forms application written in .NET 2.0 (c#). The application is single threaded app - it starts without any form (Application.run()). After that we start another application...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.