吾爱破解 - LCG - LSG |安卓破解|病毒分析|www.52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 3931|回复: 4
收起左侧

[其他转载] VB模仿QQ边缘隐藏

  [复制链接]
〆红瞳朱雀丶痛 发表于 2014-8-8 18:06
之前制作的Visual Basic语言模仿QQ边缘隐藏的功能,今天放这里。      

编程语言:Visual Basic     编译软件:Visual Basic 6.0      所需控件:timer1

代码如下:


                ‘---------------------------------A-------------------------------P--------------------------------------I--------------------------------------

Option Explicit

Private Declare Function ReleaseCapture Lib "user32" () As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, IParam As Any) As Long
Private Const WM_SYSCOMMAND = &H112
Private Const SC_MOVE = &HF010&
Private Const HTCAPTION = 2

Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
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 Type RECT
    Left As Long
    Top As Long
    Right As Long
    Bottom As Long
End Type
Private Type POINTAPI
    X As Long
    Y As Long
End Type
Private Const HWND_TOPMOST = -1
Private Const SWP_NOSIZE = &H1
Private Const SWP_NOMOVE = &H2
Private Const HWND_TOP = 0
Private Const SWP_NOACTIVATE = &H10

Private Const SWP_SHOWWINDOW = &H40

Private Sub Form_Load()
    '窗体放在最前面
    SetWindowPos Me.hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_SHOWWINDOW Or SWP_NOMOVE Or SWP_NOSIZE
End Sub
Private Sub Timer1_Timer()
    Dim p As POINTAPI
    Dim f As RECT
    GetCursorPos p '得到MOUSE位置
    GetWindowRect Me.hWnd, f '得到窗体的位置
    If Me.WindowState <> 1 Then '不是最小化
        If p.X > f.Left And p.X < f.Right And p.Y > f.Top And p.Y < f.Bottom Then
            'MOUSE 在窗体上,例如屏幕边沿或者顶端的时候,窗口能显示出来,
            If Me.Top < 0 Then
                Me.Top = -10
                Me.Show
            ElseIf Me.Left < 0 Then
                Me.Left = -10
                Me.Show
            ElseIf Me.Left + Me.Width >= Screen.Width Then
                Me.Left = Screen.Width - Me.Width + 10
                Me.Show
            End If

        Else
            '不在的时候可以隐藏
            If f.Top <= 4 Then
                Me.Top = 40 - Me.Height
            ElseIf f.Left <= 4 Then
                Me.Left = 40 - Me.Width
            ElseIf Me.Left + Me.Width >= Screen.Width - 4 Then
                Me.Left = Screen.Width - 40
            End If
        End If
    End If
End Sub

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    ReleaseCapture '释放
    Dim ret As Long
    ret = SendMessage(Me.hWnd, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0)
End Sub

By:HackAny

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

空心 发表于 2014-8-8 18:11
这么好·支持下老··········
ww1113330 发表于 2014-8-8 18:35
头像被屏蔽
永远不知道 发表于 2014-8-9 12:36
許生i 发表于 2015-2-1 20:27
学习了,正好学VB
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

快速回复 收藏帖子 返回列表 搜索

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-9-22 15:40

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表