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!

Always on top... and then loses focus?

Status
Not open for further replies.

graabein

Programmer
Oct 9, 2002
186
NO
Hello, I have a dialog form that I can set always on top with:

Code:
Public Function AlwaysOnTop(bTopMost as Boolean) As Long
  If bTopMost Then
    AlwaysOnTop = SetWindowPos(Me.Hwnd, HWND_TOPMOST, 0, 0, 0, 0, FLAGS)
  Else
    AlwaysOnTop = SetWindowPos(Me.Hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, FLAGS)
    AlwaysOnTop = False '?
  End If
End Function

The problem is when my application loses focus to another application or the window manager. My on-top dialog form is still on top. Where do I detect that my app loses focus?

My dialog form is sort of like a floating toolbar I have on top of my app that the user can move around...

[elephant2]
graabein
 
I think that the SetWindowPos function is for ordering windows on the desktop itself. To set your "floating toolbar" form to be on top of the main form, try opening it with:
Code:
  myToolbarForm.Show False, Me
  'Modal = False, Owner Form = Me (The calling form)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top