• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 262
  • Last Modified:

how to simulate a OnKeyDown event

How can I simulate a OnKeyDown event in C++ Builder 4? Basically I want my program to think that I pressed a certain key on the keybord when I click a TButton for example.
0
TropicalFish
Asked:
TropicalFish
1 Solution
 
nietodCommented:
Often it is best not to even try that.  Instead you should try to move the code that responds to the key to a seperate function.  Then you can call this function when the button is pressed or when the key is typed.  

That is likely to be the best solution.  However, you could use the keybd_event() function to "simulate" the pressing of the key.  This is a windows API function and it is documented in the windows help.  

Let me know if you have any questions.
0

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now