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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T11:02:20+00:00 2026-05-20T11:02:20+00:00

I have a trouble with using ctypes lib in my python script. Here is

  • 0

I have a trouble with using ctypes lib in my python script. Here is my code (found on the Internet):

if __name__ == "__main__":
    from ctypes import *
    user32 = windll.user32
    kernel32 = windll.kernel32

    class RECT(Structure):
        _fields_ = [
            ("left", c_ulong),
            ("top", c_ulong),
            ("right", c_ulong),
            ("bottom", c_ulong)];

    class GUITHREADINFO(Structure):
        _fields_ = [
        ("cbSize", c_ulong),
        ("flags", c_ulong),
        ("hwndActive", c_ulong),
        ("hwndFocus", c_ulong),
        ("hwndCapture", c_ulong),
        ("hwndMenuOwner", c_ulong),
        ("hwndMoveSize", c_ulong),
        ("hwndCaret", c_ulong),
        ("rcCaret", RECT)
        ]

    def moveCursorInCurrentWindow(x, y):
        # Find the focussed window.
        guiThreadInfo = GUITHREADINFO(cbSize=sizeof(GUITHREADINFO))
        user32.GetGUIThreadInfo(0, byref(guiThreadInfo))
        focussedWindow = guiThreadInfo.hwndFocus

        # Find the screen position of the window.
        windowRect = RECT()
        user32.GetWindowRect(focussedWindow, byref(windowRect))

        # Finally, move the cursor relative to the window.
        user32.SetCursorPos(windowRect.left + x, windowRect.top + y)

    if __name__ == '__main__':
    # Quick test.
        moveCursorInCurrentWindow(100, 100)

The first problem was that python couldn’t find the ctypes so i copied the files downloaded from the project site to

netbeans\6.9\jython-2.5.1\Lib\

(yep, im using netbeans) and then it shows this error:

>    from ctypes import *
>  File "C:\Users\k\.netbeans\6.9\jython-2.5.1\Lib\ctypes\__init__.py", line 10, in <module>
>    from _ctypes import Union, Structure, Array

Just like the init file has some errors o_O Help guys!
Greetings, Chris

  • 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-20T11:02:21+00:00Added an answer on May 20, 2026 at 11:02 am

    Jython doesn’t yet have full support for ctypes: http://bugs.jython.org/issue1328

    You can’t simply take the ctypes library compiled for CPython, and plug it into Jython.

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

Sidebar

Related Questions

Little trouble in using css, in the below code, i have used odd and
I have trouble using SSL pages with JMeter, which I previously posted here .
I have trouble using the transactionscope on SQLite, i am using the following code.
I'm using http://code.google.com/p/django-email-extras/ to generate rich email content. I have trouble in sending email
I have some JSF-trouble using h:selectOneMenu with a list from my backend bean: My
I have trouble here using fopen to open files which have paths longer than
I have trouble using sed. I need to replace some lines in very deprecated
I have trouble parsing a HTML table using Nokogiri and Ruby. My HTML table
I am have trouble converting my xml using XSLT back to xml in the
Having a bit of trouble using the List.Find with a custom predicate i have

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.