c# - Simulate a keypress for X seconds -
here code use simulate tab-keypress in process:
[dllimport("user32.dll")] static extern bool postmessage(intptr hwnd, uint32 msg, int wparam, int lparam); public form1() { postmessage(memoryhandler.getmainwindowhandle(), (int)keycodes.wmessages.wm_keydown, (int)keycodes.vkeys.vk_tab, 0); initializecomponent(); }
is there way extend presses key (example) 1 second, instead of tapping it?
please note i'm not interested in thread.sleep()
solution blocks ui thread.
the repeating of keystroke when hold down feature that's built keyboard controller. microprocessor that's built keyboard itself. 8042 microcontroller traditional choice, keyboard device driver still carries name.
so, no, not done windows , postmessage() not going you. not problem, can emulate timer.
Comments
Post a Comment