dbTalk Databases Forums  

Stay on Top

comp.database.ms-access comp.database.ms-access


Discuss Stay on Top in the comp.database.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Oin Zea
 
Posts: n/a

Default Stay on Top - 04-08-2005 , 04:17 AM






is there a way to tell an MDIChild window to always stay on top of the other
in Visual Basic 6?



Reply With Quote
  #2  
Old   
David Hodgkins
 
Posts: n/a

Default Re: Stay on Top - 04-08-2005 , 03:35 PM






Yes, there is. I got the following code from a member of another group quite
some time ago. I wish I could remember who it was so I could give credit
where credit is due, but below is what I got and it works great for me.
start by creating a basic module called modSetAlwaysOnTop and put in the
following code:

Option Explicit

Public Const SWP_NOMOVE = 2
Public Const SWP_NOSIZE = 1
Public Const Flags = SWP_NOMOVE Or SWP_NOSIZE
Public Const HWND_TOPMOST = -1
Public Const HWND_NOTOPMOST = -2

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

Public Function SetTopMostWindow(hwnd As Long, Topmost As Boolean) _
As Long

If Topmost = True Then 'Make the window topmost
SetTopMostWindow = SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, _
0, Flags)
Else
SetTopMostWindow = SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, _
0, 0, Flags)
SetTopMostWindow = False
End If
End Function
------------------------------------------------------------------------

Next, in the form you want to keep on top, put the following in the
Form_Load event

Private Sub Form_Load()
Dim lR As Long
'Keep this window on top
lR = SetTopMostWindow(Me.hwnd, True)
End Sub
-------------------------------------------------

Hope this helps!

David Hodgkins, MCSD, MCDBA, MCSE
JSTAR Software Solutions
4402 Sweet Cherry Ln.
Kalamazoo, MI 49004
www.jstarsoftware.com - Home of AutoCompact for Access Databases
269-382-2931


"Oin Zea" <OinZea (AT) hotmail (DOT) com> wrote

Quote:
is there a way to tell an MDIChild window to always stay on top of the
other
in Visual Basic 6?





Reply With Quote
  #3  
Old   
Oin Zea
 
Posts: n/a

Default Re: Stay on Top - 04-11-2005 , 05:25 AM



It works but not on a MDI form. If I set the form to be a mdichild it will
hide behind other mdichild windows.

"Oin Zea" <OinZea (AT) hotmail (DOT) com> wrote

Quote:
is there a way to tell an MDIChild window to always stay on top of the
other
in Visual Basic 6?





Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.