Click here to Skip to main content
15,892,768 members
Articles / Programming Languages / C#

Using Hooks from C#

Rate me:
Please Sign up or sign in to vote.
4.58/5 (39 votes)
30 Dec 2009CPOL5 min read 506K   21.2K   193  
An article on using Windows hooks from .NET, demonstrated with a MouseHook.
Microsoft Visual Studio Solution File, Format Version 8.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MouseHookTest", "MouseHookTest\MouseHookTest.csproj", "{952A886A-EE99-4509-9E89-6E6A39A9131A}"
	ProjectSection(ProjectDependencies) = postProject
	EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Win32.Hooks", "Microsoft.Win32.Hooks\Microsoft.Win32.Hooks.csproj", "{29588A04-98E8-41AC-A5C3-CEADEE7776CB}"
	ProjectSection(ProjectDependencies) = postProject
	EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ParentNotifyMouse", "ParentNotifyMouse\ParentNotifyMouse.csproj", "{8DDF389B-59AA-422A-AD11-24BE0FBDF7F9}"
	ProjectSection(ProjectDependencies) = postProject
	EndProjectSection
EndProject
Global
	GlobalSection(SolutionConfiguration) = preSolution
		Debug = Debug
		Release = Release
	EndGlobalSection
	GlobalSection(ProjectConfiguration) = postSolution
		{952A886A-EE99-4509-9E89-6E6A39A9131A}.Debug.ActiveCfg = Debug|.NET
		{952A886A-EE99-4509-9E89-6E6A39A9131A}.Debug.Build.0 = Debug|.NET
		{952A886A-EE99-4509-9E89-6E6A39A9131A}.Release.ActiveCfg = Release|.NET
		{952A886A-EE99-4509-9E89-6E6A39A9131A}.Release.Build.0 = Release|.NET
		{29588A04-98E8-41AC-A5C3-CEADEE7776CB}.Debug.ActiveCfg = Debug|.NET
		{29588A04-98E8-41AC-A5C3-CEADEE7776CB}.Debug.Build.0 = Debug|.NET
		{29588A04-98E8-41AC-A5C3-CEADEE7776CB}.Release.ActiveCfg = Release|.NET
		{29588A04-98E8-41AC-A5C3-CEADEE7776CB}.Release.Build.0 = Release|.NET
		{8DDF389B-59AA-422A-AD11-24BE0FBDF7F9}.Debug.ActiveCfg = Debug|.NET
		{8DDF389B-59AA-422A-AD11-24BE0FBDF7F9}.Debug.Build.0 = Debug|.NET
		{8DDF389B-59AA-422A-AD11-24BE0FBDF7F9}.Release.ActiveCfg = Release|.NET
		{8DDF389B-59AA-422A-AD11-24BE0FBDF7F9}.Release.Build.0 = Release|.NET
	EndGlobalSection
	GlobalSection(ExtensibilityGlobals) = postSolution
	EndGlobalSection
	GlobalSection(ExtensibilityAddIns) = postSolution
	EndGlobalSection
EndGlobal

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Team Leader Starkey Laboratories
United States United States
The first computer program I ever wrote was in BASIC on a TRS-80 Model I and it looked something like:
10 PRINT "Don is cool"
20 GOTO 10

It only went downhill from there.

Hey look, I've got a blog

Comments and Discussions