Using something other than netsend
I am very new to VB6, and have developed a small program where by clicking a button it would execute a bat file which contained a netsend string to send a network message. However, do to changed network requirements, I need to change the functionality where it does not use netsend. Is there a way to code it where it utilizes Active Directory to send a message across the network and only be contained within a certain area of a domain? Any help or pointers in the right direction would be appreciated.
Re: Using something other than netsend
Welcome to the forums. :)
Experience with this to see how it works for you.
VB Code:
Option Explicit
Private Declare Function NetMessageBufferSend Lib "NETAPI32.DLL" (yServer As Any, yToName As Byte, yFromName As Byte, yMsg As Byte, ByVal lSize As Long) As Long
Private Const NERR_Success As Long = 0&
Public Function SendMessage(ByVal pstrToUser As String, ByVal pstrMessage As String) As Boolean
Dim bytToName() As Byte
Dim bytFromName() As Byte
Dim bytMsg() As Byte
bytToName = pstrToUser & vbNullChar
bytMsg = pstrMessage & vbNullChar
If NetMessageBufferSend(ByVal 0&, bytToName(0), ByVal 0&, bytMsg(0), UBound(bytMsg)) = NERR_Success Then
SendMessage = True
End If
End Function
Private Sub Command1_Click()
'Where 'JoJo' and 'Mimi' are valid network accounts
SendMessage "JoJo","You are a spoon"
SendMessage "Mimi","Get a job"
End Sub
Re: Using something other than netsend
Thanks Hack,
I will give it a try....