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

  • Home
  • SEARCH
  • 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 7613277
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T02:07:01+00:00 2026-05-31T02:07:01+00:00

class DoubleClickHover : Form { Thread T1; System.Timers.Timer timer = new System.Timers.Timer(4000); //3 seconds

  • 0
class DoubleClickHover : Form
{
    Thread T1;
    System.Timers.Timer timer = new System.Timers.Timer(4000); //3 seconds

    public DoubleClickHover()
    {
        T1 = new Thread(new ThreadStart(DoubleClickEvent));
        timer.Elapsed += new ElapsedEventHandler(timer_Elapsed);
    }

    #region Timer Mouse Double Click event

    //Here, the timer for Timer click event will start when mouse hovers over an area
    private void form_MouseHover(object sender, System.EventArgs e)
    {
        timer.Start();
    }

    private void form_MouseLeave(object sender, System.EventArgs e)
    {
        timer.Stop();
    }

    void timer_Elapsed(object sender, ElapsedEventArgs e)
    {
        timer.Stop();
        DoubleClickEvent();
    }

    //This method allows the user to click a file/folder by hovering/keeping still the mouse for specified time
    public void DoubleClickEvent()
    {
        // Set the cursor position
        // System.Windows.Forms.Cursor.Position();

            DoClickMouse(0x2);      // Left mouse button down
            DoClickMouse(0x4);      // Left mouse button up
            DoClickMouse(0x2);      // Left mouse button down
            DoClickMouse(0x4);      // Left mouse button up  

    }

    static void DoClickMouse(int mouseButton) 
    {
        var input = new INPUT()
        {
            dwType = 0, // Mouse input
            mi = new MOUSEINPUT() { dwFlags = mouseButton }
        };

       if (SendInput(1, input, Marshal.SizeOf(input)) == 0)
        {
            throw new Exception();
        }
    }
    [StructLayout(LayoutKind.Sequential)]
    struct MOUSEINPUT
    {
        int dx;
        int dy;
        int mouseData;
        public int dwFlags;
        int time;
        IntPtr dwExtraInfo;
    }
    struct INPUT
    {
        public uint dwType;
        public MOUSEINPUT mi;
    }
    [DllImport("user32.dll", SetLastError = true)]
    static extern uint SendInput(uint cInputs, INPUT input, int size);

    #endregion
}

error:

A call to PInvoke function ‘DoubleClickHover::SendInput’ has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.

please help.
thank u

  • 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-31T02:07:02+00:00Added an answer on May 31, 2026 at 2:07 am

    Yes, your definition of SendInput is wrong. The second parameter is a pointer to a structure, which you need to declare as being passed by reference:

    [DllImport("user32.dll", SetLastError = true)]
    static extern uint SendInput(uint nInputs, ref INPUT pInputs, int cbSize);
    

    Alternatively you could declare pInputs as an array (since that’s what it really is):

    [DllImport("user32.dll", SetLastError = true)]
    static extern uint SendInput(uint nInputs, INPUT[] pInputs, int cbSize);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

class ZiggyTest{ public static void main(String[] args){ RunnableThread rt = new RunnableThread(); Thread t1
class MyClass<T> where T: new() { public Test() { var t = new T();
class A { public static void main(String[] args) { A a = new A();
class Object { }; Class Derived : public Object { }; boost::shared_ptr<Object> mObject(new Derived);
class Size{ Size(){ } //public final Size SMALL = new Size();//infinite loop final Size
class a { public $test=msg1; } $t1 = new a; echo echo1: After Instantiation
class foo { public readonly int bar; }; foo a = new foo() {
class A : IFoo { } ... A[] arrayOfA = new A[10]; if(arrayOfA is
class AbstractQuery { virtual bool isCanBeExecuted()=0; public: AbstractQuery() {} virtual bool Execute()=0; }; class
class C { T a; public: C(T a): a(a) {;} }; Is it legal?

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.