My clipboard hell
- Thoughtcat
- Baaaaa!

- Posts: 1637
- Joined: Mon Jul 03, 2006 7:08 pm 0
- Location: London UK
My clipboard hell
What causes that thing where occasionally you copy something to the clipboard, paste it somewhere, and then copy something else entirely, but when you try and paste the second thing, the first bloody thing comes out instead? Over and over again, no matter how many times you try??
(I'm in XP.)
Last edited by Thoughtcat on Mon Jun 04, 2007 1:18 pm 0, edited 1 time in total.
- chris4500uk
- Baaaaa!

- Posts: 1158
- Joined: Thu Feb 26, 2004 3:05 am 0
- Location: Middlesbrough, UK
- Contact:
- Thoughtcat
- Baaaaa!

- Posts: 1637
- Joined: Mon Jul 03, 2006 7:08 pm 0
- Location: London UK
- chris4500uk
- Baaaaa!

- Posts: 1158
- Joined: Thu Feb 26, 2004 3:05 am 0
- Location: Middlesbrough, UK
- Contact:
- gilesgoat
- Sheepie Whore

- Posts: 27259
- Joined: Wed Sep 03, 2003 7:54 am 0
- Location: Monfalcone, Italy
- Contact:
To handle the clipboard events it's not really trivial ..
I know because I had to write some code to handle it.
Could be that somewhere in some windows or some particular places
they forgot and they have not been arsed to handle it.
It does not come "for free" and requires a bit of code to be handled ..
.. and of course .. enough "one thing left there or a pointer somewhere" and
you can make spectacular messes/explosions.
IIRC you get an event of I can't remember what that then gives you a
pointer to something that tells you the type of data that been pasted and
a pointer to a data-chunk containing what been pasted then you can filter
and decide what kind of data to accept as valid paste and what not and
then it's all up to you to decide what to do with that data.
The "cut/copy" operation I think is a bit more complex .. and can't
remember how it was going.
Of course all this goes into a messages queue, it all up to you to handle
the memory/buffers and be sure that all is properly cleared once you've
done, return the correct flags in the correct places otherwise it will
default to the "standard window procedure" and lot of other things ...
I can't remember if the text is always passed as UNICODE string and/or
if it depends on source and you have to check about that too.
It's not totally trivial really ..
[edit] - for your fun .. it's even a bit more complex than that ..
Plain and simple huh ?
And this handles text only ..
I know because I had to write some code to handle it.
Could be that somewhere in some windows or some particular places
they forgot and they have not been arsed to handle it.
It does not come "for free" and requires a bit of code to be handled ..
.. and of course .. enough "one thing left there or a pointer somewhere" and
you can make spectacular messes/explosions.
IIRC you get an event of I can't remember what that then gives you a
pointer to something that tells you the type of data that been pasted and
a pointer to a data-chunk containing what been pasted then you can filter
and decide what kind of data to accept as valid paste and what not and
then it's all up to you to decide what to do with that data.
The "cut/copy" operation I think is a bit more complex .. and can't
remember how it was going.
Of course all this goes into a messages queue, it all up to you to handle
the memory/buffers and be sure that all is properly cleared once you've
done, return the correct flags in the correct places otherwise it will
default to the "standard window procedure" and lot of other things ...
I can't remember if the text is always passed as UNICODE string and/or
if it depends on source and you have to check about that too.
It's not totally trivial really ..
[edit] - for your fun .. it's even a bit more complex than that ..
Code: Select all
case WM_COMMAND:
OutputDebugString ("GOT A COMMAND !\n");
if (LOWORD(wParam) == IDM_PASTE)
{
OutputDebugString ("PASTE EVENT !\n");
if (IsClipboardFormatAvailable (CF_TEXT))
{
// there's some text in the clipboard
if (OpenClipboard(hWnd))
{
// the clipboard is open
HGLOBAL hglb;
LPTSTR lptstr;
hglb = GetClipboardData(CF_TEXT);
if (hglb != NULL)
{
lptstr = (LPTSTR) GlobalLock(hglb);
if (lptstr != NULL)
{
// Call the application-defined ReplaceSelection
// function to insert the text and repaint the
// window.
OutputDebugString ("Someone pasted some text shite !!\n");
OutputDebugString (lptstr);
OutputDebugString ("\n");
if (NeonContext != NULL) Neon_UpdateClipboardData (NeonContext, lptstr);
GlobalUnlock(hglb);
}
EmptyClipboard();
}
CloseClipboard();
}
}
return 0;
}
break;
And this handles text only ..
Giles the billy goat
"Baa"
"Baa"
Re: My clipboard hell
Do you have the 'improved' clipboard in Office enabled? The one with the list on the right-hand side of the screen?
Holier than thou
- Thoughtcat
- Baaaaa!

- Posts: 1637
- Joined: Mon Jul 03, 2006 7:08 pm 0
- Location: London UK
Cheers Giles! I hope you're not going to test me on that later
Yep, I have the 'new' clipboard - didn't think of looking at that TBH - I've since rebooted and the problem's gone. All sorts of shit was happening before reboot - saying Word had run out of disk space and that I should save my work, and Outlook wouldn't let me complete an email. Next time I'll try the new clipboard - or just buy a Mac
Yep, I have the 'new' clipboard - didn't think of looking at that TBH - I've since rebooted and the problem's gone. All sorts of shit was happening before reboot - saying Word had run out of disk space and that I should save my work, and Outlook wouldn't let me complete an email. Next time I'll try the new clipboard - or just buy a Mac
Re: My clipboard hell
Orava wrote:'improved' clipboard
- piku
- Sheepie Whore

- Posts: 20960
- Joined: Wed Apr 24, 2002 10:44 am 0
- Website: Http://Www.ncot.uk
- Location: Wakefield
- Contact:
Re: My clipboard hell
Agh that thing does my head in. "You have copied lots of stuff, look! Watch as the same thing is copied many times due to you getting all confused".Orava wrote:Do you have the 'improved' clipboard in Office enabled? The one with the list on the right-hand side of the screen?
return (0);
- sponge
- Baaaaaa!

- Posts: 3227
- Joined: Sun Jul 17, 2005 9:05 am 0
- Location: Twatting around in Los Angeles, California.
Re: My clipboard hell
Ah ha! I've spotted the problem...Thoughtcat wrote:(I'm in XP.)
-
Kronos
Re: My clipboard hell
Or the cute little puppy in the search window?XOR wrote:Are you that little smiley paper-clip fucker?Thoughtcat wrote:(I'm in XP.)


