Results 1 to 5 of 5

Thread: STAY ON TOP, DAMN YOU!!!

  1. #1

    Thread Starter
    Member FrogBoy666's Avatar
    Join Date
    Aug 2000
    Location
    Columbia, SC
    Posts
    34

    Angry

    As you can see, frustration has ensued...

    Here's my delimma:
    I have a program with two forms. I click a command button on the first form (frmMain) and the second form (frmBrowse) pops up. I disabled frmMain while frmBrowse is up, but I need to know how to make sure that frmBrowse is always on top of frmMain.

    The problem arises when I select frmMain in the taskbar. Both forms are on top of everything else, but frmMain is now on top of frmBrowse.

    (oh, and I don't want to take frmMain out of the taskbar).

  2. #2
    Fanatic Member
    Join Date
    Oct 1999
    Location
    MA, USA
    Posts
    523
    How about using vbModal function?
    ex.
    Code:
    Private Sub Command1_Click()
        Form2.Show vbModal
    End Sub
    Or use this code to keep form always on top
    Code:
    Private Const HWND_TOPMOST = -1
    Private Const HWND_NOTOPMOST = -2
    Private Const SWP_NOMOVE = &H2
    Private Const SWP_NOSIZE = &H1
    Private Const SWP_NOACTIVATE = &H10
    Private Const SWP_SHOWWINDOW = &H40
    Private Const TOPMOST_FLAGS = SWP_NOMOVE Or SWP_NOSIZE
    
    Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, y, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
    
    Public Sub MakeNormal(Handle As Long)
    	'// Replaces the window in the ZOrder
    	SetWindowPos Handle, HWND_NOTOPMOST, 0, 0, 0, 0, TOPMOST_FLAGS
    End Sub
    
    Public Sub MakeTopMost(Handle As Long)
    	'// Sets the window in the ZOrder
    	SetWindowPos Handle, HWND_TOPMOST, 0, 0, 0, 0, TOPMOST_FLAGS
    End Sub
    Post #513

  3. #3
    Addicted Member cwm's Avatar
    Join Date
    Mar 2000
    Posts
    133
    frog boy, what's up with that sig?
    i was expecting a bit more =\
    Generic vb 5

    Private Sub WakeMyAssUp( As Boolean)
    If Then : = False
    End Sub

  4. #4

    Thread Starter
    Member FrogBoy666's Avatar
    Join Date
    Aug 2000
    Location
    Columbia, SC
    Posts
    34

    Unhappy You mean the URL?

    Sorry CWM...

    If you are indeed referring to the link to the site... I just started it. As soon as I got everything setup, I realized that I had no content.

    Any suggestions?!

  5. #5

    Thread Starter
    Member FrogBoy666's Avatar
    Join Date
    Aug 2000
    Location
    Columbia, SC
    Posts
    34

    Talking BTW...

    Thanks for the help, QWERTY! VBModal was EXACTLY what I was looking for...
    It's usually the easiest things that get past me.
    Last edited by FrogBoy666; Sep 18th, 2003 at 03:50 PM.

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