Post: [vb.net]Alternative to ClipBoard Hook [text tut]
05-10-2011, 03:50 PM #1
(adsbygoogle = window.adsbygoogle || []).push({}); First post on here, so I figured I'd share my alternative to a Clipboard Hook.


Uses a timer and "My.Computer.Clipboard.GetText"

Toss the following code in a form with a textbox named "CBL", a button named "ClearCBL" and a timer named "CBLTimer"

    
Public Class ClipboardLog
Private Sub ClipboardLog_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
CBLTimer.Enabled = True
CBL.AppendText(Clipboard.GetText())
End Sub

Private Sub CBLTimer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CBLTimer.Tick
If CBL.Text.Contains(Clipboard.GetText) Then
CBL.Text = CBL.Text.Replace(Clipboard.GetText, Clipboard.GetText)
Else
CBL.Text = CBL.Text & Environment.Newline
CBL.AppendText(Clipboard.GetText)
End If
End Sub

Private Sub ClearCBL_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClearCBL.Click
CBL.Text = Nothing
End Sub
End Class

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo