PDA

Click to See Complete Forum and Search --> : Dll call problem


Tonatiuh
Jan 6th, 2000, 12:17 AM
I made an ActiveX DLL and I registered. I want to call the functions into it in the same way that I call the API functions, for example functions into a USER32.DLL. But if I declare and call the function that is into my DLL I receive this error message:

Can't find DLL entry point Test in Proyect1

'Test' is the function tha I made into 'Proyect1.DLL'

The code of my ActiveX DLL is:
Public Function Test(x As Integer, y As Single) As Integer
MsgBox x & " - " & y
Test = 7365
End Function

And the code of the EXE proyect from I want to call the Test function is:

Option Explicit

Private Declare Function Test Lib "proyect1" (ByRef x As Integer, ByRef y As Single) As Integer

Private Sub Form_Load()
Dim s As Integer
s = Test(3, 13.5)
MsgBox "The returned value is: " & s
End Sub

Any idea will be deeply appreciated!

Thanks


[This message has been edited by Tonatiuh (edited 01-06-2000).]

Clunietp
Jan 6th, 2000, 12:25 AM
You are making COM dlls, not traditional C++ dlls.

To use, you need to add a reference to your ActiveX dll via the PROJECT --> REFERENCES and instantiate the object in code:



'declare variables, etc.
Dim objMyClass as MyDLL.MyClass
dim varReturnValue as variant


'instantiate instance of class
set objMyClass = new MyDLL.MyClass


'invoke function in class
varReturnValue = objMyClass.DoSomething(<Param1>, <param2> )


'all done for now, destroy object
set objMyClass = Nothing



HTH

Tom

Tonatiuh
Jan 6th, 2000, 12:35 AM
Yes Tom but, Is there any way to make a DLL and call its functions in the same way as an API function using VB?

[This message has been edited by Tonatiuh (edited 01-06-2000).]

Clunietp
Jan 6th, 2000, 12:50 AM
A clue I have not!

Speculation:
'Cant find DLL entry point' means that the library is not loaded into memory. Maybe you can call another API to load the library into memory, then call one of its functions.

Anyone else?

Tonatiuh
Jan 17th, 2000, 09:27 PM
How can I implement and AddressOf functionallity into my DLL.

I want to return a list to the application.