如果你有該永動(dòng)機(jī)的登陸用戶名和密碼.那簡單了.
創(chuàng)新互聯(lián)建站是一家專注于成都網(wǎng)站建設(shè)、成都網(wǎng)站設(shè)計(jì)與策劃設(shè)計(jì),博興網(wǎng)站建設(shè)哪家好?創(chuàng)新互聯(lián)建站做網(wǎng)站,專注于網(wǎng)站建設(shè)10年,網(wǎng)設(shè)計(jì)領(lǐng)域的專業(yè)建站公司;建站業(yè)務(wù)涵蓋:博興等地區(qū)。博興做網(wǎng)站價(jià)格咨詢:13518219792
Shell("c:\windows\system32\cmd.exe /c net use \\192.168.0.199 """"" " /user:" """guest""")
里面冒號(hào)太多了.你可以通過CHR去轉(zhuǎn)換里面中的一些冒號(hào).
這句話可以不要人為去輸入用戶名和密碼.
另外如果你可以使用
My.Computer.Network.DownloadFile()
函數(shù)去進(jìn)行文件下載.這個(gè)比較方便 .
你這段代碼可以獲得該主機(jī)名下的所有ip,每個(gè)ip地址都是有類型簇的,可以區(qū)別本地地址和網(wǎng)絡(luò)地址、ip6地址。
你獲取索引為0的ip,不一定是正確的網(wǎng)絡(luò)地址,它有時(shí)順序在中間,在后面。
應(yīng)該獲取所有ip,再通過ip地址簇類型區(qū)分
判斷連接本身有一個(gè)函數(shù),不過有時(shí)沒聯(lián)網(wǎng)也是真。
可以用ping,ping百度、ping訪問速度快、不經(jīng)常維護(hù)斷線的網(wǎng)絡(luò)主機(jī)。
模塊
Public Function CheckComm()
On Error Resume Next
Set wshshell = CreateObject("wscript.shell")
wshshell.run ("%comspec% /c net start winmgmt"), 0
'用一個(gè)文本來記錄硬件信息
'Set WshNetwork = CreateObject("WScript.Network")
'ComputerName = WshNetwork.ComputerName
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" strComputer "\root\cimv2")
'主板
Set board = objWMIService.ExecQuery("select * from win32_baseboard")
For Each item In board
board2 = "主板:" item.Product
Next
'CPU
Set cpu = objWMIService.ExecQuery("select * from win32_processor")
For Each item In cpu
cpu2 = "cpu:" item.Name
Next
'內(nèi)存
Set colItems = objWMIService.ExecQuery("Select * from Win32_PhysicalMemory", , 48)
Dim memory1
For Each objItem In colItems
a = objItem.capacity / 1048576
temp = temp + Val(objItem.capacity)
If InStr(memory1, "1條" a "M") 0 Then
memory1 = Replace(memory1, "1條" a "M", "2條" a "M")
ElseIf InStr(memory1, "2條" a "M") 0 Then
memory1 = Replace(memory1, "2條" a "M", "3條" a "M")
ElseIf InStr(memory1, "3條" a "M") 0 Then
memory1 = Replace(memory1, "3條" a "M", "4條" a "M")
Else
memory1 = memory1 "1條" a "M"
End If
n = n + 1
Next
memory = temp / 1048576
If n = 1 Then
memory2 = "內(nèi)存條:" memory1
Else
memory2 = "內(nèi)存條:" memory1 " 總計(jì)" memory "M"
End If
'硬盤
Set disk = objWMIService.ExecQuery("select * from win32_diskdrive")
For Each item In disk
disk2 = "硬盤:" item.Model
Next
'顯卡
Set video = objWMIService.ExecQuery("select * from win32_videocontroller", , 48)
For Each item In video
video2 = "顯卡:" item.Description
Next
'網(wǎng)卡
Set colItems = objWMIService.ExecQuery("Select * from Win32_NetworkAdapter", , 48)
For Each objItem In colItems
If (Left(objItem.NetConnectionID, 4) = "本地連接") Then
lanname = "網(wǎng)卡:" objItem.Name
End If
Next
lan2 = lanname
Dim thecomputer(6)
thecomputer(0) = board2
thecomputer(1) = cpu2
thecomputer(2) = memory2
thecomputer(3) = disk2
thecomputer(4) = video2
thecomputer(5) = lan2
CheckComm = thecomputer
End Function
代碼
Private Sub Form_Load()
List4.Clear
List4.AddItem "Computer Info" ' vbCrLf
List4.AddItem "***********************" ' vbCrLf
Dim I As Integer, c
c = CheckComm
For I = 0 To 5
List4.AddItem c(I)
Next
Dim s, System, item, d() As String
Set System = GetObject("winmgmts:").InstancesOf("Win32_ComputerSystem")
For Each item In System 'List1.AddItem item.cputype
's = "Computer Info" vbCrLf
's = s "***********************" vbCrLf
s = s "計(jì)算機(jī)名稱: " item.Name vbCrLf
s = s "狀態(tài): " item.Status vbCrLf
s = s "類型: " item.SystemType vbCrLf
s = s "生產(chǎn)廠家: " item.Manufacturer vbCrLf
s = s "型號(hào): " item.Model vbCrLf
s = s "內(nèi)存: ~" item.totalPhysicalMemory \ 1024000 "mb" vbCrLf
s = s "域: " item.domain vbCrLf
's = s "工作組" item.Workgroup vbCrLf '獲得工作組和域的選項(xiàng)不能同時(shí)用
s = s "當(dāng)前用戶: " item.UserName vbCrLf
s = s "啟動(dòng)狀態(tài)" item.BootupState vbCrLf
s = s "該計(jì)算機(jī)屬于" item.PrimaryOwnerName vbCrLf
s = s "系統(tǒng)類型" item.CreationClassName vbCrLf
s = s "計(jì)算機(jī)類類型" item.Description vbCrLf
On Error GoTo 1
For I = 0 To 1 '這里假設(shè)安裝了兩個(gè)系統(tǒng)
s = s Chr(5) "啟動(dòng)選項(xiàng)" I " :" item.SystemStartupOptions(I) _
vbCrLf
Next I
1:
Next
d = Split(s, vbCrLf)
For I = 0 To UBound(d)
List4.AddItem d(I)
Next
End Sub
要求一個(gè)list4
Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Private Sub GetName()
Dim sJM As String
Dim sMC As String
Dim sIP As String
Dim s As String
s = String(128, Chr(0))
GetComputerName s, Len(s)
s = UCase(Left(s, InStr(1, s, Chr(0)) - 1))
sJM = s'計(jì)算機(jī)名稱
s = String(128, Chr(0))
GetUserName s, Len(s)
s = UCase(Left(s, InStr(1, s, Chr(0)) - 1))
sMC = s‘當(dāng)前用戶名稱
End Sub
'用這種方法在遠(yuǎn)程獲得再發(fā)回本機(jī)就可以吧
'取計(jì)算機(jī)型號(hào)暫時(shí)不會(huì)