#NEWLINE# def _copyWindows( text ) : #NEWLINE# #INDENT# GMEM_DDESHARE = 8192 #NEWLINE# CF_UNICODETEXT = 13 #NEWLINE# d = ctypes . windll #NEWLINE# if ( not isinstance ( text , text_type ) ) : #NEWLINE# #INDENT# text = text . decode ( 'mbcs' ) #NEWLINE# #UNINDENT# d . user32 . OpenClipboard ( 0 ) #NEWLINE# d . user32 . EmptyClipboard ( ) #NEWLINE# hCd = d . kernel32 . GlobalAlloc ( GMEM_DDESHARE , ( len ( text . encode ( 'utf-16-le' ) ) + 2 ) ) #NEWLINE# pchData = d . kernel32 . GlobalLock ( hCd ) #NEWLINE# ctypes . cdll . msvcrt . wcscpy ( ctypes . c_wchar_p ( pchData ) , text ) #NEWLINE# d . kernel32 . GlobalUnlock ( hCd ) #NEWLINE# d . user32 . SetClipboardData ( CF_UNICODETEXT , hCd ) #NEWLINE# d . user32 . CloseClipboard ( )