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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:42:58+00:00 2026-05-28T00:42:58+00:00

I’m attempting to emulate user clicking and mouse-moving, specifically in Mozilla Firefox, in a

  • 0

I’m attempting to emulate user clicking and mouse-moving, specifically in Mozilla Firefox, in a Windows 7 environment. The solution I frankensteined together from various tutorials, forum posts, and MSDN documents works for 99% of Windows Applications out there, but it won’t work for Firefox 8.0.

From my preliminary research, the most accurate (low-level) way of emulating keyboard and mouse input in Windows is to use the SendInput function from the User32.dll Windows Library. To test this, I wrote a short C# program to loop through and make a call to SendInput that creates a programmatic mouse-click every 5 seconds, no matter where the mouse cursor is on screen.

Once running, the program perfectly emulates a mouseclick for almost every application window I switch focus to, even including the Windows interface itself (Start Button, Taskbar, Windows Explorer, etc.), but no programmatic mouse-clicks occur when I bring the cursor into a Mozilla Firefox Window.

In order to get a better handle on what was happening under the hood, I booted up Microsoft Spy++ and began inspecting what messages were actually getting passed to the Firefox window’s message queue. Sure enough, the Firefox window would receive no messages even though my cursor would be situated directly above it while it had focus. When I manually clicked my mouse, the Firefox Spy++ listener would then go nuts and display the full “nHittest:HTCLIENT wMouseMsg:WM_LBUTTONDOWN” that I saw when observing other applications’ correct responses to my emulation program.

Can anyone provide an explanation for how/why Mozilla Firefox is one of the only applications that does not even receive any messages at all from the SendInput function and perhaps a suggestion for how to overcome this?

Source Code
(Imports/external references removed for clarity):

static void Main(string[] args)
{
    for (; ; )
    {
        System.Threading.Thread.Sleep(5000);
        INPUT[] inp = new INPUT[2];
        inp[0].type = INPUT_MOUSE;
        inp[0].mi = createMouseInput(0, 0, 0, 0, MOUSEEVENTF_LEFTDOWN);
        inp[1].type = INPUT_MOUSE;
        inp[1].mi = createMouseInput(0, 0, 0, 0, MOUSEEVENTF_LEFTUP);
        SendInput((uint)inp.Length, inp, Marshal.SizeOf(inp[0].GetType()));
    }
}

private static MOUSEINPUT createMouseInput(int x, int y, uint data, uint t, uint flag)
{
    MOUSEINPUT mi = new MOUSEINPUT();
    mi.dx = x;
    mi.dy = y;
    mi.mouseData = data;
    mi.time = t;
    mi.dwFlags = flag;
    return mi;
}

[StructLayout(LayoutKind.Sequential)]
struct MOUSEINPUT
{
    public int dx;
    public int dy;
    public uint mouseData;
    public uint dwFlags;
    public uint time;
    public IntPtr dwExtraInfo;
}

[StructLayout(LayoutKind.Explicit)]
private struct INPUT
{
    [FieldOffset(0)]
    public int type;
    [FieldOffset(sizeof(int))] //[FieldOffset(8)] for x64
    public MOUSEINPUT mi;
    [FieldOffset(sizeof(int))] //[FieldOffset(8)] for x64
    public KEYBDINPUT ki;
    [FieldOffset(sizeof(int))] //[FieldOffset(8)] for x64
    public HARDWAREINPUT hi;
}
  • 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-28T00:42:58+00:00Added an answer on May 28, 2026 at 12:42 am

    Did you run your program as an administrator? It could be an UIPI, i.e. integrity level issue.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
Specifically, suppose I start with the string string =hello \'i am \' me And
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string

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.