Always on top

Pogo
03-25-2003, 10:09 AM
How is this achieved?

Robse
03-25-2003, 10:15 AM
Add this code to a module


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

Public Const HWND_TOPMOST = -1
Public Const HWND_NOTOPMOST = -2

Public Sub SetTop(OnOff As Boolean)
If OnOff Then
Call SetWindowPos(Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, 3)
Else
Call SetWindowPos(Me.hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, 3)
End If


Make a call like this to set always on top

SetTop(True)

Mikecrosoft
03-25-2003, 10:21 AM
I think this code can't be added to a module because Me.Hwnd will not works !!!

May be need to add the function in the form code

Robse
03-25-2003, 10:26 AM
I think this code can't be added to a module because Me.Hwnd will not works !!!

May be need to add the function in the form code

Mikecrosoft is right.

So forget the above code and just call The Function
from wherever you want to like this


Call SetWindowPos(Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, 3)


to set the window on top.

Pogo
03-25-2003, 10:54 AM
Ok, thanks

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum