windows-user-action-hook icon indicating copy to clipboard operation
windows-user-action-hook copied to clipboard

VB.Net - WM_PASTE

Open snrchang opened this issue 7 years ago • 1 comments

Could you be so kind to give me a example of using your awesome library in VB.Net

Also could this library be used to globally catch the WM_PASTE hook. So you can detect user paste not only by ctrl v but also by context menu

Thanks so much for this library and your work

snrchang avatar May 12 '18 08:05 snrchang

I am not sure on the syntax for event handling in VB.Net. Its been years.

    Dim eventHookFactory = New EventHookFactory()
    Dim keyboardWatcher = eventHookFactory.GetKeyboardWatcher()
    keyboardWatcher.Start()

I see that difficulty is with attaching the events with handlers. It won't be any different than the vb sample code in msdn for timer elapsed event.

https://msdn.microsoft.com/en-us/library/system.timers.timer.interval(v=vs.110).aspx?cs-save-lang=1&cs-lang=vb#code-snippet-2

May be something like below.


 ' Hook up the Elapsed event for the timer.  
 AddHandler keyboardWatcher.OnKeyInput, AddressOf OnKeyInputEvent

   Private Sub OnKeyInputEvent(source As Object, e As KeyInputEventArgs)
         Console.WriteLine(string.Format("Key {0} event of key {1}", e.KeyData.EventType, e.KeyData.Keyname));
    End Sub

justcoding121 avatar May 16 '18 01:05 justcoding121