def GetData(self, fe):
ret_stg = None
cf, target, aspect, index, tymed = fe
if aspect & pythoncom.DVASPECT_CONTENT and \
tymed==pythoncom.TYMED_HGLOBAL:
if cf == win32con.CF_TEXT:
ret_stg = pythoncom.STGMEDIUM()
# ensure always 'bytes' by encoding string.
ret_stg.set(pythoncom.TYMED_HGLOBAL, str2bytes(self.strval))
elif cf == win32con.CF_UNICODETEXT:
ret_stg = pythoncom.STGMEDIUM()
ret_stg.set(pythoncom.TYMED_HGLOBAL, unicode(self.strval))
if ret_stg is None:
raise COMException(hresult=winerror.E_NOTIMPL)
return ret_stg
评论列表
文章目录