示例#1
0
def open_ie(url, size=(900, 680)):
    """打开IE浏览器"""
    width, height = size

    ie = DispatchEx('InternetExplorer.Application')

    # 设置窗口style
    ie.Visible = 1
    ie.ToolBar = 0
    ie.AddressBar = 0
    ie.MenuBar = 0
    ie.StatusBar = 0
    ie.Resizable = 0
    ie.Width = width
    ie.Height = height

    # 设置打开的 URL
    ie.Navigate(url)

    win32gui.SetForegroundWindow(ie.HWND)
    #win32gui.SetWindowPos(ie.HWND, win32con.HWND_TOPMOST,
    win32gui.SetWindowPos(
        ie.HWND, 0, 0, 0, width, height, win32con.SWP_NOACTIVATE
        | win32con.SWP_NOOWNERZORDER | win32con.SWP_SHOWWINDOW)

    return ie