Board index » cppbuilder » Methods of exposing a DLL's methods

Methods of exposing a DLL's methods

I have a DLL which contains between twenty and thirty functions. I want to
wrap this DLL in COM wrapper to make it available to, say, VB or other
programming environments. The DLL has no visual interface and doesn't really
require one, so it's not obvious how this fits into ActiveX, which seems to
be visually oriented. It seems that I have several choices:

1. Create a new, windowless VCL component that wraps the functions of the
DLL, and then create an ActiveX object from that.
2. Just create a COM object that wraps the DLL.
3. Create an ActiveX library that contains the functions.

Is there another alternative, and which one will create the easiest
interface for the end user?

Thanks,
Mike

 

Re:Methods of exposing a DLL's methods


On Tue, 19 Jun 2001 16:21:09 -0500, "Mike Coldewey"

Quote
<No_Spam4m_colde...@hotmail.com> wrote:
>2. Just create a COM object that wraps the DLL.

I would create an automation object. From the builder5 new wizard
there is a tab called activex with an item called "automation object".

This option gives you all the smarts required to be accessible from
VB. As oppossed to com object which doesn't.

Re:Methods of exposing a DLL's methods


Thanks, John. I'll try it out and let you know how it goes.

Mike

Quote
"John Moshakis" <john.mosha...@home.com> wrote in message

news:3b2fc810.27007464@newsgroups.borland.com...
Quote
> On Tue, 19 Jun 2001 16:21:09 -0500, "Mike Coldewey"
> <No_Spam4m_colde...@hotmail.com> wrote:

> >2. Just create a COM object that wraps the DLL.

> I would create an automation object. From the builder5 new wizard
> there is a tab called activex with an item called "automation object".

> This option gives you all the smarts required to be accessible from
> VB. As oppossed to com object which doesn't.

Re:Methods of exposing a DLL's methods


John -
I have created two different modules, each of which creates an automation
object, that appear to be visible from Visual Basic. VB doesn't like these
objects; the example stuff from VB (6) refer extensively to Excel, and not
to general objects. Have you ever created a component in Borland and used it
in VB in this way? I'm aware that this is probably a trivial process - "it's
easy once you know what you're doing" sort of thing, but the mechanics of
this (as opposed to the theory) don't seem to be as clear as if I were doing
it from, say VC++.

Mike

Quote
"John Moshakis" <john.mosha...@home.com> wrote in message

news:3b2fc810.27007464@newsgroups.borland.com...
Quote
> On Tue, 19 Jun 2001 16:21:09 -0500, "Mike Coldewey"
> <No_Spam4m_colde...@hotmail.com> wrote:

> >2. Just create a COM object that wraps the DLL.

> I would create an automation object. From the builder5 new wizard
> there is a tab called activex with an item called "automation object".

> This option gives you all the smarts required to be accessible from
> VB. As oppossed to com object which doesn't.

Re:Methods of exposing a DLL's methods


On Wed, 20 Jun 2001 11:22:03 -0500, "Mike Coldewey"

Quote
<No_Spam4m_colde...@hotmail.com> wrote:
>John -
>I have created two different modules, each of which creates an automation
>object, that appear to be visible from Visual Basic. VB doesn't like these
>objects; the example stuff from VB (6) refer extensively to Excel, and not
>to general objects.

What do you mean by "doesn't like them"?

Have you started off by doing "new ActiveX library" and then "new
automation object"?

Quote
>>Have you ever created a component in Borland and used it
>in VB in this way?

I've created automation objects and used them in active server pages.

Re:Methods of exposing a DLL's methods


Quote
"John Moshakis" <john.mosha...@home.com> wrote in message

news:3b30cea3.8392207@newsgroups.borland.com...
Quote
> On Wed, 20 Jun 2001 11:22:03 -0500, "Mike Coldewey"
> <No_Spam4m_colde...@hotmail.com> wrote:

> >John -
> >I have created two different modules, each of which creates an automation
> >object, that appear to be visible from Visual Basic. VB doesn't like
these
> >objects; the example stuff from VB (6) refer extensively to Excel, and
not
> >to general objects.

> What do you mean by "doesn't like them"?

> Have you started off by doing "new ActiveX library" and then "new
> automation object"?

John, sorry for the lack of detail. I got it to work after I did these two
steps and added the DLL through the VB object browser (as opposed to the
.TLB). And after I used the correct syntax in VB:

Private Sub Form_Load()
    Set myAPI = CreateObject("SWAPI620.AutomationSWAPI")
End Sub
where SWAPI620 is the DLL name and AutomationSWAPI is the class name.

Thanks again.

Mike

Other Threads