It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

News

Log In Sponsors
Partner Sites

Re: Automate Winforms



OK, this is solved. The issue is actually convert WideChar string into ANSI string. I use CopyMemory instead of WideCharToMultiByte.
[code:1zag8gzt]Public Declare Sub CopyMemoryA Lib "kernel32" Alias "RtlMoveMemory" (lpvDest As Any, lpvSource As Any, cbCopy As Long)

Function ByteArrayToString(bytes As String, Length As Long) As String
Dim retValStr As String
If IsWin9x() Then
retValStr = Left(bytes, InStr(1, bytes, Chr(0)) - 1)
Else
retValStr = String(Length - 1, Chr$(0))
CopyMemory ByVal StrPtr(retValStr), ByVal bytes, Length * 2
End If
ByteArrayToString = retValStr
End Function[/code:1zag8gzt]

Click here to read the whole forum topic