PDA

Click to See Complete Forum and Search --> : Always Behind


matbrophy
Nov 14th, 2000, 12:10 PM
I know it is very easy to make a window alwatsontop, but is is possible to make it always behind?

Nov 14th, 2000, 01:38 PM
Private Declare Function SetWindowPos Lib "user32" Alias "SetWindowPos"_
(ByVal hwnd As Long, ByVal hWndInsertAfter As Long, _
ByVal x As Long, ByVal y As Long, ByVal cx As Long, _
ByVal cy As Long, ByVal wFlags As Long) As Long

Const SWP_NOMOVE = 2
Const SWP_NOSIZE = 1
Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE
Const HWND_TOPMOST = -1
Const HWND_NOTOPMOST = -2


Private Sub Form_Load()
SetWindowPos Me.hWnd, HWND_NOTOPMOST, _
0, 0, 0, 0, FLAGS
End Sub

matbrophy
Nov 14th, 2000, 01:43 PM
IT DOESN'T WORK!

It makes it not on top, but not BEHIND - e.g. all other windows are on top of it despite it's focus.

Matthew

Nov 14th, 2000, 01:49 PM
You want it to stay behind all other Windows at all times? Try putting it in a timer.

Private Sub Timer1_Timer()
SetWindowPos Me.hWnd, HWND_NOTOPMOST, _
0, 0, 0, 0, FLAGS
End Sub

matbrophy
Nov 14th, 2000, 01:52 PM
Unfortunately that doesn't work either

matbrophy
Nov 15th, 2000, 07:49 AM
So, can anybody help?

bbosh
Nov 17th, 2000, 04:26 PM
compile that as an exe and run it. it works.

matbrophy
Nov 18th, 2000, 07:36 AM
It still won't work for me, I have VB6 Pro

Chris
Nov 19th, 2000, 12:17 AM
Hi, Matthew, I think this will be better.

Private Sub Timer1_Timer()
SetWindowPos Me.hwnd, HWND_BOTTOM, 0, 0, 0, 0, FLAGS
End Sub


Can we replace the timer by others mean?

Originally posted by Matthew Gates
You want it to stay behind all other Windows at all times? Try putting it in a timer.


Private Sub Timer1_Timer()
SetWindowPos Me.hWnd, HWND_NOTOPMOST, _
0, 0, 0, 0, FLAGS
End Sub