Clipboard content automatically erased

10

1

My clipboard gets automatically erased from time to time.

For example:
I copy some text using Ctrl+C, and then paste it somewhere. And when I try to paste it again, nothing happens. I need to copy it once again.

This happens irregulary, sometimes I'm able to paste the text for many times, sometimes not even once.

I'm a developer, so I copy & paste very often (...), but this is really annoying.

How can I discover, which software does this? Is there any tool for monitoring WHICH PROCESS ERASED CLIPBOARD? Or if you experienced this problem with any software you've used, which one was that?

I'm using Windows 7, and many applications are running on my system, so it is hard to tell which one is causing all the trouble.

Update

Today I've confirmed that the misbehaving application is Visual C# 2010, and the problem is appearing only inside this application. I've tried to clipboard-monitoring tools as JRobert suggested. It seems that the text is correctly copied into the clipboard (so the clipboard history manager can record it) and then the Visual C# 2010 erases the clipboard content for some reason, which leads into "empty clipboard".

So thank you all, I'm now sure which application causes the trouble, and have even found Microsoft Connect bug tracker about this:
https://connect.microsoft.com/VisualStudio/feedback/details/554039/visual-studio-2010-clipboard-copy-and-cut-does-not-work?wa=wsignin1.0
And here is some additional info:
http://alpascual.com/post/copy-and-paste-problems-in-visual-studio-2010.aspx

Now I can just wait and pray for Microsoft to fix the bug.

Paya

Posted 2010-06-19T18:29:21.510

Reputation: 237

What tool did you use to determine that VS 2010 is the culprit? @JRobert's link contains dozens of programs.. – BlueRaja - Danny Pflughoeft – 2014-10-21T18:10:58.770

I've read the article and the whole discussion under it, but nobody experienced the same problem as me. :-( – Paya – 2010-07-03T19:06:22.927

1You don't happen to be using KeePass do you? – BloodPhilia – 2010-07-03T19:53:01.837

No I'm not, but I've installed it in the past, and uninstalled it... – Paya – 2010-07-03T20:36:33.397

why you don't do it the easy way ?

Start by closing the desktop applications you added before this issues comes up, I will start flash/AIR applications and desktop gadgets etc ...

"too much is never too much" – None – 2010-07-03T21:19:10.570

