问题描述
我需要在IE中运行一个Web应用程序,因此它至少看起来类似于一个独立的应用程序。我还需要能够在单独的会话中同时运行此Web应用程序的多个实例。
I need to run a web application in IE so it at least looks similar to a stand-alone application. I also need to be able to run multiple instances of this web application at the same time in separate sessions.
为了实现这一目标,我希望始终启动Internet Explorer 7在一个没有工具栏/状态栏的新进程中,从桌面上的快捷方式开始。
To achieve this look I'd like to always launch Internet Explorer 7 in a new process without toolbars/statusbar from a shortcut on the desktop.
我尝试了一些事情。到目前为止,我所遇到的壁橱是创建以下vb脚本的快捷方式,
I've tried a few things. So far the closet I've come to it is creating a shortcut to the following vb script,
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进程)。由于这两个实例在同一个进程中,因此它们共享同一个会话。因此,如果您登录到应用程序的一个实例,那么您已登录到应用程序的另一个实例,这对我没有好处。
This looks exactly like I want it to. However, if you double-click the shortcut again it does open a new window but within the same process (i.e. there is only one iexplore.exe process in the Windows Task Manager). Since the two instance are within the same process they're sharing the same session. So if you're logged in to one instance of the application then you're logged in to the other instance of the application, which is no good for me.
I也试过了,
"Program Files\Internet Explorer\iexplore.exe" http://stackoverflow.com
始终启动新流程,但不能仅删除工具栏/状态栏。 Kiosk模式(-k参数)对我不利,因为我需要它出现在窗口中。
which always launches a new process but you can't remove just the toolbars/statusbar. Kiosk mode (the "-k" parameter) is no good to me as I need it to appear in a window.
任何人都可以告诉如何始终启动Internet Explorer 7在没有工具栏/状态栏的新流程中,桌面上的快捷方式是什么?
Can anyone tell how to always launch Internet Explorer 7 in a new process without toolbars/statusbar from a shortcut on the desktop?
我对解决方案的任何技术都持开放态度。
I'm open to any kind of technology for the solution.
谢谢,
Everett
Thanks,Everett
推荐答案
其他答案都没有为我解决这是一个我从各种来源拼凑而成的vb脚本(我不是vb脚本编写者)。
None of the other answers worked out for me so here is a vb script I cobbled together from various sources (I'm not a vb scripter).
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
我愿意接受任何改进或建议。
I'm open to any improvements or suggestions.
这篇关于在没有工具栏的新进程中启动Internet Explorer 7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!