VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



A small bit of code to make your form stay on top

by Kevin Nading (1 Submission)
Category: Custom Controls/Forms/Menus
Compatability: Visual Basic 3.0
Difficulty: Unknown Difficulty
Date Added: Wed 3rd February 2021
Rating: (8 Votes)

This code will make your form stay on top of any other windows running, just like winamp stays on top.

Assumes
just make a new form and make a module and follow instructions below.. if you already have a form and or a module just add the code below to them
Side Effects
do not make a large form stay on top or you will not be able to see the other apps that are open
API Declarations
'put this stuff in your new module
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
Global Const conHwndTopmost = -1
Global Const conSwpNoActivate = &H10
Global Const conSwpShowWindow = &H40

Rate A small bit of code to make your form stay on top

'just put this line in your form_load event
SetWindowPos hwnd, conHwndTopmost, 100, 100, 400, 141, conSwpNoActivate Or conSwpShowWindow

Download this snippet    Add to My Saved Code

A small bit of code to make your form stay on top Comments

No comments have been posted about A small bit of code to make your form stay on top. Why not be the first to post a comment about A small bit of code to make your form stay on top.

Post your comment

Subject:
Message:
0/1000 characters