473,804 Members | 3,762 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2405
In article <jx************ *********@phobo s.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.o rg> wrote in message
news:MP******** *************** *@msnews.micros oft.com...
In article <jx************ *********@phobo s.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************ **********@phob os.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(uns igned_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.Interfa ceName.SelectDr ive(DriveLetter , Drive) ;

I still get compiler errors ...
An object reference is required for the nonstatic field, method, or property
'Perlustro.ICDD VDIO.SelectDriv e(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.o rg> wrote in message
news:MP******** *************** *@msnews.micros oft.com...
In article <Mf************ **********@phob os.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************ **********@phob os.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.Interfa ceName.SelectDr ive(DriveLetter , Drive) ;

I still get compiler errors ...
An object reference is required for the nonstatic field, method, or property
'Perlustro.ICDD VDIO.SelectDriv e(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.Sele ctDrive(DriveLe tter, 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
2775
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 with the Borland web site, and it didn't answer my questions, so I hope someone here will be kind enough to reply. I took a few courses on C++ using Microsoft Visual C++, and then taught myself MFC for GUI design -- an exercise akin to using...
3
8332
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 object. But I want to have as input for the Media Player Object a specified memory buffer where I put my MPEG2 data coming from a video server by the net. Is it possible doing this? I hope there is a C++Builder developer in this group that can...
11
9281
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 C++. I find my self sometimes, trying Object app = Object(); Object *app = Object(); Object app = new Object();
15
3783
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 windows programs (not the DOS style program). I have had a quick look at both of these and Borland seems to have a lot more components (Buttons, Forms etc) than Microsoft Visual C++. Does Visual C++ have these components easily accesable. Chris.
0
9706
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
10571
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
10326
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10317
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10075
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...
1
7615
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6851
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
5520
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...
2
3815
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.