MAJUSCULE

GHGFSJD Messages postés 113 Date d'inscription samedi 11 novembre 2000 Statut Membre Dernière intervention 16 août 2008 - 7 juil. 2008 à 02:34
GHGFSJD Messages postés 113 Date d'inscription samedi 11 novembre 2000 Statut Membre Dernière intervention 16 août 2008 - 7 juil. 2008 à 08:32
Bonsoir, je cherche un moyen pour activer la touche MAJUSCULE. Merci d'avance

4 réponses

spamito Messages postés 183 Date d'inscription samedi 24 mars 2007 Statut Membre Dernière intervention 30 mars 2013
7 juil. 2008 à 02:47
Pouvez-vous nous expliquer d'avantage car votre demande est incomptéhensible.
0
GHGFSJD Messages postés 113 Date d'inscription samedi 11 novembre 2000 Statut Membre Dernière intervention 16 août 2008
7 juil. 2008 à 02:55
eh bien je dois envoyer un postmessage de la touche . sur un logiciel mais si la touche MAJ n'est pas activée cela ne marche pas :

Call PostMessage(aa, WM_KEYDOWN, 190, 0&) '.
Call PostMessage(aa, WM_KEYUP, 190, 0&)

Donc il me faut activer le MAJ avant .Merci a vous
0
Renfield Messages postés 17287 Date d'inscription mercredi 2 janvier 2002 Statut Modérateur Dernière intervention 27 septembre 2021 74
7 juil. 2008 à 07:21
190, super explicite !!

a tenter (vague idée)

Call PostMessage(aa, WM_KEYDOWN, vbKeyShift, 0&) '.

Call PostMessage(aa, WM_KEYDOWN, 190, 0&) '.

Call PostMessage(aa, WM_KEYUP, 190, 0&)

Call PostMessage(aa, WM_KEYUP, vbKeyShift, 0&)

ou se genre de code pas très élégant:
http://www.vbfrance.com/codes/CONTROL-LEDS-NUMLOCK-CAPSLOCK-SCROLLLLOCK_36823.aspx

Renfield
Admin CodeS-SourceS- MVP Visual Basic
0
GHGFSJD Messages postés 113 Date d'inscription samedi 11 novembre 2000 Statut Membre Dernière intervention 16 août 2008
7 juil. 2008 à 08:32
Bonjour,
Merci a tous, j'ai trouver ce code qui correspond exactement a ma recherche et je tenais a vous en faire profiter:
Auteur : avigeilpro

Option Explicit

''''********************************************************************************''''
' Procédure utilisée pour simuler l'appuie des touches CapsLock, Numlock et ScrollLock
''''********************************************************************************''''

Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As _
Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Private Declare Function SetKeyboardState Lib "user32" (lppbKeyState As Byte) _
As Long
Private Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As _
Integer
Private Declare Function MapVirtualKey Lib "user32" Alias "MapVirtualKeyA" _
(ByVal wCode As Long, ByVal wMapType As Long) As Long

Public Const VK_NUMLOCK = &H90
Public Const VK_SCROLL = &H91
Public Const VK_CAPITAL = &H14
Private Const KEYEVENTF_EXTENDEDKEY = &H1
Private Const KEYEVENTF_KEYUP = &H2

Public Sub SetKeyState(ByVal Key As Long, ByVal State As Boolean)

keybd_event Key, MapVirtualKey(Key, 0), KEYEVENTF_EXTENDEDKEY Or 0, 0
keybd_event Key, MapVirtualKey(Key, 0), KEYEVENTF_EXTENDEDKEY Or KEYEVENTF_KEYUP, 0
If Key 20 And State False Then
keybd_event 16, 0, 0, 0
keybd_event 16, 0, 2, 0
End If

End Sub

Public Property Get CapsLock() As Boolean
CapsLock GetKeyState(VK_CAPITAL) 1
End Property

Public Property Let CapsLock(ByVal Value As Boolean)
SetKeyState VK_CAPITAL, Value
End Property

Public Property Get NumLock() As Boolean
NumLock GetKeyState(VK_NUMLOCK) 1
End Property

Public Property Let NumLock(ByVal Value As Boolean)
SetKeyState VK_NUMLOCK, Value
End Property

Public Property Get ScrollLock() As Boolean
ScrollLock GetKeyState(VK_SCROLL) 1
End Property

Public Property Let ScrollLock(ByVal Value As Boolean)
SetKeyState VK_SCROLL, Value
End Property



Et voici comment il s'utilise :
If CapsLock True Then CapsLock False
If NumLock True Then NumLock False
If ScrollLock True then ScrollLock False
0
Rejoignez-nous