Virtual KEY Codes 0 - 9 menu

User Tag List

Results 1 to 10 of 10
  1. #1
    luciferc's Avatar Contributor
    Reputation
    90
    Join Date
    Jul 2008
    Posts
    373
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Virtual KEY Codes 0 - 9

    So in C# i was sending Input from my Bot > the Game and can't seem to get
    the top (0-9) And (-)(=)on the Top of the Keyboard for the Action Bars.

    0x30 - 0x39 is what The MSDN Showed for the Virtual keys but it doesn't work.

    EX:
    0x30 - 0
    0x31 - 1
    Code:
    SendInput(1, 0x30, Marshal.SizeOf(input[0]));
    For 0x31 it sends an empty space instead of 1...
    For 0x30 it sends the 'B' Key and opens up my Bags...

    So what are the real Virtual Keys if it anything to consolation i am use a saitech keyboard w/ Driver if that ****s it up @ all.

    Virtual KEY Codes 0 - 9
  2. #2
    Cypher's Avatar Kynox's Sister's Pimp
    Reputation
    1356
    Join Date
    Apr 2006
    Posts
    5,368
    Thanks G/R
    0/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Your keyboard has nothing to do with it.

    I personally use the virtual keys defined in the Windows headers. (ie VK_BLAH). I have previously had no problem sending and relaying the keys you're having trouble with. The only keys I've had trouble with are the OEM style ones.

    Could you please provide some source code so I could get a better idea of what you're doing and so I can modify and test it.

  3. #3
    luciferc's Avatar Contributor
    Reputation
    90
    Join Date
    Jul 2008
    Posts
    373
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay.
    Here it is. (C# 200

    Code:
    void press(int scanCode)
            {
                sendKey(scanCode, true);
            }
            void release(int scanCode)
            {
                sendKey(scanCode, false);
            }
            private void sendKey(int scanCode, bool press)
            {
                KEYBOARD_INPUT[] input = new KEYBOARD_INPUT[1];
                input[0] = new KEYBOARD_INPUT();
                input[0].type = INPUT_KEYBOARD;
                input[0].flags = KEY_SCANCODE;
    
                if ((scanCode & 0xFF00) == 0xE000)
                { // extended key?
                    input[0].flags |= KEY_EXTENDED;
                }
    
                if (press)
                { // press?
                    input[0].scanCode = (ushort)(scanCode & 0xFF);
                }
                else
                { // release?
                    input[0].scanCode = (ushort)scanCode;
                    input[0].flags |= KEY_UP;
                }
                uint result = SendInput(1, input, Marshal.SizeOf(input[0]));
                if (result != 1)
                {
                    throw new Exception("Could not send key: " + scanCode);
                }
            }
    const uint INPUT_KEYBOARD = 1;
            const int KEY_EXTENDED = 0x0001;
            const uint KEY_UP = 0x0002;
            const uint KEY_SCANCODE = 0x0008;
            [StructLayout(LayoutKind.Sequential)]
            private struct KEYBOARD_INPUT
            {
                public uint type;
                public ushort vk;
                public ushort scanCode;
                public uint flags;
                public uint time;
                public uint extrainfo;
                public uint padding1;
                public uint padding2;
            }
            [DllImport("User32.dll")]
            private static extern uint SendInput(uint numberOfInputs, [MarshalAs(UnmanagedType.LPArray, SizeConst = 1)] KEYBOARD_INPUT[] input, int structSize);

  4. #4
    Apoc's Avatar Angry Penguin
    Reputation
    1387
    Join Date
    Jan 2008
    Posts
    2,750
    Thanks G/R
    0/12
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    For the love of god, when will you people realize that System.Windows.Forms.Keys is the FULL VK_KEYS list in an easy to use enum?

    (int)Keys.D0
    (int)Keys.D1
    etc...

    Not hard!

  5. #5
    kynox's Avatar Account not activated by Email
    Reputation
    830
    Join Date
    Dec 2006
    Posts
    888
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Apoc View Post
    For the love of god, when will you people realize that System.Windows.Forms.Keys is the FULL VK_KEYS list in an easy to use enum?

    (int)Keys.D0
    (int)Keys.D1
    etc...

    Not hard!
    Cypher would have a hernia trying to use those, you difficult poc!

  6. #6
    Cypher's Avatar Kynox's Sister's Pimp
    Reputation
    1356
    Join Date
    Apr 2006
    Posts
    5,368
    Thanks G/R
    0/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by kynox View Post
    Cypher would have a hernia trying to use those, you difficult poc!

    Wtf are you on about jewfag.

    I've used the enum apoc is talking about before, and besides, I was referring to C++ so the enum isn't available.

    In short: You fail.

  7. #7
    luciferc's Avatar Contributor
    Reputation
    90
    Join Date
    Jul 2008
    Posts
    373
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Charmander mind telling me whats wrong?

  8. #8
    Cypher's Avatar Kynox's Sister's Pimp
    Reputation
    1356
    Join Date
    Apr 2006
    Posts
    5,368
    Thanks G/R
    0/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Your code is reeeaaaly ugly. I don't care enough to want to decipher it. Rewrite it properly and I'll take another look.

  9. #9
    Shynd's Avatar Contributor
    Reputation
    97
    Join Date
    May 2008
    Posts
    393
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    First off, you're creating your KEYBOARD_INPUT in a really ****ing odd way. Why are you creating an array of KEYBOARD_INPUT and then only using the zeroth index? Why not just create one KEYBOARD_INPUT structure and use that?

    Secondly, you're passing the wrong kind of structure to SendInput. You need to send a normal INPUT structure, inside which is a pointer to your KEYBOARD_INPUT structure. Maybe you should have looked it up on pinvoke.net first.

    pinvoke.net: SendInput (user32)

  10. #10
    goderion's Avatar Active Member
    Reputation
    25
    Join Date
    Oct 2008
    Posts
    54
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello.

    I use something like this, if i want to know the code of a specific key.

    This is C++, but i guess it would be easy to port it to C#.
    Code:
    void CheckKeys()
    {
    	int i;
    	int run;
    
    	run = 1;
    
    	while(run)
    	{
    		for(i = 0; i < 256; ++i)
    		{
    			if( GetKeyState(i) & 0x80 )
    			{
    				cout << "Key " << i << " pressed" << endl;
    
    				if(27 == i) // 27 = ESC
    				{
    					run = 0;
    				}
    			}
    		}
    
    		Sleep(40);
    	}
    }
    I dont really know, if this could tell you the correct keycodes to use with the SendInput function, but i guess its worth a try. ^^

Similar Threads

  1. [Buying] Microsoft Office Key Code
    By Praesto in forum General Trading Buy Sell Trade
    Replies: 0
    Last Post: 04-17-2012, 10:18 AM
  2. [Selling] Diablo 3 Beta Key Code for SALE
    By asvestis123 in forum General MMO Buy Sell Trade
    Replies: 4
    Last Post: 03-20-2012, 08:10 AM
  3. [Selling] Diablo 3 Beta Key Code for 75$ only!!!
    By asvestis123 in forum General MMO Buy Sell Trade
    Replies: 0
    Last Post: 03-15-2012, 08:49 AM
  4. [Selling] WTS Vanilla Key Code For Trading or Tipping account only ( Good For Gold Farmer ! )
    By Berta in forum World of Warcraft Buy Sell Trade
    Replies: 10
    Last Post: 10-06-2011, 08:37 PM
  5. [Selling] Cata key code EU
    By olari in forum World of Warcraft Buy Sell Trade
    Replies: 7
    Last Post: 01-04-2011, 11:05 AM
All times are GMT -5. The time now is 03:05 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search