c# - How to programatically simulate a button press? -


how can simulate button press in .net?

i can autohotkey ease:

#persistent settimer,pressthekey,1000 return  pressthekey: send, {f5} return 

any application know button pressed (just pressed me). tried doing same with:

[dllimport("user32.dll", setlasterror = true)] public static extern uint sendinput(uint ninputs, input[] pinputs, int cbsize); 

or:

[dllimport("user32.dll")] static extern void keybd_event(byte bvk, byte bscan, uint dwflags, int dwextrainfo); 

or using windows input simulator (https://inputsimulator.codeplex.com/):

inputsimulator.keyboard.keydown(virtualkeycode.vk_h) 

they worked in notepad or other apps, never worked in full screen game. idea how can achieve it? solution simulates click globally on system level.

there lib out there called interceptor wrapper windows keyboard driver, there limitations - namely win8 or above not supported - , seems work on has ceased (11 months ago now). have if suits needs.

i've read somewhere there ways via directinput api - whether case i'm unsure. i've used interceptor few times , worked needs @ time.

hope helps

also link

edit: fixed links


Comments

Popular posts from this blog

java - pagination of xlsx file to XSSFworkbook using apache POI -

Unlimited choices in BASH case statement -

apache - How do I stop my index.php being run twice for every user -