
Make a window always on top (of every window..always)
Private Declare Function SetWindowPos Lib "user32" _
(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 HWND_TOPMOST = -1
Const HWND_NOTOPMOST = -2
Const SWP_NOMOVE = &H2
Const SWP_NOSIZE = &H1
Dim lngWindowPosition As Long
Private Sub ChckTop_Click()
If ChckTop.Value = 1 Then
lngWindowPosition = SetWindowPos(frmTime.hwnd, _
HWND_TOPMOST, _
0, _
0, _
0, _
0, _
SWP_NOMOVE Or SWP_NOSIZE)
Else
lngWindowPosition = SetWindowPos(frmTime.hwnd, _
HWND_NOTOPMOST, _
0, _
0, _
0, _
0, _
SWP_NOMOVE Or SWP_NOSIZE)
End If
End Sub
This does that with a check box and an API call. It will keep this window above ALL
other windows.
Quote:
> I have a Active X exe that I use from my main application, that takes care of
> things like progress bars, and "Please Wait" animations (because of the
> blocking that occurs in my main program, I needed to run these things in a
> seperate thread).
> Anyway, I want to always show the forms within the ActiveX exe to be always on
> top of every window in my main application, and in one case, I want the form to
> be display above all windows in the entire OS. Is there a way to do this with
> Win32...(there must be)