Código:
Añadir un Text1, un Timer1 y 1 Command1
Añadir el Codigo.
Código:
'Declaración del Api FindWindow
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
'Declaración del Api SendMessage
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
Const gcClassnameMSIExplorer = "IEFrame"
Const SC_CLOSE = &HF060&
Const WM_SYSCOMMAND = &H112
Dim cerrar&
Private Sub Command1_Click()
'en este caso la contraseña es administrador
If Not Text1.Text = "administrador" Then
MsgBox "Contraseña Incorrecta", vbCritical, "IEXPLORE"
Else
Form1.Visible = False
Shell "C:\Archivos de programa\Internet Explorer\IEXPLORE.EXE", vbMaximizedFocus
End If
End Sub
Private Sub Form_Load()
On Error Resume Next
'esto hace que la aplicacion si inicie junto con windows
Dim El_Objeto As Object
Set El_Objeto = CreateObject("WScript.Shell")
Resultado = El_Objeto.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\Bloqueo")
If Resultado = "" Then
El_Objeto.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\Bloqueo", App.Path & "\" & App.EXEName & ".exe"
End If
Text1.PasswordChar = "*"
App.TaskVisible = False
Command1.Default = True
Timer1.Interval = 20
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Cancel = 1
End Sub
Private Sub Form_Unload(Cancel As Integer)
'ponle el nombre bloqueo al ejecutable en este caso
Shell App.Path & "/Bloqueo.exe", vbNormalNoFocus
End Sub
Private Sub Timer1_Timer()
cerrar = FindWindow(gcClassnameMSIExplorer, vbNullString)
If cerrar <> 0 Then
If Not Text1.Text = "administrador" Then
Call SendMessage(cerrar, WM_SYSCOMMAND, SC_CLOSE, ByVal 0&)
Form1.Visible = True
End If
End If
If Not cerrar <> 0 And Form1.Visible = False Then
Text1.Text = ""
End If
End Sub
Aunque Nunca lo eh intentado xD !!