怎样编程实现windows 的 net send 10.0.0.1 "asfasdf" 功能??

KitSdk 2002-04-04 01:10:04
怎样编程实现windows 的 net send 10.0.0.1 "asfasdf" 功能??
不用装客户端 让局网上的机器接受信息,并提示有信息?????
...全文
247 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
KitSdk 2002-05-15
  • 打赏
  • 举报
回复
是啊98下怎么接受 信史服务 ????
easypower 2002-04-04
  • 打赏
  • 举报
回复
net send 98不能用呀
我想作者的愿意是用nt的东西编程在98等系统下用吧
NowCan 2002-04-04
  • 打赏
  • 举报
回复
http://go5.163.com/nowcan/tech_vb_network.htm
turbochen 2002-04-04
  • 打赏
  • 举报
回复
send都没问题,关键是实现NETBIOS Session Service来招收,而不用windows自己的那个.我想这才是作者的原意.
shawls 2002-04-04
  • 打赏
  • 举报
回复


楼上的办法真简单!

y1g1y1 2002-04-04
  • 打赏
  • 举报
回复

shell "cmd /c net send ygy fdsafds"
thorkhan 2002-04-04
  • 打赏
  • 举报
回复
這是我在www.planetsourcecode.com上找的一個類模塊﹐不敢獨享﹐﹐
Option Explicit
Private Const ERROR_ACCESS_DENIED = 5&
Private Const ERROR_BAD_NETPATH = 53&
Private Const ERROR_INVALID_PARAMETER = 87&
Private Const ERROR_NOT_SUPPORTED = 50&
Private Const ERROR_INVALID_NAME = 123&
Private Const NERR_Success = 0& ' Success
Private Const NERR_NameNotFound = 2273& ' The message alias could not be found on the network.
Private Const NERR_NetworkError = 2136& ' A general network error occurred.

Private 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) As Integer
Private Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" (lpVersionInformation As OSVERSIONINFO) As Long

Private Const VER_PLATFORM_WIN32_NT = 2

Private Type OSVERSIONINFO
dwOSVersionInfoSize As Long
dwMajorVersion As Long
dwMinorVersion As Long
dwBuildNumber As Long
dwPlatformId As Long
szCSDVersion As String * 128 ' Maintenance string for PSS usage
End Type





' Events
Public Event Error(ByVal lError As Long, ByVal ErrorText As String)
Public Event Sent()

' Local copies of properties
Private m_sMsgTo As String
Private m_sMsg As String
Private m_sMsgFrom As String
Private m_lNetApiStatus As Long
Private m_sErrorText As String
Private m_bIsWinNT As Boolean

'-----------------------------------------------------------
' FUNCTION: IsWindowsNT
'
' Returns true if this program is running under Windows NT
'-----------------------------------------------------------'
Function IsWindowsNT() As Boolean

Dim lRC As Long
Dim typOSInfo As OSVERSIONINFO

typOSInfo.dwOSVersionInfoSize = Len(typOSInfo)
lRC = GetVersionEx(typOSInfo)
IsWindowsNT = (typOSInfo.dwPlatformId = VER_PLATFORM_WIN32_NT)
End Function

Public Sub ClearError()
' Set Error Properties
m_lNetApiStatus = 0
m_sErrorText = ""
End Sub

Public Property Get ErrorText() As String
'Set ErrorText
ErrorText = m_sErrorText
End Property

Public Property Get Err() As Long
' Set Error Number
Err = m_lNetApiStatus
End Property

Private Function SetErrorText(Error As Long) As String
Select Case Error
Case ERROR_ACCESS_DENIED: SetErrorText = "Access Denied!"
Case ERROR_BAD_NETPATH: SetErrorText = "Server '" & UCase$(m_sMsgFrom) & "' not Found."
Case ERROR_INVALID_PARAMETER: SetErrorText = "Invalid parameter specified."
Case ERROR_NOT_SUPPORTED: SetErrorText = "Network request not supported."
Case ERROR_INVALID_NAME: SetErrorText = "Illegal character or malformed name."
Case NERR_Success: SetErrorText = "Message sent."
Case NERR_NameNotFound: SetErrorText = "User/Workstation '" & m_sMsgTo & "' not found."
Case NERR_NetworkError: SetErrorText = "General network error occurred."
Case Else: SetErrorText = "Unknown error executing command."
End Select
End Function

Private Sub SetLastErr(ByVal lError As Long)
m_lNetApiStatus = lError
m_sErrorText = SetErrorText(lError)
If m_lNetApiStatus Then RaiseEvent Error(m_lNetApiStatus, m_sErrorText)
End Sub

Public Function NetSendMessage(Optional ByVal sUser As String = "", Optional ByVal sMsg As String = "") As Boolean

Dim sBuf
Dim sMsgFrom As String
Dim sMsgName As String
Dim Net_Api_Status As Long

If Not m_bIsWinNT Then Exit Function

If Len(sUser) Then m_sMsgTo = sUser ' Else use the SendTo Property


If m_sMsgTo = "" Then
NetSendMessage = False
SetLastErr ERROR_INVALID_PARAMETER
RaiseEvent Error(ERROR_INVALID_PARAMETER, m_sErrorText)
Else
Screen.MousePointer = vbHourglass

If Len(sMsg) Then m_sMsg = sMsg

sBuf = StrConv(m_sMsg, vbUnicode)
sMsgName = StrConv(m_sMsgTo, vbUnicode)

If Len(m_sMsgFrom) And sUser = "" Then
sMsgFrom = StrConv(m_sMsgFrom, vbUnicode)
Else
sMsgFrom = vbNullString
End If
Net_Api_Status = netSend(sMsgFrom, sMsgName, vbNullString, sBuf, ByVal Len(sBuf))
SetLastErr Net_Api_Status
NetSendMessage = Not CBool(Net_Api_Status)
If NetSendMessage Then RaiseEvent Sent
Screen.MousePointer = vbNormal
End If

End Function

Public Property Let Message(ByVal vData As String)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.sMessage = 5
m_sMsg = vData
End Property


Public Property Get Message() As String
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.sMessage
Message = m_sMsg
End Property


Public Property Let SendTo(ByVal vData As String)
m_sMsgTo = vData
End Property
Public Property Get SendTo() As String
SendTo = m_sMsgTo
End Property

Public Property Let SendFromServer(ByVal vData As String)
'used when assigning a value to the property, on the left side of an assignment.
m_sMsgFrom = vData
End Property


Public Property Get SendFromServer() As String
'used when retrieving value of a property, on the right side of an assignment.
SendFromServer = m_sMsgFrom
End Property



Private Sub Class_Initialize()
m_bIsWinNT = IsWindowsNT()
If m_bIsWinNT Then
m_lNetApiStatus = 0
Else
MsgBox "The NetSend class requires Windows NT.", vbCritical + vbOKOnly, "Net Send"
End If
End Sub


sonicdater 2002-04-04
  • 打赏
  • 举报
回复

Dim IPAddress As String
Dim strMsg As String
IPAddress = "192.168.1.45"
strMsg = "Message"

Shell "net send " & IPAddress & strMsg
turbochen 2002-04-04
  • 打赏
  • 举报
回复
建议你研究一下NETBIOS Session Service(使用139port)协议

7,763

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