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:
- Press the F3 button.
- Press the right-arrow key 3 times.
- Press the space button.
- Type letter 'E' on the keyboard.
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?