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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T04:59:01+00:00 2026-06-16T04:59:01+00:00

I only have the python 2.6. Can I do this without using external libraries?

  • 0

I only have the python 2.6. Can I do this without using external libraries? I just want to perform a left click wherever the cursor currently is.

  • 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-16T04:59:02+00:00Added an answer on June 16, 2026 at 4:59 am

    OK, first you have to know how to open the user32 windll via ctypes, which is trivial:

    from ctypes import *
    user32 = windll.user32
    

    Next, the Win32 function you want to call is probably SendInput, although you might want to look at mouse_event and possibly SendMessage (and the documentation for which WM_* messages correspond to a mouse click) to compare and contrast.

    Assuming you go with SendInput, you’re going to send one MOUSEEVENTF_LEFTDOWN followed by one MOUSEEVENTF_LEFTUP, with 0 for all of the params besides dwFlags.

    So, how do you call this? Well, here’s the C API:

    UINT WINAPI SendInput(
      _In_  UINT nInputs,
      _In_  LPINPUT pInputs,
      _In_  int cbSize
    );
    

    That LPINPUT means you’ve got a pointer to an array of INPUT structures. Since the INPUT structure itself has a union of MOUSEINPUT, KBDINPUT, and HARDWAREINPUT, you’ll also need to define those (although you can get away with just defining the first and pretending the others don’t exist, since the first is the only one you need).

    So, the steps to doing this with ctypes are:

    • Define the Structures for MOUSEINPUT and INPUT.
    • Load the user32 windll.
    • Set the argtypes for user32.SendInput.
    • Create your first MOUSEINPUT instance, with dwFlags= MOUSEEVENTF_LEFTDOWN, and the INPUT instance to go with it.
    • Call user32.SendInput(1, [myinput], len(INPUT)) or user32.SendInput(1, addressof(myinput), len(INPUT)) or whatever (depending on how you defined the argtypes).
    • Create your second MOUSEINPUT instance, with dwFlags= MOUSEEVENTF_LEFT, and the INPUT instance to go with it.
    • Call user32.SendInput() again.

    One last note: On Vista and above, you have to have the right “integrity level” to do this. For example, a normal app cannot send a click to an “elevated” app (e.g., an installer). Hopefully this isn’t an issue for you. If it is, you need to read up on UIPI and UAC… and if worst comes to worst, you may need to fall back to lower-level tricks.

    Is that enough, or do you need help with some specific part of this?

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

Sidebar

Related Questions

I have a large piece of Python 2 only code. It want to check
I'm using Python 2.6.6 I have this code: height = 20 width = 10
this is the idea. I'll have 'main' python script that will start (using subprocess)
Just started learning PySide and is having problem with QTimer I have this #!/usr/bin/python
I am setting up a simple test page in Python. I only have two
I have only started learning python recently. I would still be considered a beginner.
I have only started learning Python recently. Let me explain what I am trying
I have a python psp page code is shown below. Currently it only prints
Lets say that I have only DHT (distributed hash table) implemented (in Python), and
I have been writing Python code for only a couple of weeks, so I'm

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.