Hi, all:
I have a question about using a hook in my program. As is known that we can use a function SetWindowsHookEx(...) in Win32API and C/C++ programming. Now I want do it with BCL and C# in Windows Form progamming. For example, I want to get keyboard message when the form is mininized or unactived. How can I do?
Thanks for any advices.
Comments
: I have a question about using a hook in my program. As is known that we can use a function SetWindowsHookEx(...) in Win32API and C/C++ programming. Now I want do it with BCL and C# in Windows Form progamming. For example, I want to get keyboard message when the form is mininized or unactived. How can I do?
: Thanks for any advices.
:
In vb.net you use the same old declare statement from vb6. In c# you will use a statement like the following...
[code]
using System.Runtime.InteropServices
[DllImport("kernel32")]
private static extern int Beep(int dwFreq, int dwDuration);
[/code]
This is a sample that I saw in a book, but all you have to do is modify the func name and the parameters. (I think) If not, it'll be close enough that you could wing it.
-Ray