Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
getclip (images)
#4
Usually, applications store data into the clipboard in several formats. Some of them (values < 512) are standard formats. An application also can use registered formats (>32K) and private formats (512 - 1K).

Copy something, and run following code. It shows what formats currently are in the clipboard. Those with strings are registered. You can then use RegisterClipboardFormat to get numeric value.

Code:
Copy      Help
dll user32
,#OpenClipboard hWnd
,#CloseClipboard
,#CountClipboardFormats
,#EnumClipboardFormats wFormat
,#GetClipboardFormatName wFormat $lpString nMaxCount

ClearOutput
int i f
str s
OpenClipboard 0
for i 0 CountClipboardFormats
,f=EnumClipboardFormats(f)
,s.fix(GetClipboardFormatName(f s s.all(100)))
,out "%i %s" f s
CloseClipboard

I tried it with selected wordart object in MS Word doc. I discovered that one of formats is "GIF". Then I executed following code, and result was normal gif file.

Code:
Copy      Help
str s.getsel(0 RegisterClipboardFormat("GIF"))
s.setfile("$desktop$\test.gif")


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)