Solved

how to simulate a OnKeyDown event

Posted on 2000-05-13
1
249 Views
Last Modified: 2008-02-20
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
Comment
Question by:TropicalFish
1 Comment
 
LVL 22

Accepted Solution

by:
nietod earned 30 total points
ID: 2807176
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now