Solved

Detect Changes to Clipboard

Posted on 1998-11-24
3
469 Views
Last Modified: 2013-11-25
How do I, using VB4-16, detect changes to the clipboard content?  I want my application to sit in the background and be 'notified' if the user copies some text to the clipboard.  If they do, then I know how to read it and check for certain content.

Right now I am reading the text contents of the clipboard every 2 seconds, but it seems a waste of processor time, if Windows can notify me of changes.

Thanks,
Rob
0
Comment
Question by:RobCG
3 Comments
 
LVL 2

Expert Comment

by:trillo
ID: 1446689
Unfortunately you can'n. VB processed the most used windows messages and transforms them into "Events". To catch new messages you should install what is called a WindowsHook, which can't be done in VB. I would start searching for a OCX component.
0
 
LVL 4

Accepted Solution

by:
anzen earned 150 total points
ID: 1446690
Get the "free" MsgHook control from Mabry (You can get it from some shareware sites) and intercept the messages You need.
0
 

Author Comment

by:RobCG
ID: 1446691
Thanks to anzen and trillo.  I found and installed msghook and found an example of a clipboard viewer somewhere else that used msghook for detecting clipboard changes.  I now have exactly what I needed.

I still think it would be technically possible without msghook, because if I remember correctly, I saw an example of receiving drag/drop (from file manager) messages without any addon programs (vbx/ocx).  I think it checked messages then did doevents() over and over.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

747 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

13 Experts available now in Live!

Get 1:1 Help Now