Esempio n. 1
0
 def init_window(self):
     log("Win32Clipboard.init_window() creating clipboard window class and instance"
         )
     self.wndclass = WNDCLASSEX()
     self.wndclass.cbSize = sizeof(WNDCLASSEX)
     self.wndclass.lpfnWndProc = WNDPROC(self.wnd_proc)
     self.wndclass.style = win32con.CS_GLOBALCLASS
     self.wndclass.hInstance = GetModuleHandleA(0)
     self.wndclass.lpszClassName = clipboard_window_class_name
     self.wndclass_handle = RegisterClassExW(byref(self.wndclass))
     log("RegisterClassExA(%s)=%#x", self.wndclass.lpszClassName,
         self.wndclass_handle)
     if self.wndclass_handle == 0:
         raise WinError()
     style = win32con.WS_CAPTION  #win32con.WS_OVERLAPPED
     self.window = CreateWindowExW(0, self.wndclass_handle, u"Clipboard",
                                   style, 0, 0, win32con.CW_USEDEFAULT,
                                   win32con.CW_USEDEFAULT,
                                   win32con.HWND_MESSAGE, 0,
                                   self.wndclass.hInstance, None)
     log("clipboard window=%s", self.window)
     if not self.window:
         raise WinError()
     if not AddClipboardFormatListener(self.window):
         log.warn("Warning: failed to setup clipboard format listener")
         log.warn(" %s", get_last_error())
Esempio n. 2
0
 def set_err(self, msg):
     log.warn("Warning: cannot set clipboard value")
     log.warn(" %s", msg)
Esempio n. 3
0
 def set_clipboard_error(error_text=""):
     log("set_clipboard_error(%s)", error_text)
     if error_text:
         log.warn("Warning: failed to set clipboard data")
         log.warn(" %s", error_text)
     cleanup()
Esempio n. 4
0
 def errback(error_text=""):
     log("errback(%s)", error_text)
     if error_text:
         log.warn("Warning: failed to get clipboard data")
         log.warn(" %s", error_text)
     got_contents(target, 8, b"")
Esempio n. 5
0
 def clear_error(self, error_text=""):
     log.warn("Warning: failed to clear the clipboard")
     if error_text:
         log.warn(" %s", error_text)
Esempio n. 6
0
 def nolock(*_args):
     log.warn("Warning: failed to copy image data to the clipboard")