Hi,
i've a dll and i want to know how to instantiate it and use his functions.
Thanks in advance.
I will rate your response.
Printable View
Hi,
i've a dll and i want to know how to instantiate it and use his functions.
Thanks in advance.
I will rate your response.
you declare a function/functions that you want form it like that:
public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (byval hwnd as Long, _
byval wMsg as Long, byval wParam as Long, lParam as Any) as Long
better declare it in a module, and then you can use it as a regular function
----------
The @host is everywhere!
----------
Firstly, use "regsvr32" to register your Dll. Then add a Reference to it in VB. (On the VB menue: Project -> Reference)
Regards,
Michi
MCSE, MCDBA
'if it is a vb dll and if you have it registered on your machine, after you
'added a reference to it via menu->project->references, you can
dim aNameOfYourchose as yourdllName.AclassCreatable
'
set aNameOfYourchose = new yourdllName.AclassCreatable
with aNameOfYourchose
.'after typeing a point, you will have intellisense to help you find methods
'and properties of your dll
end with
'after using, remember to do:
set aNameOfYourchose= nothing
'One more help will come from Object Browser:
'add the reference to the dll then press F2 and search for
'the dll
Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood,
Bruno Paris and all the other wonderful people who made and make Codeguru
a great place.
Come back soon, you Gurus.
The Rater
The others have given the answer but you first need to know if it is an ActiveX dll or not.
To do this, open the dll with the program called Quickview and scroll down to the very bottom of the resulting output to a secyion called Export Table
If this section includes the words "DllCanUnloadNow" or "OLESelfRegister" then it is an ActiveX dll - if it has a bunch of others, but none like these two then it is a standard dll.
For ActiceX dlls you must register them using RegSvr32 and then use them by declaring instances of their class(es) e.g.
Dim myObj as myDll.myDllClass
set myObj = new myDll.myDllClass
myObj.myProperty = "This is a test"
and for non-ActiveX dlls you need to use the declarations i.e.
private Declare Sub myProc Lib "myDll.dll" ()
Call myProc()
HTH,
Duncan
-------------------------------------------------
Ex. Datis: Duncan Jones
Merrion Computing Ltd
http://www.merrioncomputing.com
Check out the new downloads - ImageMap.ocx is the VB control that emulates an HTML image map, EventVB.OCX for adding new events to your VB form and adding System Tray support simply, MCL Hotkey for implemenmting system-wide hotkeys in your application...all with source code included.
Great!
-sorry, I am out of votes-
Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood,
Bruno Paris and all the other wonderful people who made and make Codeguru
a great place.
Come back soon, you Gurus.
The Rater
I think we (3 or 4 people who answered this) should get together to write an article on it - this must be one of the most frequently asked questions on this site.
HTH,
Duncan
-------------------------------------------------
Ex. Datis: Duncan Jones
Merrion Computing Ltd
http://www.merrioncomputing.com
Check out the new downloads - ImageMap.ocx is the VB control that emulates an HTML image map, EventVB.OCX for adding new events to your VB form and adding System Tray support simply, MCL Hotkey for implemenmting system-wide hotkeys in your application...all with source code included.
It sounds good. What is next step?
Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood,
Bruno Paris and all the other wonderful people who made and make Codeguru
a great place.
Come back soon, you Gurus.
The Rater
Have a look also here:
http://codeguru.com/cgi-bin/bbs/wt/s...collapsed&sb=5
Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood,
Bruno Paris and all the other wonderful people who made and make Codeguru
a great place.
Come back soon, you Gurus.
The Rater