VBGood网站全文搜索 Google

搜索VBGood全站网页(全文搜索)
首页 - 经验之谈 - 在WindowsNT网络中广播消息
发表评论(0)作者:, 平台:, 阅读:9833, 日期:2000-03-25
在WindowsNT网络中广播消息

Windows 9x中有一个WinPopUp.exe可以在一个Windows网络中收发消息。但Windows NT中并未提供该程序。

利用WIN32 API函数NetMessageBufferSend()可以在一个Windows NT网络中广播一个消息。


Private Const NERR_Success As Long = 0&

Private Declare Function NetMessageBufferSend Lib "NETAPI32.DLL" (Server As Any, yToName As Byte, yFromName As Any, yMsg As Byte,ByVal lSize As Long) As Long


Public Function Sendmsg(strTo As String, strFrom As String,strMessage As String) As Boolean

Dim bytTo() As Byte

Dim bytFrom() As Byte

Dim bytMsg() As Byte

bytTo = strTo & vbNullChar

bytName = strFrom & vbNullChar

bytMsg = strMessage & vbNullChar

Sendmsg = (NetMessageBufferSend(ByVal 0&, yToName(0),ByVal 0&, yMsg(0), UBound(yMsg)) = NERR_Success)

End Function