64

Is there any limit of the size of data that can be copied to clipboard? I am using VB6 and need to copy blocks of data to the clipboard.

  • Is this a programming question? If so, how about giving us some more detail so we can help you out. If not, this question belongs elsewhere. – Bevan Aug 24 '09 at 04:41
  • 3
    Yes,I am trying to write data to clipboard using vb6. Thats why I am wondering about its limit. –  Aug 24 '09 at 04:42
  • As a information: you can think the clipboard buffer is to small while copying text with some <NUL> (ascii 0) characters into an editor. In this case, the problem is not the size of the clipboard, but the editor recognize the <NUL> as the end of the text and don't insert anymore after this character. – Olivier Faucheux Jul 12 '12 at 07:40

3 Answers3

42

Applications call GlobalAlloc(GMEM_MOVEABLE or GMEM_DDESHARE) to allocate the memory for data to be stored on the clipboard and make it available to other applications. For 32-bit applications GlobalAlloc can allocate blocks up to 2 GB in size or up to the amount of virtual memory the PC has, whichever is less. The Windows clipboard does not impose any other size limits.

Jan Goyvaerts
  • 21,379
  • 7
  • 60
  • 72
4

Most data is copied as a reference rather than the data itself so you can copy most anything any size. Text though is actually copied and from what I know the amount of data is limited to how much ram is currently availiable. Remember this, if vb6 can handle it, I'm sure the clipboard can handle it.

  • 12
    (-1) Most data not copied by reference. In the simplest case, a string variable in an app is copied into a global memory block, as Jan indicated. There are some situations where the copy/paste involves pointers to internal storage, but that's usually with proprietary/private formats. For common things like AnsiString, UnicodeString, RTF, HTML, Bitmap, etc., it's done with shared global memory, which means a second copy of the data has to exist. – Chris Thornton Jul 19 '12 at 19:30
-2

Depends on the amount of memory in the system.

rahul
  • 184,426
  • 49
  • 232
  • 263
  • 13
    I don't think so, but the "amount of memory" is too vague anyway. Phsyical RAM or virtual memory? And what about systems with >4GB memory and 32 bits apps? –  Aug 24 '09 at 10:58