SENDKEY NO WIN 7
Pessoal to com um problemao eu usa o sendkey normal no xp mas no win 7 nao funciona da erro achei a maneira de resolver na net mas perdi a funcao que eu usava dentro dele do sendkey
Private Sub CPF_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
SendKeys [Ô]{tab}[Ô]
[ô]valida o cnpj
If ValidaCPF_CNPJ(CPF) = False Then
MsgBox [Ô]CPF Informado não é valido[Ô], 64
CPF.SetFocus
Exit Sub
Else
CPF = Formato
End If
End If
End Sub
eu usava o enter pra verificar dados dentro dos text e agora da forma pra win 7 nao consigo usar mais agora fico assim no win 7
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case 13:
[ô]*** Campo se pressionado (ENTER)
SendKeysA vbKeyTab, True
Case 27:
[ô]Fecha Form se pressionado (ESC)
Unload Me
Case 38:
[ô]Volta Campo similar (SHIFT + TAB)
SendKeysA vbKeyShift, True
SendKeysA vbKeyTab, True
SendKeysA vbKeyShift, False
Case 40:
[ô]*** Campo se pressionado (SETA ACIMA)
SendKeysA vbKeyTab, True
End Select
End Sub
Private Sub CPF_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
SendKeys [Ô]{tab}[Ô]
[ô]valida o cnpj
If ValidaCPF_CNPJ(CPF) = False Then
MsgBox [Ô]CPF Informado não é valido[Ô], 64
CPF.SetFocus
Exit Sub
Else
CPF = Formato
End If
End If
End Sub
eu usava o enter pra verificar dados dentro dos text e agora da forma pra win 7 nao consigo usar mais agora fico assim no win 7
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case 13:
[ô]*** Campo se pressionado (ENTER)
SendKeysA vbKeyTab, True
Case 27:
[ô]Fecha Form se pressionado (ESC)
Unload Me
Case 38:
[ô]Volta Campo similar (SHIFT + TAB)
SendKeysA vbKeyShift, True
SendKeysA vbKeyTab, True
SendKeysA vbKeyShift, False
Case 40:
[ô]*** Campo se pressionado (SETA ACIMA)
SendKeysA vbKeyTab, True
End Select
End Sub
desabilite o controle de usuário do Windows 7
pode resolver
pode resolver
o Sendkeys não funciona do vista pra frente...
Você pode tentar usar esta função:
[txt-color=#0000f0]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[/txt-color]
Você pode tentar usar esta função:
[txt-color=#0000f0]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[/txt-color]
Ja passei pro isso.. se desabilitar o Controle de usuario resolve
No vista eu tentei e não deu certo, no 7 nunca tentei.....
No vista ainda nao tentei tambem rs... mas no Seven ja precisei fazer isso em 4 clientes e funcionou.
obrigado a todos pela forca deu certo
Tópico encerrado , respostas não são mais permitidas