谁知道netmessagebuffsender函数是在哪个单元声明的。(*delphi中要引用的单元)(20分)

  • 主题发起人 主题发起人 delphi009
  • 开始时间 开始时间
D

delphi009

Unregistered / Unconfirmed
GUEST, unregistred user!
谁知道netmessagebuffsender函数是在哪个单元声明的。(*delphi中要引用的单元)<br>有例子的加分
 
不用引用单元,直接采用静态连接外部dll,该dll只有nt下面才有,好象是net打头的。<br>具体记不清了,我有一个例子程序,需要的话给我写信。guyigood@163.com
 
function NetMessageBufferSend; external 'netapi32.dll' name 'NetMessageBufferSend';<br>举例:<br>------------------------------------------------------------<br>unit SendMsgUnit;<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; &nbsp; MsgName:PWideChar;<br>&nbsp; &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; &nbsp; Buf: PWideChar;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var BufLen:integer):integer;cdecl;<br>implementation<br><br>function ToUnicode(str:string;dest:PWideChar):integer;<br>var<br>&nbsp; len:integer;<br>begin<br>&nbsp; //len:=0;<br>&nbsp; StringToWideChar(str,dest,len);<br>&nbsp; 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>&nbsp; ToName :array [0..64] of WideChar;<br>&nbsp; FromName :array [0..64] of WideChar;<br>&nbsp; WMsgText:array [0..1000] of WideChar;<br>&nbsp; MsgLen, i:integer;<br>begin<br>&nbsp; for i := 0 to 64 do ToName := #0;<br>&nbsp; ToUnicode(Toh,ToName);<br><br>&nbsp; for i := 0 to 64 do FromName := #0;<br>&nbsp; ToUnicode(From,FromName);<br><br>&nbsp; for i := 0 to 1000 do WMsgText := #0;<br>&nbsp; ToUnicode(Msg,WMsgText);<br><br>&nbsp; Result:=NetMessageBufferSend(nil,ToName,nil,@WMsgText,MsgLen);<br>end;<br><br>end.<br><br>
 
在'netapi32.dll' 里面<br>相当与net send 127.0.0.1 你好!
 
不是pas, it's dll
 
多人接受答案了。
 
后退
顶部