Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Building DLL in Visual Basic 2

Status
Not open for further replies.

Aleksei

Technical User
Mar 4, 2002
10
NL
Hi all,

I have a problem in exporting routines from a DLL written
in VB6. What I need is a DLL which simply exports about
four pre-defined routines, which the target application
calls.

I have created an Active X DLL project, containing one
module (with sub main()) and one class (with initialize and
terminate methods, instancing is set to GlobalMultiUse). I
wrote required functions as public, and tried them in both
the module and the class, but in both cases the target
application compains about not being able to find the
desired routines. When I use Quickview or the Dependancy
Walker to view the resulting DLL exported functions, I can
only see DllCanUnloadNow, DllGetClassObject,
DllRegisterServer and DllUnregisterServer.

Who can help me with this ?

Regards, Alex van L.
 
The problem is likely to be that with VB you can't make a DLL in the normal(C++) sense. What you can do is create Active X DLL's. What environment are you using the DLL in?

Matt
 
VB can only create ActiveX DLLs and EXEs both of which are really COM DLLs, rather than 'classic' API function-exporting DLLs.

In other words they are object libraries that require the use of:

Dim Fred as Object
Set Fred = CreateObject("myActiveXLibrary.myActiveXObject")

or the addition of the relevant library reference to your project and:

Dim Fred as myActiveXLibrary.myActiveXObject
Set Fred = New myActiveXLibrary.myActiveXObject

In both cases you can now refer to properties and methods of your instantiated object as follows:

result = Fred.myProperty
Call Fred.myMethod
etc.

What you cannot do is anything like:

Private Function myMethod() lib "MyActiveXLibrary" () as Longas this requires a 'classic' DLL. VB cannot produce such DLLs.

Hence the errors you have been getting.
 
Okay guys, that was the answer I was afraid of.
I tried to tackle my problem in VC++ originally, for which I also have an example of how to hook into the target application. I spent *way* too much time on the VC++ part, where I lack experience. A collegue suggested I'ld try VB instead, and I got much of the functionality in quite fast. Only this interface now seems impossible, so I will have to revert back to VC++ again - blast!.

Thanks for your help.

Aleksei
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top