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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:53:53+00:00 2026-05-27T23:53:53+00:00

I tried [DllImport(user32.dll)] static extern bool SetCursorPos(int X, int Y); and it works pretty

  • 0

I tried
[DllImport(“user32.dll”)]
static extern bool SetCursorPos(int X, int Y);

and it works pretty fine to move the cursor to the desired point. I have never tried such kind of a DLL import before but it works :). However I want more what else can I extract?
Mainly I want to make double click, click or use wheel options without any mouse input, just the code how can I do that? and how can I check what else is included in user32dll?

Thanx

  • 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-27T23:53:54+00:00Added an answer on May 27, 2026 at 11:53 pm
    [DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
    public static extern void mouse_event(uint dwFlags, uint dx, uint dy, uint cButtons, UIntPtr dwExtraInfo);
    private const uint MOUSEEVENTF_LEFTDOWN = 0x02;
    private const uint MOUSEEVENTF_LEFTUP = 0x04;
    private const uint MOUSEEVENTF_RIGHTDOWN = 0x08;
    private const uint MOUSEEVENTF_RIGHTUP = 0x10;
    

    You should Import and Define these Constant’s to work with Mouse using Win32API

    Use method’s below to do Mouse Operation’s

    void sendMouseRightclick(Point p)
    {
        mouse_event(MOUSEEVENTF_RIGHTDOWN | MOUSEEVENTF_RIGHTUP, p.X, p.Y, 0, 0);
    }
    
    void sendMouseDoubleClick(Point p)
    {
        mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, p.X, p.Y, 0, 0);
    
    Thread.Sleep(150);
    
        mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, p.X, p.Y, 0, 0);
    }
    
    void sendMouseRightDoubleClick(Point p)
    {
        mouse_event(MOUSEEVENTF_RIGHTDOWN | MOUSEEVENTF_RIGHTUP, p.X, p.Y, 0, 0);
    
        Thread.Sleep(150);
    
        mouse_event(MOUSEEVENTF_RIGHTDOWN | MOUSEEVENTF_RIGHTUP, p.X, p.Y, 0, 0);
    }
    
    void sendMouseDown()
    {
        mouse_event(MOUSEEVENTF_LEFTDOWN, 50, 50, 0, 0);
    }
    
    void sendMouseUp()
    {
        mouse_event(MOUSEEVENTF_LEFTUP, 50, 50, 0, 0);
    }
    

    If you want to do a Mouse Drag you should First Send MouseDown(Mouse Click) and keep it Clicked While Changing the Mouse Position than Send MouseUp(Release Click) something like this .

    sendMouseDown();
    Cursor.Position = new Point(30,30);
    sendMouseUp();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to compare two images using: [DllImport(msvcrt.dll)] private static extern int memcmp(IntPtr b1,
I'm calling the following from c#: [DllImport(u3dapi10.dll, CharSet=CharSet.Auto)] public static extern uint dapiCreateSession(out uint
I have tried dllimport and extern command without any success. Searched the net for
I have tried the following code but has no effect: Imports system.Runtime.InteropServices <DllImport(UxTheme.DLL, BestFitMapping:=False,
I have tried this code to convert my path to UNC path: [DllImport(mpr.dll, CharSet
I tried to use __declspec(dllexport) to export functions in my DLL, but it doesn't
I am calling a method from C# like this: [DllImport(@C:\Hash.dll, CallingConvention = CallingConvention.Cdecl)] public
The Microsoft WinAPI documentation appears to suggest that user32.dll contains a function called GetNextWindow()
I have tried DllImport, But it seems more complicated than it needs to be.
Tried following the instructions here: How to use Google app engine with my own

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.