在同一局域网内,通过一个台主机向其他主机发送信息(类似于Win2000中Messager的功能)(100分)

  • 主题发起人 主题发起人 Thomas_Lotus
  • 开始时间 开始时间
T

Thomas_Lotus

Unregistered / Unconfirmed
GUEST, unregistred user!
unit Unit2;
interface
uses SysUtils, Classes;

function ToUnicode(str:string;dest:PWideChar):integer;
function SendMsg(Toh,From,Msg:string):integer;
function NetMessageBufferSend(servername:PWideChar;
MsgName:PWideChar;
FromName:PWideChar;
Buf: PWideChar;
var BufLen:integer):integer;cdecl;
implementation
function ToUnicode(str:string;dest:PWideChar):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.
 
你好,谢谢你的帮助!能给我一个编译好的文件吗?
 

Similar threads

D
回复
0
查看
2K
DelphiTeacher的专栏
D
S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
后退
顶部