Results 1 to 3 of 3

Thread: Always On Top

  1. #1

    Thread Starter
    Frenzied Member arpan_de's Avatar
    Join Date
    Oct 2005
    Location
    Mumbai, India
    Posts
    1,394

    Question Always On Top

    Users can keep a VB app on top of the other apps/windows by clicking a menu. Clicking other menus & buttons residing on this app invoke other Forms. This is how I implemented the always on top feature:

    Code:
    Private Sub mnuAlwaysTop_Click()
        If (mnuAlwaysTop.Checked = False) Then
            mnuAlwaysTop.Checked = True
            SetWindowPos Me.hWnd, HWND_TOPMOST, 0, 0, 0, 0, Flags
        Else
            mnuAlwaysTop.Checked = False
            SetWindowPos Me.hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, Flags
        End If
    End Sub
    But when Forms belonging to this app are invoked, even they get hidden behing the main app.

    How do I ensure that when the app is always on top, the Forms that get invoked by clicking menus & buttons belonging to this app (i.e. Forms that are part & parcel of this VB app) do not get hidden behind the main app though other open apps/windows stay behind this VB app?


    ARPAN

    IF YOU HAVE AN APPLE & I HAVE AN APPLE AND WE EXCHANGE THE APPLES, THEN YOU & I WILL STILL HAVE ONE APPLE BUT IF YOU HAVE AN IDEA & I HAVE AN IDEA AND WE EXCHANGE OUR IDEAS, THEN EACH OF US WILL HAVE TWO IDEAS!

    NOTHING IS IMPOSSIBLE IN THIS WORLD.....EVEN THE WORD IMPOSSIBLE SAYS I'M POSSIBLE!

    PRACTICE MAKES A MAN PERFECT BUT NOBODY IS PERFECT; SO WHY PRACTICE?

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Always On Top

    If you have it set to always on top, then that is what it is going to be and all other forms will be behind it.

    You would need to flip that off or perhaps minimize the window.

  3. #3
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Always On Top

    Its doing exactly what you are telling it to do. You made the main form always on top and thats what its doing. If you want other forms to be always on top then when you click that menu to open on you will need to set that form as always on top.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

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