如何用netmessagebuffersend向所有机器发送message(100分)

  • 主题发起人 主题发起人 Carem
  • 开始时间 开始时间
C

Carem

Unregistered / Unconfirmed
GUEST, unregistred user!
注意:我要求的是用函数,而不是net send 命令!谢谢各位了!
 
你会向一台机器发消息吗?<br><br>会的话把其中的机器名换成*就可以了,和net send性质一样的
 
我知道,但是在函数里面,* 不起作用!
 
抄的:<br><br>unit Unit2;<br>interface<br>uses SysUtils, Classes;<br><br>function ToUnicode(str:string;dest:PWideChar):integer;<br>function SendMsg(Toh,From,Msg:string):integer;<br>function NetMessageBufferSend(servername:PWideChar;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MsgName:PWideChar;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FromName:PWideChar;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Buf: PWideChar;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var BufLen:integer):integer;cdecl;<br>implementation<br>function ToUnicode(str:string;dest:PWideChar):integer;<br>var<br>len:integer;<br>begin<br>StringToWideChar(str,dest,len);<br>Result:=len;<br>end;<br><br><br>function NetMessageBufferSend; external 'netapi32.dll' name 'NetMessageBufferSend';<br><br>function SendMsg(Toh,From,Msg:string):integer;<br>var<br>ToName :array [0..64] of WideChar;<br>WMsgText:array [0..1000] of WideChar;<br>MsgLen, i:integer;<br>begin<br>for i := 0 to 64 do ToName := #0;<br>ToUnicode(Toh,ToName);<br>for i := 0 to 1000 do WMsgText := #0;<br>ToUnicode(Msg,WMsgText);<br>Result:=NetMessageBufferSend(nil,ToName,nil,@WMsgText,MsgLen);<br>end;<br><br>end.<br>&nbsp;<br>
 
没有 &nbsp;* &nbsp;这东西,只有循环!
 
thanks temp2000 &nbsp;很久没看见你了!你上哪里去了!?
 
又一個倒分的,*_*<br>http://www.delphibbs.com/delphibbs/listq.asp?sort=6&amp;type=2&amp;expert=temp2000
 
后退
顶部