Results 1 to 8 of 8

Thread: [RESOLVED] Looking for list of keycodes.

  1. #1

    Thread Starter
    Hyperactive Member metalmidget's Avatar
    Join Date
    Mar 2007
    Location
    Melbourne, Australia
    Posts
    342

    Resolved [RESOLVED] Looking for list of keycodes.

    Hi. I'm looking for a comprehensive list of all the keycodes for the keyup, keydown and keypress events, so i can know what the integer is for any key, or find which key any integer is referring to. I've done a fair bit of searching but google and MSDN suck, so hopefully someone can point me in the right direction.
    Cheers,
    Metal
    Last edited by metalmidget; Jul 22nd, 2007 at 06:11 AM.

  2. #2
    Interweb adm/o/distrator Paul M's Avatar
    Join Date
    Nov 2006
    Location
    Australia, Melbourne
    Posts
    2,306

    Re: Looking for list of keycodes.

    Just catch the key pressed in the Keydown event

    vb Code:
    1. MsgBox KeyCode

  3. #3
    Addicted Member xavierjohn22's Avatar
    Join Date
    Oct 2006
    Location
    Approx. 4921' and 3.11" asl
    Posts
    249

    Re: Looking for list of keycodes.

    Code:
    Key Code Constants
    
    
    Key Codes
    Constant Value Description
    vbKeyLButton 1 Left mouse button
    vbKeyRButton 2 Right mouse button
    vbKeyCancel 3 CANCEL key
    vbKeyMButton 4 Middle mouse button
    vbKeyBack 8 BACKSPACE key
    vbKeyTab 9 Tab key
    vbKeyClear 12 CLEAR key
    vbKeyReturn 13 ENTER key
    vbKeyShift 16 SHIFT key
    vbKeyControl 17 CTRL key
    vbKeyMenu 18 MENU key
    vbKeyPause 19 PAUSE key
    vbKeyCapital 20 CAPS Lock key
    vbKeyEscape 27 ESC key
    vbKeySpace 32 SPACEBAR key
    vbKeyPageUp 33 PAGE UP key
    vbKeyPageDown 34 PAGE DOWN key
    vbKeyEnd 35 End key
    vbKeyHome 36 HOME key
    vbKeyLeft 37 Left ARROW key
    vbKeyUp 38 UP ARROW key
    vbKeyRight 39 Right ARROW key
    vbKeyDown 40 DOWN ARROW key
    vbKeySelect 41 Select key
    vbKeyPrint 42 Print SCREEN key
    vbKeyExecute 43 EXECUTE key
    vbKeySnapshot 44 SNAPSHOT key
    vbKeyInsert 45 INS key
    vbKeyDelete 46 DEL key
    vbKeyHelp 47 HELP key
    vbKeyNumlock 144 NUM Lock key
    
    
    KeyA Through KeyZ Are the Same As Their ASCII Equivalents: 'A' Through 'Z'
    Constant Value Description
    vbKeyA 65 A key
    vbKeyB 66 B key
    vbKeyC 67 C key
    vbKeyD 68 D key
    vbKeyE 69 E key
    vbKeyF 70 F key
    vbKeyG 71 G key
    vbKeyH 72 H key
    vbKeyI 73 I key
    vbKeyJ 74 J key
    vbKeyK 75 K key
    vbKeyL 76 L key
    vbKeyM 77 M key
    vbKeyN 78 N key
    vbKeyO 79 O key
    vbKeyP 80 P key
    vbKeyQ 81 Q key
    vbKeyR 82 R key
    vbKeyS 83 S key
    vbKeyT 84 T key
    vbKeyU 85 U key
    vbKeyV 86 V key
    vbKeyW 87 W key
    vbKeyX 88 X key
    vbKeyY 89 Y key
    vbKeyZ 90 Z key
    
    
    Key0 Through Key9 Are the Same As Their ASCII Equivalents: '0' Through '9
    Constant Value Description
    vbKey0 48 0 key
    vbKey1 49 1 key
    vbKey2 50 2 key
    vbKey3 51 3 key
    vbKey4 52 4 key
    vbKey5 53 5 key
    vbKey6 54 6 key
    vbKey7 55 7 key
    vbKey8 56 8 key
    vbKey9 57 9 key
    
    
    Keys On the Numeric Keypad
    Constant Value Description
    vbKeyNumpad0 96 0 key
    vbKeyNumpad1 97 1 key
    vbKeyNumpad2 98 2 key
    vbKeyNumpad3 99 3 key
    vbKeyNumpad4 100 4 key
    vbKeyNumpad5 101 5 key
    vbKeyNumpad6 102 6 key
    vbKeyNumpad7 103 7 key
    vbKeyNumpad8 104 8 key
    vbKeyNumpad9 105 9 key
    vbKeyMultiply 106 MULTIPLICATION SIGN (*) key
    vbKeyAdd 107 PLUS SIGN (+) key
    vbKeySeparator 108 ENTER (keypad) key
    vbKeySubtract 109 MINUS SIGN (-) key
    vbKeyDecimal 110 DECIMAL POINT(.) key
    vbKeyDivide 111 DIVISION SIGN (/) key
    
    
    Function Keys
    Constant Value Description
    vbKeyF1 112 F1 key
    vbKeyF2 113 F2 key
    vbKeyF3 114 F3 key
    vbKeyF4 115 F4 key
    vbKeyF5 116 F5 key
    vbKeyF6 117 F6 key
    vbKeyF7 118 F7 key
    vbKeyF8 119 F8 key
    vbKeyF9 120 F9 key
    vbKeyF10 121 F10 key
    vbKeyF11 122 F11 key
    vbKeyF12 123 F12 key
    vbKeyF13 124 F13 key
    vbKeyF14 125 F14 key
    vbKeyF15 126 F15 key
    vbKeyF16 127 F16 key

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Looking for list of keycodes.

    Or just open your Object Browser in the VB IDE by pressing F2 and type "KeyCodeConstants" into the search box. You will get a listing of all the key constants.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  5. #5
    Interweb adm/o/distrator Paul M's Avatar
    Join Date
    Nov 2006
    Location
    Australia, Melbourne
    Posts
    2,306

    Re: Looking for list of keycodes.

    There you go rob, outdoing everyone again

    MSDN suck
    MSDN doesn't have a list? That is weird.

  6. #6
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Looking for list of keycodes.

    Well I should say its most of the keycodes in just that one Type. But to get the others you can also search the Object Browser with just "vbKey" and it will get them all together in one list for you.

    Actually, there is always someone somewhere that will out do you as no one knows everything. I am still learning something every day.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  7. #7

    Thread Starter
    Hyperactive Member metalmidget's Avatar
    Join Date
    Mar 2007
    Location
    Melbourne, Australia
    Posts
    342

    Re: Looking for list of keycodes.

    Thanks to all, that list was what I really needed. Oh and Hell-Lord, I already had a line saying label1.caption = keycode so i could find a number for any key, but the problem was that this was a program i havent used for a while, and it was using something for keycode 93, and I couldn't remember what 93 was. I needed a list of everything so i could find out what a key is given its number.
    Nevertheless, looking on these lists there doesn't seem to be a 93, which would explain why I've tried most of the keys to no avail. Must just be an error, ill go change it to whatever it's meant to be.
    Thanks again,
    Metal

  8. #8
    PowerPoster Ellis Dee's Avatar
    Join Date
    Mar 2007
    Location
    New England
    Posts
    3,530

    Re: [RESOLVED] Looking for list of keycodes.

    KeyCode 93 is an undocumented key because it didn't really come into vogue until after VB6 was released. It's the context menu key, on the right of the spacebar next to the Start Menu key.

    Pressing it effectively simulates a mouse right click, but it doesn't actually send a right click. (Mainly because it is independent of the mouse location; it sends the equivalent of a right click at the keyboard's insertion point.)

    This is a great key to support, as all the users who it will affect will be very appreciative if you include it and very annoyed if you don't.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width