Restored from previous forum. Originally posted by Rings.
Okay here it goes.First DLL Example in PureBasic:
Code: Select all
Global BackString.s
ProcedureDLL EasyRequester(Message$)
MessageRequester("EasyRequester !", Message$, #MB_ICONINFORMATION)
ProcedureReturn Len(Message$)
EndProcedure
ProcedureDLL EasyString(Message$)
MessageRequester("EasyString !", Message$, #MB_ICONINFORMATION)
BackString="1234"+Message$
ProcedureReturn @Backstring.s
EndProcedure
and now the VBCode for it (paste it in a form with a CommandButton
and change path for dll if needed:
Code: Select all
Private Declare Function EasyRequester Lib "c:\Purebasic\Compilers\Purebasic.dll" (ByVal Message As String) As Long
Private Declare Function EasyString Lib "c:\Purebasic\Compilers\Purebasic.dll" (ByVal Message As String) As Long 'String
Private Declare Function lstrcpy Lib "Kernel32.dll" (ByVal MyString As String, ByVal MyLong As Long) As Long
Private Sub Command1_Click()
Dim Result As Long
Dim MyString As String
Dim Pointer As Long
Result = EasyRequester("Test")
MsgBox Str(Result)
Pointer = EasyString("Test")
MsgBox Str(Pointer)
MyString = Space(255)
Res = lstrcpy(MyString, Pointer)
MsgBox MyString
End Sub
as you see you have to deal with the Pointer to the string.
in Pure you can easily use PeekS(Zeiger)
Its a long way to the top if you wanna .....CodeGuru