home *** CD-ROM | disk | FTP | other *** search
/ Mastering Visual Basic 5 / MasteringVisualBasic5.iso / ch_code / ch12 / wintop / wintop.frm (.txt) next >
Encoding:
Visual Basic Form  |  1997-02-20  |  1.3 KB  |  36 lines

  1. VERSION 5.00
  2. Begin VB.Form Form1 
  3.    Caption         =   "Always on Top"
  4.    ClientHeight    =   2250
  5.    ClientLeft      =   60
  6.    ClientTop       =   345
  7.    ClientWidth     =   4950
  8.    LinkTopic       =   "Form1"
  9.    ScaleHeight     =   2250
  10.    ScaleWidth      =   4950
  11.    StartUpPosition =   3  'Windows Default
  12.    Begin VB.Label Label1 
  13.       Caption         =   "This window will remain on top even if you switch to another window.  Try it!"
  14.       Height          =   1575
  15.       Left            =   120
  16.       TabIndex        =   0
  17.       Top             =   360
  18.       Width           =   4695
  19.    End
  20. Attribute VB_Name = "Form1"
  21. Attribute VB_GlobalNameSpace = False
  22. Attribute VB_Creatable = False
  23. Attribute VB_PredeclaredId = True
  24. Attribute VB_Exposed = False
  25. Option Explicit
  26. Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, _
  27.     ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, _
  28.     ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
  29. Const HWND_TOPMOST = -1
  30. Const SWP_SHOWWINDOW = &H40
  31. Private Sub Form_Load()
  32.     Dim retValue As Long
  33.     retValue = SetWindowPos(Me.hwnd, HWND_TOPMOST, Me.CurrentX, Me.CurrentY, _
  34.                     Me.Width, Me.Height, SWP_SHOWWINDOW)
  35. End Sub
  36.