Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 504461
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:29:57+00:00 2026-05-13T06:29:57+00:00

I need to interact with an external application running, and send specific keypresses &

  • 0

I need to interact with an external application running, and send specific keypresses & releases. I’ve tried to use the SendKeys class, but it does only half of the job, as the keypress is being sent with an immediate keyrelease to the external applications.

I need to be able to simulate a “key hold down” for the external app. I’m now trying to use the SendMessage thing, but for now it won’t work at all 🙁 and I don’t even get errors.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T06:29:58+00:00Added an answer on May 13, 2026 at 6:29 am

    Ok, case solved. I actually installed VC++ to try the core keybd_event() function, and after it worked I was able to use it wisely in C#.

    Here’s the code, and surprisingly it’s very simple. You’ll need to add this using to your code to be able to import dll’s: using System.Runtime.InteropServices;

    This code will press and hold the ‘1’ button for 3 secs, and then will release for 1 second and repeat the process.

    (the code highlight got messed up :/, copy from ‘namespace …’ to the last bracket ‘}’)

    public class Program 
    { 
        [DllImport("user32.dll")] 
        private static extern void keybd_event(byte bVk, byte bScan, 
            uint dwFlags, UIntPtr dwExtraInfo);
    
        private static void Main(string[] args)
        {            
            while (true)
            {
                keybd_event((byte)0x31, (byte)0x02, 0, UIntPtr.Zero);
                Thread.Sleep(3000);
    
                keybd_event((byte)0x31, (byte)0x82, (uint)0x2, UIntPtr.Zero);
                Thread.Sleep(1000);
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Almost all the activities in my application need to interact with a web server
My web application stores external website login/passwords for interaction with them. To interact with
I don't know C, but need to interact with some C files in a
I need to start external executable in such way that user can interact with
in an application I'm working on, I need to interact with iPhone's AddressBook. Currently,
I am developing an application which need to interact with 2003, 2007, 2010 versions
To interact with an external data feed I need to pass a rolling security
I need to organize windows service which should interacts with applications next way: Application
We are in need of a small application that interacts with facebook. Whether integrated
I am developing program which need to interact with COM ports. By learning from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.