BLOQUEAR TECLA

HELIO.COSTA 05/05/2013 14:10:06
#422967
Como bloquerar as telcas [Ô]ALT F4[Ô] no form MDI e form normal.
ROBSON 05/05/2013 16:18:02
#422970

Utilizando a propriedades Keypress, KeyDown, Keyup
HELIO.COSTA 11/05/2013 13:16:38
#423330
Certo.
qual o codigo ascii das teclas?
HELIO.COSTA 11/05/2013 13:50:25
#423331
Procurei e achei este exemplo aqui.

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Dim ShiftDown, AltDown, CtrlDown, Txt
ShiftDown = (Shift And vbShiftMask) > 0
AltDown = (Shift And vbAltMask) > 0
CtrlDown = (Shift And vbCtrlMask) > 0
If KeyCode = vbKeyF4 Then [ô] Display key combinations.
If AltDown Then
Txt = [Ô]ALT+F4.[Ô]
MsgBox [Ô]You pressed [Ô] & Txt
End If
End Sub

Acontece que o programa está fechando mesmo assim.
Quero que o cliente não feche o programa desta forma.
Como bloquear?
GANDA.NICK 13/05/2013 11:08:26
#423371
Olá,

Veja se isto o ajuda:

Private bALTF4 As Boolean

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 115 And Shift = 4 Then bALTF4 = True [ô]altf4
End Sub

Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
bALTF4 = False
End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Cancel = bALTF4
End Sub



Té +
VELDRAME 13/05/2013 11:47:41
#423375
Resposta escolhida

Dim bln_alt As Boolean
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 18 Then
bln_alt = True
End If
If KeyCode = 115 And bln_alt = True Then
MsgBox [Ô]ALT+F4 Bloqueado![Ô], vbCritical, [Ô]ATENÇÃO![Ô]
bln_alt = False
KeyCode = 0
Exit Sub
End If
End Sub

Private Sub Form_KeyPress(KeyAscii As Integer)
bln_alt = False
End Sub
HELIO.COSTA 18/05/2013 11:00:25
#423695
Veldrame, funcionou.
Sabe se tem como fazer no form MDI?
Tópico encerrado , respostas não são mais permitidas