title: Enumerating windows trough ctypes in python
body: <p>I'm trying to get a list of all visible windows using ctypes in Python3.3</p>
  
  <p>But with the code i have, not a single window is returned. The <code>EnumWindows</code> function fails, and the returned error code is 0.</p>
  
  <pre><code>import ctypes
  
  user32 = ctypes.windll.user32
  
  def worker(hwnd, lParam):
      length = user32.GetWindowTextLengthW(hwnd) + 1
      buffer = ctypes.create_unicode_buffer(length)
      user32.GetWindowTextW(hwnd, buffer, length)
      print("Buff: ", repr(buffer.value))
  
  a = ctypes.WINFUNCTYPE(ctypes.c_bool,
                         ctypes.POINTER(ctypes.c_int),
                         ctypes.POINTER(ctypes.c_int))(worker)
  
  if not user32.EnumWindows(a, True):
      print("Err: ", ctypes.windll.kernel32.GetLastError())
  </code></pre>
  
  <p>Here is the current output:</p>
  
  <pre><code>Buff:  ''
  Err:  0
  </code></pre>
  
  <p>And this is what i expected:</p>
  
  <pre><code>Buff: 'Python 3.3.2 shell'
  Buff: 'test.py - C:\Users\...'
  [...]
  </code></pre>
  
  <p>Could you point me in the right direction to achieve this? Thanks in advance.</p>