Sendkeys
jo456
-
lativ Posted messages 148 Status Member -
lativ Posted messages 148 Status Member -
Hello,
I am currently making a program (VB) under VB6 and for now I’m progressing quite quickly thanks to the satisfying answers on this forum... however for the next step I will have to simulate pressing several keyboard keys in sequence... I will use "SendKeys" to do this. I know some keys such as:
Alt ... %
Shift ... +
F1... {F1}
but I need to know others, more specifically the keys "Win", "Up", "Down", "Left", "Right", "Enter" and "Tab"
thank you in advance for your help... I’ve been looking but can’t find!!!
I am currently making a program (VB) under VB6 and for now I’m progressing quite quickly thanks to the satisfying answers on this forum... however for the next step I will have to simulate pressing several keyboard keys in sequence... I will use "SendKeys" to do this. I know some keys such as:
Alt ... %
Shift ... +
F1... {F1}
but I need to know others, more specifically the keys "Win", "Up", "Down", "Left", "Right", "Enter" and "Tab"
thank you in advance for your help... I’ve been looking but can’t find!!!
Configuration: Windows XP Internet Explorer 7.0
4 answers
-
On this page: "To specify a key combination with SHIFT, CTRL and ALT, precede the normal key code with one or more codes among the following:
SHIFT + CTRL ^ ALT %
" so for ALT+TAB, for example, to switch windows. There is also this: "For specifying that the SHIFT, CTRL and ALT keys must be held down while other keys are used, place the codes for these keys in parentheses. For example, to specify that the SHIFT key must be held down while you press the E and C keys, use "+(EC)". To specify that the SHIFT key must be held down while you press the E key, then release the SHIFT key while you press the C key, use "+EC". To specify key repetition, use the form {key number}. Be sure to put a space between the key and the number of times that key should be pressed. For example, {LEFT 42} means the LEFT key is pressed 42 times. {h 10} indicates that the H key should be pressed 10 times." Then for the Windows key (the Super key), it’s simply the CTRL+ESC combination. So you can do it with ^ and {ESC} in your SendKeys. There you go. Good luck. -
Hello
... the longest part was finding this outline in my b... which I still name the hard drive...
Trigger a procedure via a keyboard shortcut ... We will make sure not to define single keys but rather a key combination ... like CTRL + f which for VBA code would give: Application.OnKey "{^f}", "NomDeLaMacro" AIDE {HELP} ARRÊT DÉFIL. {SCROLLLOCK} DOWN {DOWN} From F1 to F15 {F1} to {F15} START {HOME} RIGHT {RIGHT} ESCAPE {ESCAPE} or {ESC} ERASE {CLEAR} ENTER (numpad) {ENTER} END {END} LEFT {LEFT} UP {UP} INSERT {INSERT} PAUSE {BREAK} PAGE.PREV {PGUP} PAGE.NEXT {PGDN} RET.ARR {BACKSPACE} or {BS} RETURN {RETURN} DELETE or DEL {DELETE} or {DEL} TABULATION {TAB} SHIFT LOCK {CAPSLOCK} NUM LOCK {NUMLOCK} To combine keys place the character below before the key code ALT % (percent sign) CTRL ^ (caret) SHIFT + (plus sign) Option Explicit 'Assign a shortcut to the ESC key "Essai" = name of the macro to run Sub Affectation() Application.OnKey "{ESCAPE}", "Essai" End Sub
--
Best regards,
Michel -
Hello,
Otherwise you also have all of this located at this place:
https://docs.microsoft.com/fr-fr/dotnet/api/system.windows.forms.sendkeys?redirectedfrom=MSDN&view=netframework-4.8 -
Unfortunately not! I will try to "win" at every turn, but...
--
Kind regards,
Michel