VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



True Always On top With API

by Liu Yucheng (4 Submissions)
Category: Windows API Call/Explanation
Compatability: Visual Basic 3.0
Difficulty: Unknown Difficulty
Date Added: Wed 3rd February 2021
Rating: (5 Votes)

True window always on top. Like MS toolbar.
It floats over any active application is inactive but is still always on top.
Allows you to switch between applications and window is still always on top!
Much better than Jake McCurry's lousy Always on top code.

Inputs
Window Handle of Window to stay on top.
Assumes
Nothing
Code Returns
Nothing
Side Effects
Nothing
API Declarations
Public Const HWND_BOTTOM = 1
Public Const HWND_NOTOPMOST = -2
Public Const HWND_TOP = 0
Public Const HWND_TOPMOST = -1
Public Const SWP_NOMOVE = &H2
Public Const SWP_NOSIZE = &H1
Public 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 Declare Function GetActiveWindow Lib "user32" () As Long

Rate True Always On top With API

Public Sub MakeWindowAlwaysTop(hwnd As Long)
SetWindowPos hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE + SWP_NOSIZE
End Sub
Public Sub MakeWindowNotTop(hwnd As Long)
SetWindowPos hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE + SWP_NOSIZE
End Sub

Download this snippet    Add to My Saved Code

True Always On top With API Comments

No comments have been posted about True Always On top With API. Why not be the first to post a comment about True Always On top With API.

Post your comment

Subject:
Message:
0/1000 characters