C # simulate a mouse click event FindWindow instance

Source: Internet
Author: User
[DllImport ("User32.dll", EntryPoint = "FindWindow")] private static extern IntPtr FindWindow (string lpClassName, string lpWindowName); private void button2_Click (object sender, EventArgs e) {IntPtr formHandle = FindWindow (null, "window title"); // 0x0175015f hexadecimal coordinate, decimal to hexadecimal (x high, y low) (0175) x = 373, (015F) y = 351 SendMessage (formHandle, 0x0201, 0, (int) 0x0175015f); // send WM_LBUTTONDOWN = 0x0201 left-click to press SendMessage (formHandle, 0x0202, 0, (int) 0x0175015f); // send WM_LBUTTONUP = 0x0202 left-click lift}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.