如何从java获取Internet Explorer的实例?

时间:2015-06-10 23:08:29

标签: java shell internet-explorer doc

我有一个java 6应用程序,我需要从java获得一个确定的Internet Explorer的实例?它的这个实例它运行在与JVM相同的pc中。当我得到实例时,我需要更改网址。

有人对此有任何想法吗?

我在谷歌搜索过,我发现了一些与此相关的内容。我想,我需要从microsoft安装一些东西才能使用这个软件包。它适用于Windows XP和Java 6吗? 我找到了页面https://support.microsoft.com/en-us/kb/299356

我找到了JNA,我有一些代码,我可以获得User32实例的处理程序。但我不知道如何导航到URL。

public static void main(String[] args) {
    HWND hwnd = User32.INSTANCE.FindWindow
           (null, "PageTitle"); // window title
    if (hwnd == null) {
        System.out.println("Excel is not running");
    }
    else{
        User32.INSTANCE.ShowWindow(hwnd, 9 );        // SW_RESTORE
        User32.INSTANCE.SetForegroundWindow(hwnd);   // bring to front

    }
}

0 个答案:

没有答案