I need to invoke the ListBox1_DoubleClick event from another application.
Look below how I think that should be the code:
using System.Runtime.InteropServices;
public class RemoteControl
{
[DllImport("user32.dll", EntryPoint = "FindWindow", SetLastError = true)]
private static extern IntPtr FindWindowByCaption(IntPtr zeroOnly, string lpWindowName);
public void SendClickLB(string sWinTitle, int iChildHandler)
{
var windowHWnd = FindWindowByCaption(IntPtr.Zero, windowTitle);
var childWindows = GetChildWindows(windowHWnd);
IntPtr hWnd = childWindows.ToArray()[index];
const int WM_LBUTTONDBLCLK = 0x0203;
SendMessage(hWnd, WM_LBUTTONDBLCLK, new IntPtr(0), new IntPtr(0));
}
}