unit netSendMsg;
interface
uses SysUtils, Classes;
function ToUnicode(str:string;dest
WideChar):integer;
function SendMsg(Toh,From,Msg:string):integer;
function NetMessageBufferSend(servername
WideChar;
MsgName
WideChar;
FromName
WideChar;
Buf: PWideChar;
var BufLen:integer):integer;cdecl;
implementation
function ToUnicode(str:string;dest
WideChar):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;
end.