Sub ShowDriveInfo(drvpath)
Dim fs, d, s, t
Set fs = CreateObject("Scripting.FileSystemObject")
Set d = fs.GetDrive(fs.GetDriveName(fs.GetAbsolutePathName(drvpath)))
Select Case d.DriveType
Case 0: t = "Unknown"
Case 1: t = "Removable"
Case 2: t = "Fixed"
Case 3: t = "Network"
Case 4: t = "CD-ROM"
Case 5: t = "RAM Disk"
End Select
s = "Drive " & d.DriveLetter & ": - " & t
s = s & vbCrLf & "SN: " & d.SerialNumber
MsgBox s
End Sub
作者: ADAM 时间: 2003-11-5 01:30
是這樣的...
如下:
Private Declare Function HDSerialNumRead Lib "HDSerialNumRead.dll" () As String
Public Function GetHDSerialNum() As String
'先取消這句
'On Error GoTo err_hd
Dim S As String
S = Trim(HDSerialNumRead())
GetHDSerialNum = Left(S, Len(S) - 1)
Option Compare Database
Public Type OPENFILENAME
lStructSize As Long
hwndOwner As Long
hInstance As Long
lpstrFilter As String
lpstrCustomFilter As String
nMaxCustFilter As Long
nFilterIndex As Long
lpstrFile As String
nMaxFile As Long
lpstrFileTitle As String
nMaxFileTitle As Long
lpstrInitialDir As String
lpstrTitle As String
flags As Long
nFileOffset As Integer
nFileExtension As Integer
lpstrDefExt As String
lCustData As Long
lpfnHook As Long
lpTemplateName As String
End Type
Public Declare Function GetOpenFileName Lib "comdlg32.dll" Alias "GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long
Public Function FilePath() As String
Dim ofn As OPENFILENAME
ofn.lStructSize = Len(ofn)
ofn.hwndOwner = hwnd 'Me.hwnd
ofn.flags = 0
Dim a
a = GetOpenFileName(ofn)
If (a) Then
FilePath = Trim$(ofn.lpstrFile)
End If
End Function 作者: ADAM 时间: 2003-11-5 15:20
有是有用,
不過就是這個東西把我害慘了.....
那個慘啊,,,切齒痛恨...........
上次我發的貼子,"Getopenfilename的用法",就是為這個東東
你要注意了,上面那段代碼返回的文件名會多一個空格一樣的東西....,用trim去不掉
所以要加多一句..
If (a) Then
FilePath = Trim$(ofn.lpstrFile)
filepath=left(filepath,len(filepath)-1))
End If 作者: ADAM 时间: 2003-11-5 15:25
.....
怎么沒人回答我的貼子呢....,
老是這樣,太不公平了
.........
搞得每次提出問題總是不能結案....