论坛: 编程破解 标题: VB制作屏幕保护程序 复制本贴地址    
作者: hongliubo1 [hongliubo1]    论坛用户   登录

Private Declare Function GetDesktopWindow Lib "user32" () As Long
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Private Declare Function ShowCursor Lib "user32" (ByVal bShow As Long) As Long
Private Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hdc As Long) As Long


Sub Form_load()
    'form1窗体大小、位置与屏幕重合
    Form1.Width = Screen.Width
    Form1.Height = Screen.Height
    Form1.Left = 0
    Form1.Top = 0
    '图片框的窗体大小、位置与屏幕重合
    Picture1.Width = Screen.Width
    Picture1.Height = Screen.Height
    Picture1.Left = 0
    Picture1.Top = 0
    '隐藏鼠标
    ShowCursor False
    '将整屏画面抓到图片框中
    ScreenhWnd = GetDesktopWindow()
    ScreenDC = GetDC(ScreenhWnd)
    BitBlt Picture1.hdc, I, j, Picture1.ScaleWidth, Picture1.ScaleHeight, ScreenDC, 0, 0, vbSrcCopy
    ReleaseDC ScreenhWnd, ScreenDC
    Form1.Show
    '左右移动图片框
    While True
    Picture1.Left = Picture1.Left + 1
    '超出窗体右边则重新回到最左边
    If Picture1.Left > Form1.Width Then
        Picture1.Left = -Form1.Width
    End If
    DoEvents '响应其它事件
    Wend
End Sub

'点击鼠标结束滚幕


Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    End
End Sub

Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    End
End Sub
Private Sub Form_Unload(Cancel As Integer)
    '显示鼠标
    ShowCursor True
End Sub




Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
End
End Sub

地主 发表时间: 05-01-14 21:37

论坛: 编程破解

20CN网络安全小组版权所有
Copyright © 2000-2010 20CN Security Group. All Rights Reserved.
论坛程序编写:NetDemon

粤ICP备05087286号