always on top window

BlitzMax Forums/BlitzMax Programming/always on top window

The following should work for making windows always on top and back again.

Extern "win32"
	Function GetActiveWindow()
	Function SetWindowPos(hWnd:Int,after:Int,x:Int,y:Int,w:Int,h:Int,flags:Int)
End Extern

Const SWP_NOSIZE:Int = $1
Const SWP_NOMOVE:Int = $2
Const HWND_TOPMOST:Int = -1
Const HWND_NOTOPMOST:Int = - 2

Function alwaysOnTop(hwnd:Int)
	SetWindowPos( hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE + SWP_NOMOVE )
End Function
Function notAlwaysOnTop(hwnd:Int)
	SetWindowPos( hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE + SWP_NOMOVE )
End Function

' // this is how its used
Local hWnd:Int = GetActiveWindow()
alwaysOnTop(hWnd)