111,130
社区成员
发帖
与我相关
我的任务
分享
public partial class FormApi : Form
{
public const uint WM_LBUTTONDOWN = 0x0201;
public const uint WM_LBUTTONUP = 0x0202;
[DllImport("user32.dll", EntryPoint = "SendMessageA")]
public static extern int SendMessage(IntPtr hwnd, uint wMsg, long wParam, long lParam);
int MAKELPARAM(ushort wLow, ushort wHigh)
{
return wHigh * 0x10000 + wLow;
}
public FormApi()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
SendMessage(this.Handle, WM_LBUTTONDOWN, 0, MAKELPARAM(40, 11));
SendMessage(this.Handle, WM_LBUTTONUP, 0, MAKELPARAM(40, 11));
}
private void button2_Click(object sender, EventArgs e)
{
MessageBox.Show("button2_Click");
}
private void FormApi_Click(object sender, EventArgs e)
{
MessageBox.Show("FormApi_Click");
}
}