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 4:41
  • Yes,I am trying to write data to clipboard using vb6. Thats why I am wondering about its limit. – Pradeep Aug 24 '09 at 4:42
  • Ok - Tried to migrate back but apparently we can't. My best suggestion is to have the question voted to reopen and notifying Pradeep to edit his question accordingly. – BinaryMisfit Aug 24 '09 at 11:36
  • why is this on SU? Isn't this a programmnig question for SO? – Preet Sangha Oct 6 '10 at 17:11
  • Isn't the size of the clipboard independent of what specific content you want to put there? What makes this a programming question? It's not about programming the clipboard. – fixer1234 Dec 19 '14 at 20:52

To add something to the clipboard, you need to allocate memory for the data first, then pass a handle of this memory block to the clipboard. Because WIN32 applications are limited to 2 GB of memory, the amount of memory that you could allocate would be related to the size of RAM that's still available in your application. With the additional /3GB parameter in boot.ini, you could make this amount a bit bigger. And if your system has less than 2 GB of RAM, increasing the size of the swap file will also help to send up to 2 GB. Of course, the client application also needs to be able to use this data. Trying to fir 1500 MB of data in a process that only has 600 MB available will not work.

But if you truly want to send huge blocks of data, use temporary files instead! One trick would be by using a COM interface. Create your own COM class first, which needs to wrap around the data, where the data should be file-based. Then create a temporary file and add your data to this file. Create a COM object which links to this temporary file and send the COM object over to the client. The client needs to be able to handle the COM object too but could then use it to extract the data from it again. This would theoretically provide you unlimited memory space. Drawback: you need to write a COM class and know what you're doing.

Or use other techniques to send over the data. Named pipes, mailslots, TCP/IP... There are many alternative inter-process techniques to send data between two applications.

Since you're using VB6, I won't start about .NET or WIN64 options.


Depends on the amount of memory in the system.

  • 1
    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? – MSalters Aug 24 '09 at 10:58

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy