Bill English said:
What is the difference between managed and unmanaged code?
Managed code is what is produced when you code in C#, VB.NET, or Managed
C++. According to MS, the definition is:
"Code executed and managed by the Microsoft® .NET Framework, specifically by
the .NET Framework's common language runtime. Managed code must supply the
information necessary for the common language runtime to provide services
such as memory management, cross-language integration, code access security,
and automatic lifetime control of objects. All code based on Microsoft
Intermediate Language executes as managed code."
Unmanaged code is what is produced by 'standard' C++ or C etc:
"Code that is executed directly by the operating system, outside the
Microsoft .NET Framework's common language runtime. Unmanaged code must
provide its own memory management, type checking, and security support,
unlike managed code, which receives these services from the common language
runtime. Unmanaged code must be executed outside the .NET Framework."
So basically, if you want to install a global hook, you're almost certainly
going to have to write unmanaged code, probably in the form of a C or C++
DLL. You'll then have to write some code that can interface between that and
the rest of your application, which I'm assuming is in C#. That interface
layer will either be in Managed C++, or will be P/Invoke calls from C#.
Stu