-
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).
-
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
-
frog boy, what's up with that sig?
i was expecting a bit more =\
-
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?! :)
-
BTW...
Thanks for the help, QWERTY! VBModal was EXACTLY what I was looking for...
It's usually the easiest things that get past me.