C# 读IE地址栏中的网址。
[DllImport("User32.dll")] //User32.dll是Windows操作系统的核心动态库之一
static extern int FindWindow(string lpClassName, string lpWindowName);
[DllImport("User32.dll")]
static extern int FindWindowEx(int hwndParent, int hwndChildAfter, string lpszClass, string lpszWindow);int parent = FindWindow("IEFrame", null);
int child = FindWindowEx(parent, 0, "WorkerW", null);
child = FindWindowEx(child, 0, "ReBarWindow32", null);
child = FindWindowEx(child, 0, ("Address Band Root"), null);
child = FindWindowEx(child, 0, "ComboBoxEx32", null);
child = FindWindowEx(child, 0, "ComboBox", null);上面代码中的“IEFrame”,“WorkerW”是什么,对不对象在内存的名称,请高手指点,我怎么样才参知道对象完整结构树。这样我才好读取IE中的标题等内容。万分感谢!!!
[DllImport("User32.dll")] //User32.dll是Windows操作系统的核心动态库之一
static extern int FindWindow(string lpClassName, string lpWindowName);
[DllImport("User32.dll")]
static extern int FindWindowEx(int hwndParent, int hwndChildAfter, string lpszClass, string lpszWindow);int parent = FindWindow("IEFrame", null);
int child = FindWindowEx(parent, 0, "WorkerW", null);
child = FindWindowEx(child, 0, "ReBarWindow32", null);
child = FindWindowEx(child, 0, ("Address Band Root"), null);
child = FindWindowEx(child, 0, "ComboBoxEx32", null);
child = FindWindowEx(child, 0, "ComboBox", null);上面代码中的“IEFrame”,“WorkerW”是什么,对不对象在内存的名称,请高手指点,我怎么样才参知道对象完整结构树。这样我才好读取IE中的标题等内容。万分感谢!!!
IEFrame WorkerW是 空间类名 多看msdn
至于窗口类是什么,你的研究一下windows api.CreateWindow的第一个参数就是它
参考:
http://msdn.microsoft.com/en-us/library/ms908192.aspx窗口的完整结构树可以使用Spy++来看。Spy++是Visual Studio带的一个工具,可以从
开始菜单中Visual Studio下面的Visual Studio Tools中进入
参考:
http://www.cnblogs.com/index/archive/2005/03/29/127619.html