Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Using DirectInput

Using DirectInput

Scheduled Pinned Locked Moved Visual Basic
tutorialquestionc++graphics
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Klazen
    wrote on last edited by
    #1

    Hey all, I am attempting to create a program that runs in the background, takes keypresses from the keyboard, changes the keypresses to different keys, and sends the new key to the program running in the foreground (for example: I press "A" and the program in the foreground gets "F"). I thought that DirectInput would be the best way to go about this. However, I cannot seem to initialize the program correctly. I want to use the below code to gain control of the keyboard: Dim keyboard = New Microsoft.DirectX.DirectInput.Device() keyboard.Acquire() However, "Microsoft.DirectX.DirectInput.Device" wants the guid of the keyboard passed to it as an argument, and I cannot find out how to get this. So, How can I find the guid of the keyboard? I have looked all over the internet for the way to do this, but all I can find is information about directx8 or code in C++. Also, while I am asking, will this program prevent the actual keypresses from getting to the program in the foreground? Using the example from above, if this program can't hide the actual keypresses, then the program in the foreground would get "AF", instead of just "F". Thanks for taking the time to help me. NOTE: I am using Visual Basic 2005 Express Edition.

    V D U 3 Replies Last reply
    0
    • K Klazen

      Hey all, I am attempting to create a program that runs in the background, takes keypresses from the keyboard, changes the keypresses to different keys, and sends the new key to the program running in the foreground (for example: I press "A" and the program in the foreground gets "F"). I thought that DirectInput would be the best way to go about this. However, I cannot seem to initialize the program correctly. I want to use the below code to gain control of the keyboard: Dim keyboard = New Microsoft.DirectX.DirectInput.Device() keyboard.Acquire() However, "Microsoft.DirectX.DirectInput.Device" wants the guid of the keyboard passed to it as an argument, and I cannot find out how to get this. So, How can I find the guid of the keyboard? I have looked all over the internet for the way to do this, but all I can find is information about directx8 or code in C++. Also, while I am asking, will this program prevent the actual keypresses from getting to the program in the foreground? Using the example from above, if this program can't hide the actual keypresses, then the program in the foreground would get "AF", instead of just "F". Thanks for taking the time to help me. NOTE: I am using Visual Basic 2005 Express Edition.

      V Offline
      V Offline
      Vasudevan Deepak Kumar
      wrote on last edited by
      #2

      http://geekswithblogs.net/clingermangw/articles/84666.aspx[^]

      Vasudevan Deepak Kumar Personal Homepage Tech Gossips

      1 Reply Last reply
      0
      • K Klazen

        Hey all, I am attempting to create a program that runs in the background, takes keypresses from the keyboard, changes the keypresses to different keys, and sends the new key to the program running in the foreground (for example: I press "A" and the program in the foreground gets "F"). I thought that DirectInput would be the best way to go about this. However, I cannot seem to initialize the program correctly. I want to use the below code to gain control of the keyboard: Dim keyboard = New Microsoft.DirectX.DirectInput.Device() keyboard.Acquire() However, "Microsoft.DirectX.DirectInput.Device" wants the guid of the keyboard passed to it as an argument, and I cannot find out how to get this. So, How can I find the guid of the keyboard? I have looked all over the internet for the way to do this, but all I can find is information about directx8 or code in C++. Also, while I am asking, will this program prevent the actual keypresses from getting to the program in the foreground? Using the example from above, if this program can't hide the actual keypresses, then the program in the foreground would get "AF", instead of just "F". Thanks for taking the time to help me. NOTE: I am using Visual Basic 2005 Express Edition.

        D Offline
        D Offline
        Dave Kreskowiak
        wrote on last edited by
        #3

        You don't need DirectX or DirectInput for this. Just write a Global Keyboard Hook. Search the articles for "keybook hook", or Google for "VB.NET Global Keyboard Hook" and you'll find lots of resources.

        A guide to posting questions on CodeProject[^]
        Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
             2006, 2007

        1 Reply Last reply
        0
        • K Klazen

          Hey all, I am attempting to create a program that runs in the background, takes keypresses from the keyboard, changes the keypresses to different keys, and sends the new key to the program running in the foreground (for example: I press "A" and the program in the foreground gets "F"). I thought that DirectInput would be the best way to go about this. However, I cannot seem to initialize the program correctly. I want to use the below code to gain control of the keyboard: Dim keyboard = New Microsoft.DirectX.DirectInput.Device() keyboard.Acquire() However, "Microsoft.DirectX.DirectInput.Device" wants the guid of the keyboard passed to it as an argument, and I cannot find out how to get this. So, How can I find the guid of the keyboard? I have looked all over the internet for the way to do this, but all I can find is information about directx8 or code in C++. Also, while I am asking, will this program prevent the actual keypresses from getting to the program in the foreground? Using the example from above, if this program can't hide the actual keypresses, then the program in the foreground would get "AF", instead of just "F". Thanks for taking the time to help me. NOTE: I am using Visual Basic 2005 Express Edition.

          U Offline
          U Offline
          User 3303935
          wrote on last edited by
          #4

          You can find the keyboard's guid on here:

          Microsoft.DirectX.DirectInput.SystemGuid.Keyboard
          

          In other words, you should create your dxkeyboard object like the following example:

          Protected mKeyboard As Microsoft.DirectX.DirectInput.Device = Nothing
          mKeyboard = New Microsoft.DirectX.DirectInput.Device(Microsoft.DirectX.DirectInput.SystemGuid.Keyboard) 
          

          Sincerilly yours. Manusoftar®

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups