Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

TSAC

12 views
Skip to first unread message

Tom Jones

unread,
Mar 29, 2002, 1:51:18 PM3/29/02
to
I am trying to script the Terminal Services Advanced Client to launch
and resize terminal server sessions. I've tried all the various
flavors of doing this (vbscript, asp, vb6) and found that Alex
Angelopoulos' suggested technique of wrapping that control in a .HTA
file works best and is the most flexible in accomplishing the task.

Among other things, HTA gives us the ability to:
1. Close the window (i.e. window.close) on session disconnect w/o the
security message 'The web page you are viewing is trying to close the
window'.
2. Control the system menu (to prevent users from [x] closing the
window and disconnecting their sessions.)
3. Script the session startup to tailor the window to the users'
screen dimensions (we 'downsize' the window one resolution smaller
than the users' screen).
4. Provide a fast way to create create shortcuts to launch
applications in a window.

But we have run into a catch... if we launch a TSAC window (via HTA)
then use [ALT]-[TAB] to toggle to another active window and then
[ALT]-[TAB] back to the TSAC HTA, keyboard and mouse events don't fire
(the window does not register keystokes or mouseclicks). The only way
you can get the mouse and keyboard back is to press [TAB]. (It's acts
almost like the TSAC control has lost 'focus' and you need to hit
[TAB] to set focus back on the it).

Toggling several times causes the window to paint gray and only
repaint the block where an active control is (i.e. user control --
buttons, text boxes, etc.)... of couse it will only repaint those
blocks if you pressed [TAB] to 'wake-it-up' (or set focus... or
whatever it is doing).

One other strange quirk, if you set the 'SELECTION="YES"' in the
HTA:APPLICATION tag, the mouse works... but not the keyboard (see the
sample code below).

The TSAC object appears to function normally outside of HTA (ala the
TSWeb framework provided in W2K... connect.asp, etc.).

Help... has anyone seen this (but more importantly) is there a
solution? Are there any MS TSAC/HTA guru's out there who could shed
light?

Here is a stripped down sample of what we're trying. If you copy and
paste this into notepad (changing the 'strServer' variable to a WTS
box at your site) and save it as a .HTA file (i.e. test.hta) then
execute the hta from the Run prompt, you will see the symptom.

<HTML>

<!--
Note... setting 'SELECTION="yes"' will allow the mouse to work when
[ALT]-[TAB]bing between the TSAC window and another window. "no"
causes the mouse to hang up just like the keyboard does.
-->

<HTA:APPLICATION
ID="objHTA"
APPLICATIONNAME="TSAppLauncher"
BORDER="thin"
BORDERSTYLE="normal"
CAPTION="yes"
ICON=""
NAVIGABLE="no"
SCROLL="no"
SELECTION="no"
SHOWINTASKBAR="yes"
SINGLEINSTANCE="no"
SYSMENU="no"
VERSION="2.0"
WINDOWSTATE="normal">
</HTA:APPLICATION>

<!--
Purpose of this inline style is to prevent any body 'border' around
the Terminal Server Client window.
-->

<STYLE>
BODY
{
BORDER-RIGHT: medium none;
PADDING-RIGHT: 0px;
BORDER-TOP: medium none;
PADDING-LEFT: 0px;
FONT-SIZE: 10pt;
BACKGROUND: white;
PADDING-BOTTOM: 0px;
MARGIN: 0px;
BORDER-LEFT: medium none;
COLOR: black;
PADDING-TOP: 0px;
BORDER-BOTTOM: medium none;
FONT-FAMILY: Verdana, Arial
}
</STYLE>


<HEAD>
<TITLE>TSAC Test</TITLE>
</HEAD>


<SCRIPT LANGUAGE="VBScript">
<!--

Sub window_onLoad()

Dim lngWindowHeight
Dim lngWindowWidth
Dim strServer
Dim strUsername
Dim strExe
Dim lngAdjustX
Dim lngAdjustY

lngAdjustX = 6
lngAdjustY = 32
lngWindowWidth = 1024
lngWindowHeight = 768

' To test, put your server, domain, user id and optionally executable
to run here
strServer = "TerminalServerNameGoesHere"
strDomain = "YourDomain"
strUserID = "AValidUserID"
strExe = ""

lngWindowX = (Screen.Width - lngWindowWidth) / 2
lngWindowY = ((Screen.Height - lngWindowHeight - 32) / 2)

Window.MoveTo lngWindowX, lngWindowY
Window.ResizeTo lngWindowWidth + lngAdjustX, lngWindowHeight +
lngAdjustY
objTSC.DesktopWidth = lngWindowWidth
objTSC.DesktopHeight = lngWindowHeight

' Terminal server control settings
objTSC.Domain = strDomain
objTSC.UserName = strUserName
objTSC.Server = strServer
If strEXE <> "" Then objTSC.SecuredSettings.StartProgram = strEXE
objTSC.Connect

End Sub

Sub objTSC_OnDisconnected(lngDisconnectCode)

Window.Close

End Sub

-->
</SCRIPT>
<BODY>
<OBJECT LANGUAGE="VBScript" ID="objTSC" width=1024 height=768
CLASSID="CLSID:1fb464c8-09bb-4017-a2f5-eb742f04392f"
>
</OBJECT>
</BODY>
</HTML>

0 new messages