日期:2014-05-17 浏览次数:21096 次
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace WindowsFormsApplication6
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
/// <summary>
/// 向指定窗口发送字符串
/// </summary>
[DllImport("User32.dll", EntryPoint = "SendMessage")]
static extern int SendMessage(IntPtr hWnd, int msg, IntPtr wParam, string lParam);
/// <summary>
/// 查找指定窗口句柄
/// </summary>
/// <param name="lpClassName">窗口类名</param>
/// <param name="lpWindowName">窗口标题</param>
/// <returns></returns>
[DllImport("user32.dll")]
private static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
/// <summary>
/// 查找子窗口句柄
/// </summary>
/// <param name="hwndParent">要查找子窗口的父窗口句柄</param>