shell "ipconfig /all >c:\ipconfig.txt",vbHide
'然后读文件c:\ipconfig.txt的内容
'然后读文件c:\ipconfig.txt的内容
解决方案 »
- 求一款 VB + SQL Server 做的小软件
- 今天,你光棍了没?
- 我在另一个窗体中调用主窗体中frmMain.mscomm1.PortOpen为什么老要执行frmMain_load?
- 没办办法判断一张BMP是不是空的,即整张图,全部都是白色,基本没有其它色。
- 在VB中,有现成的用于预测的BP神经网络函数吗?
- 为什么换了台机器连CurDir,Time,Date都不能用了?
- 如何使用Chart控件????????在线等候....急!急!!急!!!!!!!
- 怎么在在窗体上实现三维文字?
- vb里面生成一个excel对象。高手指点!
- vb做的日文软件要转化成中文软件出现乱码问题,有没有办法解决阿
- 求助:不规范数据的查找引用
- 求VB获取网页内容代码
'取本机MAC地址
Private Function GetRemoteMACAddress(ByVal sRemoteIP As String, sRemoteMacAddress As String) As Boolean
Dim dwRemoteIP As Long
Dim pMacAddr As Long
Dim bpMacAddr() As Byte
Dim PhyAddrLen As Long
Dim cnt As Long
Dim tmp As String
dwRemoteIP = inet_addr(sRemoteIP)
If dwRemoteIP <> 0 Then
PhyAddrLen = 6
If SendARP(dwRemoteIP, 0&, pMacAddr, PhyAddrLen) = NO_ERROR Then
If pMacAddr <> 0 And PhyAddrLen <> 0 Then
ReDim bpMacAddr(0 To PhyAddrLen - 1)
CopyMemory bpMacAddr(0), pMacAddr, ByVal PhyAddrLen
For cnt = 0 To PhyAddrLen - 1
If bpMacAddr(cnt) = 0 Then
tmp = tmp & "00-"
Else
tmp = tmp & Hex$(bpMacAddr(cnt)) & "-"
End If
Next
If Len(tmp) > 0 Then
sRemoteMacAddress = Left$(tmp, Len(tmp) - 1)
GetRemoteMACAddress = True
End If
Exit Function
Else
GetRemoteMACAddress = False
End If
Else
GetRemoteMACAddress = False
End If
Else
GetRemoteMACAddress = False
End If
End Function用法:
Dim sRemoteMacAddress As String
Call GetRemoteMACAddress(Winsock1.LocalIP, sRemoteMacAddress)
获取IP:MsgBox "本机IP:" & Winsock1.LocalIP
获取计算机名:Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Private Sub Command2_Click()
Dim PcNm As String * 255
If GetComputerName(PcNm, 255&) <> 0 Then
Print PcNm
End If
End Sub
http://download.csdn.net/source/3057332
我在dos窗口下直接ipconfig /all >c:\ipconfig.txt能产生文件
为什么?
http://hi.baidu.com/cbm666/blog/item/668d09232507d34a93580755.html
ipconfig /all >c:\ipconfig.txt
然后
shell "c:\ipall.bat",vbHide
你用这个吧!
Shell "cmd /c ipconfig /all > " & Chr(34) & "c:\ip.txt " & Chr(34), vbHide
运行后可以在c盘根下生成一个ip.txt文件的!
vb6测试通过!
90-FB-A6-8-81-39 前面有0就不对了.