; CLIPBOARD
;
; Program for Proteus
;
; (C) 2004 Simone Zanella Productions
;
; This program enumerates the formats in the clipboard and print the contents (if it is representable as text).
; It also sets the clipboard to "Hello, world!" on exit.
#!proteus -z
CONST CF_TEXT 1
CONST CF_BITMAP 2
CONST CF_METAFILEPICT 3
CONST CF_SYLK 4
CONST CF_DIF 5
CONST CF_TIFF 6
CONST CF_OEMTEXT 7
CONST CF_DIB 8
CONST CF_PALETTE 9
CONST CF_PENDATA 10
CONST CF_RIFF 11
CONST CF_WAVE 12
CONST CF_UNICODETEXT 13
CONST CF_ENHMETAFILE 14
CONST CF_HDROP 15
CONST CF_LOCALE 16
CONST CF_MAX 17
CONST CF_OWNERDISPLAY 0x0080
CONST CF_DSPTEXT 0x0081
CONST CF_DSPBITMAP 0x0082
CONST CF_DSPMETAFILEPICT 0x0083
CONST CF_DSPENHMETAFILE 0x008E
CONST CF_PRIVATEFIRST 0x0200
CONST CF_PRIVATELAST 0x02FF
CONST CF_GDIOBJFIRST 0x0300
CONST CF_GDIOBJLAST 0x03FF
;ProteusSetClipboard(type, data)
;ProteusGetClipboardSize(type)
;ProteusGetClipboard(type)
;ProteusEnumClipboardFormats(lasttype)
!extern SetClipboard, PROTEXT.DLL, ProteusSetClipboard, 2, 0
!extern GetClipboardSize, PROTEXT.DLL, ProteusGetClipboardSize, 1, 0
!extern GetClipboard, PROTEXT.DLL, ProteusGetClipboard, 1, 32768
!extern EnumClipboardFormats, PROTEXT.DLL, ProteusEnumClipboardFormats, 1, 0
LASTTYPE = EnumClipboardFormats(0)
CONSOLELN "Formats for the clipboard:"
WHILE NEQ(LASTTYPE, 0)
N = GetClipboardSize(LASTTYPE)
CONSOLELN "-- Format: " LASTTYPE " (size " N " bytes)"
IF EQ(LASTTYPE, CF_TEXT)
CONSOLELN "---- Contents: " GetClipboard(LASTTYPE)
FI
LASTTYPE = EnumClipboardFormats(LASTTYPE)
LOOP
CONSOLELN "Setting clipboard to \"Hello, world!\".."
SetClipboard(CF_TEXT, "Hello, world!")
CONSOLELN "Done."
ABORT 0