HI Alex,
I think making a background thread to check the clipboard is not a good
solution(may be its logic is simple).
Because of infinite loop, it will waste a lot of CPU work cycles.
Beside of HOOK, I think you can use SetClipboardViewer() to set your window
to the notification chain of clipboard.
The parameter of this function is your window that wants to be notificated
when clipboard changes.
You can search SetClipboardViewer() function in MSDN to get more
information.
If you still have anything unclear, please feel free to let me know.
Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! -
www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
--------------------
| Content-Class: urn:content-classes:message
| From: "Alex" <ba*******@hotmail.com>
| Sender: "Alex" <ba*******@hotmail.com>
| References: <uZ**************@TK2MSFTNGP09.phx.gbl>
<Lr**************@cpmsftngxa06.phx.gbl>
| Subject: RE: Can C# listen for system events?
| Date: Thu, 21 Aug 2003 19:58:19 -0700
| Lines: 10
| Message-ID: <05****************************@phx.gbl>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Thread-Index: AcNoWT2mY2a6IfhzTt6gQSjaAJx9AQ==
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Newsgroups: microsoft.public.dotnet.languages.csharp
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:178448
| NNTP-Posting-Host: TK2MSFTNGXA14 10.40.1.166
| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| Thanks for the reply!
|
| I have decided an easier solution to my problem is to
| create a new thread that will run continuously and call
| System.Windows.Forms.Clipboard.GetDataObject(). From this
| point, I can determine if the clipboard's data has
| changed. I should have thought of that initially, but I
| am grateful for your response - it was helpful.
|
| Alex
|