Besides the wrong use of DLLs, when I try to use the theTestValue
inside the IntPtr
method the IntelliSense marks it as fail. I would like to know why this is happening because I need to use a bool
from outside inside this method.
public partial class Form1 : Form
{
[DllImport("user32.dll")]
private static extern IntPtr CallNextHookEx(IntPtr hhk, int nCode,
IntPtr wParam, IntPtr lParam);
[DllImport("user32.dll")]
private static extern IntPtr CallNextHookEx(IntPtr hhk, int nCode,
IntPtr wParam, IntPtr lParam);
private static LowLevelKeyboardProc _proc = HookCallback;
private delegate IntPtr LowLevelKeyboardProc(
int nCode, IntPtr wParam, IntPtr lParam);
public bool theTestValue = false; //This is the value
private static IntPtr HookCallback(
int nCode, IntPtr wParam, IntPtr lParam)
{
theTestValue = true; //Red marked
}
return CallNextHookEx(_hookID, nCode, wParam, lParam);
}