title: Python get file from Clipboard with winapi through DragQueryFile returns nothing
body: <p>I am trying to make a simple Python program, which gets the currently copied file from the Clipboard. I am using the windll to achieve this. I used some code from the already existing pyperclip tool(can only get text not files) and I tried to adapt it to get the currently copied files.</p>
  
  <p>Here is the Documentation for the function I am calling : <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/bb776408(v=vs.85).aspx" rel="nofollow noreferrer">https://msdn.microsoft.com/en-us/library/windows/desktop/bb776408(v=vs.85).aspx</a></p>
  
  <p>Reference for Clipboard Functions: <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/ff468802(v=vs.85).aspx" rel="nofollow noreferrer">https://msdn.microsoft.com/en-us/library/windows/desktop/ff468802(v=vs.85).aspx</a></p>
  
  <pre><code>import ctypes
  from ctypes.wintypes import *
  from ctypes import c_size_t, sizeof, c_wchar_p, get_errno, c_wchar, c_ulong, c_uint32
  
  class CheckedCall(object):
      def __init__(self, f):
          super(CheckedCall, self).__setattr__("f", f)
  
      def __call__(self, *args):
          ret = self.f(*args)
          if not ret and get_errno():
              raise PyperclipWindowsException("Error calling " + self.f.__name__)
          return ret
  
      def __setattr__(self, key, value):
          setattr(self.f, key, value)
  
  windll = ctypes.windll
  
  safeCreateWindowExA = CheckedCall(windll.user32.CreateWindowExA)
  safeCreateWindowExA.argtypes = [DWORD, LPCSTR, LPCSTR, DWORD, INT, INT,
                                      INT, INT, HWND, HMENU, HINSTANCE, LPVOID]
  safeCreateWindowExA.restype = HWND
  
  safeDestroyWindow = CheckedCall(windll.user32.DestroyWindow)
  safeDestroyWindow.argtypes = [HWND]
  safeDestroyWindow.restype = BOOL
  
  OpenClipboard = windll.user32.OpenClipboard
  OpenClipboard.argtypes = [HWND]
  OpenClipboard.restype = BOOL
  
  clipboarddata=CheckedCall(windll.user32.GetClipboardData)
  clipboarddata.argtypes = [UINT]
  clipboarddata.restype = HANDLE
  
  safeCloseClipboard = CheckedCall(windll.user32.CloseClipboard)
  safeCloseClipboard.argtypes = []
  safeCloseClipboard.restype = BOOL
  
  hwnd = safeCreateWindowExA(0, b"STATIC", None, 0, 0, 0, 0, 0,None, None, None, None)
  print(hwnd)
  print(OpenClipboard(hwnd))
  
  hendl=clipboarddata(15)
  print(hendl)
  
  
  text = ctypes.create_string_buffer(255)
  
  UINTval=windll.shell32.DragQueryFile(c_uint32(hendl),c_uint32(0),text,c_uint32(255))
  print(repr(text.raw))
  print(UINTval)
  
  
  safeCloseClipboard()
  </code></pre>
  
  <p>With a few adjustments this code works perfectly text from the Clipboard, but it just wont work with files. Maybe I am missing something obvious or just misunderstood the specification.</p>
  
  <p>System: Python3.5.2, Windows 8.1 </p>