ツールバーなしの新しいプロセスでInternet Explorer 7を起動します

StackOverflow https://stackoverflow.com/questions/1003836

  •  05-07-2019
  •  | 
  •  

質問

IEでWebアプリケーションを実行する必要があるので、少なくともスタンドアロンアプリケーションに似ています。また、このWebアプリケーションの複数のインスタンスを別々のセッションで同時に実行できる必要があります。

この外観を実現するために、デスクトップのショートカットからツールバー/ステータスバーを使用せずに、常に新しいプロセスでInternet Explorer 7を起動します。

いくつかのことを試しました。ここまで来たクローゼットは、次のvbスクリプトへのショートカットを作成しています。

Set objExplorer = CreateObject("InternetExplorer.Application")
objExplorer.Navigate "http://stackoverflow.com"
objExplorer.ToolBar = 0
objExplorer.StatusBar = 0
objExplorer.Width = 1024
objExplorer.Height = 768
objExplorer.Left = 0
objExplorer.Top = 0
objExplorer.Visible = 1

これは、私が望んでいる通りです。ただし、ショートカットを再度ダブルクリックすると、同じウィンドウ内に新しいウィンドウが開きます(つまり、Windowsタスクマネージャーにはiexplore.exeプロセスが1つしかありません)。 2つのインスタンスは同じプロセス内にあるため、同じセッションを共有しています。そのため、アプリケーションの1つのインスタンスにログインしている場合は、アプリケーションの別のインスタンスにログインしていることになります。これは私には良くありません。

私も試しました

"Program Files\Internet Explorer\iexplore.exe" http://stackoverflow.com

常に新しいプロセスを起動しますが、ツールバー/ステータスバーだけを削除することはできません。キオスクモード(" -k"パラメーター)は、ウィンドウに表示する必要があるので、私には良くありません。

誰でも、デスクトップのショートカットからツールバー/ステータスバーなしで新しいプロセスでInternet Explorer 7を起動する方法を教えてもらえますか?

このソリューションのあらゆる種類のテクノロジーを受け入れています。

ありがとう、 エベレット

役に立ちましたか?

解決 4

他の答えは私のためにうまくいかなかったので、ここにさまざまなソースから一緒にまとめたvbスクリプトがあります(私はvbスクリプターではありません)。

On Error Resume Next

AppURL = "http://www.stackoverflow.com"
AppToRun = "iexplore about:blank"
AboutBlankTitle = "Blank Page"
LoadingMessage = "Loading stackoverflow..."
ErrorMessage = "An error occurred while loading stackoverflow.  Please close the Internet Explorer with Blank Page and try again.  If the problem continues please contact IT."
EmptyTitle = ""

'Launch Internet Explorer in a separate process as a minimized window so we don't see the toolbars disappearing
dim WshShell
set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run AppToRun, 6

dim objShell
dim objShellWindows

set objShell = CreateObject("Shell.Application")
set objShellWindows = objShell.Windows

dim ieStarted
ieStarted = false

dim ieError
ieError = false

dim seconds
seconds = 0

while (not ieStarted) and (not ieError) and (seconds < 30)

    if (not objShellWindows is nothing) then
        dim objIE
        dim IE

        'For each IE object
        for each objIE in objShellWindows

            if (not objIE is nothing) then

                if isObject(objIE.Document) then
                    set IE = objIE.Document

                    'For each IE object that isn't an activex control
                    if VarType(IE) = 8 then

                        if IE.title = EmptyTitle then
                            if Err.Number = 0 then
                                IE.Write LoadingMessage

                                objIE.ToolBar = 0
                                objIE.StatusBar = 1
                                objIE.Navigate2 AppURL

                                ieStarted = true
                            else
                                'To see the full error comment out On Error Resume Next on line 1
                                MsgBox ErrorMessage
                                Err.Clear

                                ieError = true

                                Exit For
                            end if
                        end if
                    end if
                end if
            end if

            set IE = nothing
            set objIE = nothing
        Next
    end if

    WScript.sleep 1000
    seconds = seconds + 1
wend

set objShellWindows = nothing
set objShell = nothing

'Activate the IE window and restore it
success = WshShell.AppActivate(AboutBlankTitle)

if success then 
    WshShell.sendkeys "% r"  'restore 
end if

改善点や提案を受け付けています。

他のヒント

次のようなHTMLアプリケーションを使用できます。

<html>
<head>
<title>Stack Overflow</title>
<hta:application showintaskbar="yes" singleinstance="no" sysmenu="yes" scroll="no"
icon="http://www.stackoverflow.com/favicon.ico">
<style type="text/css">
* { margin: 0px; padding: 0px; }
iframe { position: absolute; top: 0px; left: 0px; width: 100%; height: 100%; }
</style>
</head>
<body>
<IFRAME SRC="http://www.stackoverflow.com/" APPLICATION="no">
</body>
</html>

ただし、これは、HTAの特別な予防策なしに、そこにあるページのJSを台無しにする傾向があります。

IE COMサーバーを操作することでこれを行うことができます。 PowerShellで簡単に実行できます:

$ie = new-object -COM InternetExplorer.Application
$ie.ToolBar = $false
$ie.StatusBar = $false
$ie.Navigate2( "http://www.stackoverflow.com" )
$ie.Visible = $true

ie-app.ps1にある場合、ショートカットには「powershell -command ie-app.ps1」があります。呼び出します。

これは、vbscriptでWindows Scripting Hostを使用した場合と基本的に同じです。 InternetExplorer.Application COMオブジェクトを操作できるものなら何でも使用できます。私はIE8を持っていますが、IE7とIE8の違いだけかもしれませんが、私のPowershellの例では、2つのプロセスがあります。

これを達成するために使用するコーディングレジームは指定しませんが、間違いなく WebBrowserクラス

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top