Solved

how to simulate a OnKeyDown event

Posted on 2000-05-13
1
256 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

627 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