recognizing function key

Discussion in 'C' started by dssr, Jul 15, 2008.

  1. dssr

    dssr New Member

    Joined:
    Feb 16, 2008
    Messages:
    26
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Programming
    Location:
    Kolkata
    can any one tell me how to recognize a function key in C, i mean function key does not have any ASCII value, so if i want to execute a command after pressing a function key then how can i do that??
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    Write your WndProc and see if it gets called for the Fn Keypress. If yes check out the code in Msg.
     
  3. dssr

    dssr New Member

    Joined:
    Feb 16, 2008
    Messages:
    26
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Programming
    Location:
    Kolkata
    can you be more specific??
    I have searched everywhere for function key equivalent
    Even I have typed a program for finding the ASCII you press a key and corresponding ASCII value will be shown on the screen
    In that program too the ASCII code is not showing

    So is there any other method with which i can recognize ascii code
     
  4. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,009
    Likes Received:
    203
    Trophy Points:
    63
    Occupation:
    Senior Support Engineer
    Location:
    England
    What operating system are you using? It's not the same for all.
     
  5. dssr

    dssr New Member

    Joined:
    Feb 16, 2008
    Messages:
    26
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Programming
    Location:
    Kolkata
    simple windows xp, i know it's different for Mac and other, but i dont think function key has any ascii code for any of them donno about UNICODE, have not searched

    but as i want to implement using C then i have to do it in ascii code, aint it?
     
  6. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,009
    Likes Received:
    203
    Trophy Points:
    63
    Occupation:
    Senior Support Engineer
    Location:
    England
    No. ASCII is a characterset and has nothing to do with reading the keyboard. Some of the values correspond but that's about it.
    Have a look at Get KeyState and GetAsyncKeyState in the Windows API reference. The key name constants begin with VK_, so the keycode for F1 is VK_F1. Innit.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice