custom .net class that receives windows-messages possible?

A

Art

hi everyone,

maybe someone can give me advice how to implement a .net - class that
receives (keystroke) messages. i dove already into the topic of
Application / AplicationContext and IMessageFilter. I understood, that
i can attach a message loop to a thread, and this thread then raises
the events in forms, in case windows sends a message to that form. but
it is always just a Form that gets messages routed to. in my case i
don't want a form.
in this simple example it should just be a class that listens to
keystrokes (without the console) and raise a keystroke-event or
however else it handles the message subsequently.

I spent the whole night on that topic and read several times, that
such a thing can not be achieved with .net/c#. WinAPI-funtions have to
be used to do that.

If so (or not) can anyone point me into the right direction? I have
some understanding of .net/c# but none at all with unmanaged code or
dll-imports. so if you provide advice can you please also post a
simple code sample of a .net class that can process messages.

thanks in advance,
Art
 
C

Chris Dunaway

hi everyone,

maybe someone can give me advice how to implement a .net - class that
receives (keystroke) messages. i dove already into the topic of
Application / AplicationContext and IMessageFilter. I understood, that
i can attach a message loop to a thread, and this thread then raises
the events in forms, in case windows sends a message to that form. but
it is always just a Form that gets messages routed to. in my case i
don't want a form.
in this simple example it should just be a class that listens to
keystrokes (without the console) and raise a keystroke-event or
however else it handles the message subsequently.

I spent the whole night on that topic and read several times, that
such a thing can not be achieved with .net/c#. WinAPI-funtions have to
be used to do that.

If so (or not) can anyone point me into the right direction? I have
some understanding of .net/c# but none at all with unmanaged code or
dll-imports. so if you provide advice can you please also post a
simple code sample of a .net class that can process messages.

thanks in advance,
Art

Perhaps this little library will help you:

http://www.codeproject.com/KB/system/globalmousekeyboardlib.aspx

Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top