Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Question about the clipboard

Posted on 2004-04-30
11
Medium Priority
?
220 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
  • 2
  • +1
11 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 1000 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
NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

 
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
 
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

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Question has a verified solution.

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

This tutorial is about how to put some of your C++ program's functionality into a standard DLL, and how to make working with the EXE and the DLL simple and seamless.   We'll be using Microsoft Visual Studio 2008 and we will cut out the noise; that i…
zlib is a free compression library (a DLL) on which the popular gzip utility is built.  In this article, we'll see how to use the zlib functions to compress and decompress data in memory; that is, without needing to use a temporary file.  We'll be c…
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…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

604 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