I
ILT5000
Guest
Hello,
When i use SendInput with the MouseKeyHook library for catching global mouse hooks, the SendInput mouse action is unwanted delayed. What could be the problem and how could i fix it?
public Form1() {
InitializeComponent();
Subscribe();
}
public void Subscribe() {
m_GlobalHook = Hook.GlobalEvents();
m_GlobalHook.MouseDownExt += GlobalHookMouseDownExt;
}
private void GlobalHookMouseDownExt(object sender, MouseEventExtArgs e) {
e.Handled = true;
switch (e.Button) {
case MouseButtons.Left:
INPUT m_input = new INPUT();
Point p;
if (GetCursorPos(out p)) {
IntPtr hWnd = WindowFromPoint(p);
if (hWnd != IntPtr.Zero) SetWindowText(hWnd, "Window Found");
m_input.type = INPUT_MOUSE;
m_input.mi.dx = p.X;
m_input.mi.dy = p.Y;
m_input.mi.dwFlags = 0x01000;
m_input.mi.dwExtraInfo = IntPtr.Zero;
m_input.mi.mouseData = 120;
m_input.mi.time = 0;
SendInput(1, ref m_input, Marshal.SizeOf(m_input));
}
break;
default:
break;
}
Continue reading...
When i use SendInput with the MouseKeyHook library for catching global mouse hooks, the SendInput mouse action is unwanted delayed. What could be the problem and how could i fix it?
public Form1() {
InitializeComponent();
Subscribe();
}
public void Subscribe() {
m_GlobalHook = Hook.GlobalEvents();
m_GlobalHook.MouseDownExt += GlobalHookMouseDownExt;
}
private void GlobalHookMouseDownExt(object sender, MouseEventExtArgs e) {
e.Handled = true;
switch (e.Button) {
case MouseButtons.Left:
INPUT m_input = new INPUT();
Point p;
if (GetCursorPos(out p)) {
IntPtr hWnd = WindowFromPoint(p);
if (hWnd != IntPtr.Zero) SetWindowText(hWnd, "Window Found");
m_input.type = INPUT_MOUSE;
m_input.mi.dx = p.X;
m_input.mi.dy = p.Y;
m_input.mi.dwFlags = 0x01000;
m_input.mi.dwExtraInfo = IntPtr.Zero;
m_input.mi.mouseData = 120;
m_input.mi.time = 0;
SendInput(1, ref m_input, Marshal.SizeOf(m_input));
}
break;
default:
break;
}
Continue reading...