BVB Source Codes

VB grab screenshot of the screen, drag the source code Show CaptureIt.frm Source code

Return Download VB grab screenshot of the screen, drag the source code: download CaptureIt.frm Source code - Download VB grab screenshot of the screen, drag the source code Source code - Type:.frm
  1. VERSION 5.00
  2. Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
  3. Begin VB.Form Form1
  4.    Caption         =   "抓图小精灵"
  5.    ClientHeight    =   5625
  6.    ClientLeft      =   60
  7.    ClientTop       =   450
  8.    ClientWidth     =   8835
  9.    LinkTopic       =   "Form1"
  10.    MaxButton       =   0   'False
  11.   ScaleHeight     =   5625
  12.    ScaleWidth      =   8835
  13.    StartUpPosition =   3  '窗口缺省
  14.   Begin VB.CommandButton CmdExit
  15.       Caption         =   "退  出"
  16.       Height          =   495
  17.       Left            =   7320
  18.       TabIndex        =   6
  19.       Top             =   4560
  20.       Width           =   1335
  21.    End
  22.    Begin MSComDlg.CommonDialog DlgSave
  23.       Left            =   7320
  24.       Top             =   5160
  25.       _ExtentX        =   847
  26.       _ExtentY        =   847
  27.       _Version        =   393216
  28.    End
  29.    Begin VB.CommandButton CmdSaveBmp
  30.       Caption         =   "保存图片"
  31.       Height          =   495
  32.       Left            =   7320
  33.       TabIndex        =   5
  34.       Top             =   2880
  35.       Width           =   1335
  36.    End
  37.    Begin VB.CommandButton CmdCapRect
  38.       Caption         =   "桌面区域"
  39.       Height          =   495
  40.       Left            =   7320
  41.       TabIndex        =   4
  42.       ToolTipText     =   "请按左上到右下的方向选择屏幕区域!"
  43.       Top             =   2040
  44.       Width           =   1335
  45.    End
  46.    Begin VB.Timer Timer1
  47.       Enabled         =   0   'False
  48.      Interval        =   1000
  49.       Left            =   8040
  50.       Top             =   5160
  51.    End
  52.    Begin VB.CommandButton CmdCapActiveWindow
  53.       Caption         =   "活动窗口"
  54.       Height          =   495
  55.       Left            =   7320
  56.       TabIndex        =   3
  57.       ToolTipText     =   "请在2秒钟内选择好活动窗口!"
  58.       Top             =   1200
  59.       Width           =   1335
  60.    End
  61.    Begin VB.CommandButton CmdClear
  62.       Caption         =   "清  除"
  63.       Height          =   495
  64.       Left            =   7320
  65.       TabIndex        =   2
  66.       Top             =   3720
  67.       Width           =   1335
  68.    End
  69.    Begin VB.CommandButton CmdCapScreen
  70.       Caption         =   "整个桌面"
  71.       Height          =   495
  72.       Left            =   7320
  73.       TabIndex        =   1
  74.       ToolTipText     =   "直接捕获整个桌面!"
  75.       Top             =   360
  76.       Width           =   1335
  77.    End
  78.    Begin VB.PictureBox Picture1
  79.       Height          =   1695
  80.       Left            =   6600
  81.       ScaleHeight     =   1635
  82.       ScaleWidth      =   3435
  83.       TabIndex        =   0
  84.       Top             =   6120
  85.       Width           =   3495
  86.    End
  87.    Begin VB.Label Label1
  88.       AutoSize        =   -1  'True
  89.      Caption         =   "Written By HaiSu (2007)"
  90.       Enabled         =   0   'False
  91.      Height          =   180
  92.       Left            =   360
  93.       TabIndex        =   7
  94.       Top             =   5280
  95.       Width           =   2070
  96.    End
  97.    Begin VB.Image Image1
  98.       BorderStyle     =   1  'Fixed Single
  99.      Height          =   4935
  100.       Left            =   240
  101.       Stretch         =   -1  'True
  102.      ToolTipText     =   "缩略图会在视觉上失真,但不影响真实保存的图形内容!"
  103.       Top             =   240
  104.       Width           =   6855
  105.    End
  106. End
  107. Attribute VB_Name = "Form1"
  108. Attribute VB_GlobalNameSpace = False
  109. Attribute VB_Creatable = False
  110. Attribute VB_PredeclaredId = True
  111. Attribute VB_Exposed = False
  112. Public BorderWidth As Integer
  113. Public hDC3 As Long
  114. 'Download by http://www.bvbsoft.com
  115. Private Sub CmdCapActiveWindow_Click()
  116.     Me.WindowState = 1
  117.     Timer1.Enabled = True
  118. End Sub
  119.  
  120. Private Sub CmdCapRect_Click()
  121.   Dim sX As Integer, sY As Integer
  122.     Form1.WindowState = 1
  123.     Form2.AutoRedraw = True
  124.     hDC3 = GetDC(0)
  125.     sX = Screen.Width \ Screen.TwipsPerPixelX
  126.     sY = Screen.Height \ Screen.TwipsPerPixelY
  127.     BitBlt Form2.hdc, 0, 0, sX, sY, hDC3, 0, 0, vbSrcCopy
  128.     Form2.WindowState = 2
  129.     Form2.Show
  130.     Form2.MousePointer = vbCrosshair
  131. End Sub
  132.  
  133. Private Sub CmdCapScreen_Click()
  134.     Dim hdc As Long, sX As Integer, sY As Integer
  135.     Me.WindowState = 1
  136.     DoEvents '目的是为了隐藏自身
  137.    Picture1.Width = Screen.Width
  138.     Picture1.Height = Screen.Height
  139.     hdc = GetDC(0)
  140.     sX = Screen.Width \ Screen.TwipsPerPixelX
  141.     sY = Screen.Height \ Screen.TwipsPerPixelY
  142.     BitBlt Picture1.hdc, 0, 0, sX, sY, hdc, 0, 0, vbSrcCopy
  143.     ReleaseDC 0, hdc
  144.     Me.WindowState = 0
  145.     Image1.Picture = Picture1.Image
  146. End Sub
  147.  
  148. Private Sub CmdClear_Click()
  149.    Image1.Picture = Nothing
  150. End Sub
  151.  
  152. Private Sub CmdExit_Click()
  153.    End
  154. End Sub
  155.  
  156. Private Sub CmdSaveBmp_Click()
  157.    Dim r As Long
  158.    DlgSave.Filter = "(*.bmp)|*.bmp"
  159.    DlgSave.FileName = ""
  160.    DlgSave.ShowSave
  161.    If DlgSave.FileName <> "" Then
  162.      If Dir(DlgSave.FileName) <> "" Then
  163.        r = MsgBox("该文件已经存在,是否要覆盖?", vbYesNo + vbQuestion, "文件覆盖")
  164.        If r = vbNo Then Exit Sub
  165.      End If
  166.      SavePicture Image1.Picture, DlgSave.FileName
  167.    End If
  168. End Sub
  169.  
  170. Private Sub Form_Load()
  171.    BorderWidth = (Me.Width - Me.ScaleWidth) / 2
  172.    Picture1.AutoRedraw = True
  173. End Sub
  174.  
  175. Private Sub Timer1_Timer()
  176.    Dim hActiveWindow As Long
  177.    Dim RectActive As RECT
  178.    Dim hDC2 As Long
  179.    Static Count As Integer
  180.    hActiveWindow = GetForegroundWindow()
  181.    GetWindowRect hActiveWindow, RectActive
  182.    Picture1.Cls
  183.    Picture1.Width = (RectActive.Right - RectActive.Left) * Screen.TwipsPerPixelX + BorderWidth
  184.    Picture1.Height = (RectActive.Bottom - RectActive.Top) * Screen.TwipsPerPixelY + BorderWidth
  185.    hDC2 = GetWindowDC(hActiveWindow)
  186.    BitBlt Picture1.hdc, 0, 0, Picture1.Width, Picture1.Height, hDC2, 0, 0, vbSrcCopy
  187.    ReleaseDC hActiveWindow, hDC2
  188.    Count = Count + 1
  189.    If Count = 2 Then
  190.      Image1.Picture = Picture1.Image
  191.      Count = 0
  192.      Timer1.Enabled = False
  193.      Form1.SetFocus
  194.      Form1.WindowState = 0
  195.    End If
  196. End Sub
  197.  
