using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Runtime.InteropServices; using System.Windows.Forms; using System.Diagnostics; using System.Threading; using Microsoft.Win32;namespace one { public partial class Form1 : Form { [DllImport("User32.dll ")] public static extern System.IntPtr FindWindowEx(System.IntPtr parent, System.IntPtr childe, string strclass, string strname); [DllImport("User32.dll", EntryPoint = "SendMessage")] private static extern int SendMessage( IntPtr hWnd, // handle to destination window int Msg, // message IntPtr wParam, // first message parameter int lParam // second message parameter ); bool flag = false; public Form1() { InitializeComponent(); } private void button1_Click(object sender, System.EventArgs e) { const int BM_CLICK = 0xF5;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using System.Diagnostics;
using System.Threading;
using Microsoft.Win32;namespace one
{
public partial class Form1 : Form
{ [DllImport("User32.dll ")]
public static extern System.IntPtr FindWindowEx(System.IntPtr parent, System.IntPtr childe, string strclass, string strname); [DllImport("User32.dll", EntryPoint = "SendMessage")]
private static extern int SendMessage(
IntPtr hWnd, // handle to destination window
int Msg, // message
IntPtr wParam, // first message parameter
int lParam // second message parameter
);
bool flag = false;
public Form1()
{
InitializeComponent(); }
private void button1_Click(object sender, System.EventArgs e)
{ const int BM_CLICK = 0xF5;
IntPtr hwndChildNext = FindWindowEx(父窗口句柄, System.IntPtr.Zero, "Button", "下页"); while(flag == true) {
SendMessage(hwndChildNext, BM_CLICK, System.IntPtr.Zero, 0);
Thread.Sleep(1000);
}
} private void button2_Click(object sender, EventArgs e)
{
flag = false;
}
}
}