- 生肖
- 蛇
- 性别
- 男
- 积分
- 208
- 积分
- 216
- 精华
- 0
- 阅读权限
- 30
- 注册时间
- 2012-4-28
- 最后登录
- 2012-6-1
- 帖子
- 30
- 生肖
- 蛇
- 性别
- 男
|
本帖最后由 sky_yx 于 2015-12-30 14:23 编辑
- Private Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hdc As Long) As Long
- Private Declare Function OpenClipboard Lib "user32" (ByVal hwnd As Long) As Long
- Private Declare Function EmptyClipboard Lib "user32" () As Long
- Private Declare Function SetClipboardData Lib "user32" (ByVal wFormat As Long, ByVal hMem As Long) As Long
- Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
- Private Declare Function DeleteDC Lib "gdi32" (ByVal hdc 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 CreateDC Lib "gdi32" Alias "CreateDCA" (ByVal lpDriverName As String, ByVal lpDeviceName As String, ByVal lpOutput As String, lpInitData As Long) As Long
- Private Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hdc As Long) As Long
- Private Declare Function CreateCompatibleBitmap Lib "gdi32" (ByVal hdc As Long, ByVal nWidth As Long, ByVal nHeight As Long) As Long
- Private Declare Function CloseClipboard Lib "user32" () As Long
- Dim p1 As String
- Sub ScrnCap(Lt, Top, Rt, Bot)
- rWidth = Rt - Lt
- rHeight = Bot - Top
- SourceDC = CreateDC("DISPLAY", 0, 0, 0)
- DestDC = CreateCompatibleDC(SourceDC)
- BHandle = CreateCompatibleBitmap(SourceDC, rWidth, rHeight)
- SelectObject DestDC, BHandle
- BitBlt DestDC, 0, 0, rWidth, rHeight, SourceDC, Lt, Top, &HCC0020
- Wnd = Screen.ActiveForm.hwnd
- OpenClipboard Wnd
- EmptyClipboard
- SetClipboardData 2, BHandle
- CloseClipboard
- DeleteDC DestDC
- ReleaseDC DHandle, SourceDC
- End Sub
- '以下的示例把屏幕图象捕捉后,放到Picture1 中。
- Sub Command1_Click()
- ScrnCap 400, 300, 500, 400
- Picture1.Picture = Clipboard.GetData()
- End Sub
- Private Sub Command2_Click()
- ScrnCap 400, 300, 500, 400
- Picture2.Picture = Clipboard.GetData()
- For i = 1 To Picture1.Width Step 15
- For j = 1 To Picture1.Height Step 15
- If Picture1.Point(i, j) <> Picture2.Point(i, j) Then
- MsgBox "图像改变"
- Exit Sub
- End If
- Next j
- Next i
- End Sub
复制代码
|
|