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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:22:21+00:00 2026-06-13T08:22:21+00:00

I need to programmatically enter one character into a cell of a Delphi grid

  • 0

I need to programmatically enter one character into a cell of a Delphi grid (in other application).

In order to do this manually, following steps are required:

  1. Press the F3 button.
  2. Press the right-arrow key 3 times.
  3. Press the space button.
  4. Type letter ‘E’ on the keyboard.
  5. Press the right-arrow key.

     // Press F3 button         
     keybd_event(VK_F3, 0, 0, 0);         
     // Press right arrow key 3 times
     keybd_event(VK_RIGHT, 0, 0, 0);
     keybd_event(VK_RIGHT, 0, 0, 0);
     keybd_event(VK_RIGHT, 0, 0, 0);
    
     // Press the space button
     keybd_event(VK_SPACE, 0, 0, 0);
    
     // Type letter E
     keybd_event(Ord('E'), 0, 0, 0);
    
     // Move to the right
     keybd_event(VK_RIGHT, 0, 0, 0);
    

But it doesn’t work. When I run this code, nothing seems to happen.

How should I modify this code so that it actually simulates user input?

  • 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-06-13T08:22:22+00:00Added an answer on June 13, 2026 at 8:22 am

    Each key press is a key down and then a key up. So you need two calls to keybd_event per key press. For example, to press F3:

    keybd_event(VK_F3, 0, KEYEVENTF_KEYDOWN, 0);
    keybd_event(VK_F3, 0, KEYEVENTF_KEYUP, 0);
    

    Note that KEYEVENTF_KEYDOWN isn’t actually defined by the Windows header files, or the Delphi translation. Define it to be 0. It makes the code clearer written out explicitly though.

    Naturally you would not litter your code with paired calls to keybd_event. But instead you would wrap up the paired calls into a helper function.

    It’s possible that in some situations you would need to specify the second parameter, the scan code. But it’s often not necessary.

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

Sidebar

Related Questions

I need to programmatically install (In Ubuntu) few hundreds of fonts for my application
I need to programmatically start an android application on a specified remote emulator. I
I need to programmatically minimize and maximize a fullscreen 16bit application. Unfortunately DosBox is
I need to programmatically select a UITableViewCell, I have tried this: NSIndexPath *selectedCellIndexPath =
I need to programmatically insert a row into an Excel Spreadsheet multiple times. I
I am creating a C# Windows Mobile application that I need to programmatically invoke
I need to programmatically create a shortcut using C++. How can I do this
I need to programmatically set text into TextBox and catch event when text was
I need to programmatically set up a node reference field. My module successfully creates
I need to programmatically modify the Access Descriptors on a known Registry key during

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.