Modules |
5.92 API Inviare messaggi tra risorse di rete con NetSend |
'====================================================================== ' CODICE DA COPIARE IN UN MODULO '====================================================================== Option Compare Database Option Explicit NetSend ( SHELL ) 'Inviare messaggi di tipo NetSend ad una risorsa locale (WinNT/2000/XP) Sub fNetSend() 'Comando WinXP : "Net Start Messenger" Dim strMsg As String Dim strTo As String strMsg = InputBox("Inserire il Messaggio da inviare : ", _ "Messaggio", "MSG_SENT ?") strTo = Environ$("computername") Shell "net send " & strTo & " " & strMsg, vbMinimizedFocus End Sub '------------------------------------------------------------------------------------------ NetSend ( API ) Syntaxe : Call fNetSend("Messaggio", "NOME_DESTINATARIO") Declare Function NetMessageBufferSend Lib "NETAPI32.DLL" _ (ByVal servername As Byte, msgname As Byte, _ ByVal fromname As Byte, buf As Byte, _ ByVal buflen As Long) As Long Function fNetSend(strMsg As String, _ strTo As String) Dim bMessage() As Byte Dim bDestination() As Byte bMessage = strMsg & vbNullChar bDestination = strTo & vbNullChar If NetMessageBufferSend(0&, bDestination(0), _ 0&, bMessage(0), _ UBound(bMessage)) <> 0 _ Then: msgbox "Fatto" End FunctionNota Il materiale di questa FAQ è stato gentilmente messo a disposizione del Sito Comune da Alessandro Baraldi. |