How to Simulate a key press likes function VOID keybd_event(
BYTE bVk, // virtual-key code
BYTE bScan, // hardware scan code
DWORD dwFlags, // function options
ULONG_PTR dwExtraInfo // additional keystroke data
);
in window API
How to do Simulate Key press in wxWindow wxwidgets ?
How to Simulate a key press likes function keybd_event()
-
- In need of some credit
- Posts: 8
- Joined: Fri Nov 10, 2006 9:37 am
- Location: Viet Name
Re: How to Simulate a key press likes function keybd_event()
the following worked for me without collateral damage.
Code: Select all
wxApp::OnInit()
{
...
Construct frame and canvas
...
other desired intitialization
frame->Show();
// see <wx/event.h>
wxKeyEvent kevent;
kevent.m_keyCode = 0; // replace 0 with the key you wish to send
frame->canvas->OnChar(kevent);
return true;
}
Last edited by doublemax on Sun Jan 31, 2016 10:06 pm, edited 1 time in total.
Reason: Added code tags
Reason: Added code tags
Re: How to Simulate a key press likes function keybd_event()
That would only work inside your own application.
The equivalent for keybd_event() under Windows would be wxUIActionSimulator:
http://docs.wxwidgets.org/trunk/classwx ... lator.html
The equivalent for keybd_event() under Windows would be wxUIActionSimulator:
http://docs.wxwidgets.org/trunk/classwx ... lator.html
Use the source, Luke!