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中的标题等内容。万分感谢!!!

解决方案 »

  1.   

    用SPY++查看  
    IEFrame WorkerW是 空间类名   多看msdn
      

  2.   

    控件类名,打错了   多翻翻MSDN再来问
      

  3.   

    是FindWindowEx要查找的多级子窗体名. 你用spy++打开看一下就知道了.
      

  4.   

    谢谢指点,控件类名,spy++我再学习一下,只是打开之后有很多“窗口”有点不知道那个是我打开的IE呀?
      

  5.   

    IEFrame,WorkerW是窗口类的名称。
    至于窗口类是什么,你的研究一下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
      

  6.   

    WINDOWS XP 是下面的结构IEFrame --> WorkerW --> ReBarWindow32 --> ComboBoxEx32 --> ComboBox --> EditEdit 中是地址
      

  7.   

    上下MSDN去查查,楼主是要做个浏览器吧?共同探讨下?