Understanding dllimport and how to use keyboard hooking
My knowledge at C# is from school.
I'm trying to build something that requires keyboard hooking - as I understand, that allows me to know what the user press when my program is out of focus.
I googled it and in many tutorials I came across the line dllimport
which I don't know so well - only the fact that it import a dll in other language (not C#).
I tried to read about it but I realy don't understand it.
When I try to import a method from a dll, logically I should have the dll method in that options box - but I don't have. H开发者_高级运维ow can I know which methods are inside this dll, and moreover, which variables I should send to them? I really don't understand this.
I'll be thankful for any little explanations.
Stephen Toub has a good example of how to do keyboard hooking.
DllImport is used to call into unmananged dlls such as the ones in the Win32 API for keyboard hooking. You find out about functions in dlls by reading the C/C++ headers for the dll's API. For the Win32 API, there is also http://pinvoke.net/ and the online MSDN documentation.
have a look at this project on CodeProject.
精彩评论