Page 1 of 1
Posted: Thu Feb 07, 2002 2:11 am
by BackupUser
Restored from previous forum. Originally posted by Paul.
Maybe someone out there can help me??
I need to access functions in a DLL. I have tried Mr.Skunks library but it either doesn't work properly/doesn't return the proper data, or it crashes the EXE.
I went to the Windows API and can load the DLL using LoadLibrary() and can even get the address of the various commands inside the DLL using GetProcAddress() but after that I hit a brick wall... I can't seem to find any commands or reference to commands that actually send/receive arguments to the DLL.
Can anyone point me in the right direction??
Posted: Thu Feb 07, 2002 3:19 am
by BackupUser
Restored from previous forum. Originally posted by El_Choni.
I havent tested this:
Code: Select all
If LoadLibrary_("MySystemLib.dll")
arg1.l = 1
arg2.l = 2
arg3.l = 3
result.l = 0
FunctionPointer = GetProcAddress_(whatever goes here... )
! push dword [v_arg1]
! push dword [v_arg2]
! push dword [v_arg3] ; or maybe in reverse order, I don't remember
call FunctionPointer
! mov [v_result], eax
EndIf
Hope it works. Bye,
El_Choni
Edited by - El_Choni on 07 February 2002 03:19:55
Posted: Thu Feb 07, 2002 4:23 am
by BackupUser
Restored from previous forum. Originally posted by Paul.
Seems to be a "No Go" here.
Causes an EXE crash when trying to run or compile

Posted: Thu Feb 07, 2002 12:13 pm
by BackupUser
Restored from previous forum. Originally posted by El_Choni.
This works, with inline asm enabled:
Code: Select all
module = LoadLibrary_("USER32.DLL")
If module
result = 0
MessageBox = GetProcAddress_(module, "MessageBoxA")
If MessageBox
Caption.s = "MessageBox function"
Message.s = "Working"
push dword 0
push Caption
push Message
push dword 0 ; the order seems correct
call MessageBox
mov result, eax
EndIf
EndIf
Bye,
El_Choni
Edited by - El_Choni on 07 February 2002 12:19:46
Posted: Thu Feb 07, 2002 2:26 pm
by BackupUser
Restored from previous forum. Originally posted by Paul.
The call I have to make looks like this:
Error.l=BoxReady(LPT1.l,Type.l)
Value going in is LPT.l=1
Return values are Error and Type
So I need something that will return 2 values.
If I try to modify your code I get either EXE has generated errors or Assembly error, mail Fred

Posted: Thu Feb 07, 2002 2:57 pm
by BackupUser
Restored from previous forum. Originally posted by El_Choni.
If Type is a return value, then you should probably pass its pointer instead of its value.
Code: Select all
module = LoadLibrary_("YourLib.DLL")
If module
result = 0
BoxReady = GetProcAddress_(module, "BoxReady")
If MessageBox
LPT1.l = whatever
Type.l
varptr.l = @Type
push LPT1
push varptr ; the order seems correct
call BoxReady
mov Error, eax ; Type is already updated
EndIf
EndIf
Try it. Anyway, I don't know if LoadLibrary can load any library or only registered libraries or only libraries present in the System folder, you may know that.
Bye,
El_Choni
Edited by - El_Choni on 07 February 2002 14:58:15
Posted: Thu Feb 07, 2002 3:23 pm
by BackupUser
Restored from previous forum. Originally posted by Paul.
WooHoooo !!!
That's for the help El_Choni.
At first this wouldn't work either but out of desperation a switched around the PUSH to:
push varptr
push LPT1
Guess it does things in reverse. Anyways, thank you for solving my problem!!
Posted: Sat Feb 09, 2002 11:08 am
by BackupUser
Restored from previous forum. Originally posted by gnozal.
Yes, WooHoooo for El_Choni !!!
But I'd like some REAL DLL support in PureBasic instead of using ASM !
Please Fred...
Posted: Sat Feb 09, 2002 12:28 pm
by BackupUser
Restored from previous forum. Originally posted by fred.
WIll be in the next release. Don't worry
Fred - AlphaSND
Posted: Sat Feb 09, 2002 3:33 pm
by BackupUser
Restored from previous forum. Originally posted by michaelj.
WIll be in the next release. Don't worry
Now, if that would include ActiveX DLLs, that would be world-changing !!
;o)
Michael.
(Registered PureBasic user)
Posted: Thu Apr 11, 2002 3:42 am
by BackupUser
Restored from previous forum. Originally posted by Shawn.
WIll be in the next release. Don't worry
Fred - AlphaSND
Hi.
Did the DLL support get pushed back to a later release, or did I miss it in the documentation?
Thanks.
Shawn
Posted: Thu Apr 11, 2002 3:49 am
by BackupUser
Restored from previous forum. Originally posted by Shawn.
WIll be in the next release. Don't worry
Fred - AlphaSND
Hi.
Did the DLL support get pushed back to a later release, or did I miss it in the documentation?
Thanks.
Shawn
I did miss it in the documentation. See "Library" in the reference section. It is not yet listed on the main page.
Thanks.
Shawn
Posted: Thu Apr 11, 2002 7:33 am
by BackupUser
Restored from previous forum. Originally posted by Rings.
Its defintly in the V3.0 version.
Its a long way to the top if you wanna .....CodeGuru