Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6055811
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:18:22+00:00 2026-05-23T08:18:22+00:00

From a .net application I wish to capture all keyboard events, globally. I set

  • 0

From a .net application I wish to capture all keyboard events, globally.

I set a callback using a win32-method SetWindowsHookEx(WH_KEYBOARD, HINSTANCE). (Using dllimport and some mashall-call.)

One the first key is pressed I get a nice response saying which key is pressed.
My callback-function calls CallNextHookEx as is should do.
But after the first event I get no more events.

Any-one has any idea of common causes for events to stop coming?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T08:18:23+00:00Added an answer on May 23, 2026 at 8:18 am

    WH_KEYBOARD is not supported from a managed wrapper, it needs to inject itself into the process.

    You can use WH_KEYBOARD_LL which will be called in the declaring thread.

    see: http://support.microsoft.com/kb/318804

    Global hooks are not supported in the
    .NET Framework Except for the
    WH_KEYBOARD_LL low-level hook and the
    WH_MOUSE_LL low-level hook, you cannot
    implement global hooks in the
    Microsoft .NET Framework. To install a
    global hook, a hook must have a native
    DLL export to inject itself in another
    process that requires a valid,
    consistent function to call into. This
    behavior requires a DLL export. The
    .NET Framework does not support DLL
    exports. Managed code has no concept
    of a consistent value for a function
    pointer because these function
    pointers are proxies that are built
    dynamically.

    Low-level hook procedures are called
    on the thread that installed the hook.
    Low-level hooks do not require that
    the hook procedure be implemented in a
    DLL.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How do I invoke a console application from my .NET application and capture all
I wish to compile my asp.net MVC application using aspnet_compiler.exe from the comandline to
Any GOOD libraries available to access SVN from .net application (using C#). The only
Has anyone successfully talked profibus from a .NET application? If you did, what device/card
I have a query that I'm executing from a .NET application to a SQL
How do I get the path to the machine.config from a .Net application? It
I'm trying to profile SQL reporting services, used from ASP.NET application. In SQL profiler
I tried upgrading an ASP.Net application from Visual Studio 2005 to 2008, and I
I am migrating an application from .NET 1.1 to .NET 2.0. Should I remove
We just recently migrated our web application from .NET 1.1 to .NET 2.0. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.