I really appreciate your reply and code, and will try to convert it to use with VB.Net
Thank you, Richar
----- Ayaz Ahmed wrote: ----
Hello
'API Declaration
Option Explici
Private Declare Function NetMessageBufferSend Lib "netapi32.dll"
(ByVal servername As String,
ByVal msgname As String,
ByVal fromname As String,
ByVal Buffer As String,
ByVal BufSize As Long) As Lon
Private Const NERR_SUCCESS As Long =
Private Const NERR_BASE As Long = 210
Private Const NERR_NetworkError As Long = (NERR_BASE + 36
Private Const NERR_NameNotFound As Long = (NERR_BASE + 173
Private Const NERR_UseNotFound As Long = (NERR_BASE + 150
Private Const ERROR_ACCESS_DENIED As Long =
Private Const ERROR_BAD_NETPATH As Long = 5
Private Const ERROR_NOT_SUPPORTED As Long = 5
Private Const ERROR_INVALID_PARAMETER As Long = 8
Private Const ERROR_INVALID_NAME As Long = 12
Public Function NetSendMessage(ByVal sSendTo As String, ByVal sMessag
As String) As Lon
Dim ret As Lon
sSendTo = StrConv(sSendTo, vbUnicode
sMessage = StrConv(sMessage, vbUnicode
NetSendMessage = NetMessageBufferSend(vbNullString, sSendTo
vbNullString,
sMessage, Len(sMessage)
End Functio
Public Function NetSendErrorMessage(ErrNum As Long) As Strin
Select Case ErrNu
Case NERR_SUCCES
'NetSendErrorMessage = "The message was successfully sent
Case NERR_NameNotFoun
NetSendErrorMessage = "Send To not found
Case NERR_NetworkErro
NetSendErrorMessage = "General network error occurred
Case NERR_UseNotFoun
NetSendErrorMessage = "Network connection not found
Case ERROR_ACCESS_DENIE
NetSendErrorMessage = "Access to computer denied
Case ERROR_BAD_NETPAT
NetSendErrorMessage = "Sent From server name not found.
Case ERROR_INVALID_PARAMETE
NetSendErrorMessage = "Invalid parameter(s) specified.
Case ERROR_NOT_SUPPORTE
NetSendErrorMessage = "Network request not supported.
Case ERROR_INVALID_NAM
NetSendErrorMessage = "Illegal character or malformed name.
Case Els
NetSendErrorMessage = "Unknown error executing command.
End Selec
End Functio
Private Sub Command2_Click(
Dim ret As Lon
If Text1.Text = "" The
MsgBox "Please Specify Computer Name", vbCritical, "Alert
Text1.SetFocu
Exit Su
End I
If Text2.Text = "" The
MsgBox "Please Specify Sending Message", vbCritical, "Alert
Text2.SetFocu
Exit Su
End I
ret = NetSendMessage(Text1.Text, Text2.Text
If ret <> 0 The
MsgBox NetSendErrorMessage(ret), vbCritical, "Error
Els
' MsgBox NetSendErrorMessage(ret), vbInformation, "NetSend
MsgBox "Message Succesfully Send", vbInformation, "NetSend
End I
End Su
Thanks
Warm Regards
Ayaz Ahmed
Software Engineer & Web Develope
Creative Chaos (Pvt.) Ltd
"Managing Your Digital Risk
http://www.csquareonline.co
Karachi, Pakista
Mobile +92 300 2280950
Office +92 21 455 241
*** Sent via Developersdex
http://www.developersdex.com **
Don't just participate in USENET...get rewarded for it