border

Miembros:
Mensajes:
Temas:
Online:

Ultimo Miembro:

 
 

  #1 (permalink)  
Antiguo 31-01-2007, 01:26:54
Un Nuevo Amigo
 
Registrado: sep 2006
Posts: 4
Janus_gf Valoración +2
Contactar con Janus_gf a través de MSN Contactar con Janus_gf a través de Yahoo
Predeterminado DESACTIVAR O BLOQUEAR LAS TECLA "IMPR PANT"

HOLA A TODOS, :smt003 QUISIERA INHABILITAR LA TECLA "IMPR PANT" DURANTE UNA APLICACIÓN, ES DECIR CUANDO MI APLICACIÓN ESTE ACTIVA QUE ESTA TECLA NO FUNCIONE :smt004
HE INTENTADO COMO CUANDO SE QUIERE QUE EL ENTER FUNCIONE COMO TAB CON EL SIGUIENTE CÓDIGO:

EVENTO KEYPRESS DEL FORMULARIO
If e.KeyChar = Convert.ToChar(Keys.Snapshot) Then ' tecla impr pant
SendKeys.Send("{TAB}")
End If

AGRADECERÍA SUGERENCIAS :smt002
__________________
Dime y lo olvido... enseñame y lo recuerdo... involúcrame y lo aprendo...
Responder Con Cita
  #2 (permalink)  
Antiguo 31-01-2007, 08:46:55
Avatar de Korku
Usuario VIP del Foro
 
Registrado: feb 2005
Ubicación: España
Posts: 625
Korku Aun no valorado
Contactar con Korku a través de ICQ Enviar un mensaje a través de AIM a Korku Contactar con Korku a través de MSN Contactar con Korku a través de Yahoo Send a message via Skype™ to Korku
Predeterminado

Hola,

Usa SendKeys.Send("abcd")

Aquí muestro la lista:

BACKSPACE {BACKSPACE}, {BS}, or {BKSP}
BREAK {BREAK}
CAPS LOCK {CAPSLOCK}
DEL or DELETE {DELETE} or {DEL}
DOWN ARROW {DOWN}
END {END}
ENTER {ENTER}or ~
ESC {ESC}
HELP {HELP}
HOME {HOME}
INS or INSERT {INSERT} or {INS}
LEFT ARROW {LEFT}
NUM LOCK {NUMLOCK}
PAGE DOWN {PGDN}
PAGE UP {PGUP}
PRINT SCREEN {PRTSC} (reserved for future use)
RIGHT ARROW {RIGHT}
SCROLL LOCK {SCROLLLOCK}
TAB {TAB}
UP ARROW {UP}
F1 {F1}
F2 {F2}
F3 {F3}
F4 {F4}
F5 {F5}
F6 {F6}
F7 {F7}
F8 {F8}
F9 {F9}
F10 {F10}
F11 {F11}
F12 {F12}
F13 {F13}
F14 {F14}
F15 {F15}
F16 {F16}
Keypad add {ADD}
Keypad subtract {SUBTRACT}
Keypad multiply {MULTIPLY}
Keypad divide {DIVIDE}

COMBINACIONES DE TECLAS

SHIFT +
CTRL ^
ALT %

Adjunto un zip sobre SendKeysToWindow. Tengo un ejemplo de como desactivar las teclas Ctrl + Alt + Supr, no sé si te sirve de algo...

