|
-
Dec 31st, 2002, 08:55 PM
#1
Thread Starter
Hyperactive Member
Question...
Here's a class that uses the NetSendMessageBuffer API, Now it seems to be physically working (I used this from a VB6 App I made a while back) but the problem I'm running into is, the Return value on the API is never 0 (No Errors), It's always some 10-12 digit return value. This will make it hard to track wether or not the message was successfull or not, anyone have any Ideas?
Imports System.Threading
Public Class clsNetSend
'Net Send API
Private Declare Unicode Function NetMessageBufferSend Lib "NETAPI32.DLL" _
(ByVal yServer As String, ByVal yToName As String, ByVal yFromName As String, _
ByVal yMsg As String, ByVal lSize As Long) As Long
'Send Values
Private strToName As String
Private strFromName As String
Private strMsg As String
Public Event UpdateStatus(ByVal InStr As String)
'Send the message
Public Sub SendTheMessage()
Dim X As Long
'Set up the values
strToName = "127.0.0.1"
strFromName = "Your Computer"
strMsg = "This is a test..."
X = NetMessageBufferSend(vbNullString, strToName, strFromName, strMsg, strMsg.Length * 2)
RaiseEvent UpdateStatus("Error: " & X.ToString)
End Sub
End Class
'In a form
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim T As New Thread(AddressOf X.SendTheMessage)
T.Start()
End Sub
Private Sub X_UpdateStatus(ByVal strMsg As String) Handles X.UpdateStatus
Me.Label1.Text = strMsg
End Sub
Here Is The Link to download the little example I made if you want to try and help me figure out why It's not returning a NoN-Error code when it seems to be working fine?
Last edited by Hinder; Dec 31st, 2002 at 09:15 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|