我创建了一个简单的html页面,该页面使用MsRdpClient ActiveX自动以全屏模式打开远程桌面。
除了IE不会失去焦点并且打开的远程桌面窗口保持在IE窗口的后面,其他一切正常。
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Remote Desktop Web Page</title>
</head>
<body>
<script language="vbscript">
Username = "my username"
Server = "serve ip address"
Password = "my password"
Domain = "my domain"
sub ConnectClient
MsRdpClient.Server = Server
MsRdpClient.UserName = Username
MsRdpClient.Domain = Domain
MsRdpClient.AdvancedSettings2.ClearTextPassword = Password
' false it show inside browser windows
MsRdpClient.FullScreen = TRUE
MsRdpClient.Width = screen.width
MsRdpClient.Height = screen.height
MsRdpClient.DesktopWidth = MsRdpClient.Width
MsRdpClient.DesktopHeight = MsRdpClient.Height
MsRdpClient.AdvancedSettings5.AuthenticationLevel = 2
'FullScreen title
MsRdpClient.FullScreenTitle = L_FullScreenTitle_Text & "(" & Server & ")"
MsRdpClient.Connect
end sub
</script>
<div id="connectArea">
<center>
<object language="vbscript" id="MsRdpClient" classid="CLSID:4eb89ff4-7f78-4a0f-8b8d-2bf02e94e4b2"
onreadystatechange="ConnectClient" width="1024" height="768">
</object>
</center>
</div>
</body>
</html>
要尝试,请复制粘贴并填写:用户名,密码,域和服务器。
如何修改它以使远程桌面位于IE之上?
编辑:更确切地说,它通过IE打开远程桌面,并在IE重新获得焦点之后。
WshShell对象的AppActivate方法可能会有所帮助:
Dim objShell
Dim sAppTitle
Set objShell = CreateObject("Wscript.Shell")
objShell.AppActivate(sAppTitle)
[sAppTitle
是包含应用程序标题的字符串(显示在标题栏中,但可能直接显示为L_FullScreenTitle_Text & "(" & Server & ")"
)或应用程序的进程ID。