类别 项目 描述
属性 ScrollBarSize 返回滚动条宽度的系统量度,以缇为单位。
WorkAreaHeight 返回可见桌面的高度,这是为 Windows 95 和 Windows NT 4.0 任务条作了调整之后的值。
WorkAreaLeft 返回可见桌面左边界的坐标,这是为 Windows 95 和 Windows NT 4.0 任务条作了调整之后的值。
WorkAreaTop 返回可见桌面上边界的坐标,这是为 Windows 95 和 Windows NT 4.0 任务条作了调整之后的值。
WorkAreaWidth 返回可见桌面宽度,这是为 Windows 95 和 Windows NT 4.0 任务条作了调整之后的值。
事件 DisplayChanged 在系统屏幕分辨率发生变化时产生该事件。
SysColorsChanged 当应用程序或控制面板改变了系统颜色设置时产生该事件。
当屏幕的分辨率发生改变时,将触发 DisplayChanged 事件。在 DisplayChanged 事件中使用 WorkAreaHeight、WorkAreaWidth、WorkAreaRight 和 WorkAreaLeft 属性即可确定当前的系统大小(可用的屏幕区域),并进行相应的调整。如果在 Windows 95 或 Windows NT 4.0 中任务条是可见的,则它不被算在可用的屏幕区域之内。
如果用户通过 Windows 95 或 Windows NT 4.0 的控制面板中的“显示”设置改变了滚动条的大小,则有可能需要更新显示区域以正确地放置滚动条。可以在 DisplayChanged 事件中使用 ScrollBarSize 属性进行调整。
Public Declare Function GetLogicalDriveStrings Lib "kernel32" _
Alias "GetLogicalDriveStringsA" _
(ByVal nBufferLength As Long, _
ByVal lpBuffer As String) As Long
Public Declare Function GetDriveType Lib "kernel32" _
Alias "GetDriveTypeA" _
(ByVal nDrive As String) As Long
Public Const DRIVE_REMOVABLE = 2
Public Const DRIVE_FIXED = 3
Public Const DRIVE_REMOTE = 4
Public Const DRIVE_CDROM = 5
Public Const DRIVE_RAMDISK = 6
===========================================================
Dim r As Long
Dim allDrives As String
Dim currDrive As String
Dim drvType As String
'get the list of all available drives
allDrives = GetDriveString()
'separate the drive strings and retrieve the drive type
Do Until allDrives = Chr$(0)
'strip off one drive from the string allDrives
currDrive = StripNulls(allDrives)
'get the drive type
drvType = rgbDrvType(currDrive)
Print " " & currDrive & vbTab & drvType
Loop
End Sub
Private Function rgbDrvType(RootPathName) As String
'Passed is the drive to check.
'Returned is the type of drive.
Select Case GetDriveType(RootPathName)
Case 0: rgbDrvType = "The drive type cannot be determined"
Case 1: rgbDrvType = "The root directory does not exist"
Case DRIVE_REMOVABLE:
Select Case Left$(RootPathName, 1)
Case "a", "b": rgbDrvType = "Floppy drive"
Case Else: rgbDrvType = "Removable drive"
End Select
Case DRIVE_FIXED: rgbDrvType = "Hard drive; can not be removed"
Case DRIVE_REMOTE: rgbDrvType = "Remote (network) drive"
Case DRIVE_CDROM: rgbDrvType = "CD-ROM drive"
Case DRIVE_RAMDISK: rgbDrvType = "RAM disk"
End Select
End Function
Private Function GetDriveString() As String
'returns string of available
'drives each separated by a null
Dim sBuffer As String
'possible 26 drives, three characters each, plus trailing null
sBuffer = Space$(26 * 4)
If GetLogicalDriveStrings(Len(sBuffer), sBuffer) Then
'do not trim off trailing null!
GetDriveString = Trim$(sBuffer)
End If
End Function
Private Function StripNulls(startstr As String) As String
'Take a string separated by chr$(0)
'and split off 1 item, shortening the
'string so next item is ready for removal.
Dim pos As Long