C# Клик мыши в неактивном окне
Как сделать клик мыши по кординатам в не активном окне?
для игры на движке DirectX
игра сделана в Unity, скомпилирована в машинный код (C++)
Для WinAPI я использую библиотеку: MemorySharp
Пробывал:
Point move = new Point(450, 365);
MemorySharp sharp = new MemorySharp(process);
Binarysharp.MemoryManagement.Windows.RemoteWindow window = sharp.Windows.MainWindow;
window.SendMessage(Binarysharp.MemoryManagement.Native.WindowsMessages.LButtonDown, UIntPtr.Zero, CreateLParam(move));
window.SendMessage(Binarysharp.MemoryManagement.Native.WindowsMessages.LButtonUp, UIntPtr.Zero, CreateLParam(move));
sharp.Dispose();
Метод CreateLParam
public static IntPtr CreateLParam(Point point)
{
return (IntPtr)((point.X << 16) | (point.Y & 0xffff));
}
Пробывал №2:
window.PostMessage(Binarysharp.MemoryManagement.Native.WindowsMessages.LButtonDown, UIntPtr.Zero, (UIntPtr)(move.X & (move.Y << 16)));
window.PostMessage(Binarysharp.MemoryManagement.Native.WindowsMessages.LButtonUp, UIntPtr.Zero, (UIntPtr)(move.X & (move.Y << 16)));