Actually I had been googling for hours and I had found those web pages before I wrote my question here. Thanks for making the effort but unfortunately none of those code pieces are useful for me. They provide different codes, not the one I need for. For instance when I press the '7' and numeric '7' I get the same code (provided that NumLock is on). When the NumLock is off, pressing 'Home' and numeric '7' gives the same result, and because of that I cannot use them. I want to distinguish all the phisical buttons, including buttons in the numeric area, modifiers etc. independently from NumLock, CapsLock state.