How to reference a dll in a vb6 project ??

J

Jason Jacob

To all

I've written an ActiveX Dll project using VB6.
I've named the project as [cs_Dll_Trial] and the Project Description
is [Dll_Trial]

I've compiled the dll successfully, the name of the dll is
"csDllTrial_Project.dll"

Somehow I can import the reference to another VB standard project, but
somehow the program can't reference the dll I've made

code snippets...

under Module1
Public Declare Function getSProperty Lib "Dll_Trial" Alias
"getCSProperty" _
() As String

Public Declare Sub setSProperty Lib "Dll_Trial" Alias "setCSProperty"
_
(sMsg As String)

under Form1
Private Sub Command1_Click()
Module1.setSProperty (Text1.Text)
Text2.Text = Module1.getSProperty
End Sub

Error is "Runtime error 53-- File not found:Dll_Trial"

It's strange, since I've tried nearly all the combinations such as
Dll_Trial, cs_Dll_Trial, cs_Dll_Trial.Dll_Trial, csDllTrial_Project
But none of them succeeded!?

Can anyone tell me what's wrong??

From Jason (Kusanagihk)
 
C

Cor Ligthert

Hi Jason,

Did you know that this is a VBNet newsgroup, a language with the same start
name and a lot of equal things like French and English.

For VB6 the better place is
microsoft.public.vb* 'there are a lot newsgroups

I hope you find your answer fast?

Cor
 
A

Al Reid

Wrong group for this.

However, you don't do it that way. You go to Project>References and add a reference to the dll. You then instantiate the object.
 
H

Herfried K. Wagner [MVP]

Jason,

* (e-mail address removed) (Jason Jacob) scripsit:
I've written an ActiveX Dll project using VB6.
I've named the project as [cs_Dll_Trial] and the Project Description
is [Dll_Trial]

I've compiled the dll successfully, the name of the dll is
"csDllTrial_Project.dll"

Somehow I can import the reference to another VB standard project, but
somehow the program can't reference the dll I've made

code snippets...

under Module1
Public Declare Function getSProperty Lib "Dll_Trial" Alias
"getCSProperty" _
() As String

Public Declare Sub setSProperty Lib "Dll_Trial" Alias "setCSProperty"
_
(sMsg As String)

under Form1
Private Sub Command1_Click()
Module1.setSProperty (Text1.Text)
Text2.Text = Module1.getSProperty
End Sub

Error is "Runtime error 53-- File not found:Dll_Trial"

It's strange, since I've tried nearly all the combinations such as
Dll_Trial, cs_Dll_Trial, cs_Dll_Trial.Dll_Trial, csDllTrial_Project
But none of them succeeded!?

You cannot export functions from your VB6 ActiveX DLL that can be used
with 'Declare'. Instead, add a reference to the DLL and use the classes
defined in the DLL.

Notice that this is a VB.NET language group and your question doesn't
seem to be related to the VB.NET programming language. I suggest to
give the VB6 groups (microsoft.public.vb.*) a try for future VB6-related
questions.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top