Vb. Net Global Keyboard mouse hook [vb.net hook] (revised version)

Source: Internet
Author: User
Tags visual studio

There are bugs in the original, because this is the code I converted from C #, where the original conversion was not fully compatible because of the different nature of the two languages.

Of course, now I am fully capable of compatible with the characteristics of both languages, so rewrite this code, the original code in the event detection, as well as the original code in the KeyPress time can not detect input character casing bug elimination (thanks to Comrade Verywzm).

Note: If this code wants to run in VS, remove the check from the [engineering properties]-[Debug]-[Start Visual Studio Hosting process], or use CTRL+F5 for compile-Time debugging!

This code contains dangerous code, please do not use for illegal purposes!

-------------------------------------------------------------------

This is real. NET environment, the global keyboard Mouse hook code!

This code is from CodeProject, the original author Michael Kennedy,c# encoded.

I translated this section of C # source code for VB, because there are some differences in the internal mechanism of the two languages, so I made a big change. Not easy AH ~ ~

The following code is I modify and expand the code, to retain all rights, pirated copy, piracy shameful.

Using the method is simple, create a new class file, copy the code aggressively, and then add an instance of the type to a blank area of a form.

Dim WithEvents Myhook as New Systemhook ()

Then you can use the static binding event.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.