Is it possible to use the following code to broadcast a message to the entire network instead of just one user?
VB Code:
  1. Private Declare Function NetMessageBufferSend Lib "NETAPI32.DLL" _
  2. (yServer As Any, yToName As Byte, yFromName As Any, yMsg As Byte, ByVal lSize As Long) As Long
  3. Private Const NERR_Success As Long = 0&
  4.  
  5. Public Function BroadcastMessage(UserOrMachine As String, _
  6. FromName As String, Message As String) As Boolean
  7.  
  8. Dim ToName() As Byte
  9. Dim FromName2() As Byte
  10. Dim MessageToSend() As Byte
  11.  
  12. ToName = UserOrMachine & vbNullChar
  13. FromName2 = FromName & vbNullChar
  14. MessageToSend = Message & vbNullChar
  15.  
  16. 'Broadcast message via API
  17. If NetMessageBufferSend(ByVal 0&, ToName(0), FromName2(0), _
  18. MessageToSend(0), UBound(MessageToSend)) = NERR_Success Then
  19.  
  20. BroadcastMessage = True
  21. End If
  22.  
  23. End Function
  24.  
  25. Private Sub Command1_Click()
  26. BroadcastMessage "DOMAIN", "ADMIN", "We are going to be doing some server maintainence, please save your work and log off as soon as possible. The Admin"
  27. End Sub

I've tried putting the Domain name in instead of user name, and it doesn't work, I've tried * cause that works with Net Send, but it doesn't work with the API. Does anyone know if it's possible? I thought about listing all logged in users, and looping through and sending to each one, but that would be a terrible strain on the server...

Thanks
-Joey
[/Highlight]