Clipboard size

Clipboard size

Postby Dietmar Jahnel » Wed Jun 18, 2008 6:47 pm

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
User avatar
Dietmar Jahnel
 
Posts: 83
Joined: Mon Oct 17, 2005 10:33 am
Location: Austria

Postby Antonio Linares » Sat Jun 21, 2008 10:50 am

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 ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42052
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Dietmar Jahnel » Sun Jun 22, 2008 9:10 am

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
User avatar
Dietmar Jahnel
 
Posts: 83
Joined: Mon Oct 17, 2005 10:33 am
Location: Austria

Postby James Bott » Sun Jun 22, 2008 6:14 pm

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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby Detlef Hoefner » Sun Jun 22, 2008 9:31 pm

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
User avatar
Detlef Hoefner
 
Posts: 312
Joined: Sat Oct 08, 2005 9:12 am
Location: Germany

Postby PatrickWeisser » Wed Dec 10, 2008 8:34 am

Hello Dietmar,

Did you ever get this issue resolved? I'm having a problem with the Windows Clipboard only accepting about 20k of text. I'm using FWH 8.10 and Windows XP. As a test I modified the PlaceSomeText() function of the TestClip.prg sample as follows:

Code: Select all  Expand view
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 nil



When I run it and select Use The Clipboard, Place Some Text, I get 20,352 in the result:

[img]
http://www.donorquest.com/images/TestClp.jpg
[/img]

It should be 1,200,000 bytes based on replicating the string "ABCDEFGHIJ" (plus CR-LF) 100,000 times.

I have tried it on two different XP machines and still get the same result.

Thanks,

-Patrick
User avatar
PatrickWeisser
 
Posts: 53
Joined: Fri Mar 23, 2007 4:10 am
Location: Seattle, WA, USA

Postby Antonio Linares » Wed Dec 10, 2008 8:37 am

Patrick,

We are going to test it in a few minutes... :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42052
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Antonio Linares » Wed Dec 10, 2008 9:05 am

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 ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42052
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby PatrickWeisser » Wed Dec 10, 2008 9:50 am

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
User avatar
PatrickWeisser
 
Posts: 53
Joined: Fri Mar 23, 2007 4:10 am
Location: Seattle, WA, USA

Postby PatrickWeisser » Wed Dec 10, 2008 10:02 am

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.
User avatar
PatrickWeisser
 
Posts: 53
Joined: Fri Mar 23, 2007 4:10 am
Location: Seattle, WA, USA

Postby Antonio Linares » Wed Dec 10, 2008 10:04 am

Patrick,

We have been googling for clipboard size (limit) and it seems as there is such limitation :-(
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42052
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby James Bott » Wed Dec 10, 2008 2:23 pm

Patrick,

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.


You can use the MAPI or SMTP classes to do this. MAPI will send them to the currently installed MAPI compliant mail client software (like Outlook), and SMTP will send it directly to the mail server.

I would suggest SMTP for mass emails. They will have to have access to an SMTP server.

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby PatrickWeisser » Wed Dec 10, 2008 5:43 pm

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
User avatar
PatrickWeisser
 
Posts: 53
Joined: Fri Mar 23, 2007 4:10 am
Location: Seattle, WA, USA

Postby James Bott » Wed Dec 10, 2008 5:58 pm

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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby Antonio Linares » Wed Dec 10, 2008 6:11 pm

Patrick,

You are totally right. It was a bug in our code (from 16 bits times) :-)

Now it is working fine. These are the required changes in FWH\source\clpbrd.c function SETCLIPBOARDDATA():
Code: Select all  Expand view
   ...
   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;
...

You can download the modified clpbrd.obj from here:
http://www.mediafire.com/?sharekey=de51 ... 2c0c6b2158
Link it as another OBJ of your app, or replace it in FiveHC.lib.

Thanks! :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42052
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot], nageswaragunupudi and 33 guests