Código:
'Up at the very top !!!
Imports System.Threading
Imports System.Reflection
Imports System.Runtime.InteropServices

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
        HookKeyboard()
        apiSystemParametersInfoA(SPI_SETKEYBOARDDELAY, -1, 0, 0)
        apiSystemParametersInfoA(SPI_SETKEYBOARDSPEED, 1, 0, 0)
    End Sub

    Private Sub Form1_Closed(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Closed
        UnhookKeyboard()
        apiSystemParametersInfoA(SPI_SETKEYBOARDDELAY, 20, 0, 0)
        apiSystemParametersInfoA(SPI_SETKEYBOARDSPEED, 20, 0, 0)
    End Sub

    Public Function IsHooked(ByRef Hookstruct As KBDLLHOOKSTRUCT) As Boolean
        On Error Resume Next

        ' block task manager from the ctrl alt delete combo
        If (Hookstruct.vkCode = Keys.Delete Or CBool(GetAsyncKeyState(Keys.Delete) And &H8000) = True) And (Hookstruct.vkCode = VK_CONTROL Or CBool(GetAsyncKeyState(VK_CONTROL) And &H8000) = True) And (Hookstruct.vkCode = Keys.Menu Or CBool(GetAsyncKeyState(Keys.Menu) And &H8000) = True) Then
            Dim t As New Thread(AddressOf KillTask)
            t.Start()
            Return True
        End If

        'block task manager from the control alt escape combo
        If (Hookstruct.vkCode = Keys.Escape Or CBool(GetAsyncKeyState(Keys.Escape) And &H8000) = True) And CBool(GetAsyncKeyState(VK_CONTROL) And &H8000) And CBool(GetAsyncKeyState(Keys.Shift) And &H8000) Then
            Dim t As New Thread(AddressOf KillTask)
            t.Start()
            Return True
        End If

        If (Hookstruct.vkCode = Keys.RWin) Then   'block right win key, or any single key press like this
            Return True
        End If

        If (Hookstruct.vkCode = Keys.LWin) Then 'block left win key
            Return True
        End If

        'Block ctrl escape  Stops from opening the start menu, as above with win keys.
        If CBool(GetAsyncKeyState(VK_CONTROL) And &H8000) And (Hookstruct.vkCode = Keys.Escape) Then
            Return True
        End If

        'Block control F4  Stops the closing of a window within an application without closing the main application
        If CBool(GetAsyncKeyState(VK_CONTROL) And &H8000) And (Hookstruct.vkCode = Keys.F4) Then
            Return True
        End If

        'Block Alt F4 from directly closing this the application
        If CBool(GetAsyncKeyState(Keys.Menu) And &H8000) And (Hookstruct.vkCode = Keys.F4) Then
            Return True
        End If

        'Block Alt Space Stops the opening of the titlebar menu, that can close the alt+f4 combo above
        If CBool(GetAsyncKeyState(Keys.Menu) And &H8000) And (Hookstruct.vkCode = Keys.Space) Then
            Return True
        End If

        'Stop from switching focus to previous application
        If CBool(GetAsyncKeyState(Keys.Menu) And &H8000) And (Hookstruct.vkCode = Keys.Tab) Then
            Return True
        End If

        'Stop from switching focus to previous application
        If CBool(GetAsyncKeyState(Keys.Menu) And &H8000) And (Hookstruct.vkCode = Keys.Escape) Then
            Return True
        End If


        'block any keys you like here


        Return False
    End Function

    Public Sub KillTask()
        On Error Resume Next
        Dim i As Integer
        Do
            Dim clt() As Process = Process.GetProcessesByName("taskmgr")
            For Each p As Process In clt
                p.Kill()
            Next
            Thread.Sleep(1)
            i += 1
            If i = 100 Then
                Exit Do
            End If
        Loop
    End Sub

    Const VK_CONTROL As Integer = &H11
    Const SPI_SETKEYBOARDDELAY As Integer = 23
    Const SPI_SETKEYBOARDSPEED As Integer = 11
    Public Structure KBDLLHOOKSTRUCT
        Public vkCode As Integer
        Public scanCode As Integer
        Public flags As Integer
        Public time As Integer
        Public dwExtraInfo As Integer
    End Structure
    Public Delegate Function KeyboardHookDelegate(ByVal Code As Integer, ByVal wParam As Integer, ByRef lParam As KBDLLHOOKSTRUCT) As Integer
    <MarshalAs(UnmanagedType.FunctionPtr)> Private callback As KeyboardHookDelegate
    Public KeyboardHandle As Integer
    Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Integer) As Integer
    Public Declare Function SetWindowsHookEx Lib "user32" Alias "SetWindowsHookExA" (ByVal idHook As Integer, ByVal lpfn As KeyboardHookDelegate, ByVal hmod As Integer, ByVal dwThreadId As Integer) As Integer
    Private Declare Function CallNextHookEx Lib "user32" (ByVal hHook As Integer, ByVal nCode As Integer, ByVal wParam As Integer, ByVal lParam As KBDLLHOOKSTRUCT) As Integer
    Public Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hHook As Integer) As Integer
    Public Declare Function apiSystemParametersInfoA Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Integer, ByVal uParam As Integer, ByVal lpvParam As Integer, ByVal fuWinIni As Integer) As Integer
    Dim clt() As Process = Process.GetProcessesByName("taskmgr")
    Dim t As New Thread(AddressOf KillTask)
    Public Sub HookKeyboard()
        callback = New KeyboardHookDelegate(AddressOf KeyboardCallback)
        KeyboardHandle = SetWindowsHookEx(13&, callback, Marshal.GetHINSTANCE([Assembly].GetExecutingAssembly.GetModules()(0)).ToInt32, 0)
    End Sub
    Public Sub UnhookKeyboard()
        If (Hooked()) Then
            Call UnhookWindowsHookEx(KeyboardHandle)
        End If
    End Sub
    Private Function Hooked()
        Hooked = KeyboardHandle <> 0
    End Function
    Public Function KeyboardCallback(ByVal Code As Integer, ByVal wParam As Integer, ByRef lParam As KBDLLHOOKSTRUCT) As Integer
        If (Code = 0) Then
            If (IsHooked(lParam)) Then
                Return 1
            End If
        End If
        Return CallNextHookEx(KeyboardHandle, Code, wParam, lParam)
    End Function
