Solved

Question about the clipboard

Posted on 2004-04-30
11
207 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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

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…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

744 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

10 Experts available now in Live!

Get 1:1 Help Now