How to make any Windows Application mimic Always on Top using Script Tools

Many Windows 3.1 applications have a flag that can be set to keep that 
Window always on top of other applications. The Control Menu Box for that
application will have an ALWAYS ON TOP that can be checked on or off.
You can mimic this behavior using the PCT4W Script Tools for any 
Windows application.

The simple script that accomplishes this is below:


Attach "WNOM_ScriptTools Macros1"
HWND=_ATTACHWINDOW
DLLCall("USER", "SetWindowPos",HWND,-1,0,0,0,0,64)

The first line attaches the Window you want. You will need the exact
name of the Window you want. This can be found by using the Create option
off the Script Tools menu, then select Attach Name, and then click on the
Identify button.  Then just move the cursor until it is over the Window
you want identified, and click. The example above is attaching the
folder that contains the Script Tools items.

The second line of the script identifies the internal handle to the 
Window that Windows uses (note the _  before the attachwindow).


Now the tricky part. In the third line, the 0,0,0,0 indicate where the
Window will be placed. The first number is the upper left hand corner
in the x (horizontal) direction. The second number is the upper left
hand corner in the y (vertical) direction. The third number is the
Windows width, the fourth is it's height. These numbers are in units of
pixels, with 0,0 being the top left corner. You will have to experiment
to get the actual position you want. Using the 0,0,0,0 will place a
small skinny Window at the top left.

Finally, in case you want, you can use the same commands to turn the
Always on Top off. Simply replace the -1 with a -2 in the third line.

This script will override any settings that currently exist for a 
Window that has an always on top menu item.

CAUTION: Some Windows 3.0 specific (not 3.1) applications may have a
problem with the above method, and will not respond. I don't know any
way around that if there indeed is one. Also if you make a particular
Window always on top, there may be no way to turn if off other than
minimizing or closing the Window. To play it ultra safe, create both a
'turn it on' and a 'turn it off' script for the application, using the -1 
to turn it on and the -2 to turn if off as explained above.
 

K.Jeffrey Carr    June 2,1993
CIS  76226,1045