That sample works well for me (I have test it on free server (not java server))
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using System.Diagnostics;
using System.Threading;
using System.Windows.Forms;
namespace hndlTest
{
class Program
{
[DllImport("User32.dll")]
public static extern int SendMessage(IntPtr hWnd, int uMsg, int wParam, int lParam);
[DllImport("user32.dll", EntryPoint = "PostMessage")]
public static extern int PostMessage(IntPtr hWnd, uint Msg, uint wParam, uint lParam);
static private void Click()
{
IntPtr win_handle = new IntPtr();
string win_title = "II"; // set Lineage 2 window title here
foreach (Process p in Process.GetProcesses())
{
if (p.MainWindowTitle.Contains(win_title))
{
win_handle = p.MainWindowHandle;
break;
}
}
PostMessage(win_handle, 0x100, (uint)Keys.B, 0);
}
static void Main(string[] args)
{
Click();
Console.ReadKey();
}
}
}
p.s.
Same code with FindWindow("class","title"); or FindWindowEx(.....) wont work, becouse it obtains wrong handle.
+
If you want to send commands to several lineage 2 window you could try to rename it's titles somehow.