Results 1 to 9 of 9

Thread: Always Behind

  1. #1

    Thread Starter
    Addicted Member matbrophy's Avatar
    Join Date
    Sep 1999
    Location
    Kent, United Kingdom
    Posts
    149

    Exclamation

    I know it is very easy to make a window alwatsontop, but is is possible to make it always behind?

  2. #2
    Guest
    Code:
    Private Declare Function SetWindowPos Lib "user32" Alias "SetWindowPos"_
      (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 SWP_NOMOVE = 2 
    Const SWP_NOSIZE = 1 
    Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE 
    Const HWND_TOPMOST = -1 
    Const HWND_NOTOPMOST = -2
    
    
    Private Sub Form_Load()
    SetWindowPos Me.hWnd, HWND_NOTOPMOST, _
    0, 0, 0, 0, FLAGS
    End Sub

  3. #3

    Thread Starter
    Addicted Member matbrophy's Avatar
    Join Date
    Sep 1999
    Location
    Kent, United Kingdom
    Posts
    149

    Unhappy Doesn't work

    IT DOESN'T WORK!

    It makes it not on top, but not BEHIND - e.g. all other windows are on top of it despite it's focus.

    Matthew

  4. #4
    Guest
    You want it to stay behind all other Windows at all times? Try putting it in a timer.

    Code:
    Private Sub Timer1_Timer()
    SetWindowPos Me.hWnd, HWND_NOTOPMOST, _
    0, 0, 0, 0, FLAGS
    End Sub

  5. #5

    Thread Starter
    Addicted Member matbrophy's Avatar
    Join Date
    Sep 1999
    Location
    Kent, United Kingdom
    Posts
    149

    No

    Unfortunately that doesn't work either

  6. #6

    Thread Starter
    Addicted Member matbrophy's Avatar
    Join Date
    Sep 1999
    Location
    Kent, United Kingdom
    Posts
    149
    So, can anybody help?

  7. #7
    Addicted Member bbosh's Avatar
    Join Date
    Oct 2000
    Location
    Hell (AKA New Mexico)
    Posts
    186
    compile that as an exe and run it. it works.
    Brian
    Programming: VB5 Pro (SP3) - QBasic 1.1,4.5
    Internet: HTML 4, CSS, JavaScript
    Visit AltInt.com!

  8. #8

    Thread Starter
    Addicted Member matbrophy's Avatar
    Join Date
    Sep 1999
    Location
    Kent, United Kingdom
    Posts
    149
    It still won't work for me, I have VB6 Pro

  9. #9
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238
    Hi, Matthew, I think this will be better.
    Code:
    Private Sub Timer1_Timer()
    SetWindowPos Me.hwnd, HWND_BOTTOM, 0, 0, 0, 0, FLAGS
    End Sub
    Can we replace the timer by others mean?

    Originally posted by Matthew Gates
    You want it to stay behind all other Windows at all times? Try putting it in a timer.

    Code:
    Private Sub Timer1_Timer()
    SetWindowPos Me.hWnd, HWND_NOTOPMOST, _
    0, 0, 0, 0, FLAGS
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width