Ok, zaboravi ono gore, .NET message queue implementacija se ne moze tako lako prevariti, moras da simuliras pravi doubleclick nad textboxom sto ukljucuje slanje 4 poruke
Evo ti mali sample, kad sam vec u ordinaciji.
Code:
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
[DllImport("user32.dll", CharSet = CharSet.Auto)]
private static extern IntPtr SendMessage(HandleRef hWnd, int msg, int wParam, int lParam);
private const int WM_MOUSEDOWN = 0x201;
private const int WM_MOUSEUP = 0x202;
private const int WM_LBUTTONDBLCLK = 0x203;
private void button1_Click(object sender, EventArgs e)
{
HandleRef h = new HandleRef(textBox1, textBox1.Handle);
SendMessage(h, WM_MOUSEDOWN, 0, 0);
SendMessage(h, WM_MOUSEUP, 0, 0);
SendMessage(h, WM_LBUTTONDBLCLK, 0, 0);
SendMessage(h, WM_MOUSEUP, 0, 0);
}
private void textBox1_DoubleClick(object sender, EventArgs e)
{
MessageBox.Show("Ovo je textbox doubleclick");
}
}
naravno, po specifikaciji WM_* poruke imaju konkretne w i l parametre, ali radi i sa 0,0. Jedina nezgodacija sa ovim je sto ce fokus ostati na textbox-u (zbog prvog WM_MOUSEDOWN)