Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Sorry found the solution on a different part of the site. Here it is in case your wondering yoursleves

 

Here's a basic class to send using the API:

 

VB:

--------------------------------------------------------------------------------

Imports System.Runtime.InteropServices

 

Public Class NetSend

'Note the use of the Unicode keyword:

Declare Unicode Function NetMessageBufferSend Lib "NETAPI32.dll" ( _

ByVal servername As String, _

ByVal msgname As String, _

ByVal fromname As String, _

ByVal buf As String, _

ByVal buflen As Int32) As Int32

 

Public Shared Sub Send(ByVal destination As String, ByVal message As String)

NetMessageBufferSend(Nothing, _

destination, _

Nothing, _

message, _

message.Length * 2) 'times 2 because every one character = 2 bytes in unicode

End Sub

End Class

 

--------------------------------------------------------------------------------

 

Just stick that in a class file and call it like

VB:

--------------------------------------------------------------------------------

NetSend.Send("127.0.0.1", "this is a message")

 

--------------------------------------------------------------------------------

 

 

 

__________________

~ Simon

"Gravity isn't just a law. It's a good idea!"

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...