I don't remember where I got this, But I know it works. At some point in time I neded to do the same, and this is How I got it to work !
Place in MODULE
Global Const SWP_NOMOVE = 2Global Const SWP_NOSIZE = 1
Global Const HWND_TOPMOST = -1Global Const HWND_NOTOPMOST = -2
Global Const FLOAT = 1, SINK = 0
Public Declare Sub 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)
This is a sub within the module
Sub FloatWindow(X As Integer, action As Integer)
Dim wFlags As Integer, result As Integer
wFlags = SWP_NOMOVE Or SWP_NOSIZE
If action <> 0 Then
' Float
Call SetWindowPos(X, HWND_TOPMOST, 0, 0, 0, 0, wFlags)
Else
' Sink
Call SetWindowPos(X, HWND_NOTOPMOST, 0, 0, 0, 0, wFlags)
End If
End Sub
Code to use -->
'Float code
Dim f as integer
f = Screen.ActiveForm.hWndCall
FloatWindow(f, FLOAT)
'sink code
Dim f as integer
f = Screen.ActiveForm.hWndCall
Main Topics
Browse All Topics





by: stefanxPosted on 2000-02-29 at 06:20:08ID: 2568933
Just do a search in this category for "Always on Top". Itmust have been asked about 100 times before ;)