www.pudn.com > Mysystem.rar > Mysystem.vb


''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 
' 
'该文件为系统信息读取的NAMESPACE 
' 
'该文件由K9998制作 
'QQ:35333120 
' 
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 
Imports System.IO 
Imports System.Reflection 
Imports System.Net 
 
Namespace K9998system 
 
    Public Class Gettime 
 
 
        Private Structure SYSTEMTIME 
            Public wYear As UShort 
            Public wMonth As UShort 
            Public wDayOfWeek As UShort 
            Public wDay As UShort 
            Public wHour As UShort 
            Public wMinute As UShort 
            Public wSecond As UShort 
            Public wMilliseconds As UShort 
        End Structure 
 
        Private Declare Function GetSystemTime Lib "CoreDll.dll" (ByRef lpSystemTime As SYSTEMTIME) As UInteger 
        Private Declare Function SetSystemTime Lib "CoreDll.dll" (ByRef lpSystemTime As SYSTEMTIME) As UInteger 
 
         
        Public Shared Function GetDateTime() As Date 
            Dim st As SYSTEMTIME 
 
            GetSystemTime(st) 
 
            '返回当前系统时间(data) 
            Return New Date(st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond, st.wMilliseconds) 
        End Function 
 
        Public Shared Sub SetDateTime(ByVal newDateTime As Date) 
            Dim newTime As SYSTEMTIME 
 
            '转换data为系统时间 
            newTime.wYear = newDateTime.Year 
            newTime.wMonth = newDateTime.Month 
            newTime.wDay = newDateTime.Day 
            newTime.wHour = newDateTime.Hour 
            newTime.wMinute = newDateTime.Minute 
            newTime.wSecond = newDateTime.Second 
            newTime.wMilliseconds = newDateTime.Millisecond 
 
            SetSystemTime(newTime) 
        End Sub 
 
    End Class 
 
    Public Class Getmomeny 
 
        Friend Structure MEMORYSTATUS 
            Public dwLength As UInteger 
            Public dwMemoryLoad As UInteger 
            Public dwTotalPhys As UInteger 
            Public dwAvailPhys As UInteger 
            Public dwTotalPageFile As UInteger 
            Public dwAvailPageFile As UInteger 
            Public dwTotalVirtual As UInteger 
            Public dwAvailVirtual As UInteger 
        End Structure 
 
        Friend Declare Function GlobalMemoryStatus Lib "CoreDll.Dll" (ByRef ms As MEMORYSTATUS) As Integer 
	 
	'返回当前内存使用状态 
        Friend Shared Function GetMemory() As MEMORYSTATUS 
 
            Dim memStatus As New MEMORYSTATUS 
            GlobalMemoryStatus(memStatus) 
 
            Return memStatus 
        End Function 
    End Class 
 
    Public Class GetAppDir 
 
	'返回当前程序所在位置 
        Public Function GetApplicationDirectory() As String 
 
            Return Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetModules(0).FullyQualifiedName) 
 
        End Function 
    End Class 
 
    Public Class GetPlatform 
	'返回设备名称 
        Private Function GetDeviceName() As String 
 
            Return Dns.GetHostName() 
 
        End Function 
    End Class 
End Namespace