home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form TopForm
- Caption = "Always On Top"
- ClientHeight = 2025
- ClientLeft = 1095
- ClientTop = 1485
- ClientWidth = 4380
- Height = 2430
- Left = 1035
- LinkTopic = "Form1"
- ScaleHeight = 2025
- ScaleWidth = 4380
- Top = 1140
- Width = 4500
- Begin CommandButton Command1
- Caption = "Close"
- Height = 525
- Left = 1530
- TabIndex = 1
- Top = 1350
- Width = 1245
- End
- Begin ListBox List1
- Height = 1005
- Left = 1530
- TabIndex = 0
- Top = 210
- Visible = 0 'False
- Width = 1245
- End
- Begin ccSubClass SubClass1
- CtlParam = "TopForm"
- Left = 450
- Messages = TOPMOST.FRX:0000
- Top = 1200
- End
- Option Explicit
- Declare Sub SetWindowPos Lib "user" (ByVal hWnd%, ByVal hwndinsertafter%, ByVal x%, ByVal y%, ByVal cx%, ByVal cy%, ByVal wFlags%)
- Dim msgcount As Integer
- Sub Command1_Click ()
- Unload Me
- End Sub
- Sub SubClass1_WndMessage (wnd As Integer, msg As Integer, wp As Integer, lp As Long, retval As Long, nodef As Integer)
- Static settop As Integer 'need this to prevent infinite loop
- If settop Then ' we're in the process of setting this window to topmost
- settop = False
- Exit Sub
- End If
- ' FYI - Shows how many times this message is processed
- List1.AddItem Str$(msgcount)
- List1.ListIndex = msgcount
- msgcount = msgcount + 1
- 'calling the SetWindowPos API function triggers a WM_WINDOWPOSCHANGING
- 'message, set a flag to prevent infinite loop
- settop = True
- ' set topmost window
- SetWindowPos TopForm.hWnd, -1, 0, 0, 0, 0, 3
- nodef = True
- End Sub
-