NetMessageBufferSend 在vb.net中如何调用?
这是函数声明
Private Declare Function NetMessageBufferSend Lib _
"NETAPI32.DLL" (yServer As Any, yToName As Byte, _
yFromName As Any, yMsg As Byte, ByVal lSize As Long) As Long
成功后会返回0
以下是VB6中的函数使用方法
Private Declare Function NetMessageBufferSend Lib _
"NETAPI32.DLL" (yServer As Any, yToName As Byte, _
yFromName As Any,yMsg As Byte,ByVal lSize As Long) As Long
Private Const NERR_Success As Long = 0&
Public Function SendMessage(RcptToUser As String, _
FromUser As String, BodyMessage As String) As Boolean
Dim RcptTo() As Byte
Dim From() As Byte
Dim Body() As Byte
RcptTo = RcptToUser & vbNullChar
From = FromUser & vbNullChar
Body = BodyMessage & vbNullChar
If NetMessageBufferSend(ByVal 0&, RcptTo(0), ByVal 0&, _
Body(0), UBound(Body)) = NERR_Success Then
SendMessage = True
End If
End Function
Private Sub Form_Load()
Dim RetVal As Boolean
RetVal = SendMessage("机器名", "FromUser", "BodyText")
End Sub
在VB.NET中该如何写呢?