Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C# 

C# Keypress and keysend

Hello, pretty new to c# so i wan wondering if i could get some help
basically what i would like to do is check for a key press lets say for example "i"
if "i" is pressed i want to then simulate a keypress(keysend) of another key for example "c".

Desired output would be
if i is pressed
simulate c is pressed aswell

Anyone got any idea's?
No idea what are you trying to do, but this should work:

PHP Code

<?php 
private void Form1_KeyPress(object sender, KeyPressEventArgs e)
{
    if (
e.KeyCode == Keys.I)
    {
        
//do something, for instance SendKeys.Send("C")
    
}
} 
I would map them to a dictionary<keys, char/string> instead of a huge if statement.
Check keys in or outside the program?
(Apr 30, 2017 02:46 PM)Finn. Wrote:  Check keys in or outside the program?

a blanket check, pretty much not application specific.


(Apr 30, 2017 12:47 PM)Zilog80 Wrote:  No idea what are you trying to do, but this should work:

PHP Code

<?php 
private void Form1_KeyPress(object sender, KeyPressEventArgs e)
{
    if (
e.KeyCode == Keys.I)
    {
        
//do something, for instance SendKeys.Send("C")
    
}
} 
thanks for the help, however i think i am going to use the keybd_event from user32.dll
try this ?

ttps://hackforums.net/showthread.php?tid=5579335&pid=54386164#pid54386164


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C#] by agoSwitchDec 27, 2021 08:53 AM 6 296 Dec 27, 2021 08:53 AM
Last Post: oje28830
[.NET] by InterGalacticMar 11, 2019 02:44 AM 6 280 Mar 11, 2019 02:44 AM
Last Post: InterGalactic
[.NET] by ChristmasNoobJan 28, 2019 03:21 PM 1 165 Jan 28, 2019 03:21 PM
Last Post: HeadHoncho