MUDANCA DE ENTER NO LUGAR DO TAB NAO FUNCIONA

MALA 17/12/2013 09:17:04
#432173
ESTA FUNÇÃO NAO QUER FUNCIONAR NO WINDOWS 8

Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
On Error Resume Next
If KeyCode = vbKeyReturn And Acao <> [Ô]Ok[Ô] And Acao <> [Ô]Sim[Ô] And Acao <> [Ô]Não[Ô] Then
SendKeys [Ô]{Tab}[Ô]
ElseIf KeyCode = 27 And Acao <> [Ô]Ok[Ô] And Acao <> [Ô]Sim[Ô] And Acao <> [Ô]Não[Ô] Then
SendKeys [Ô]+{Tab}[Ô]
Else
Acao = Empty
End If
End Sub


DESDE JA AGRADEÇO A ATENÇÃO DE TODOS
FILMAN 17/12/2013 15:45:56
#432203
Resposta escolhida
Tente assim, crie um modulo novo e coloque o código abaixo

Option Explicit

Private Const KEYEVENTF_KEYUP = &H2
Private Const INPUT_KEYBOARD = 1

Private Type KEYBDINPUT
wVk As Integer
wScan As Integer
dwFlags As Long
time As Long
dwExtraInfo As Long
End Type

Private Type GENERALINPUT
dwType As Long
xi(0 To 23) As Byte
End Type

Private Declare Function SendInput Lib [Ô]user32.dll[Ô] (ByVal nInputs As Long, pInputs As GENERALINPUT, ByVal cbSize As Long) As Long
Private Declare Sub CopyMemory Lib [Ô]kernel32[Ô] Alias [Ô]RtlMoveMemory[Ô] (pDst As Any, pSrc As Any, ByVal ByteLen As Long)

Public Function SendKeysA(ByVal vKey As Integer, Optional booDown As Boolean = False)
Dim GInput(0) As GENERALINPUT
Dim KInput As KEYBDINPUT
KInput.wVk = vKey
If Not booDown Then
KInput.dwFlags = KEYEVENTF_KEYUP
End If
GInput(0).dwType = INPUT_KEYBOARD
CopyMemory GInput(0).xi(0), KInput, Len(KInput)
Call SendInput(1, GInput(0), Len(GInput(0)))
End Function



Para chamar a função faça o seguinte


Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
On Error Resume Next
If KeyCode = vbKeyReturn And Acao <> [Ô]Ok[Ô] And Acao <> [Ô]Sim[Ô] And Acao <> [Ô]Não[Ô] Then
SendKeysA vbKeyTab, True
ElseIf KeyCode = 27 And Acao <> [Ô]Ok[Ô] And Acao <> [Ô]Sim[Ô] And Acao <> [Ô]Não[Ô] Then
SendKeysA vbKeyTab, True
Else
Acao = Empty
End If
End Sub



Espero ter ajudado
Tópico encerrado , respostas não são mais permitidas