Find Code:
All Words
Any of the Words
Exact Phrase
Home
:
Code
:
Forums
:
Submit
:
Mailing List
:
About
:
Contact
Code
All
VB.NET
ASP.NET
C#
VB Classic
ASP Classic
Snippets
Popular
Resources
Submit Code
Forums
Articles
Tips
Links
Books
Contest
Link to us
Keeps a form always on top even when you click on ...
Author:
Justin Manley
Submitted:
1/2/2000
Version:
VB5
Compatibility:
VB5,6
Category:
Windows API
Views:
36549
Keeps a form always on top even when you click on another window.
Declarations:
Private 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 Const HWND_TOPMOST = -1 Const SWP_SHOWWINDOW = &H40
Code:
Private Sub Form_Load() Dim TempValue As Long Dim MyWidth As Long, MyHeight As Long Dim MyTop As Long, MyLeft As Long MyWidth = (Screen.Width / 2) MyWidth = MyWidth / Screen.TwipsPerPixelX MyHeight = Screen.Height / 2 MyHeight = MyHeight / Screen.TwipsPerPixelY MyLeft = Screen.Width / (4 * Screen.TwipsPerPixelX) MyTop = Screen.Height / (4 * Screen.TwipsPerPixelY) 'Call SetWindowPos API function TempValue = SetWindowPos(Me.hwnd, HWND_TOPMOST, MyLeft, MyTop, MyWidth, MyHeight, SWP_SHOWWINDOW) End Sub
Home
|
Forums
|
Submit
|
Books
|
Mailing List
|
Advertising
|
About
|
Contact
© 2023 A1VBCode. All rights reserved.
Legal disclaimer & terms of use
Privacy statement