i created a little demo, i can't believe that i am the only person with this problem.
the attachment is this source + gui with 4 buttons. you need visual c# to compile.
if you run it, set diablo to 800*600 windowed, i just click static screen positions.
if i change the 0x0207 to 0x0201 and 0x0208 to 0x0202 to use the left mouse button it works, but i want the middle button
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.Runtime.InteropServices;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
IntPtr hwnd;
[DllImport("user32")]
static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
[DllImport("user32.dll")]
public static extern IntPtr SendMessage(IntPtr hwnd, uint message, IntPtr wParam, IntPtr lParam);
public Form1()
{
InitializeComponent();
hwnd = FindWindow(null, "Diablo III");
}
public void MMouseClick(short x, short y)
{
IntPtr lParam = (IntPtr)((x & 0xFFFF) | ((y & 0xFFFF) << 16));
const uint WM_MBUTTONDOWN = 0x0207; // 0x0201 = left, 0x0204 = right, 0x0207 = middle
const uint WM_MBUTTONUP = 0x0208; // 0x0202 = left, 0x0205 = right, 0x0208 = middle
SendMessage(hwnd, WM_MBUTTONDOWN, IntPtr.Zero, lParam);
System.Threading.Thread.Sleep(100);
SendMessage(hwnd, WM_MBUTTONUP, IntPtr.Zero, lParam);
}
private void north_Click(object sender, EventArgs e)
{
MMouseClick(400, 200);
}
private void south_Click(object sender, EventArgs e)
{
MMouseClick(400, 400);
}
private void west_Click(object sender, EventArgs e)
{
MMouseClick(300, 300);
}
private void east_Click(object sender, EventArgs e)
{
MMouseClick(500, 300);
}
}
}
Peter