Restored from previous forum. Originally posted by Num3.
Can anyone gimme a help on this one?
;DLL Procedure
ProcedureDLL settext(a.s)
ProcedureReturn a+" OK"
EndProcedure
;Function Call
If OpenLibrary(0,"add.dll")
*a.s="Zé"
MessageRequester("Result",Str(CallFunction(0,"setstext",*a)),0)
EndIf
Result is alway "0"
--
Kind Regards
Rui Carvalho
Old programmers never die... They branch into a subroutine...
[HELP] Passing text into DLL
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Num3.
I've seen it was from retyping....
The function name is correct, just misspelled here
You see a DLL only accepts pointers in, but i can't seem to get the text out of the pointer it returns inside the DLL
Here's another example:
;DLL CODE
ProcedureDLL add(a,b)
ProcedureReturn (a+b)
EndProcedure
ProcedureDLL settext(a.s)
ProcedureReturn a+"OK"
EndProcedure
; Function Calling
If OpenLibrary(0,"add.dll")
*a.s="Peter Pan"
MessageRequester("Result",Str(CallFunction(0,"add",5,6)),0)
;Result is eleven
MessageRequester("Result",Str(CallFunction(0,"settext",*a)),0)
;Result is 1 ???
EndIf
--
Kind Regards
Rui Carvalho
Old programmers never die... They branch into a subroutine...
I've seen it was from retyping....
The function name is correct, just misspelled here

You see a DLL only accepts pointers in, but i can't seem to get the text out of the pointer it returns inside the DLL

Here's another example:
;DLL CODE
ProcedureDLL add(a,b)
ProcedureReturn (a+b)
EndProcedure
ProcedureDLL settext(a.s)
ProcedureReturn a+"OK"
EndProcedure
; Function Calling
If OpenLibrary(0,"add.dll")
*a.s="Peter Pan"
MessageRequester("Result",Str(CallFunction(0,"add",5,6)),0)
;Result is eleven
MessageRequester("Result",Str(CallFunction(0,"settext",*a)),0)
;Result is 1 ???
EndIf
--
Kind Regards
Rui Carvalho
Old programmers never die... They branch into a subroutine...
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by VPureBasic.
Hi Num3.,
Second Read the return loke this:
Sentence.s = PeekS( CallFunction( 0, "settext","This example works.." )
Roger
Hi Num3.,
First set your procedure to "PROCEDUREDLL.s"Originally posted by Num3
I've seen it was from retyping....
The function name is correct, just misspelled here
You see a DLL only accepts pointers in, but i can't seem to get the text out of the pointer it returns inside the DLL
Here's another example:
;DLL CODE
ProcedureDLL add(a,b)
ProcedureReturn (a+b)
EndProcedure
ProcedureDLL settext(a.s)
ProcedureReturn a+"OK"
EndProcedure
; Function Calling
If OpenLibrary(0,"add.dll")
*a.s="Peter Pan"
MessageRequester("Result",Str(CallFunction(0,"add",5,6)),0)
;Result is eleven
MessageRequester("Result",Str(CallFunction(0,"settext",*a)),0)
;Result is 1 ???
EndIf
--
Kind Regards
Rui Carvalho
Old programmers never die... They branch into a subroutine...
Second Read the return loke this:
Sentence.s = PeekS( CallFunction( 0, "settext","This example works.." )
Roger
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm