views:

224

answers:

2

I am writing VB script in which I have to call a function of a COM DLL. The fuction which I want to use is in structure and thus I want to create the object of that structure to access the required function. e.g. I have a dll 'BasicCom.dll', in which

struct abc
{
    bool xyz();
} 

Now I want to call xyz(). Is any one have any idea, how to deal with such call in Vb script.

A: 

You should to register it as COM+ component (run REGSVR32 BasicCom.dll) and do:

Set yourClass = CreateObject("BasicCom.Abc") ''// Should be ProjectName.ClassName
returnValue = yourClass.xyz()
Rubens Farias
Regsvr32 merely registers the COM component. COM+ is something different which (among other things) allows for a COM component to hosted in another process. COM+ is not needed in this scenario.
AnthonyWJones
A: 

Have a look at

VBScript CreateObject Function

The CreateObject function creates an object of a specified type.

Syntax

CreateObject(servername.typename[,location])  
astander