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 7963133
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T05:32:32+00:00 2026-06-04T05:32:32+00:00

How do I simulate keystrokes when mouse is clicked in a legacy program. NOTE!

  • 0

How do I simulate keystrokes when mouse is clicked in a legacy program. NOTE! The program may not know that the mouse is clicked

I’m experimenting with

 IntPtr module = LoadLibrary("user32.dll");
 _mouseHookHandle = (HookType.MouseLowLevel, _mouseDelegate, module, 0);

and test to return -1 from the HookProc. But when I do so, SendInput don’t send my input to the application.
If I return the result from CallNextHookEx, SendInput works, but then the mouse click are sended to the legacy application to.

Background

We have a program that is controlled with a special keyboard. When pressing a key on the keyboard, it sends a sequence of ESC and letters. The program then performs an operation based on what the mouse is placed over the screen.

I am developing an on-screen keyboard so that you can control the application without this special keyboard. The user selects a button on-screen keyboard with the mouse. Then the user moves the mouse pointer to the object he wants to send the commando to, and then click again.
But that said, mouse click may not be passed on to the program, the program performs another operation at mouse click.

  • 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-06-04T05:32:33+00:00Added an answer on June 4, 2026 at 5:32 am

    As one of possible ways, you can use simple SendMessage to send any window messages directly to the target window. It can be used with windows of external application. (but you need to find the target window’s handle to use this function). In this way you can send any keyboard and mouse events as well.

    Ignoring mouse events is more difficult. You need to subclass that window, i.e. to attach your own custom window procedure to filter window messages. To achieve this, you need to inject your DLL into the controlled process.
    The overall task is quite complicated, it’s not a simple code snippet that you can copy-paste.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to simulate multiple embedded server devices that are typically used for motor
I'm looking to simulate a kiosk mode for Safari on Windows. OSX will not
Is it possible for a program to send keystrokes or messages to Windows 7
I want to simulate data changing in the model and having that data be
I know how to simulate a 2d array in a linear array using [x
How do i simulate and handle the server not responding error? And which case
Is it possible to simulate closures in PHP 5.2.x not using globals? I could
I want to Simulate a button click via JavaScript using a button's value, not
Write a program to simulate simple digital clock displaying HOURS(s) : MINUTES(s): SECOND(s) How
I'm trying to simulate an Android UI element that unfortunately doesn't exist in Windows

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.