473,725 Members | 2,032 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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. AecAnchorTagToE ntClass anchor = new
AecXSchedule30. AecAnchorTagToE ntClass();

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 1954
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************* *@exisconsultin g.com

"Bobby C. Jones" <bo****@acadx.c om> wrote in message
news:Oo******** ******@TK2MSFTN GP12.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. AecAnchorTagToE ntClass anchor = new
AecXSchedule30. AecAnchorTagToE ntClass();

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************ **@exisconsulti ng.com> wrote
in message news:%2******** ********@TK2MSF TNGP11.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************* *@exisconsultin g.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.c om> wrote in message
news:Oo******** ******@TK2MSFTN GP12.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. AecAnchorTagToE ntClass anchor = new
AecXSchedule30. AecAnchorTagToE ntClass();

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
2285
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 about the global assembly cache (GAC) and primary interop assemblies (PIA) and so forth, and did all the recommendations, in terms of tweeking Office, installing the .NET Office stuff for framework 1.1, etc. I got it to the point where it compiles ok,...
1
1997
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, this layer manage the underlying COM Objects and upon request, provide a pointer to those objects to the 'API Consumer', following is an illustration of the system: API Consumer ( Native C++/C# ) || ******************************************* * ...
1
2014
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 go out of scope and get picked up by the garbage collector? Thanks a lot for your replies.
8
8212
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 party COM component that takes about 5 seconds to run one of its functions (Network IO bound call). Since I dont want my GUI to freeze
2
1989
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 to the output of. Specify a filename to shove all of the data (into Excel), and start the whole thing going. I get that done no problem. The problem comes with the Data. The data is coming from a different application, and I am not 100% sure of...
5
27256
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 any of the methods because I cannot pull in the Microsoft.Office.Interop.Excel class. I am using Visual c# 2005 Express as my IDE, and here what I have done so far. I open a new project and select Project->Add Reference Then I go to the...
1
6013
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 object fully is another matter. On the C# side of things I’ve got an object defined like so: public class PID : IPID { private string type;
2
4746
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 http://msdn2.microsoft.com/en-us/library/ms996450.aspx but to no avail. When I execute the web method that instantiates the COM Interop, I receive the following error: System.Runtime.InteropServices.COMException (0x800A005B): Object variable or With block variable not set...
0
1862
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 (MapInfo professional) from our app using interop services and do some reparenting etc to make it look like our app. We also register our own application as a COM server and let MapInfo professional register a callback so MapInfo can communicate...
0
8888
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8752
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9401
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9111
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8096
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6011
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4517
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3221
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2157
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.