Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Forms always on top
Message
From
03/07/2001 12:29:18
 
 
To
03/07/2001 11:51:13
General information
Forum:
Visual Basic
Category:
Other
Miscellaneous
Thread ID:
00526337
Message ID:
00526367
Views:
15
>How can I set single form to be always on top?
>Thanks

Use the API call SetWindowPos.



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 Sub AlwaysOnTop(myfrm As Form, SetOnTop As Boolean)


If SetOnTop Then
lFlag = HWND_TOPMOST
Else
lFlag = HWND_NOTOPMOST
End If
SetWindowPos myfrm.hwnd, lFlag, _
myfrm.Left / Screen.TwipsPerPixelX, _
myfrm.Top / Screen.TwipsPerPixelY, _
myfrm.Width / Screen.TwipsPerPixelX, _
myfrm.Height / Screen.TwipsPerPixelY, _
SWP_NOACTIVATE Or SWP_SHOWWINDOW
End Sub

'Well, if your for example in a form cal
' led 'Form1' then you'd simply type:
AlwaysOnTop Form1, True
Guy Barrette, MCSD
============
Blog http://weblogs.asp.net/guybarrette
Microsoft Regional Director, Montreal, Canada www.microsoft.com/rd
MVP, ASP.NET http://mvp.support.microsoft.com/
President, Montreal Visual Studio User Group www.guvsm.net
INETA Regional Rep for Quebec www.ineta.org
UniversalThread Magazine Columnist (.NET Books Review Column) www.utmag.com
Tech Chair French Track, DevTeach 2004 & 2005 www.devteach.com
Business Architect, Microsoft Team - Nurun Inc www.nurun.com
XBox Live Gamer Tag: Slomo QC CA
Previous
Reply
Map
View

Click here to load this message in the networking platform