473,320 Members | 1,724 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,320 software developers and data experts.

Use COM object made with Borland C++ Builder

Hi,

I have a COM object in a dll and it is registered on the system.
The COM object was made with Borland C++ Builder and works nicely when used
in BC++ projects.

I'm TOTALLY new to .NET (first day) and I have no clue how to use make use
of the COM object.
I made a small test app with a button and now I'm stuck ;-))

I have the *_TLB.cpp and *_TLB.h files of the COM object.

Some guidance would be really appreciated !
I'd like to get it to work in the test app, so that I can play with it and
learn how to use it.
Nov 16 '05 #1
5 2382
In article <jx*********************@phobos.telenet-ops.be>, Peter@Smart-
Projects.net says...
Hi,

I have a COM object in a dll and it is registered on the system.
The COM object was made with Borland C++ Builder and works nicely when used
in BC++ projects.

I'm TOTALLY new to .NET (first day) and I have no clue how to use make use
of the COM object.


If you're using VS.NET, simply add a reference to the COM object from
the references section of your project.

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele
Nov 16 '05 #2
Thanks,
risking to sound very stupid now but ...
how do I add a reference to the COM object ?
(like said, very new to VS.NET)

-------------------------------------------------------------
"Patrick Steele [MVP]" <pa*****@mvps.org> wrote in message
news:MP************************@msnews.microsoft.c om...
In article <jx*********************@phobos.telenet-ops.be>, Peter@Smart-
Projects.net says...
Hi,

I have a COM object in a dll and it is registered on the system.
The COM object was made with Borland C++ Builder and works nicely when used in BC++ projects.

I'm TOTALLY new to .NET (first day) and I have no clue how to use make use of the COM object.


If you're using VS.NET, simply add a reference to the COM object from
the references section of your project.

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele

Nov 16 '05 #3
In article <Mf**********************@phobos.telenet-ops.be>,
Pe***@Smart-Projects.net says...
Thanks,
how do I add a reference to the COM object ?
(like said, very new to VS.NET)


Go to the "Project" menu. Click "Add Reference..." Click on the "COM"
tab and select the COM object from the list presented.

It actually creates a .NET wrapper that makes your COM object look like
a .NET object (a "Runtime callable wrapper" or simply "RCW").

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele
Nov 16 '05 #4
Seemed to work very smoothly !
Still some more confusion however,

One of the functions in the COM object (in C++) is :

SelectDrive(unsigned_char DriveLetter/*[in]*/, void** DriveHandle/*[out]*/)

Input is a char, for instance 'd'
Output is a pointer to a HANDLE of an object (the handle is used to pass to
other functions of the COM object)
(in C++ HANDLE is a pointer to void and because it's output of the function,
the output is a pointer to a pointer of void (void**))

..NET seems to make this of this function :

public abstract new void SelectDrive ( System.Byte DriveLetter ,
System.IntPtr DriveHandle )

I don't seem to understand .NET (yet) because I can't write a few simple
lines that use the COM object.
I find it strange that I seem to have to pass an entire object each time,
instead of a simple variable ?
I tried numerous things, then tried the classes as they are used in the
function template made by .NET
This was the last attempt :

System.IntPtr Drive ;
System.Byte DriveLetter = (byte)'D' ;
DllName.InterfaceName.SelectDrive(DriveLetter, Drive) ;

I still get compiler errors ...
An object reference is required for the nonstatic field, method, or property
'Perlustro.ICDDVDIO.SelectDrive(byte, out System.IntPtr)'

Can anybody give a few simple lines of code showing me how to do this !
I don't have the time right now to completely dig into .NET
I just need to be able to demonstrate the use of the COM object in .NET

Thanks !
Peter
-------------------------------------------------------------
"Patrick Steele [MVP]" <pa*****@mvps.org> wrote in message
news:MP************************@msnews.microsoft.c om...
In article <Mf**********************@phobos.telenet-ops.be>,
Pe***@Smart-Projects.net says...
Thanks,
how do I add a reference to the COM object ?
(like said, very new to VS.NET)


Go to the "Project" menu. Click "Add Reference..." Click on the "COM"
tab and select the COM object from the list presented.

It actually creates a .NET wrapper that makes your COM object look like
a .NET object (a "Runtime callable wrapper" or simply "RCW").

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele

Nov 16 '05 #5
In article <Ef**********************@phobos.telenet-ops.be>,
Pe***@Smart-Projects.net says...
I tried numerous things, then tried the classes as they are used in the
function template made by .NET
This was the last attempt :

System.IntPtr Drive ;
System.Byte DriveLetter = (byte)'D' ;
DllName.InterfaceName.SelectDrive(DriveLetter, Drive) ;

I still get compiler errors ...
An object reference is required for the nonstatic field, method, or property
'Perlustro.ICDDVDIO.SelectDrive(byte, out System.IntPtr)'


Like COM, you still need to create an instance of the object before
calling any of its methods:

InterfaceName the_object = new XXX();
the_object.SelectDrive(DriveLetter, out Drive);

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele
Nov 16 '05 #6

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

Similar topics

5
by: Steven O. | last post by:
First, sorry if by some chance I am not posting to the correct newsgroups, these seemed to be the most applicable to my question (see disclaimer at end of post for further comments....). Started...
3
by: Lorenzo Polidori | last post by:
Hi all, I have to display an MPEG2 stream in my C++ application. I have seen the Media Player Object of Borland C++Builder 6 can have as input a file specified in Filename property of this media...
11
by: DrUg13 | last post by:
In java, this seems so easy. You need a new object Object test = new Object() gives me exactly what I want. could someone please help me understand the different ways to do the same thing in...
15
by: Chris | last post by:
I am just beginning programming again and need a bit of advice. I have both Visual C++ 6.0 Standard Edition and Borland C++ Builder 6. Of these two which do you consider the best for programming...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
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.