I need a function that returns the name of a key directly from the keyboard, eg, the input of '32' would return 'Space'.

I know there is a function that does this, but I can't figure out which one.

Recommended Answers

All 2 Replies

Nope, not as far as I know, you will just have to create a function to return the right values, this could be a start:

string getValueName(char vk) {
  string name;

  if ( vk >= '0' && vk <= '9' ) {
    name.push_back( vk );
    return name;
  }

  switch ( vk ) {
    case VK_SPACE:  return "Space";
    case VK_SHIFT:  return "Shift";
    // ... more cases
  }

  return "";
}

I need a function that returns the name of a key directly from the keyboard, eg, the input of '32' would return 'Space'.

I know there is a function that does this, but I can't figure out which one.

I know this is knit picking but....You can't get the name of the key "directly" from the keyboard, its generally via the operating system's kernel....I know knit picking

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.