|
-
July 31st, 2001, 03:01 PM
#1
How to use a dll in vb
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.
"the opposition of the opposites is the engine of becoming"
-
July 31st, 2001, 04:15 PM
#2
Re: How to use a dll in vb
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!
----------
-
July 31st, 2001, 05:02 PM
#3
Re: How to use a dll in vb
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
-
August 1st, 2001, 03:36 AM
#4
Re: How to use a dll in vb
'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
...at present time, using mainly Net 4.0, Vs 2010
Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
-
August 1st, 2001, 06:00 AM
#5
Re: How to use a dll in vb
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.
-
August 1st, 2001, 07:09 AM
#6
Re: great
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
...at present time, using mainly Net 4.0, Vs 2010
Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
-
August 1st, 2001, 07:12 AM
#7
Re: great
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.
-
August 1st, 2001, 07:23 AM
#8
Re: writing an article
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
...at present time, using mainly Net 4.0, Vs 2010
Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
-
August 1st, 2001, 08:21 AM
#9
Re: How to use a dll in vb
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
...at present time, using mainly Net 4.0, Vs 2010
Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
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
|