Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Have a form "always on top" 2

Status
Not open for further replies.

Tommyhat

Programmer
Sep 10, 2004
96
CA
I have a form that opens and populates excel windows but i want it to be shown even if the excel windows are fullscreened. is there a way to make a form "always on top" like some programs (i.e. winamp) have?

---------------------------------------
2b||!2b that == the_question
 
This is from


I created a new module and pasted this into it

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 SWP_NOSIZE = &H1
Public Const SWP_NOMOVE = &H2

Function TopMost(F As Form)
Call SetWindowPos(F.hwnd, HWND_TOPMOST, 0, 0, 0, 0, _
SWP_NOMOVE Or SWP_NOSIZE)
End Function



Then for the Form ... just add to the following events

Form Timer Interval: 50
Form Timer: =TopMost([Form])

PaulF
 
Thanks a bunch dood!

---------------------------------------
2b||!2b that == the_question
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top