We have a problem when very long text (> 100.000 characters) is copied to the clipboard - only part of it can be pasted.
What can be done?
Is there a limit of the clipboard?
Thanks for help,
Dietmar
We have a problem when very long text (> 100.000 characters) is copied to the clipboard - only part of it can be pasted.
What can be done?
Is there a limit of the clipboard?
Thanks for help,
Dietmar
Dietmar,
The clipboard should be able to support up to 2GB strings or more (limited by max available memory).
Are you copying from a richedit control ?
no I'm using FGet (with many modifications for our use)
with
oClp:SetText( cText )
oClp:GetText( )
I can see that only part of very long texts are copied.
I there a limit by Windows? (same results with xP and vista)
Thanks,
Dietmar
If you Google "clipboard maximum size" you will get a lot of different opinions on this. It seems most people say that the limit was 32K in 16bit but in 32bit the maximum is limited to available memory which can, of course, vary from time to time even on the same computer. So, I think you are always going to have some problems with copying large amounts of text.
James
Dietmar,
just an idea and not tested.
Test your text string for binary zeroes.
Clipper and xHarbour can handle these characters in a string.
But in c language a '\0', which is chr( 0 ) terminates a string.
May be that this causes your problem ?
Regards,
Detlef
function PlaceSomeText()
local cText := Space( 30 )
//if MsgGet( "Ok...", "Write something!", @cText )
// oClp:SetText( cText )
//endif
oClp:SetText( Replicate( "ABCDEFGHIJ" + Chr( 13 ) + Chr( 10 ), 100000 ) )
nMsgBox( "Number of bytes in clipboard: " + Str( Len( oClp:GetText() ) ) )
return nilPatrick,
We are going to test it in a few minutes... ![]()
Patrick,
You are right, it seems as its size is limited (around 32 Ks).
The text that you want to copy, where will it be used from ? I mean, will it be used from the same application, or from another application ?
Antonio,
The text will be used in another application. The particular feature I am implementing copies delimited email addresses to the Clipboard so that they may be pasted in the TO: or BCC: block of an email message using whatever email software our customer prefers to use. There may be a better way of allowing our customers to do a mass email to a select group of their constituents, so I'm open to suggestions. However, having full access to the Windows Clipboard is very important and not something I would want to worry about having a limit on. I'm able to copy and paste many megabytes worth of text from my editor to a FWH memo field, and from a memo field back to the Clipboard and my editor, so I don't think it's a Windows limitation. My feeling is that it must be something with Harbour or FiveWin. It's not extremely urgent right now, but I would sure like to have full functionality at some point.
Thanks,
-Patrick
My guess is that there is probably a 32-bit parameter somewhere in the mix that indicates the size of the text buffer to be copied to the Clipboard, but the parameter is being truncated to 16-bits at some point by some old 16-bit code.
Patrick,
We have been googling for clipboard size (limit) and it seems as there is such limitation ![]()
The particular feature I am implementing copies delimited email addresses to the Clipboard so that they may be pasted in the TO: or BCC: block of an email message using whatever email software our customer prefers to use. There may be a better way of allowing our customers to do a mass email to a select group of their constituents, so I'm open to suggestions.
Thanks James, I will take a look at the FWH Samples ProxOut.prg and TestSmtp.prg (and TestMail.prg for the MAPI) to see if they offer the functionality our customers need for this particular feature.
Antonio - If there is indeed a limit of 20k on the ClipBoard in Win32, why am I able to copy many megabytes worth of text between NotePad and other text editors using the Windows ClipBoard, or indeed between a memo field of a FiveWin application and NotePad?
Thanks,
-Patrick
Patrick,
I should mention that if your users need to compose a message, then perhaps MAPI is your best solution. You can send the TO or BC list to the MAPI client and bring up the message edit screen so they can then type in their message.
If you are sending a pre-written message then SMTP is probably the best way. One button click can handle the entire process.
Regards,
James
...
ULONG ulLen; // instead of WORD
...
case CF_TEXT:
ulLen = _parclen( 2 );
hMem = GlobalAlloc( GHND, ulLen + 1 );
if( ! hMem )
{
_retl( 0 );
return;
}
pMem = GlobalLock( hMem );
_bcopy( ( char * ) pMem, _parc( 2 ), ulLen );
GlobalUnlock( hMem );
_retl( ( BOOL ) SetClipboardData( CF_TEXT, hMem ) );
break;
...