Resolution, volume label, serial number, partition table read

zhaozj2021-02-11  192

Option expedition

Private Declare Function GetVolumeInformation Lib "kernel32.dll" Alias ​​"GetVolumeInformationA" (ByVal lpRootPathName As String, ByVal lpVolumeNameBuffer As String, ByVal nVolumeNameSize As Integer, lpVolumeSerialNumber As Long, lpMaximumComponentLength As Long, lpFileSystemFlags As Long, ByVal lpFileSystemNameBuffer As String, ByVal nFileSystemNameSize As Long) As long

Const file_volume_is_compressed = & h8000

Function GetSerialNumber (strDrive As String) As LongDim SerialNum As LongDim Res As LongDim Temp1 As StringDim Temp2 As StringTemp1 = String $ (255, Chr $ (0)) Temp2 = String $ (255, Chr $ (0)) Res = GetVolumeInformation ( StrDrive, Temp1, Len (Temp1), Serialnum, 0, 0, Temp2, Len (Temp2)) MSGBOX TEMP1MSGBOX TEMP2MSGBOX HEX (Serialnum) GetSerialNumber = SerialNuMend Function

Public Sub GetVolInfo (ByVal path As String) Dim aa As LongDim VolName As StringDim fsysName As StringDim VolSeri As Long, compress As LongDim Sysflag As Long, Maxlen As Long 'volname length of the first test string = String (255, 0) fsysName = String (255, 0) AA = GetVolumeInformation (Path, Volname, 256, Volseri, Maxlen, _sysflag, fsysname, 256) Volname = Left (Volname, INSTR (1, Volname, CHR (0)) - 1) fsysname = left fsysName, InStr (1, fsysName, Chr (0)) - 1) compress = Sysflag And FILE_VOLUME_IS_COMPRESSEDIf compress = 0 ThenMsgBox "uncompressed drive" ElseMsgBox "compression driver" End IfMsgBox "drive label:" VolNameMsgBox "drive label:" HEX (Volseri) MsgBox "Drive File System (FAT, HPFS, or NTFS)" FSYSNAMEMSGBOX "supported file name length" STR $ (MAXLEN) End Sub

Private submmand1_click () MSGBOX GetSerialNumber ("c: /") End Sub

Private Sub Command2_Click () Call GetVolInfo ( "C: /") End SubPrivate Sub Command3_Click () Dim cr As StringDim Twidth As IntegerDim Theight As Integercr = Chr $ (13) Chr $ (10) Twidth% = Screen.Width / Screen .Twipsperpixelxtheight% = screen.height / screen.twipsperpixelymsgbox "screen size CR CR STR $ (twidth%) " X " STR $ (theight%), 64," Info "End Sub

转载请注明原文地址:https://www.9cbs.com/read-4863.html

New Post(0)