Your problem might not be an erased clipboard, per se, but that another program is putting something on the clipboard in another format. (For example, if you copied text to the clipboard, and a background program copied an image to the clipboard, you'll no longer be able to paste into any text boxes.) If this is what's going on, a clipboard viewer might be helpful. Being able to see what's on the clipboard might give you a clue which program might be messing with the clipboard. – Bavi_H – 2010-07-04T03:59:42.187

@Revolter: I have no idea what desktop applications I've added before this issue, because the issue is appearing random, I've ignored it for a while, but I had my limit. – Paya – 2010-07-04T14:01:28.420

@Bavi_H: It actually seems that my Visual C# 2010 is inserting empty string into the clipboard, I will download the clipboard monitor and try to confirm my suspicion. – Paya – 2010-07-04T14:04:54.470

Answers

3

Check out https://stackoverflow.com/questions/621577/clipboard-event-c

I don't think you can do more than there is available with the API, but this should be helpful enough to roll up your own Clipboard Monitor or request someone from that question to provide you theirs. Monitoring and showing the contents of the clipboard each time can be helpful whether to decide if something third-party is messing with your clipboard, from there you will have to identify the culprit by eliminating processes or something like that.

Tamara Wijsman

Posted 2010-06-19T18:29:21.510

Reputation: 54 163

Yeah I already know it is possible to monitor clipboard changes, but I need to track it down to application, which made the change. And the problem doesn't repeat periodically, but randomly. So it would be very hard to trace the app by eliminating processes. – Paya – 2010-06-19T20:07:57.690

Oh, I just got an idea that might help you to your solution. You could try to hook the API call (http://www.codeproject.com/kb/system/hooksys.aspx) and discover it in such way...

– Tamara Wijsman – 2010-06-19T23:56:32.850

Yeah, this idea also crossed my mind, but it is a bit complicated to create such a program. I just hope there is also some other solution. – Paya – 2010-06-20T10:43:08.300

3

An intermediate step (between selectively killing processes and hooking the clipboard API) might be one of these clipboard viewers. You might have to keep refreshing it manually hoping to discover when the clipboard cleared, but by narrowing that down, you might discover it happens, f/ex, right after some other apparently innocuous action you've taken.

JRobert

Posted 2010-06-19T18:29:21.510

Reputation: 6 128

It happens even if I don't taky any innocouous actions ... For example, I copy something into clipboard, and then start pressing Ctrl+V five times. It pastes 3 times, and then suddenly erases clipboard content, so the next 2 ctrl+v does nothing. And I just do the ctrl+v, nothing else. So I don't know how monitoring clipboard change will help me. – Paya – 2010-07-03T19:16:44.713

And nothing user-related has taken place at that point? The phenomenon must be related to some process that is or isn't running at a given time, if it isn't reliably repeatable. My only other suggestion is to get a snapshot (f/ex, with Process Explorer) of the currently running processes taken at times when you can reproduce the phenomenon and at times when you can't. Then compare the two snapshots for their differences. – JRobert – 2010-07-03T21:04:05.543

Well, it happens completely random, nothing user-related. However, I have now suspect Visual C# 2010 is causing the trouble, as I've googled it and it seems that others are experiencing similar (not the same) clipboard problems. Will investigate further. – Paya – 2010-07-04T14:00:24.693

2

The clipboard in Windows has never worked very well. Long ago I gave up on it and started using freeware clipboard replacements. My latest favourite is ClipX (http://www.bluemars.org/clipx/). I just got tired of banging my head into Windows clipboard weirdness and limitations (the worst one being that you can only store one clip at a time).

Beyond that, you should be aware that Microsoft has done some very odd things to the Windows clipboard in some versions of Microsoft Office. I can't recall which versions of Office were the worst offenders in this regard, but I do know that after installing one of them, clipboard operation was seriously messed up until I disabled the related features. My recollection is that these problems occurred even when no Office applications were running. Anyway, if you haven't installed Office on the machine in question, obviously you should ignore this.

boot13

Posted 2010-06-19T18:29:21.510

Reputation: 5 551

I haven't installed Office, so that shouldn't be the case. By the way, ClipX is clipboard history manager, not clipboard replacement. But it seems like the Visual C# 2010 is causing the clipboard weirdness, I'm trying to confirm that, but I'm currently unable to reproduce the problem. Will keep trying. – Paya – 2010-07-07T15:47:59.897

You're splitting hairs. ClipX and (other tools like it) hook into the Windows clipboard and effectively remove all of its limitations, including the kind of strange behaviour you originally posted about. Why beat your head against the crappy default clipboard if you can work around it? – boot13 – 2010-07-08T00:51:59.993

"until I disabled the related features" Which ones? How did you disable them? @Paya – falsePockets – 2017-10-06T00:14:50.323

@falsePockets Maybe you should ask boot13? He wrote the post. Anyway I am using Visual Studio 2017 now and it doesn't have this issue anymore. – Paya – 2017-10-06T01:19:53.657

@falsePockets: this works in Word 2007 for sure, other versions probably as well. Click the Home tab, click the little arrow to the right of where it says 'Clipboard', just below 'Paste'. Click the Options button at the bottom left. Deselect some or all of these options. – boot13 – 2017-10-06T06:28:59.663

Woops, I tagged the wrong profile. @boot13: Which features did you disable? – falsePockets – 2017-11-17T15:17:40.467

@falsePockets: all of them. In my case, that's 'Show Office Clipboard Automatically', 'Show Office Clipboard When Ctrl+C Pressed Twice', 'Collect Without Showing Office Clipboard', 'Show Office Clipboard Icon on Taskbar', and 'Show Status Near Taskbar When Copying'. – boot13 – 2017-11-17T20:20:24.863

2

The proper way to do this, is to monitor API calls, Clipboard operations are function of user32.dll module

some of them are :

user32.dll!CloseClipboard
user32.dll!SetClipboardData
user32.dll!EmptyClipboard
user32.dll!GetClipboardData
...

some tools like Spy Studio or API Monitor let you track those calls and tell you who made them.

good luck !

user8228

Posted 2010-06-19T18:29:21.510

Reputation:

Spy Studio has no 64 bit support, argh... But API Monitor seems to do so, will check it out later... +1 Looks awesome! Already have worked with XPerf but this seems to be more handy as it can show parameters and other stuff. :-) – Tamara Wijsman – 2010-07-10T14:21:39.770

The new version of API Monitor is nice, the only downside is that some thing are not very user efficient, like selecting multiple processes or filters... I'll report that one of these days. :-) – Tamara Wijsman – 2010-07-16T00:55:07.210

yeah they have just released the V2 :) looks promising. tell me if it give some results, and there is many others but most of them permit hooking over only one process (not very handy for your case) – None – 2010-07-16T19:44:07.167