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 6989277
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:11:27+00:00 2026-05-27T19:11:27+00:00

In my application, when I press CTRL + S , my form (with Key

  • 0

In my application, when I press CTRL + S, my form (with Key Preview enabled) captures this and saves the document. But when the focus is in, for example, an edit control, I get an annoying “Ding” sound, or in general, windows sounds. How do I avoid this sound?

Here’s my form’s capture of this key event…

procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
var
  C: String;
begin
  if not fChanging then
    Modified;
  if ssCtrl in Shift then begin
    C:= LowerCase(Char(Key));
    if C = 's' then begin
      DoSave;
      Key:= 0; //Tried this but didn't work
    end else
    if C = 'c' then begin
      //Copy selected item(s)
    end;
  end;
end;

PS – Is there a more standard way of capturing these events? Because I’m sure I’m doing something wrong, and I’m sure there’s another way I should be getting these key events without sounds.

  • 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-27T19:11:28+00:00Added an answer on May 27, 2026 at 7:11 pm

    A couple of things:

    • Try putting your code into FormKeyPress instead of FormKeyDown. This will make the Key := 0; code work… You will need to handle the CTRL checking manually though, by using something like GetKeyState() (I originally had GetAsyncKeyState() here, but as Rob Kennedy points out, GetKeyState() is a much better option).
    • Use an Action instead. Plop a TActionList on your form, double click on it, add an action and set it’s hot key to CTRL-S. Add your save code to it’s OnExecute event handler. This is the “proper” way to do it I believe.

    Hope this helps.

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

Sidebar

Related Questions

In other terminals I would press Ctrl+z to suspend an application, often to then
i am working in an application and I press key from keyboard, how can
When I press F5 , my web application starts up and runs, but the
Most of the functions in my WinForms application have a key press alternative. There
I need an example of an iPhone application that uses the long press option.
I have am facing browser issue - in an application, when I press CTRL
On running my window application. if the user press ctrl+alt+del i need to disable
I've got a simple window form application that turns on capslock when I press
Plenty of applications seem to do this. For example, go to Apple's mail application
In my application has a ListView. When long press on item the Context Menu

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.