1.很累的作法:
t = UCase(Trim$(Command$))
oNum = Mid(t, 1, InStr(t, ",") - 1)
oText = Mid(t, InStr(t, ",") + 1, Len(t))
2.比較簡單的作法:
cmdStr = UCase(Trim$(Command$))
Dim str() As String
str = Split(cmdStr, ",")
oNum = str(0)
oText = str(1)
2011年7月13日 星期三
2011年6月30日 星期四
[轉貼] VB6.0 如何知道遠端電腦的剩餘磁碟空間
來源:http://www.programmer-club.com.tw/ShowSameTitleN/vb/32456.html
Private Declare Function GetDiskFreeSpace Lib "kernel32" _
Alias "GetDiskFreeSpaceA" (ByVal lpRootPathName As String, _
lpSectorsPerCluster As Long, lpBytesPerSector As Long, _
lpNumberOfFreeClusters As Long, lpTtoalNumberOfClusters As Long) As Long
Public Function GetFreeHDSpace(ByVal Path As String) As Variant
Dim Status As Long
Dim dbV As Double
Dim SecPerClust As Long
Dim BytePerSec As Long, FreeClust As Long, totClust As Long
Status = GetDiskFreeSpace(Path, SecPerClust, BytePerSec, FreeClust, totClust)
dbV = SecPerClust * BytePerSec
dbV = dbV * FreeClust
GetFreeHDSpace= dbV
End Function
Private Sub Command1_Click()
MsgBox GetFreeSpace("\\x.x.x.x\c$")
End Sub
Private Declare Function GetDiskFreeSpace Lib "kernel32" _
Alias "GetDiskFreeSpaceA" (ByVal lpRootPathName As String, _
lpSectorsPerCluster As Long, lpBytesPerSector As Long, _
lpNumberOfFreeClusters As Long, lpTtoalNumberOfClusters As Long) As Long
Public Function GetFreeHDSpace(ByVal Path As String) As Variant
Dim Status As Long
Dim dbV As Double
Dim SecPerClust As Long
Dim BytePerSec As Long, FreeClust As Long, totClust As Long
Status = GetDiskFreeSpace(Path, SecPerClust, BytePerSec, FreeClust, totClust)
dbV = SecPerClust * BytePerSec
dbV = dbV * FreeClust
GetFreeHDSpace= dbV
End Function
Private Sub Command1_Click()
MsgBox GetFreeSpace("\\x.x.x.x\c$")
End Sub
訂閱:
文章 (Atom)