我想关掉所有URL以http://10.15.16.17开头的浏览器窗口,应该怎么做呢?
不是根据浏览器标题框来关闭,而是根据它的URL来关闭。

解决方案 »

  1.   

    枚举浏览器的所有子窗口,找到子窗口内容包含“http://10.15.16.17”就发送关闭窗口消息
    用API函数:
    在定时器函数中用
    EnumChilidWindow(....)函数
    写个相关的回调函数,看MSDN中上面函数的帮助
    获取文本
    SendMessage(hwnd,WM_TEXT,..);
    判断
    关闭
    PostMessage(....)
      

  2.   

    another way:
    you can create a BHO,which can monitor the url,when  url equal "http://10.15.16.17",then post wm_close message to it.
    hwo to create a bho,you can see msdn example :"IEHelper"
      

  3.   

    chsilence()说: 
    枚举浏览器的所有子窗口,找到子窗口内容包含“http://10.15.16.17”就发送关闭窗口消息
    但是很有可能IE窗口的标题并不是URL地址,这种方式还可行吗?
      

  4.   

    The EnumChildWindows function enumerates the child windows that belong to the specified 
    懂了:
    parent window by passing the handle to each child window, in turn, to an application-defined callback function. EnumChildWindows continues until the last child window is enumerated or the callback function returns FALSE. BOOL EnumChildWindows(
      HWND hWndParent,         // handle to parent window
      WNDENUMPROC lpEnumFunc,  // callback function
      LPARAM lParam            // application-defined value
    );