我现在想做个在局域网中通过win2000 server发消息的程序!发出的消息必须是弹出的!
请高手们给个idea吧!
谢谢!
在线等!

解决方案 »

  1.   

    看这个例子: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
    Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
    Private Const NERR_Success As Long = 0&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
        Dim Name As String, Length As Long
        
        Length = 255
        Name = String(Length, 0)
        GetComputerName Name, Length
        Name = Left(Name, Length)
        
        bytTo = strTo & vbNullChar
        bytFrom = VBA.IIf(strFrom = "", Name, strFrom) & vbNullChar
        bytMsg = strMessage & vbNullChar
        Sendmsg = (NetMessageBufferSend(ByVal 0&, bytTo(0), bytFrom(0), bytMsg(0), UBound(bytMsg)) = NERR_Success)
        
    End Function