Solved

Question about the clipboard

Posted on 2004-04-30
11
210 Views
Last Modified: 2013-12-03
Is it possible to change the clipboard contents without using the windows API functions OpenClipboard() or SetClipboardData()?

I am trying to create a hook that tells me when a program has changed the clipboard contents.  This works fine for most of the programs I've tested it on, but there is 1 program that changes the clipboard contents, and my hook is not notified of it.  I am hooking the two functions mentioned above, so I am wondering if this program is changing the clipboard contents without calling those two functions somehow.
0
Comment
Question by:lwinkenb
  • 5
  • 2
  • 2
  • +1
11 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 250 total points
ID: 10965417
Let me phrase it like this: Would you take a "no" as an answer?
0
 
LVL 5

Author Comment

by:lwinkenb
ID: 10965512
I would if it was the correct answer.  If there's no other way to access the clipboard, then there is no other way.
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 10974073
It seems to me that the easiest way to detect changes in the Clipboard would be to register yourself as a ClipboardViewer via the SetClipboardViewer API.

In what way is the "problem app" changing the clipboard... There are certain "changes" that are just reformatting of existing data that takes place when it is requested.

-- Dan
0
 
LVL 5

Author Comment

by:lwinkenb
ID: 10974095
Well the problem is that the program in question keeps setting itself as the clipboard owner, and it doesnt pass along the WM_DRAWCLIPBOARD messages.  

>> In what way is the "problem app" changing the clipboard... There are certain "changes" that are just reformatting of existing data that takes place when it is requested.

That is pretty much what the app does.  It reformats data on the clipboard.

I have a mistake in my original post.  Instead of hooking OpenClipboard(), I was actually hooking EmptyClipboard().  So the two functions I was hooking was EmptyClipboard(), and SetClipboardData().
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 10983053
>> It reformats data on the clipboard.

Can you describe an example?
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 5

Author Comment

by:lwinkenb
ID: 10983272
Sure.

The app monitors the clipboard, and when it sees a specific thing pasted to the clipboard, it will change that text.

For instance, Let's say the following was posted to the clipboard:

Player
team
minutes
points
rebounds
Tracy McGrady
Magic
41
32
4

Now the app recognizes that text as something it's supposed to format.  What it does it put the following onto the clipboard:

Player: Tracy McGrady
Team: Orlando Magic
Minutes: 41
Points: 32
Rebounds: 4

I'm not sure exactly how it recognizes that the text is something it's supposed to format.  Maybe it just looks for text where the first line contains "Player", and the second line contains "Team".
0
 
LVL 12

Expert Comment

by:Ivanov_G
ID: 11022526

  Look at this article "Monitoring the Clipboard"
  http://www.innotts.co.uk/zephyr/monclip.html

  I hope you can undestand the code in Delphi
0
 
LVL 5

Author Comment

by:lwinkenb
ID: 11022805
Please read all the comments in the thread Ivanov.  I cant monitor the clipboard that way because the application doesn't pass along the WM_DRAWCLIPBOARD messages.
0
 
LVL 86

Expert Comment

by:jkr
ID: 11175351
Hmm, I thought you'd take a 'no' as an answer? :o)
0
 
LVL 5

Author Comment

by:lwinkenb
ID: 11175617
hehe, I would - but no one gave me no as an answer.  I thought Dan might of had an idea which is why I kept this question open.  I guess since you insinuated that the answer to my question was 'no', then you deserve the points.  I was looking for something a little more concrete though :)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article describes how to add a user-defined command button to the Windows 7 Explorer toolbar.  In the previous article (http://www.experts-exchange.com/A_2172.html), we saw how to put the Delete button back there where it belongs.  "Delete" is …
In this article, I will show how to use the Ribbon IDs Tool Window to assign the built-in Office icons to a ribbon button.  This tool will help us to find the OfficeImageId that corresponds to our desired built-in Office icon. The tool is part of…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now