title: Using ctypes with jython
body: <p>I have a trouble with using ctypes lib in my python script. Here is my code (found on the Internet):</p>
  
  <pre><code>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)
  </code></pre>
  
  <p>The first problem was that python couldn't find the ctypes so i copied the files downloaded from the project site to </p>
  
  <pre><code>netbeans\6.9\jython-2.5.1\Lib\
  </code></pre>
  
  <p>(yep, im using netbeans) and then it shows this error:</p>
  
  <pre><code>&gt;    from ctypes import *
  &gt;  File "C:\Users\k\.netbeans\6.9\jython-2.5.1\Lib\ctypes\__init__.py", line 10, in &lt;module&gt;
  &gt;    from _ctypes import Union, Structure, Array
  </code></pre>
  
  <p>Just like the init file has some errors o_O Help guys!
  Greetings, Chris</p>