Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6247653
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T12:54:55+00:00 2026-05-24T12:54:55+00:00

I am trying to capture when a user presses Ctrl + C in order

  • 0

I am trying to capture when a user presses Ctrl+C in order to copy some text to the clipboard. If the user deliberately presses and holds Ctrl… then presses C it will register.

procedure <anObject>.KeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
begin    
  if (ssCtrl in Shift) and (upcase(Char(key)) = 'C')
    then
      begin
        //Copy code    
      end;
end;

Is there a reason why this is happening?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T12:55:00+00:00Added an answer on May 24, 2026 at 12:55 pm

    Ctrl+C is translated to a character message. So you better use a OnKeyPress handler (which is fired in response to a WM_CHAR):

    procedure <anObject>.KeyPress(Sender: TObject; var Key: Char);
    begin
      if Key = ^C then
        begin
          // Copy code
        end;
    end;
    

    update:
    I believe what’s happening is this: when pressing quickly, the user is pressing ‘Ctrl’, then pressing ‘C’, then releasing ‘Ctrl’, lastly releasing ‘C’. As you can see when the OnKeyUp for ‘C’ is fired the ‘Ctrl’ key is already released. You won’t have this kind of problem with the translated message, if the OS registered the ‘copy’ key then OnKeyPress will be fired.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to capture the text on Ctrl + V event as below..
I'm working on a web application where I'm trying to capture when the user
I'm trying to start a text editor (nano) from inside Python, have the user
In Android, I'm trying to capture user touches as well as User long-touches. I
I am trying to capture the day of the month from the user and
I am trying to let a user capture an image and add it onto
I'm trying to capture the event when the user clicks an Android Market url
I am trying to capture Window's active window changed event. Let's say if user
I am trying to capture user input in Go with little luck. I can
I've been trying to capture the values that a user enters into a datagrid

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.