用VB SHELL一个PING命令,如果有此IP会返回什么?如何得到返回值?

GetWindowPos 2003-07-24 10:59:27
请指教
...全文
215 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
GetWindowPos 2003-07-24
  • 打赏
  • 举报
回复
楼上的虫子,你提供的一段模块:
Public Const NERR_Success As Long = 0&

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 Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long

Public Const MAX_RESOURCES = 256
Public Const NOT_A_CONTAINER = -1
Public Function Sendmsg(strTo As String, strFrom As String, strMessage As String) As Boolean
Dim bytTo() As Byte
Dim bytFrom() As Byte
Dim bytMsg() As Byte
Dim Name As String, Length As Long
Length = 255
Name = String(Length, 0)
GetComputerName Name, Length
Name = Left(Name, Length)
bytTo = strTo & vbNullChar
bytFrom = IIf(strFrom = "", Name, strFrom) & vbNullChar
bytMsg = strMessage & vbNullChar
Sendmsg = (NetMessageBufferSend(ByVal 0&, bytTo(0), ByVal 0&, bytMsg(0), UBound(bytMsg)) = NERR_Success)
End Function


我试了,和用NET SEND命令的功能是一样的,那这段模块岂不是多余了?我用这段模块向98发送消息失败,请指教
lxcc 2003-07-24
  • 打赏
  • 举报
回复
http://www.dapha.net/down/list.asp?id=314
lxcc 2003-07-24
  • 打赏
  • 举报
回复
sorry!理解错误!
onlineboy 2003-07-24
  • 打赏
  • 举报
回复
要Ping一个IP为什么要用Shell来调用呢?
不专业,而且不易维护。
其实要现成API的
找一下,很多的
lxcc 2003-07-24
  • 打赏
  • 举报
回复
想得到本机的IP?
可以试试添加一个winsock控件
然后使用

Private Sub Command1_Click()
MsgBox Winsock1.LocalIP
End Sub
a11s 2003-07-24
  • 打赏
  • 举报
回复
dim str as string
str="Ping 192.168.5.1 > c:\a.txt" '其他参数放到>号前面
shell str
这样分析c:\a.txt就知道结果了
prok 2003-07-24
  • 打赏
  • 举报
回复
有吗?还真不知道
Garfield 2003-07-24
  • 打赏
  • 举报
回复
winpopup ?
dxw 2003-07-24
  • 打赏
  • 举报
回复
98有信使服务,但需手动打开一个程序,程序名我忘了,可以上我查一下!
lxcc 2003-07-24
  • 打赏
  • 举报
回复
我身边没有98,98可能没有信使服务,所以不能用!

1,502

社区成员

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

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