新建From1(窗体),新建Timer1(Timer),代码:
Private Type RECT
    Left As Long
    Top As Long
    Right As Long
    Bottom As Long
End Type
Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
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
Private Declare Function GetForegroundWindow Lib "user32" () As Long
Private Sub Form_Load()
    SetWindowPos Me.hwnd, -1, 0, 0, 0, 0, 1
End Sub
Private Sub Timer1_Timer()
    Dim wnrect As RECT
    GetWindowRect GetForegroundWindow(), wnrect
    Me.Caption = "Top = " & wnrect.Top & " " & "Left = " & wnrect.Left & Chr(13) & "Bottom = " & wnrect.Bottom & " " & "Right = " & wnrect.Right
End Sub移动窗口,可以看到窗体标题变换文字。
