/// <summary>
/// 找到窗口
/// </summary>
/// <param name="lpClassName">窗口類(lèi)名(例:Button)</param>
/// <param name="lpWindowName">窗口標(biāo)題</param>
/// <returns></returns>
[DllImport(
"user32.dll"
, EntryPoint =
"FindWindow"
)]
private
extern
static
IntPtr FindWindow(
string
lpClassName,
string
lpWindowName);
/// <summary>
/// 找到窗口
/// </summary>
/// <param name="hwndParent">父窗口句柄(如果為空,則為桌面窗口)</param>
/// <param name="hwndChildAfter">子窗口句柄(從該子窗口之后查找)</param>
/// <param name="lpszClass">窗口類(lèi)名(例:Button</param>
/// <param name="lpszWindow">窗口標(biāo)題</param>
/// <returns></returns>
[DllImport(
"user32.dll"
, EntryPoint =
"FindWindowEx"
)]
private
extern
static
IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter,
string
lpszClass,
string
lpszWindow);
/// <summary>
/// 發(fā)送消息
/// </summary>
/// <param name="hwnd">消息接受窗口句柄</param>
/// <param name="wMsg">消息</param>
/// <param name="wParam">指定附加的消息特定信息</param>
/// <param name="lParam">指定附加的消息特定信息</param>
/// <returns></returns>
[DllImport(
"user32.dll"
, EntryPoint =
"SendMessageA"
)]
private
static
extern
int
SendMessage(IntPtr hwnd,
uint
wMsg,
int
wParam,
int
lParam);
private
const
int
BM_CLICK = 0xF5;