Results 1 to 2 of 2

Thread: Key pressing for a newbie

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Oct 2005
    Posts
    19

    Key pressing for a newbie

    Hello, I'm working on a game and I realized that the KeyPress event of the PictureBox (I feel as KeyPress is a not-so-good-choice-to-use-keys) is slow and not good for what I'm doing.

    What is the best choice to have detection of keys pressed quickly and continuatively without big gaps when changing key?

    Example: imagine I must make a square moving in a picturebox. In my newbie way I would set the 8 movements to my favourite keys, and ok. The problem is that this way is slow and when I move it down, keeping the key pressed and then I press right releasing down, it takes much. I'd love to make it to change "instantly" direction.

    Another thing:
    what is - if it is related - the DirectInput?

    Thanks a lot!

  2. #2
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: Key pressing for a newbie

    DirectInput is one good way, that I use, but the proper VB method to allow yourself to have more control without relying on DirectX would be this

    http://www.vbforums.com/attachment.p...chmentid=36571

    And there's also the GetAsyncKeyState API

    http://www.mentalis.org/apilist/GetAsyncKeyState.shtml

    Learn how these work, before jumping into DirectInput.

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