Results 1 to 5 of 5

Thread: [RESOLVED] Form always on Down

  1. #1

    Thread Starter
    Addicted Member Mojtaba's Avatar
    Join Date
    Dec 2020
    Posts
    150

    Resolved [RESOLVED] Form always on Down

    Hello friends
    I want the software to always run under other windows
    Form always on Down
    There is a way !?

  2. #2

    Thread Starter
    Addicted Member Mojtaba's Avatar
    Join Date
    Dec 2020
    Posts
    150

    Re: [RESOLVED] Form always on Down

    This question has been asked before
    Answer Link

  3. #3
    PowerPoster
    Join Date
    Feb 2017
    Posts
    4,995

    Re: [RESOLVED] Form always on Down

    A way maybe using subclassing, in the WM_WINDOWPOSCHANGING message, modifying the hwndInsertAfter parameter of the WINDOWPOS structure.

  4. #4
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    9,853

    Re: [RESOLVED] Form always on Down

    Not sure what you're trying to do, but this does a pretty good job of it:

    Code:
    
    Option Explicit
    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
    
    Private Sub Form_Activate()
        PutOnBottom
    End Sub
    
    Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
        PutOnBottom
    End Sub
    
    Private Sub PutOnBottom()
        Const SWP_NOSIZE As Long = 1&
        Const SWP_NOMOVE As Long = 2&
        Const HWND_BOTTOM As Long = 1&
        SetWindowPos Me.hWnd, HWND_BOTTOM, 0&, 0&, 0&, 0&, SWP_NOSIZE Or SWP_NOMOVE
    End Sub
    
    
    It'd take a bit of subclassing (to know when it's truly activated) to do it in a broader context.
    Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.

  5. #5

    Thread Starter
    Addicted Member Mojtaba's Avatar
    Join Date
    Dec 2020
    Posts
    150

    Re: [RESOLVED] Form always on Down

    Quote Originally Posted by Elroy View Post
    Not sure what you're trying to do, but this does a pretty good job of it:

    Code:
    
    Option Explicit
    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
    
    Private Sub Form_Activate()
        PutOnBottom
    End Sub
    
    Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
        PutOnBottom
    End Sub
    
    Private Sub PutOnBottom()
        Const SWP_NOSIZE As Long = 1&
        Const SWP_NOMOVE As Long = 2&
        Const HWND_BOTTOM As Long = 1&
        SetWindowPos Me.hWnd, HWND_BOTTOM, 0&, 0&, 0&, 0&, SWP_NOSIZE Or SWP_NOMOVE
    End Sub
    
    
    It'd take a bit of subclassing (to know when it's truly activated) to do it in a broader context.
    Thank you Elroy
    I used this code, but the only problem is that the mouse on the form must be moving

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