home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form frmMain
- BackColor = &H00FFFFFF&
- BorderStyle = 1 'Fixed Single
- ClientHeight = 375
- ClientLeft = 1935
- ClientTop = 6525
- ClientWidth = 855
- ForeColor = &H00000000&
- Height = 780
- Icon = MAIN.FRX:0000
- Left = 1875
- LinkTopic = "Form2"
- MaxButton = 0 'False
- ScaleHeight = 25
- ScaleMode = 3 'Pixel
- ScaleWidth = 57
- Top = 6180
- Width = 975
- Begin SSCommand cmdCap
- BevelWidth = 1
- Caption = "Capture"
- Font3D = 0 'None
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 375
- Left = 0
- RoundedCorners = 0 'False
- TabIndex = 0
- Top = 0
- Width = 855
- End
- Option Explicit
- Dim fMarking As Integer
- Dim ptBeg As POINTAPI
- Dim ptEnd As POINTAPI
- Sub cmdCap_Click ()
- MousePointer = 10 'up arrow
- Hide
- SetCapture hWnd
- fMarking = False
- End Sub
- Sub Form_Load ()
- Load frmDest
- End Sub
- Sub Form_MouseDown (Button As Integer, Shift As Integer, X As Single, Y As Single)
- fMarking = True
- ptBeg.X = X
- ptBeg.Y = Y
- ClientToScreen hWnd, ptBeg
- ptEnd.X = X
- ptEnd.Y = Y
- ClientToScreen hWnd, ptEnd
- InvertBlock
- End Sub
- Sub Form_MouseMove (Button As Integer, Shift As Integer, X As Single, Y As Single)
- If fMarking Then
- InvertBlock
- ptEnd.X = X
- ptEnd.Y = Y
- ClientToScreen hWnd, ptEnd
- InvertBlock
- End If
- End Sub
- Sub Form_MouseUp (Button As Integer, Shift As Integer, X As Single, Y As Single)
- Dim capW As Integer
- Dim capH As Integer
- Dim srcDC As Integer
- Dim filename As String
- Dim NL As String * 2
- If Not fMarking Then Exit Sub
- fMarking = False
- MousePointer = 0
- InvertBlock
- ptEnd.X = X
- ptEnd.Y = Y
- ClientToScreen hWnd, ptEnd
- If ptEnd.X < ptBeg.X Then
- Swap ptBeg.X, ptEnd.X
- End If
- If ptEnd.Y < ptBeg.Y Then
- Swap ptBeg.Y, ptEnd.Y
- End If
- capW = ptEnd.X - ptBeg.X + 1
- capH = ptEnd.Y - ptBeg.Y + 1
- frmDest.Move 0, 0, capW * screen.TwipsPerPixelX, capH * screen.TwipsPerPixelX
- frmDest.Cls
- srcDC = CreateDC("DISPLAY", 0, 0, 0)
- BitBlt frmDest.hDC, 0, 0, capW, capH, srcDC, ptBeg.X, ptBeg.Y, &HCC0020
- DeleteDC srcDC
- ReleaseCapture
- NL = Chr$(13) + Chr$(10)
- filename = InputBox$("Enter filename:" & NL & NL & "Width:" & Str$(capW) & NL & "Height:" & Str$(capH), "Save Image")
- If filename <> "" Then
- SavePicture frmDest.Image, filename
- End If
- frmMain.Show
- End Sub
- Sub Form_Unload (Cancel As Integer)
- Unload frmDest
- End
- End Sub
- Sub InvertBlock ()
- Dim hDC As Integer
- hDC = CreateDC("DISPLAY", 0, 0, 0)
- PatBlt hDC, ptBeg.X, ptBeg.Y, ptEnd.X - ptBeg.X, ptEnd.Y - ptBeg.Y, &H550009
- DeleteDC hDC
- End Sub
- Sub Swap (num1 As Integer, num2 As Integer)
- Dim temp As Integer
- temp = num1
- num1 = num2
- num2 = temp
- End Sub
-