key

This is a discussion on key within the Windows Programming forums, part of the Platform Specific Boards category; im new to windows programming. how do i make certain events trigger when user presses a certain key. like i ...

  1. #1
    Registered User
    Join Date
    Mar 2004
    Posts
    30

    key

    im new to windows programming. how do i make certain events trigger when user presses a certain key. like i want a square to be drawn on the window if user presses "s".

  2. #2
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    Typically you might handle WM_KEYDOWN to respond to keyboard input and do your drawing within your WM_PAINT message handler. You can use, for example, InvalidateRect or UpdateWindow in response to WM_KEYDOWN messages of interest to ensure painting occurs as you require.

    Draw the rectangle or square with, unsurprisingly, Rectangle.

    For more information on using WM_PAINT, start here.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 16
    Last Post: 11-23-2007, 01:48 PM
  2. Virtual keys
    By Arkanos in forum Windows Programming
    Replies: 4
    Last Post: 12-12-2005, 10:00 AM
  3. Directional Keys - Useing in Console
    By RoD in forum C++ Programming
    Replies: 38
    Last Post: 10-06-2002, 05:42 PM
  4. FAQ: Directional Keys - Useing in Console
    By RoD in forum FAQ Board
    Replies: 38
    Last Post: 10-06-2002, 05:42 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21