Also, watch out for the SetWindowText() defined in WIN32API.INC: It's the ANSI version, so will only display the first character when used with a UNICODE string (I was using this to test conversion.)
Finally, do not use len(strUnicode): len() only works in ANSI, so will also stop after the first character.
Quite a lot of investigation for my first step working with PB/DLL

Code:
$INCLUDE "WIN32API.INC" %STR_MAX_SIZE 64 Declare FUNCTION NetMessageBufferSend LIB "NETAPI32.DLL" ALIAS "NetMessageBufferSend" (sServer AS ASCIIZ, _ sTo AS ASCIIZ, sFrom AS ASCIIZ, sMsg AS ASCIIZ, BYVAL msglen AS LONG) AS LONG Declare Function SetWindowTextW Lib "user32.dll" ALIAS "SetWindowTextW" (BYVAL hwnd AS LONG, sText AS ASCIIZ) AS LONG LOCAL lResult AS LONG LOCAL sToHostA as ASCIIZ * %STR_MAX_SIZE LOCAL sToHostW as ASCIIZ * (%STR_MAX_SIZE * 2) sToHostA = "W2K" LOCAL sBufferA AS ASCIIZ * %STR_MAX_SIZE LOCAL sBufferW AS ASCIIZ * (%STR_MAX_SIZE * 2) sBufferA = "All your base are belong to us" lResult = MultiByteToWideChar (%CP_ACP, 0&, sToHostA, -1, sToHostW, Len(sToHostA) * 2) lResult = MultiByteToWideChar (%CP_ACP, 0&, sBufferA, -1, sBufferW, Len(sBufferA) * 2) lResult = NetMessageBufferSend ("", sToHostW, "", sBufferW, %STR_MAX_SIZE * 2)
FF.
[This message has been edited by Frederic Faure (edited July 06, 2001).]
Leave a comment: