topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Sunday October 6, 2024, 6:17 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: IDEA: Clipboard Chain broken notifier  (Read 15994 times)

springro

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 41
    • View Profile
    • Donate to Member
IDEA: Clipboard Chain broken notifier
« on: May 24, 2007, 01:48 PM »

Idea is for an application that monitors the clipboard chain and lets you know when it breaks for troubleshooting what is causing it.

I'm having problems where the clipboard chain gets disconnected, but I don't what's the cause of it.
This happens every so often and even "repair clipboard chain" doesn't seem to do the trick (in this case it clipcache2.9).

Sounds like Clip Mate has something that is a similar function, but I really don't want to try having 2 clipboard managers running at the same time.
see:  http://www.clipmate....m#TroubleChainBroken

Is this something that can be done in AutoHotkey to test for the chain?

Thanks,
Rob

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Donate to Member
Re: IDEA: Clipboard Chain broken notifier
« Reply #1 on: May 24, 2007, 02:31 PM »
Well.. I'd recomend using mouser's Clipboard Help and Spell. I use it myself and i don't even know what it means to have the clipboard chain disconnected :P

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
Re: IDEA: Clipboard Chain broken notifier
« Reply #2 on: May 24, 2007, 09:43 PM »
we have had several discussions here on the clipboard chain.. btw, if you're doing programming work, this is a good place to start.. All you ever wanted to know about the Clipboard... :)


springro

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 41
    • View Profile
    • Donate to Member
Re: IDEA: Clipboard Chain broken notifier
« Reply #3 on: May 25, 2007, 05:58 AM »

I searched for clipboard chain, but didn't get anything...
Ah -- It looks like the standard Donation Coder search won't dig anything up, you need to go with the google search of donationcoder.com to get results.

Sorry Lanux - not that level of programmer to use the information you linked to, more script tinkerer.

Maybe just a question - if the clipboard chain gets broken, does it break all links or just ones "after it" (if this is how it works).

Does a new application launching that uses the clipboard chain automatically go to the end of the list?  Just wondering if when an application is started can affect how often it would be affected by other applications.  This might be useful to add a simple application that checks for something getting added to the clipboard every time CTRL+C is pressed.  At least I think this should be easy in Autohotkey, just add a pass through script for CTRL+C and monitor for a clipboard change.  If it receives a CTRL+C, but no change report, there may have been an issue.

Crazy?

Thanks,
Rob

wr975

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 369
    • View Profile
    • Donate to Member
Re: IDEA: Clipboard Chain broken notifier
« Reply #4 on: May 25, 2007, 06:19 AM »
Perhaps this is useful for you:

ArsClip offers a "clipboard chain break notification". There's also an option to enable an extended checking.

http://www.joejoesoft.com/

Automatic clipboard chain break detection

UPDATE: Vista users can and should disable chain break detection, since breaks are no longer present on the Vista operating system.

Unfortunately, any program can mess up the "clipboard chain", because it is left up to the program to correctly handle clipboard messages. ArsClip has a workaround for this. It checks the contents of the clipboard every 1 minute to make sure that it was automatically notified of the current items arrival. If it wasn't, it will display an error message, and then transparently fix any future problems this session without bugging you. This can help you track down programs that break any clipboard monitors. For example, if you run a program and copy an item to the clipboard and up to a minute later you get this ArsClip error message, you can be pretty sure that program can break the windows clipboard chain. Please let me know of any programs you use that break the chain.

ArsClip nows monitors for programs that may have crashed or left the clipboard chain without properly notifying windows. This helps detect chain breaks much earlier and increases the accuracy of detecting problem programs.

There is an option (under Config -> Clipboard) to disable the Notification window all together, but it is only recommended for advanced users.

« Last Edit: May 25, 2007, 06:24 AM by wr975 »

tranglos

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,081
    • View Profile
    • Donate to Member
Re: IDEA: Clipboard Chain broken notifier
« Reply #5 on: May 25, 2007, 08:14 AM »
Maybe just a question - if the clipboard chain gets broken, does it break all links or just ones "after it" (if this is how it works).

As I understand the relevant MS documentation, the application gets added to the front of the list, so it would break all previous links in the chain. Applications that register themselves for clipboard monitoring later should not be affected.

Does a new application launching that uses the clipboard chain automatically go to the end of the list?

To the beginning of the list, actually, and it is responsible for doing two things:
1. It must forward clipboard messages to the next application in chain
2. It muat cleanly remove itself and restore the chain when it stops monitoring the clipboard.

Failing to to either will break the chain.

Just wondering if when an application is started can affect how often it would be affected by other applications.  This might be useful to add a simple application that checks for something getting added to the clipboard every time CTRL+C is pressed.  At least I think this should be easy in Autohotkey, just add a pass through script for CTRL+C and monitor for a clipboard change.  If it receives a CTRL+C, but no change report, there may have been an issue.

Just a reminder that Ctrl+C  is only one of many ways of copying stuff to clipboard.

tranglos

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,081
    • View Profile
    • Donate to Member
Re: IDEA: Clipboard Chain broken notifier
« Reply #6 on: May 25, 2007, 08:30 AM »
This is probably tangential to your question, but I wanted to raise an issue that's rarely considered when discussing clipboard managers (and the reason I never use one ;)) Running a clipboard manager is a huge security problem if you also use a password manager or have a habit of copying/pasting passwords. The reason why is obvious; finding a solution is less so.

As far as I know, ClipMate is the only clipboard manager that behaves responsibly, but it requires cooperation from the password manager. ClipMate's author came up with a truly genius solution for password managers to tell any other program that it must not capture a particular clip. The way to do this is to register a special clipboard format, for which ClipMate checks. If clipboard contains data in this format, it will not capture the clip. It's awfully simple and can be easily implemented in any Windows program:

http://www.thornsoft...developer_ignore.htm

I use this technique in my Oubliette password manager, but it does depend on the clipboard manager checking for this condition and honoring it. Since most programs probably don't do that, I implemented a different (optional) technique as well. You guessed it: I intentionally break the clipboard chain. Just before Oubliette copies a password to clipboard, it registers itself in the chain, and then does not forward the clipboard notification to the next app in chain. Immediately after that the chain is restored.

This prevents *any* clipboard extender from capturing the clip, but is admittedly a heavy-handed approach, optional for those who worry about this sort of thing. It seems to be an interesting case when a momentary breaking of the clipboard chain is intended and quite beneficial.
« Last Edit: May 25, 2007, 08:33 AM by tranglos »

justice

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,898
    • View Profile
    • Donate to Member
Re: IDEA: Clipboard Chain broken notifier
« Reply #7 on: May 25, 2007, 08:32 AM »
Most clipboard managers allow you to specify exclusions to programs such like your password manager?

tranglos

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,081
    • View Profile
    • Donate to Member
Re: IDEA: Clipboard Chain broken notifier
« Reply #8 on: May 25, 2007, 08:36 AM »
Most clipboard managers allow you to specify exclusions to programs such like your password manager?

I don't know if they do, and I don't know how it could be implemented. When an application is notified about change in clipboard data, there is no way to know "who" put the new data on clipboard. The clipboard manager cannot tell if you copied from Word or from a password manager. At least I don't know any Windows APIs that provide that information.

(This is also a generic problem with Windows APIs: the messages applications send to each other do not sxpecify the sender. If an app gets a "COPY" message, for example, it cannot know if the user clicked Edit->Copy or a trojan horse program is trying to copy some sensitive data.)

thornsoft

  • Participant
  • Joined in 2007
  • *
  • default avatar
  • Posts: 2
    • View Profile
    • Donate to Member
Re: IDEA: Clipboard Chain broken notifier
« Reply #9 on: May 25, 2007, 08:37 AM »
All you ever wanted to know about the Clipboard... :)

That's some seriously defective clipboard handling, and is the sort of thing that can and does cause clipboard chain problems in the first place.  The code on that article does not pass clipboard messages, nor does it handle the WM_CHANGECBCHAIN message.

My article pre-dates this one by a year, and properly explains how to handle the clipboard messaging, as does the SDK.
http://www.thornsoft..._clipboardviewer.htm
Also see (clipboard mistakes in general):
http://www.thornsoft...r_commonmistakes.htm

To the OP: while a noble idea, your stand-alone app would only notify you if your app were disconnected from the chain, and can't detect breaks further down the line.
Suppose the chain looks like this:

Outlook
Foobar App
Clipboard Toy

And you launch your monitor, and you have:

Monitoring App
Outlook
Foobar App
Clipboard Toy

Now Foobar quits, and doesn't remove itself properly.
Now the chain looks like this:

Monitoring App
Outlook

But you can only see the top of the chain. How are you going to know that the Clipboard Toy is disconnected? You can't.

thornsoft

  • Participant
  • Joined in 2007
  • *
  • default avatar
  • Posts: 2
    • View Profile
    • Donate to Member
Re: IDEA: Clipboard Chain broken notifier
« Reply #10 on: May 25, 2007, 08:41 AM »
Just before Oubliette copies a password to clipboard, it registers itself in the chain, and then does not forward the clipboard notification to the next app in chain. Immediately after that the chain is restored.

This prevents *any* clipboard extender from capturing the clip
Cool!  But it's limited to PROPER clipboard managers. I've seen lots of crappy ones over the year, usually weekend VB projects, that use a polling timer instead of clipboard event notification.  These poorly-written ones could steal the password.
Also, this technique won't work on Vista.

springro

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 41
    • View Profile
    • Donate to Member
Re: IDEA: Clipboard Chain broken notifier
« Reply #11 on: May 27, 2007, 07:01 AM »
Thanks for the feedback.  From this chain, I'm thinking one thing to do that might help out is to ensure that my clipboard manager starts later than most software at startup.  Conversely, a monitoring application should be the very first thing to start to ensure it's at the end.

It also indicates that exiting and restarting a program should restore it's clipboard chain in all cases, except when there is something really strange is going on with the system.  In that case it's probably time for a reboot.

Regarding the password manager/clipboard items: can't the issue of pasting be circumvented by using a text send command instead of a paste? 
I'm referring to something similar to Autohotkey's send or sendinput commands.  I have found them to be a little slower than pasting, but in the case of a password this shouldn't be an issue.
It would at least be a good method option to include in password software that could be set as a default, with a fall back option to pasting with a warning or similar.

Best,
Rob