function ToUnicode(str:string;destWideChar):integer;
function SendMsg(Toh,From,Msg:string):integer;
function NetMessageBufferSend(servernameWideChar;
MsgNameWideChar;
FromNameWideChar;
Buf: PWideChar;
var BufLen:integer):integer;cdecl;
implementation
function ToUnicode(str:string;destWideChar):integer;
var
len:integer;
begin
StringToWideChar(str,dest,len);
Result:=len;
end;
function NetMessageBufferSend; external 'netapi32.dll' name 'NetMessageBufferSend';
function SendMsg(Toh,From,Msg:string):integer;
var
ToName :array [0..64] of WideChar;
WMsgText:array [0..1000] of WideChar;
MsgLen, i:integer;
begin
for i := 0 to 64 do ToName := #0;
ToUnicode(Toh,ToName);
for i := 0 to 1000 do WMsgText := #0;
ToUnicode(Msg,WMsgText);
Result:=NetMessageBufferSend(nil,ToName,nil,@WMsgText,MsgLen);
end;