|
-
Jun 3rd, 2004, 09:43 AM
#1
Thread Starter
New Member
Specify a VB DLL location instead of registring?
i ave created a dll and a tester program but the program cannot find the entry point stringEd
dll: [class module]
VB Code:
Option Explicit
Public Function stringEd()
stringEd = "hello cheecky"
End Function
tester program:
declaration statement in module:
VB Code:
Declare Function stringEd Lib "C:\fabian\VB Projects\Mine\dll try\stringEd.dll" () As String
VB Code:
Private Sub Command1_Click()
MsgBox stringEd()
End Sub
thanx all!
Last edited by JC Denton; Jun 4th, 2004 at 06:01 AM.
Ur all xperts? Im a rookie, u were a rookie once too, so what happened?
-
Jun 3rd, 2004, 10:03 AM
#2
VB Dlls are COM Components. The Declare Function ... statement is for accessing "standard" dlls, usually written in C/C++, like the windows api.
With COM components you need to include a refererence to the dll in your project, create an "instance" of your class and then call the class properties/methods.
References - Project -> References menu
VB Code:
Private Sub Command1_Click()
Dim oMyClassInstance as MyClassProject.MyClassName
Set oMyClassInstance = MyClassProject.MyClassName
msgbox oMyClassInstance.StringEd
Set oMyClassInstance = Nothing 'releases memory
End Sub
-
Jun 3rd, 2004, 10:26 AM
#3
Thread Starter
New Member
Thanx Brucevde
How can i make it so that the app will always be accustomed that the dll is in the same dir.... or e.g.
app.path & "\resources\stringEd.dll"
Ur all xperts? Im a rookie, u were a rookie once too, so what happened?
-
Jun 6th, 2004, 07:04 PM
#4
Hyperactive Member
Originally posted by JC Denton
Thanx Brucevde
How can i make it so that the app will always be accustomed that the dll is in the same dir.... or e.g.
app.path & "\resources\stringEd.dll"
you would have to use late-binding.
What brucevde is talking about is called early-binding. It's called early-binding because you app will have a reference to the dll before your app is compiled.
late-binding allows you to create com objects in you app without it having a reference before your app is compiled. However, you still need to know the library and class names. But I don't think you can specifiy the filepath of the dll, I'm pretty sure that the vb runtime will search the registry for its filepath.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|