NetMessageBufferSend & Net_API_Status
Posted on 1997-05-09
I'm trying to figure out how to do a LAN Manager type "net send" using the NetMessageBufferSend API in vb4. I'm missing something (code below).
1. What's the right declare? I can't find a declare for this function in the api text files.
2. The function returns a value "Net_API_Status", a dword, but I can't find any documentation that tells me what the return values mean. In the code below, NetMessageBufferSend is returning 123.
Can anybody smarter than me help?
Here's the code:
Declare Function NetSend Lib "netapi32" Alias "NetMessageBufferSend" _
(ByVal cServerName As String, _
ByVal cMsgName As String, _
ByVal cFromName As String, _
ByVal cBuf As String, _
ByRef iBufLen As Integer) _
Dim Net_API_Status As Integer
Dim cBuf As String * 255
Dim cNull As String * 1
Dim cMsgName As String
cNull = ""
cBuf = "Hello, world!"
cMsgName = StrConv("gmccull", vbUnicode)
Net_API_Status = NetSend(cNull, cMsgName, cNull, cBuf, 255)
And, to save you the trouble of looking it up, here's some documentation from MSDN:
NetMessageBufferSend sends a buffer of information to a registered message alias.
No special group membership is required to execute NetMessage buffer send locally. Admin, accounts, print, or server operator group membership is required to successfully execute NetMessageBufferSend on a remote server.
A pointer to a Unicode string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local computer.
A pointer to a Unicode string containing the message name to which the message buffer should be sent.
A pointer to a Unicode string containing the message name sending the information. fromname is a new parameter for Windows networking. This parameter is needed for sending alerts from the computer name rather than the logged on user. If a NULL is specified the message is send from the logged on user as with LAN Manager 2.x.
A pointer to a buffer of message text.
The length in bytes of the message text in buf.