How to get the hexadecimal-value of a key in KeyPress?

Posted on 2006-05-16
Last Modified: 2010-05-18
I have been looking for hours to get the hexadecimal-value of a key pressed shown in my statusbar
I made this:

  fLastKey : word

procedure TDSP3270.KeyPress(var Key: Char);
    fLastKey := key ;

[Error] DSP3270.pas(414): Incompatible types: 'Word' and 'Char'

Is it possible to convert a char to a word?

Question by:peterkiers
    LVL 28

    Accepted Solution

    Hi peterkiers,

    yes it is: fLastKey := ord(key);
    but in your case, word represents a scancode, and key is the character (will not catch shift, Fx's, alt, etc)
    I will repond to your otehr question shortly.

    LVL 1

    Author Comment


    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
    Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
    This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now