-
I want to create some new functions and put it in a DLL
then declare it and use it.
But How?
I tried this...Man I am stupid
(I open a new DLL project)
sub abc
msgbox "abc123"
end sub
'module
public declare function abc()
'After compile to DLL i use it like this
public declare sub abc lib "c:\abc.dll" ()
Private Sub Command1_click()
abc
end sub
But it keep on display an error
Could anyone tell me how to make a DLL?
-
Jian, As for Visual Basic, it only can produce 2 type of DLL. That call Active DLL(In process) and Avtive EXE (Out of Process).
Both must be include in the Project|References and can not declara as the normal Library Type DLL that compile from C/C++.
The following is the way to declare a Active DLL.
Sample
Code:
Option Explicit
Dim Obj As Class1
Private Sub Form_Load()
'Create a new instance of the Object (DLL)
Set Obj = New Class1
End Sub
Private Sub Form_Unload()
'Destroy the Object (DLL)
Set Obj = Nothing
End Sub
As from your sample, you no need to have a Basic Module file in you DLL project folder. "coz Basic Module normally juz use to declara the API function or some public variable.
Code:
'In your Class Module
Public Sub abc()
msgbox "abc123"
End Sub
Code:
'In your Form
Option Explicit
Dim Obj As Class1
Private Sub Command1_Click()
Set Obj = New Class1
Obj.abc
Set Obj = Nothing
End sub
Well, hope this made sense to you.
-
Thanks for your RE anyway.
But I really wanna know how to make a DLL to be invoked by other progs.