Un saludo :-)
Archivos Adjuntos
Tipo de Archivo: zip sendproject.zip (95,6 KB, 45 visitas)
Responder Con Cita
  #3 (permalink)  
Antiguo 01-02-2007, 01:21:45
Un Nuevo Amigo
 
Registrado: sep 2006
Posts: 4
Janus_gf Valoración +2
Contactar con Janus_gf a través de MSN Contactar con Janus_gf a través de Yahoo
Predeterminado

HOLA AMIGO GRACIAS POR LA SUGERENCIA, SIN EMBARGO LA TECLA CONTINÚA FUNCIONANDO :smt017
BUSCANDO EN LA WEB LEI UN COMENTARIO DICIENDO QUE NO SE PUEDE DESACTIVAR LA TECLA POR QUE ES UNA CARACTERÍSTICA BÁSICA DE WINDOWS, DE TODAS FORMAS SEGUIRÉ INTENTANDO

UN SALUDO
:smt002
__________________
Dime y lo olvido... enseñame y lo recuerdo... involúcrame y lo aprendo...
Responder Con Cita
Respuesta


Herramientas
Desplegado

Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Trackbacks are habilitado
Pingbacks are habilitado
Refbacks are habilitado


Temas Similares
Tema Autor Foro Respuestas Último Mensaje
que tecla es esta ">" en codigo ascii¿?¿? Fhaker_tito Visual Basic 6.00 3 13-05-2007 22:45:51
desabilitar "Impr Pant" chapulin VBScripts, JavaScripts, etc. 0 28-03-2007 20:01:11
Como Deshabilitar la tecla "Inicio" en otra Aplica Loriel Visual Basic 6.00 0 20-03-2007 21:32:21
usar tecla "enter" en vez de "tab" Eynar Visual Basic 6.00 6 13-06-2006 14:03:51
¿Cómo deshabilitar tecla "Windows" (ventanita)? lindochico Visual Basic 6.00 1 06-06-2005 09:03:05


La franja horaria es GMT. Ahora son las 04:28:22.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0
A vBSkinworks Design

Alojado en el servicio Premium de Masquewebs | Diseño mejorado por MasqueWebs

right