Click to See Complete Forum and Search --> : How to use a dll in vb
Off
July 31st, 2001, 03:01 PM
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.
deghost
July 31st, 2001, 04:15 PM
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!
----------
michi
July 31st, 2001, 05:02 PM
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
Cimperiali
August 1st, 2001, 03:36 AM
'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
Clearcode
August 1st, 2001, 06:00 AM
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.
Cimperiali
August 1st, 2001, 07:09 AM
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
Clearcode
August 1st, 2001, 07:12 AM
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.
Cimperiali
August 1st, 2001, 07:23 AM
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
Cimperiali
August 1st, 2001, 08:21 AM
Have a look also here:
http://codeguru.com/cgi-bin/bbs/wt/showpost.pl?Board=vb&Number=36667&page=0&view=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
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.