Get some basic information of the system

xiaoxiao2021-03-06  43

Option ExplicitPrivate Declare Function GetTickCount Lib "kernel32" () As LongPrivate Declare Function GetWindowsDirectory Lib "kernel32" Alias ​​"GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As LongPrivate Declare Function GetSystemDirectory Lib "kernel32" Alias ​​"GetSystemDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As LongPrivate Declare Function GetComputerName Lib "kernel32" Alias ​​"GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As LongPrivate Declare Function GetUserName Lib "advapi32.dll" Alias ​​"GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As LongPrivate Declare Sub GlobalMemoryStatus Lib "kernel32" (lpBuffer As MEMORYSTATUS) Private mvarSysDir As StringPrivate mvarWinDir As StringPrivate mvarComputerName As StringPrivate mvarUserName As StringPrivate mvarSysRunTime As StringPrivate mvarResRat As StringPrivate mvarPhyMemory As StringPrivate Type MEMORYSTATUS dwLength As Long dwMemoryLoad As Long DWTO talPhys As Long dwAvailPhys As Long dwTotalPageFile As Long dwAvailPageFile As Long dwTotalVirtual As Long dwAvailVirtual As LongEnd TypePublic Property Get SysDir () As String 'to give the system directory Dim buffer As String * 256Call GetSystemDirectory (buffer, 256) mvarSysDir = Left (buffer, InStr ( 1, buffer, vbNullChar) - 1) SysDir = mvarSysDirEnd PropertyPublic Property get WinDir () As String 'to give the Windows installation directory Dim buffer As String * 256Call GetWindowsDirectory (buffer, 256) mvarWinDir = Left (buffer, InStr (1, buffer, vbNullChar ) - 1) WINDIR = MVARWINDIREND PropertyPublic Property Get ComputerName () AS String '

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

New Post(0)