Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Mon Sep 02, 2002 11:16 pm Post subject: Window "ONTOP" Utility... |
|
|
I wrote this utility a while back for a friend, but I use it
fairly often myself (mostly to make the "SYSMON.EXE"
utility stay ontop). It makes any window stay "ONTOP"
for the duration of the window's current session.
The "Display" subroutine just lets you know the program
is active.
________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
| Code: |
%%width = @sysinfo(SCREENWIDTH)
OPTION SCALE, 96
OPTION DECIMALSEP, "."
TITLE "By Mac"
DIALOG CREATE,"Set Window Ontop",0,@diff(@div(%%width, 2), 70),140,40,SMALLCAPS,ONTOP
DIALOG ADD,BITBTN,Start,0,0,50,20,,"Start"," Start "
DIALOG ADD,BITBTN,Cancel,0,50,50,20,,"Cancel"," Cancel "
DIALOG ADD,BITBTN,Help,0,100,40,20,,"??"," Help "
DIALOG ADD,STATUS,Status,"Ready..."
DIALOG SHOW
:CancelBUTTON
:EVLOOP
%g = ""
DIALOG SET, Status, "Ready..."
rem -- Kill any extra events --
%d = @event()
WAIT EVENT
%d = @event()
if @equal(%d, CLOSE)@equal(%d, CancelBUTTON)@equal(%d, HelpBUTTON)
goto %d
end
%g = ""
%s = ?
REPEAT
DIALOG SET, Status, "Click a window "%s
GOSUB Display
%e = @event()
UNTIL @not(@equal(@winactive(),"Set Window Ontop"))%e
WAIT .5
%w = @winactive()
if %e
goto %e
end
goto %d
:StartButton
DIALOG SET, Status, "Ready..."
WINDOW ONTOP, %w
goto EVLOOP
:HelpBUTTON
DIALOG SET, Status, "Ready..."
INFO "Click the 'Start' button, then click on any"@cr()"open window (or its' taskbar button) that"@cr()"you wish to remain ontop."@cr()@cr()"Closing and re-opening the chosen window"@tab()@cr()"will reset to the original status."
goto EVLOOP
:CLOSE
EXIT
STOP
rem -------- GOSUB -----------
:Display
if @greater(@len(%s), 18)
%g = 1
end
if @greater(2,@len(%s))
%g = ""
%s = ?
end
if %g
%s = @substr(%s, 2, @len(%s))
else
%s = " "%s
end
WAIT ".01"
exit
|
EDIT - Removed what appeared to be an unecessary loop to
kill extra events in EVLOOP (hey, I said I wrote it a while back).
Cheers, Mac _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|