PDA

Click to See Complete Forum and Search --> : Background Form


VBonliner
Oct 10th, 2000, 09:53 AM
here an API call for this or something close to this:


Anyone has an idea about how to force a Form
to remain behind all other Forms (i.e. a
background Form).

I tried vbModal and Zorder, but didn't work.

Thank you

Oct 10th, 2000, 01:21 PM
Use the SetWindowPos api function.

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

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


Usage

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

VBonliner
Oct 10th, 2000, 04:18 PM
Thanks you Matthew!

What is the difference between GLOBAL and PUBLIC?

Oct 10th, 2000, 04:44 PM
Global is older and has been superseded by Public, which is newer and is a bit more flexible.

the only reason Global is still around is for backwards compatibility.