Home  |  Programs  |  Tips & Tricks  |  Subs & Functions  |  Links  |  Laz's Liberty Basic Site


Keep a window on top

'we don't need a main window
nomainwin

'set the window position
WindowWidth = 285 : WindowHeight= 130
UpperLeftX = (DisplayWidth-WindowWidth)/2
UpperLeftY = (DisplayHeight-WindowHeight)/2


'open the window
open "Top Window" for window as #main

'tell Liberty Basic to goto [quit] when the X is clicked at the top of the window
print #main, "trapclose [quit]"

'get the handle to the main window
hMain = hwnd(#main)

'tell the main window to stay on top
call KeepOnTop hMain


wait

[quit]
'close the window
close #main
end


sub KeepOnTop hWnd
flag = _SWP_NOMOVE or _SWP_NOSIZE
calldll #user32, "SetWindowPos", _
hWnd as long, _
_HWND_TOPMOST as long, _
1 as long, _
2 as long, _
3 as long, _
4 as long, _
flag as long, _
ret as long
end sub

Hosted by www.Geocities.ws

1