HWND FindWindowEx(HWND hwndParent,HWND hwndChildAfter,LPCTSTR lpszClass,LPCTSTR lpszWindow);第一参数,
第二参数,
第三参数,
第四参数,分别怎么使用,可以示一些源码,并说明一下吗?国内的相关FindWindowEx的Blog都说得不怎么清楚,MSDN说的,就第三个参数,和第四个参数不理解。主要理解第三,四参数。谢谢了。没有可用分了。
第二参数,
第三参数,
第四参数,分别怎么使用,可以示一些源码,并说明一下吗?国内的相关FindWindowEx的Blog都说得不怎么清楚,MSDN说的,就第三个参数,和第四个参数不理解。主要理解第三,四参数。谢谢了。没有可用分了。
解决方案 »
- 禁止WebBrowser弹出为帮助保护您的安全,您的WEB..
- 如何删除DataGridView中选中的一行(vs 2008 c# winform)
- C# Dll的线程、事件、窗体的传递
- 很急,高手帮帮忙啊!跪求
- 高手请进,YzDock软件有人用过吗,用C#如何做出和他相似的动画效果
- 关于C#与javascript的两个问题,请秋枫,凡瑞,小山等热心高手帮帮
- 我要往access存大于16000的文本,怎么办?
- webkit.net 按钮点击事件如何触发
- System.DateTime问题
- 请问在C#的richtextbox 和 textbox 中如何控制内容滚动
- 分享自己写的字符串操作..
- c# txt批量导入sqlite 代码实现
"a.txt - 记事本"
{窗口的标题}我的这篇文章里面有例子
http://blog.csdn.net/lovefootball/archive/2009/02/24/3933232.aspx自己结合Spy++看一下就明白了
我之前就是这样认为:
第三:类名
第四:.Text属性但用了就知道,不是这个。因为我用SPY++找到控件相关的类名。如Button控件的类名:
WindowsForms10.BUTTON.app.0.14fd2b5Button.Text="确定";我就把第三参数赋值为"WindowsForms10.BUTTON.app.0.14fd2b5".
第四参数赋值为"确定";但结果还是找不到。
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime .InteropServices ;namespace WindowsApplication128
{
public partial class Form1 : Form
{
[DllImport("user32.dll")]
static extern int GetClassName(IntPtr Handle, [Out] StringBuilder ClassName, int MaxCount); [DllImport("user32.dll")]
static extern int SendMessage(IntPtr Handle, int WParam, int LParam); [DllImport("user32.dll")]
static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow); Button B = new Button(); public Form1()
{
InitializeComponent(); B.Parent = this;
B.Click += new EventHandler(B_Click); this.Shown += new EventHandler(Form1_Shown);
}
private void B_Click(object sender, EventArgs e)
{
MessageBox.Show("!!!");
} void Form1_Shown(object sender, EventArgs e)
{
int WM_CLICK = 0x00F5; StringBuilder ClassName = new StringBuilder(256);
GetClassName(B.Handle, ClassName, ClassName.Capacity); IntPtr Handle = FindWindowEx(this.Handle, IntPtr.Zero, ClassName.ToString(), String.Empty);
SendMessage(Handle, WM_CLICK, 0);
}
}
}
string lpszWindow = "button1";
IntPtr EdithWnd = new IntPtr(0);
EdithWnd = FindWindowEx(ParenthWnd, EdithWnd, lpszClass, lpszWindow);其中ParenthWnd是控件父窗体的句柄,可以用spy++查,也可以用FindWindow来获得的