The ClipBoard File
The ClipBoard file is used on the Series 5 for cut and paste between
applications (and often for cut & paste within the same application).
It is useful to be able to read and write the clipboard from OPL applications,
so that they can integrate properly with the rest of EPOC32. This page
describes the format of the clipboard file, and how to read or write it.
-
Where is the clipboard?
The clipboard file is C:\System\Data\ClpBoard.cbd
-
How is the clipboard file arranged?
The file is a normal 'FileStore' file, which means that it can store
one or more objects within it.
For reading, you select and process the object(s) that you can, ignoring
the other objects in the file.
For writing, you write as many or as few objects as you need to recreate
the cut object in your application.
For instance, when a section is copied from a Word file, two
objects are put into the clipboard:
-
The plain text that has been cut, and
-
The formatting information for that text.
If you wish to insert the text into a simple text editor,
then you only need to read and process the plain text object stored in
the clipboard, and ignore the formatting information.
-
What is the filestore format?
Offset |
Size (bytes) |
Value |
Used for |
0 |
4 |
&10000037 |
FileStore identifier |
4 |
4 |
&1000003B |
Clipboard identifier |
8 |
4 |
&00000000 |
Application identifier (unused) |
12 |
4 |
&4739D53B |
UID checksum |
16 |
4 |
TABLE |
Offset of contents table |
The objects, of various sizes, come here |
TABLE |
1 |
Entries |
Number of table entries |
TABLE+1 |
4 |
Object UID #1 |
UID of the object |
TABLE+5 |
4 |
Offset #1 |
Offset of the object |
TABLE+9 |
4 |
Object UID #2 |
UID of the object |
TABLE+13 |
4 |
Offset #2 |
Offset of the object |
...More pairs of entries... |
-
Note: The table entries come in pairs, so the number of entries
must always be even.
-
Ok, so what's the UID of a text object?
It appears to be &10000033.
-
And the format of a text object?
Is the same as a dEDITMULTI text buffer: a single long
integer (ie. 4 bytes) which gives the length of the text, followed
by the characters of the text. There is a single NUL character that appears
after the text that is NOT included in the count, and that appears
to be rather superfluous.
-
What about control characters?
The control characters are the same ones used in the buffer of the
OPL dEDITMULTI command
-
How does this come together
Suppose that the four letters 'PROC' were to be copied
to the clipboard from the Program editor. The ClipBoard would then contain
the following characters (all in hexadecimal):
File offset |
File Contents |
Notes |
00 |
37 00 00 10 |
FileStore UID |
04 |
3B 00 00 10 |
ClipBoard UID |
08 |
00 00 00 00 |
(would be application UID) |
0C |
3B D5 39 47 |
UID Checksum |
10 |
1D 00 00 00 |
Contents Table offset |
14 |
04 00 00 00 |
Length of text |
18 |
50 52 4F 43 |
Characters of text (P R O C) |
1C |
00 |
A rather pointless NUL |
1D |
02 |
Number of Contents Table entries |
1E |
33 00 00 10 |
Entry #1 UID |
22 |
14 00 00 00 |
Entry #1 offset |
-
And bitmaps?
This is more complex, simply because individual bitmaps are not readily
accessed in EPOC32. Remember that MBM files are Multiple
BitMap files.
Suffice it to say that, given the information on the MBM format you
can find here,
it is a reasonably simple matter to convert an MBM file to
clipboard format and vice versa.
-
Are there any examples?
YES!! You can download this OPL program source for copying text to
and from the clipboard.
TextClip (2833 bytes)