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.


  1. Where is the clipboard?

  2. The clipboard file is C:\System\Data\ClpBoard.cbd
  3. How is the clipboard file arranged?

  4. 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:
    1. The plain text that has been cut, and
    2. 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.
  5. What is the filestore format?
  6. 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...
     
  7. Ok, so what's the UID of a text object?

  8. It appears to be &10000033.
  9. And the format of a text object?

  10. 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.
  11. What about control characters?

  12. The control characters are the same ones used in the buffer of the OPL dEDITMULTI command
  13. How does this come together

  14. 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
  15. And bitmaps?

  16. 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.
  17. Are there any examples?

  18. YES!! You can download this OPL program source for copying text to and from the clipboard.
    TextClip (2833 bytes)