Reads the contents of the Windows clipboard into a binary buffer.
BinaryClipGet( handle, format )
(i) handle: handle of buffer.
(i) format: format of clipboard data.
(i) bytes-read: returns the number of bytes read from the clipboard.
Note: 0 in the first parameter of BinaryClipGet returns the size of buffer needed for a subsequent BinaryAlloc, but doesn't attempt to place the contents of clipboard into a buffer.
The following is a list of possible clipboard formats. Note that some of them may not be supported, because the clipboard contains a pointer or handle to external data instead of the data itself.
Value |
Meaning |
1 |
F_TEXT |
2 |
F_BITMAP (not supported) |
3 |
F_METAFILEPICT |
4 |
F_SYLK |
5 |
F_DIF |
6 |
CF_TIFF |
7 |
CF_OEMTEXT |
8 |
CF_DIB |
9 |
CF_PALETTE |
10 |
CF_PENDATA |
11 |
CF_RIFF |
12 |
CF_WAVE |
13 |
CF_UNICODETEXT |
14 |
CF_ENHMETAFILE |
15 |
CF_HDROP |
16 |
CF_LOCALE |
128 |
CF_OWNERDISPLAY |
129 |
CF_DSPTEXT |
130 |
CF_DSPBITMAP |
131 |
CF_DSPMETAFILEPICT |
142 |
CF_DSPENHMETAFILE |
;Takes a bitmap snapshot of the screen and pastes it to the clipboard. Snapshot(0) ;returns the size of buffer needed for a subsequent BinaryAlloc, ;but doesn't attempt to place the contents of clipboard into a buffer size=BinaryClipGet(0,8) ;allocates a data buffer bb=BinaryAlloc(size) ;read file format type CF_DIB BinaryClipGet(bb,8) ; need to add first 14 bytes to make it ; a BMP file format bmpdatasize=14 bb2=BinaryAlloc(size + bmpdatasize) ;The characters identifying the bitmap.'BM' BinaryPokeStr(bb2, 0, "BM") ;Complete file size in bytes. BinaryPoke4(bb2,2,size + bmpdatasize) ;Reserved BinaryPoke4(bb2,6,0) ;Data offset headersize=BinaryPeek4(bb,0) dataoffset = headersize + bmpdatasize BinaryPoke4(bb2,10,dataoffset) BinaryCopy(bb2,bmpdatasize,bb,0,size) BinaryWrite(bb2,"c:\temp\screenshot.bmp") BinaryFree(bb) BinaryFree(bb2) Message("All","Done")
Binary Operations, BinaryAlloc, BinaryWrite, BinaryFree, BinaryClipPut, ClipGet, ClipGetEx