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  
|