|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
Allways on top
I am creating a program that i am going to run in the bottom right hand corner of my screen, however, i would like it to always be on top, i know other programs such as winamp can do this (i know winamp wasnt writen in vb, but... for example) Can n e 1 help me?
|
|
#2
|
|||
|
|||
|
There is code on www.mvps.org to keep a vb form always on top. I don't have the link but you should be able to find it easily with a search there, or on google.
|
|
#3
|
|||
|
|||
|
U can use SetWindowPos function:
The SetWindowPos function changes the size, position, and Z order of a child, pop-up, or top-level window. Child, pop-up, and top-level windows are ordered according to their appearance on the screen. The topmost window receives the highest rank and is the first window in the Z order. '------------------ ' Paste this into a form and you ' will have a new property-AlwaysOnTop. ' You then can use it like any other ' property- [FormName].AlwaysOnTop= True '------------------ Private Const HWND_TOPMOST = -&H1 Private Const HWND_NOTOPMOST = -&H2 Private Const SWP_NOSIZE = &H1 Private Const SWP_NOMOVE = &H2 '------------------ Private Declare Sub 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) '------------------ Private bOnTopState As Boolean Public Property Let AlwaysOnTop(bState As Boolean) Dim lFlag As Long On Error Resume Next If bState = True Then lFlag = HWND_TOPMOST Else lFlag = HWND_NOTOPMOST End If bOnTopState = bState Call SetWindowPos(Me.hWnd, lFlag, 0&, 0&, 0&, 0&, _ (SWP_NOSIZE Or SWP_NOMOVE)) End Property Public Property Get AlwaysOnTop() As Boolean AlwaysOnTop = bOnTopState End Property '------------------ Private Sub Form_Resize() ' Only need this if form can be ' minimized.(Loses the setting.) 'AlwaysOnTop = bOnTopState End Sub |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > Allways on top |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|