Again a problem of UNICODE
Usually i use this code since several years without problem
PB Dll code
Code: Select all
ProcedureDLL.s Try()
Static TheReturn.s
TheReturn = "Hello of KCC"
ProcedureReturn TheReturn
EndProcedure
Code: Select all
Private Declare Function FreeLibrary Lib "kernel32" (ByVal hLibModule As Long) As Long
Private Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long
Private Declare Function Try Lib "MyDLL.dll" () As Long
Private Declare Function lstrcpy Lib "kernel32" (ByVal lpString1 As Any, ByVal lpString1 As Any) As Long
Private Declare Function lstrlen Lib "kernel32.dll" (ByVal lpString As Any) As Long
Private Sub Form_Load()
ChDir App.Path
HwndLib = LoadLibrary("D:\MyDLL.dll")
Dim PtrReturn As Long, StringDLL As String
PtrReturn = Try()
StringDLL = Space$(lstrlen(PtrReturn))
lstrcpy StringDLL, PtrReturn
MsgBox StringDLL
FreeLibrary HwndLib
End Sub
I have try to replace the "lstrcpy and lstrlen" to "lstrcpyW and lstrlenW" without succes
And it's worst with "LoadLibraryA" to "LoadLibraryW", it would be too simple
If someone know the solution
Have a good day