Programma di esempio
CLIPBOARD.PRT |
; CLIPBOARD
;
; Programma per Proteus
;
; (C) 2004 Simone Zanella Productions
;
; Questo programma enumera i formati nella clipboard e stampa il contenuto (se è rappresentabile come testo).
; Inoltre, all'uscita imposta la clipboard al testo "Ciao, mondo!".
#!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 "Formato dei dati nella clipboard:"
WHILE NEQ(LASTTYPE, 0)
N = GetClipboardSize(LASTTYPE)
CONSOLELN "-- Formato: " LASTTYPE " (dim. " N " bytes)"
IF EQ(LASTTYPE, CF_TEXT)
CONSOLELN "---- Contenuto: " GetClipboard(LASTTYPE)
FI
LASTTYPE = EnumClipboardFormats(LASTTYPE)
LOOP
CONSOLELN "Imposto la clipboard a \"Ciao, mondo!\".."
SetClipboard(CF_TEXT, "Ciao, mondo!")
CONSOLELN "Fatto."
ABORT 0