在线求问 vb中怎样使用windows信使服务(net send)

13520089720tianyu 2004-07-19 10:52:52
vb中怎样使用windows信使服务(net send) 在局域网中可以随时侦测接线的机器
...全文
129 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
13520089720tianyu 2004-07-19
  • 打赏
  • 举报
回复
太感谢以上的兄弟们了
我马上试试
然后揭帖
online 2004-07-19
  • 打赏
  • 举报
回复
试试

Private Declare Function NetMessageBufferSend Lib "NETAPI32.DLL" _
(Server As Any, _
yToName As Byte, _
yFromName As Any, _
yMsg As Byte, _
ByVal lSize As Long) _
As Long

Private Sub Command1_Click()
Dim X As Boolean
X = SendMsg(TxtTo.Text, TxtFrom.Text, TxtMsg.Text)
If X Then
MsgBox "消息已被成功发送", vbInformation, "发送消息"
Else
MsgBox "发送消息失败", vbCritical, "发送消息"
End If
End Sub

Private Function SendMsg(sToUser As String, _
sFromUser As String, _
sMessage As String) _
As Boolean

Dim yToName() As Byte
Dim yFromName() As Byte
Dim yMsg() As Byte
Dim l As Long

yToName = sToUser & vbNullChar
yFromName = sFromUser & vbNullChar
yMsg = sMessage & vbNullChar

If NetMessageBufferSend(ByVal 0&, yToName(0), _
ByVal 0&, yMsg(0), UBound(yMsg)) = NERR_Success Then
SendMsg = True
End If
End Function

Private Sub Command2_Click()
End
End Sub
dljinsui 2004-07-19
  • 打赏
  • 举报
回复
1、加API:
Public Declare Function NetMessageBufferSend Lib _
"NETAPI32.DLL" _
(Server As Any, _
yToName As Byte, _
yFromName As Any, _
yMsg As Byte, _
ByVal lSize As Long) As Long

'创建信使服务

Public Function SendMsg(sToUser As String, sFromUser As String, sMessage As String) As Boolean


2、调用以下方法

'-------------------------------------------
'
' 函数名 发消息(信使)
'
'传入参数
'sToUser: 被发送对象机器名或IP
'sFromUser: 发送者机器名或IP
'sMessage: 消息内容
'
'返回值
'SendMsg: 布尔值 T:成功、F:失败

'2004/02/05
'--------------------------------------------
Dim yToName() As Byte
Dim yFromName() As Byte
Dim yMsg() As Byte
Dim l As Long

yToName = sToUser & vbNullChar
yFromName = sFromUser & vbNullChar
yMsg = sMessage & vbNullChar

If NetMessageBufferSend(ByVal 0&, yToName(0), _
ByVal 0&, yMsg(0), _
UBound(yMsg)) = NERR_Success Then
SendMsg = True
End If
End Function


3、加分!!!!!!!!
rainstormmaster 2004-07-19
  • 打赏
  • 举报
回复
http://community.csdn.net/Expert/topic/2691/2691806.xml?temp=.8880884
flyingZFX 2004-07-19
  • 打赏
  • 举报
回复
把你想要执行的命令全部都写到Bat批处理文件中,

再用 shell 去执行这个Bat文件就可以了,
jinesc 2004-07-19
  • 打赏
  • 举报
回复
shell + ping

7,763

社区成员

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

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