和OICQ窗体的感觉一样。可以在屏幕上、左、右隐藏(当然也能显示在最前和在
系统栏图标显示,不过代码太多了,剪掉了..) 
建立工程,创建Form1,加入Timer1,添加模块 
-------------------- 
模块代码: Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Lo
ng 
Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (By
Val hWnd As Long, ByVal nIndex As Long) As Long 
Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (By
Val hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Lo
ng 
Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, B
yVal yPoint As Long) As Long 
Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (
ByVal lpPrevWndFunc As Long, ByVal hWnd As Long, ByVal Msg As Long, By
Val wParam As Long, ByVal lParam As Long) As Long 
    Public Const GWL_WNDPROC = (-4) 
    Public Const WM_NCmousemove = &HA0 
    Public prevWndProc As Long 
Type RECT 
        Left As Long 
        Top As Long 
        Right As Long 
        Bottom As Long 
End Type 
Type POINTAPI 
        X As Long 
        Y As Long 
End Type 
Function WndProc(ByVal hWnd As Long, ByVal Msg As Long, ByVal wParam A
s Long, ByVal lParam As Long) As Long 
    WndProc = CallWindowProc(prevWndProc, hWnd, Msg, wParam, lParam) 
    If Msg = WM_NCmousemove Then 
            If Form1.Top < 200 Then 
Form1.Top = 0 
End If 
If Form1.Left < 200 Then 
Form1.Left = 0 
End If 
If Form1.Top > Screen.Height - Form1.Height - 200 Then 
                Form1.Top = Screen.Height - Form1.Height 
            End If 
            If Form1.Left > Screen.Width - Form1.Width - 200 Then 
                Form1.Left = Screen.Width - Form1.Width 
            End If 
    End If 
End Function 
窗体代码: 
Private Sub Form_Load() 
     Timer1.Interval = 500 
     prevWndProc = GetWindowLong(Me.hWnd, GWL_WNDPROC) 
     SetWindowLong Me.hWnd, GWL_WNDPROC, AddressOf WndProc 
End Sub 
Private Sub Form_Unload(Cancel As Integer) 
    SetWindowLong Me.hWnd, GWL_WNDPROC, prevWndProc 
End Sub 
Private Sub Timer1_Timer() 
Dim hCursorWnd As Long, point As POINTAPI 
    GetCursorPos point 
    hCursorWnd = WindowFromPoint(point.X, point.Y) 
    If Form1.hWnd <> hCursorWnd Then 
            If Form1.Top = 0 Then 
                Form1.Top = 30 - Form1.Height 
            ElseIf Form1.Left = 0 Then 
                Form1.Left = 30 - Form1.Width 
            ElseIf Form1.Left = Screen.Width - Form1.Width Then 
                Form1.Left = Screen.Width - 30 
            End If 
    End If 
End Sub※ 来源:.网易虚拟社区 http://club.netease.com.[FROM: 61.157.6.217]用了SubClass,在调试的时候记得要存盘哦