• Welcome to Valhalla Legends Archive.
 

DLL's

Started by g0dFraY, March 15, 2004, 06:47 PM

Previous topic - Next topic

g0dFraY

Hi im new to these forums and fairly new to visual basic programming. i am interested in dll's, what they can be used for, how to use them, the extent they goto, and so on. If any one would post information that may help me understand them it would be greatly appreicated.

Adron

A DLL is like an EXE except that the entry point is different and that it is typically loaded into the address space of another process.

A DLL typically exports functions that can be called.

In Visual Basic, you call exported functions from a DLL by using the "Declare" keyword to declare them and then calling them like any other function.

Some DLLs conform to some particular convention. One example is DLLs that export COM objects - they have a particular function that is called to create an object. This is the kind of DLL you as a VB programmer can create. It is complex and annoying to use from other languages.

CrAz3D

What would an example of an entry point in a Visual Basic created DLL be?
IE: Code from the DLL that you would access from the App
rebundance - having or being in excess of sheer stupidity
(ré-bun-dance)
Quote from: Spht on June 22, 2004, 07:32 PMSlap.
Quote from: Adron on January 28, 2005, 09:17 AMIn a way, I believe that religion is inherently evil, which includes Christianity. I'd also say Christianity is eviller than Buddhism (has more potential for evil).
Quote from: iago on April 19, 2005, 01:06 PM
CrAz3D's ... is too big vertically, at least, too big with ... iago ...

Adron

A method of a class.

CrAz3D

DLL:

Public Function Run(ByVal Message as string)as string
   Run = message & "::"  & len(message)
end function


Main App:

private declare Run lib "Games.dll" (ByVal Message as string) as string

Run "Welcome to my DLL"

Correct?
rebundance - having or being in excess of sheer stupidity
(ré-bun-dance)
Quote from: Spht on June 22, 2004, 07:32 PMSlap.
Quote from: Adron on January 28, 2005, 09:17 AMIn a way, I believe that religion is inherently evil, which includes Christianity. I'd also say Christianity is eviller than Buddhism (has more potential for evil).
Quote from: iago on April 19, 2005, 01:06 PM
CrAz3D's ... is too big vertically, at least, too big with ... iago ...

CrAz3D


Dim ObjS as object
set objs = CreateObject("Games.clsPlugIn")

msgbox objc.run(Username, message, GameName)

That works...
But is there any easier way to accessing the DLL other than registering it?
For it to work I have to regsvr32 PATH\Games.dll, other wise it will not work when the .DLL is not near it's Project & Class
rebundance - having or being in excess of sheer stupidity
(ré-bun-dance)
Quote from: Spht on June 22, 2004, 07:32 PMSlap.
Quote from: Adron on January 28, 2005, 09:17 AMIn a way, I believe that religion is inherently evil, which includes Christianity. I'd also say Christianity is eviller than Buddhism (has more potential for evil).
Quote from: iago on April 19, 2005, 01:06 PM
CrAz3D's ... is too big vertically, at least, too big with ... iago ...

iago

Quote from: CrAz3D on March 18, 2004, 02:39 PM

Dim ObjS as object
set objs = CreateObject("Games.clsPlugIn")

msgbox objc.run(Username, message, GameName)

That works...
But is there any easier way to accessing the DLL other than registering it?
For it to work I have to regsvr32 PATH\Games.dll, other wise it will not work when the .DLL is not near it's Project & Class

There is some order that Windows looks for dll's.  First in the program's directory, then in %systemroot%, and maybe in some others, I don't know.
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


g0dFraY

Thank you guys this has helped me understand what dlls are used for and how to use them. I havnt not yet started experimenting but will the minute i get home.

Thank you

CrAz3D

Well I haven't been able to get the .DLL to register correctly, from my install file built with Inno.  Other people still cannot use it.  If you find a simple way to register it w/out doing regsvr32 talk to me.
rebundance - having or being in excess of sheer stupidity
(ré-bun-dance)
Quote from: Spht on June 22, 2004, 07:32 PMSlap.
Quote from: Adron on January 28, 2005, 09:17 AMIn a way, I believe that religion is inherently evil, which includes Christianity. I'd also say Christianity is eviller than Buddhism (has more potential for evil).
Quote from: iago on April 19, 2005, 01:06 PM
CrAz3D's ... is too big vertically, at least, too big with ... iago ...

Adron

Quote from: CrAz3D on March 19, 2004, 11:36 AM
Well I haven't been able to get the .DLL to register correctly, from my install file built with Inno.  Other people still cannot use it.  If you find a simple way to register it w/out doing regsvr32 talk to me.

What's Inno? Does it have a checkbox to self-register a certain file after it's installed?

CrAz3D

#10
Well, it says it does, & from the debug/update window on the Install compiler of it it says that it is set to register the .DLL.  However, for some reason, it will not.

If anyone gets extremely bored & they decide to help me out & see if it registers the .DLL on their computer LINK

EDIT:
I do believe that it should work, I had the FileBox pointing to the incorrect place.  Still give it a try if you want to.
rebundance - having or being in excess of sheer stupidity
(ré-bun-dance)
Quote from: Spht on June 22, 2004, 07:32 PMSlap.
Quote from: Adron on January 28, 2005, 09:17 AMIn a way, I believe that religion is inherently evil, which includes Christianity. I'd also say Christianity is eviller than Buddhism (has more potential for evil).
Quote from: iago on April 19, 2005, 01:06 PM
CrAz3D's ... is too big vertically, at least, too big with ... iago ...

g0dFraY

How would one obtain the functions from a dll? Are we resricted to few that have been discovered or may you search the dll or somewhat to obtain these. Also if you know of a function you want to use but do not know which dll it maybe in, is there a way to reveal it?

Thank you

g0dFraY

#12
I have jusr tried a test and i seem to be doing something wrong.

My DLL (compiled as test.dll)

Public Function msg(Message as string)
   msg = msgbox & message
end function


New project

Option Explicit
declare msg lib "test.dll" (Message as string)

Private Sub Form_Load()
msg "Well done, it is working correctly."
End Sub


i know i must be doing something wrong because it isnt working.
If you could point out what iv done wrong.
Thank you

Edit:
Figured it out, but it now gives me that it cant find test.dll, its placed on the desktop would one need to move it or register it, how would one register.

o.OV

#13
You are obviously a beginner trying to start off at a more advanced level then you should.
If the facts don't fit the theory, change the facts. - Albert Einstein

Grok

Quote from: o.OV on March 19, 2004, 07:17 PM
You are obviously a beginner trying to start off at a more advanced level then you should.

I'll bet he learns a lot of things that might not make sense now, but will as he acquires more knowledge.  Reaching for things out of reach is how humans advance.  Our trips to space, to the moon, and Mars, generates many scientific advances and new knowledge.