AutoCAD 3DMAX C语言 Pro/E UG JAVA编程 PHP编程 Maya动画 Matlab应用 Android
Photoshop Word Excel flash VB编程 VC编程 Coreldraw SolidWorks A Designer Unity3D
 首页 > VB编程

在WindowsNT网络中广播消息

51自学网 http://www.wanshiok.com
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

 

 

 
上一篇:在程序中打开 Internet 拨号连接窗口  下一篇:在VB中用Outlook发电子邮件