downloadCaptureIt.frm Source code - Download VB grab screenshot of the screen, drag the source code Source code
Related Source Codes/Software:
VB+Access inventory management system - A general inventory management system based on VB+... 2011-12-31
100 VB wonderful applet source code examples - This is a good idea, wonderful VB programming 100 ... 2011-12-31
Sword VB advanced calculator - Sword advanced calculator VB Edition, artboard by ... 2011-12-31
VB based on PPStream network TV source class library written procedures - Take a look at the screenshots, this is not the PP... 2011-12-31
VB Gets an instance of the data table name - VB programming method gets the database in the dat... 2011-12-31
VC++ remote backups through the XML file database - VC++ according to the XML format in a remote datab... 2012-01-04
VC++ Car Club Manager - VC++ Car Club Manager, based on the Access databas... 2012-01-04
VC++--will walk along a path of the game robot - VC++ games--the robot to walk along a path, the pa... 2012-01-04
Notepad text editor v4.4 VC+= source code - Notepad v4.4 version source code, Notepad is a sma... 2012-01-04
WinIo.dll source code and VC demo - WinIo.dll source code and VC demo and WinIO is an ... 2012-01-04
Set up their own browser, you must have installed IE3.. - Set up their own browser, you must have installed ... 2015-04-13
Backup software management - Backup software installation list 2015-04-13
Asp holes into the software automatically - Asp holes into the software automatically 2015-04-13
Control and view the LAN users use VNC screen V0.2 stable (beta) - Control and view the LAN users use VNC screen & ha... 2015-04-13
Personal knowledge management - Personal knowledge management based on the disk fi... 2015-04-13
View the current landing QQ number - Can see your computer is currently logged in to wh... 2015-04-13
Assist the clipboard - Long-term programming, such as bar friends may fee... 2015-04-13
tuixiangzi - A tuixiangzi game 2015-04-13
Amazing site management system - VB + Access to write a good web site management sy... 2015-04-13
The gun game - I have replaced the characters in words, if you ne... 2015-04-13

 Back to top