• Sábado 9 de Noviembre de 2024, 03:46

Autor Tema:  Blokear Xp  (Leído 1186 veces)

az8

  • Miembro MUY activo
  • ***
  • Mensajes: 111
    • Ver Perfil
Blokear Xp
« en: Viernes 24 de Junio de 2005, 19:39 »
0
como puedo hacer para ke mi aplicacion inicie al igual ke el antivirus y que blokee la windows con una pantalla de mi aplicacion y que al iniciar su sesion o introducir un password se desblokee el equipo

gracias

ate az8

RadicalEd

  • Moderador
  • ******
  • Mensajes: 2430
  • Nacionalidad: co
    • Ver Perfil
Re: Blokear Xp
« Respuesta #1 en: Viernes 24 de Junio de 2005, 20:14 »
0
Un pantallaso maximimizado sin botones de cerrar, maximizar ni restaurar, y si quieres bloquear el administrador de XP haz esto.

PD. El código no es mio, no lo he probado y debes usar un modulo para todo esto.

Código: Text
  1. Option Explicit
  2.  
  3.  Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
  4.  Public Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer
  5.  Public Declare Function SetWindowsHookEx Lib "user32" Alias "SetWindowsHookExA" (ByVal idHook As Long, ByVal lpfn As Long, ByVal hmod As Long, ByVal dwThreadId As Long) As Long
  6.  Public Declare Function CallNextHookEx Lib "user32" (ByVal hHook As Long, ByVal nCode As Long, ByVal wParam As Long, lParam As Any) As Long
  7.  Public Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hHook As Long) As Long
  8.  
  9.  Public Const HC_ACTION = 0
  10.  Public Const WM_KEYDOWN = &H100
  11.  Public Const WM_KEYUP = &H101
  12.  Public Const WM_SYSKEYDOWN = &H104
  13.  Public Const WM_SYSKEYUP = &H105
  14.  Public Const WH_KEYBOARD_LL = 13
  15.  
  16.  Public Type KBDLLHOOKSTRUCT
  17.      vkCode As Long
  18.      scanCode As Long
  19.      flags As Long
  20.      time As Long
  21.      dwExtraInfo As Long
  22.  End Type
  23.  
  24.  Public Enum VirtualKey
  25.    VK_LBUTTON = &H1
  26.    VK_RBUTTON = &H2
  27.    VK_CTRLBREAK = &H3
  28.    VK_MBUTTON = &H4
  29.    VK_BACKSPACE = &H8
  30.    VK_TAB = &H9
  31.    VK_ENTER = &HD
  32.    VK_SHIFT = &H10
  33.    VK_CONTROL = &H11
  34.    VK_ALT = &H12
  35.    VK_PAUSE = &H13
  36.    VK_CAPSLOCK = &H14
  37.    VK_ESCAPE = &H1B
  38.    VK_SPACE = &H20
  39.    VK_PAGEUP = &H21
  40.    VK_PAGEDOWN = &H22
  41.    VK_END = &H23
  42.    VK_HOME = &H24
  43.    VK_LEFT = &H25
  44.    VK_UP = &H26
  45.    VK_RIGHT = &H27
  46.    VK_DOWN = &H28
  47.    VK_PRINTSCREEN = &H2C
  48.    VK_INSERT = &H2D
  49.    VK_DELETE = &H2E
  50.    VK_0 = &H30
  51.    VK_1 = &H31
  52.    VK_2 = &H32
  53.    VK_3 = &H33
  54.    VK_4 = &H34
  55.    VK_5 = &H35
  56.    VK_6 = &H36
  57.    VK_7 = &H37
  58.    VK_8 = &H38
  59.    VK_9 = &H39
  60.    VK_A = &H41
  61.    VK_B = &H42
  62.    VK_C = &H43
  63.    VK_D = &H44
  64.    VK_E = &H45
  65.    VK_F = &H46
  66.    VK_G = &H47
  67.    VK_H = &H48
  68.    VK_I = &H49
  69.    VK_J = &H4A
  70.    VK_K = &H4B
  71.    VK_L = &H4C
  72.    VK_M = &H4D
  73.    vk_n = &H4E
  74.    VK_O = &H4F
  75.    VK_P = &H50
  76.    VK_Q = &H51
  77.    VK_R = &H52
  78.    VK_S = &H53
  79.    VK_T = &H54
  80.    VK_U = &H55
  81.    VK_V = &H56
  82.    VK_W = &H57
  83.    VK_X = &H58
  84.    VK_Y = &H59
  85.    VK_Z = &H5A
  86.    VK_LWINDOWS = &H5B
  87.    VK_RWINDOWS = &H5C
  88.    VK_APPSPOPUP = &H5D
  89.    VK_NUMPAD_0 = &H60
  90.    VK_NUMPAD_1 = &H61
  91.    VK_NUMPAD_2 = &H62
  92.    VK_NUMPAD_3 = &H63
  93.    VK_NUMPAD_4 = &H64
  94.    VK_NUMPAD_5 = &H65
  95.    VK_NUMPAD_6 = &H66
  96.    VK_NUMPAD_7 = &H67
  97.    VK_NUMPAD_8 = &H68
  98.    VK_NUMPAD_9 = &H69
  99.    VK_NUMPAD_MULTIPLY = &H6A
  100.    VK_NUMPAD_ADD = &H6B
  101.    VK_NUMPAD_PLUS = &H6B
  102.    VK_NUMPAD_SUBTRACT = &H6D
  103.    VK_NUMPAD_MINUS = &H6D
  104.    VK_NUMPAD_MOINS = &H6D
  105.    VK_NUMPAD_DECIMAL = &H6E
  106.    VK_NUMPAD_POINT = &H6E
  107.    VK_NUMPAD_DIVIDE = &H6F
  108.    VK_F1 = &H70
  109.    VK_F2 = &H71
  110.    VK_F3 = &H72
  111.    VK_F4 = &H73
  112.    VK_F5 = &H74
  113.    VK_F6 = &H75
  114.    VK_F7 = &H76
  115.    VK_F8 = &H77
  116.    VK_F9 = &H78
  117.    VK_F10 = &H79
  118.    VK_F11 = &H7A
  119.    VK_F12 = &H7B
  120.    VK_NUMLOCK = &H90
  121.    VK_SCROLL = &H91
  122.    VK_LSHIFT = &HA0
  123.    VK_RSHIFT = &HA1
  124.    VK_LCONTROL = &HA2
  125.    VK_RCONTROL = &HA3
  126.    VK_LALT = &HA4
  127.    VK_RALT = &HA5
  128.    VK_POINTVIRGULE = &HBA
  129.    VK_ADD = &HBB
  130.    VK_PLUS = &HBB
  131.    VK_EQUAL = &HBB
  132.    VK_VIRGULE = &HBC
  133.    VK_SUBTRACT = &HBD
  134.    VK_MINUS = &HBD
  135.    VK_MOINS = &HBD
  136.    VK_UNDERLINE = &HBD
  137.    VK_POINT = &HBE
  138.    VK_SLASH = &HBF
  139.    VK_TILDE = &HC0
  140.    VK_LEFTBRACKET = &HDB
  141.    VK_BACKSLASH = &HDC
  142.    VK_RIGHTBRACKET = &HDD
  143.    VK_QUOTE = &HDE
  144.    VK_APOSTROPHE = &HDE
  145.  End Enum
  146.  
  147.  Dim p As KBDLLHOOKSTRUCT
  148.  
  149.  Public Function LowLevelKeyboardProc(ByVal nCode As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
  150.    Dim fEatKeystroke As Boolean
  151.    If (nCode = HC_ACTION) Then
  152.      If wParam = WM_KEYDOWN Or wParam = WM_SYSKEYDOWN Or wParam = WM_KEYUP Or wParam = WM_SYSKEYUP Then
  153.        CopyMemory p, ByVal lParam, Len(p)
  154.        fEatKeystroke = _
  155.          (p.vkCode = VK_CAPSLOCK) Or _
  156.          (p.vkCode = VK_LWINDOWS) Or _
  157.          (p.vkCode = VK_RWINDOWS) Or _
  158.          (p.vkCode = VK_APPSPOPUP) Or _
  159.          ((p.vkCode = VK_SPACE) And ((GetKeyState(VK_ALT) And &H8000) <> 0)) Or _
  160.          ((p.vkCode = VK_TAB) And ((GetKeyState(VK_ALT) And &H8000) <> 0)) Or _
  161.          ((p.vkCode = VK_ESCAPE) And ((GetKeyState(VK_CONTROL) And &H8000) <> 0))
  162.      End If
  163.    End If
  164.    If fEatKeystroke Then
  165.      LowLevelKeyboardProc = -1
  166.    Else
  167.      LowLevelKeyboardProc = CallNextHookEx(0, nCode, wParam, ByVal lParam)
  168.    End If
  169.  End Function
  170. 'Para desbloquear
  171.  UnhookWindowsHookEx hhkLowLevelKybd
  172. 'Para bloquear
  173. hhkLowLevelKybd = SetWindowsHookEx(WH_KEYBOARD_LL, AddressOf LowLevelKeyboardProc, App.hInstance, 0)
  174.  
  175.  
El pasado son solo recuerdos, el futuro son solo sueños