Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Get keyboard button?  (Read 2092 times)

0 Members and 1 Guest are viewing this topic.

Chay Hawk

  • Full Member
  • ***
  • Posts: 101
    • View Profile
    • Email
Get keyboard button?
« on: October 04, 2014, 08:17:27 pm »
I was wondering if there was a way to get whatever key was pressed without having to program them all into my program. I'm making a keylogger for personal use and I would like to know if there is an easier solution to this or do I have to program in all of the keys myself.

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
Re: Get keyboard button?
« Reply #1 on: October 04, 2014, 08:35:37 pm »
What exactly do you mean? The keyboard event's data will include the key code. Or do you mean some way to get a textual representation of the key (i.e. key code to string)?

Chay Hawk

  • Full Member
  • ***
  • Posts: 101
    • View Profile
    • Email
Re: Get keyboard button?
« Reply #2 on: October 04, 2014, 08:41:43 pm »
Well, I mean if i press a button I want it to output whatever key was pressed to a text file without me having to hard code every key on the keyboard.

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: Get keyboard button?
« Reply #3 on: October 04, 2014, 08:44:14 pm »
You really need to answer Mario's question. We aren't mind readers here and can't know the output you want.
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

Chay Hawk

  • Full Member
  • ***
  • Posts: 101
    • View Profile
    • Email
Re: Get keyboard button?
« Reply #4 on: October 04, 2014, 08:49:05 pm »
What i want to do is be able to press a button on my keyboard and have SFML figure out by itself which key I pressed, I dont want to code all buttons on my keyboard, then output a string representation of that key to a text file.

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: Get keyboard button?
« Reply #5 on: October 04, 2014, 08:56:09 pm »
You know what? What is clear that you want to yourself is not clear to other people when you continue to write very ambiguous replies even when asked to clarify what you mean. Mario gave you very clear choices.

What exactly do you mean? The keyboard event's data will include the key code. Or do you mean some way to get a textual representation of the key (i.e. key code to string)?

That said, if you want the textual representation of the key take a look at Thor.
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: Get keyboard button?
« Reply #6 on: October 04, 2014, 09:39:52 pm »
Have you looked at the TextEntered event? That sounds like what you're trying to ask for, since it returns a Unicode code point instead of a key code.

 

anything