Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Help with non-english keyboards

  1. Sep 19, 2010 #1
    Hi! I have a program I want to share with my friends, but they have hungarian computers, and I'm unable to detect some of the key presses. Can anyone provide a sample C++ or FreeBasic program that does the following:

    1)Waits for me to press a key I see on my keyboard
    2)Prints that key on my screen.
    3)Returns to part 1), and does so until ESC is pressed.

    That is all I'm asking. Even just showing me how to start would be great, although I'm not real good in C++. It's been driving me mad for a few hours now. I'm just unable to detect letters such as Á, Í, Ó, Ű, etc... Actually some of them do work using scan codes, but using what I have, the key for Í doesn't return any scan code. And some of the scan codes are different (e.g. for Ö it's 11 on my english keyboard, using alt-shift to change it to hungarian; and on a real hungarian keyboard it's 41). All I want is to see the key I pressed on my keyboard appear on the screen. Why is this so difficult? Even this forum can do it!

    Sorry for the tone it's just that this is supposed to be fairly simple, and I've been trying for hours now.

    Thanks for any help,
    -Tusike
     
  2. jcsd
  3. Sep 19, 2010 #2

    MysticDude

    User Avatar
    Gold Member

    Hi there. Now I'm not a C++ programmer or a FreeBasic programmer but I hope I can give you some insight on how to do this (if I understood it correctly, that is). Have you ever tried to http://windows.microsoft.com/en-US/windows-vista/Change-the-system-locale" The link I posted here gives you some information on what changing the locale does.

    "The system locale determines the default character set (letters, symbols, and numbers) and font that you use to enter information and that are used to display information in programs that do not use Unicode."*

    Hope I helped you a little.

    *From the link that I gave to you
     
    Last edited by a moderator: Apr 25, 2017
  4. Sep 19, 2010 #3
    I'm not sure that's what I'm looking for, I'll check it out tomorrow though. See my friends probably won't go through a lot of trouble to make sure my program works for them, they don't care that much:) When a key is pressed, the keyboard is supposed to return some sort of value that describes which key has been pressed; what I'm looking for is how Mozilla, Microsoft Word, and pretty much every program that is a bit advanced interpret the keyboard. E.g. in M$ Word, no one ever has a problem with the keyboard.
     
  5. Sep 19, 2010 #4

    MysticDude

    User Avatar
    Gold Member

    Okay, sorry for the misunderstanding. But if you change your locale, don't you think that the scan codes will also change as well? I'm new to this kind of thing, but I was only trying to help out :D.

    EDIT: When I say change your locale, I mean through your program, not necessarily through the control panel etc.
     
  6. Sep 19, 2010 #5
    You are probably right about that, and I'll test it out tomorrow when it's not 10 PM; but you see I don't want to have the readme file to the program say "Note: in order for this to work correctly, every time you wish to use this program change your locale to English (United States) & restart your computer".

    Of course what may work is for me to create two sets of ways the keyboard is interpreted; one for that and one for a hungarian locale. I must see if this works, thanks for the suggestion!
     
  7. Sep 19, 2010 #6

    MysticDude

    User Avatar
    Gold Member

    Well I hope that your program works! I'm not experienced in this field so don't expect me to be too much help XD.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook