Originally Posted by
Mikanor
You can use mouse_event - it work for the movement.
Are you saying I should bind my in game movement to mouse events? and then use mouse_event in c#?
EDIT:
I tested this and its working for setting my run forward binding to middle mouse down. This is a really awkward way of doing it.. and then I would need to bind my other asd to mouse down's... and i only have 1 mouse down... this is not the way to do it
ADDING CODE:
HTML Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using System.Windows;
using System.Runtime.InteropServices;
using System.IO;
using System.Threading;
namespace SendInput
{
public partial class Form1 : Form
{
//Win32 API imports
[DllImportAttribute("User32.dll")]
private static extern int FindWindow(String ClassName, String WindowName);
//Import the SetForeground API to activate it
[DllImportAttribute("User32.dll")]
private static extern IntPtr SetForegroundWindow(int hWnd);
[DllImport("user32.dll", ExactSpelling = true)]
public static extern long mouse_event(Int32 dwFlags, Int32 dx, Int32 dy, Int32 cButtons, Int32 dwExtraInfo);
[DllImport("user32.dll", ExactSpelling = true)]
public static extern void SetCursorPos(Int32 x, Int32 y);
public const Int32 MOUSEEVENTF_ABSOLUTE = 0x8000;
public const Int32 MOUSEEVENTF_LEFTDOWN = 0x0002;
public const Int32 MOUSEEVENTF_LEFTUP = 0x0004;
public const Int32 MOUSEEVENTF_MIDDLEDOWN = 0x0020;
public const Int32 MOUSEEVENTF_MIDDLEUP = 0x0040;
public const Int32 MOUSEEVENTF_MOVE = 0x0001;
public const Int32 MOUSEEVENTF_RIGHTDOWN = 0x0008;
public const Int32 MOUSEEVENTF_RIGHTUP = 0x0010;
public static void PerformLeftKlick(Int32 x, Int32 y)
{
SetCursorPos(x, y);
mouse_event(MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MIDDLEDOWN, 0, 0, 0, 0);
//mouse_event(MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MIDDLEUP, 0, 0, 0, 0);
}
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
int hWnd = FindWindow(null, "Star Wars: The Old Republic");
if (hWnd > 0) //If found
{
//Bring SWTOR to the front
SetForegroundWindow(hWnd);
Thread.Sleep(3000);
PerformLeftKlick(411, 380);
}
}
}
}