home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form Form1
- Appearance = 0 'Flat
- BackColor = &H80000005&
- Caption = "Form1"
- ClientHeight = 2745
- ClientLeft = 1965
- ClientTop = 2040
- ClientWidth = 4500
- BeginProperty Font
- name = "MS Sans Serif"
- charset = 1
- weight = 700
- size = 8.25
- underline = 0 'False
- italic = 0 'False
- strikethrough = 0 'False
- EndProperty
- ForeColor = &H80000008&
- Height = 3435
- Icon = "FORM1.frx":0000
- Left = 1905
- LinkTopic = "Form1"
- ScaleHeight = 183
- ScaleMode = 3 'Pixel
- ScaleWidth = 300
- Top = 1410
- Width = 4620
- Begin VB.Timer Timer1
- Interval = 500
- Left = 960
- Top = 0
- End
- Begin MSComDlg.CommonDialog CMDialog1
- Left = 240
- Top = 0
- _version = 65536
- _extentx = 847
- _extenty = 847
- _stockprops = 0
- End
- Begin VB.Menu mLoad
- Caption = "&Load"
- End
- Begin VB.Menu mSave
- Caption = "&Save"
- End
- Begin VB.Menu mFreeze
- Caption = "&Freeze"
- End
- Begin VB.Menu mUnfreeze
- Caption = "&Unfreeze"
- End
- Begin VB.Menu mAbout
- Caption = "&About"
- End
- Attribute VB_Name = "Form1"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- Private Sub CMDialog1_Click()
- End Sub
- Private Sub Form_Load()
- Form1.top = 500
- Form1.left = 500
- Form1.Width = 4920
- Form1.Height = 4290
- Form1.Caption = "WinFast T230"
- If VIDEO_Initialize() Then
- 'VIDEO_SetVideoPos 0, 0, 640, 480
- VIDEO_SetHorizontalAlignment 108
- VIDEO_SetVerticalAlignment 15
- VIDEO_SetHorizontalCrop 640
- VIDEO_SetVerticalCrop 480
- Else
- MsgBox "Can't initialize WinFast T230 Board"
- End If
- End Sub
- Private Sub Form_Paint()
- Dim FRECT As RECT
- GetWindowRect Form1.hWnd, FRECT
- xx = FRECT.left + GetSystemMetrics(SM_CXFRAME)
- yy = FRECT.top + GetSystemMetrics(SM_CYFRAME) + GetSystemMetrics(SM_CYCAPTION) + GetSystemMetrics(SM_CYMENU)
- ww = FRECT.right - FRECT.left - 2 * GetSystemMetrics(SM_CXFRAME)
- hh = FRECT.bottom - FRECT.top - 2 * GetSystemMetrics(SM_CYFRAME) - GetSystemMetrics(SM_CYMENU) - GetSystemMetrics(SM_CYCAPTION)
- VIDEO_EnableVideo
- VIDEO_SetVideoPos xx, yy, ww, hh
- End Sub
- Private Sub Form_Resize()
- Dim RC As RECT
- InvalidateRect Form1.hWnd, RC, 1
- End Sub
- Private Sub Form_Terminate()
- VIDEO_DisableVideo
- VIDEO_End
- End
- End Sub
- Private Sub Form_Unload(Cancel As Integer)
- VIDEO_DisableVideo
- VIDEO_End
- End
- End Sub
- Private Sub mAbout_Click()
- Load frmAbout
- frmAbout.Show
- End Sub
- Private Sub mFreeze_Click()
- VIDEO_FreezeVideo
- End Sub
- Private Sub mLoad_Click()
- Dim nWidth, nHeight As Integer
- Dim totalsize As Long
- Dim bmpinfo As BITMAPINFOHEADER
- Dim bmpheader As BITMAPFILEHEADER
- Dim linesize As Long
- Dim imagesize As Long
- Dim stMem As Long
- Dim gMem As Integer
- Dim hFile As Integer
- Dim wLinesPerScan, wScanTimes, wRestLines As Integer
- Dim ii As Integer
- Dim szLoadFileName As String
- szLoadFileName = ""
- VIDEO_DisableVideo
- CMDialog1.Filter = "Windows Bitmap (*.bmp)|*.bmp||"
- CMDialog1.Flags = 0
- CMDialog1.Action = 1
- szLoadFileName = CMDialog1.filename
- If szLoadFileName = "" Then
- VIDEO_EnableVideo
- Exit Sub
- End If
- gMem = GlobalAlloc(GHND, 31 * 1024)
- If gMem > 0 Then
- stMem = GlobalLock(gMem)
- VIDEO_FreezeVideo
- hFile = lopen(szLoadFileName, 0)
- If (hFile > 0) Then
- nRet% = lread(hFile, bmpheader, 14)
- nRet% = lread(hFile, bmpinfo, 40)
-
- nWidth = bmpinfo.biWidth
- nHeight = bmpinfo.biHeight
- If bmpheader.bfType <> &H4D42 Or bmpinfo.biBitCount <> 24 Then
- MsgBox "Bitmap File is not BMP24 Format"
- VIDEO_EnableVideo
- Exit Sub
- End If
-
- linesize = nWidth * 3
- imagesize = bmpinfo.biSizeImage
- totalsize = bmpinfo.biSizeImage
- wLinesPerScan = (31 * 1024) \ linesize
- wScanTimes = nHeight \ wLinesPerScan
- wRestLines = nHeight - (wScanTimes * wLinesPerScan)
-
- nRet% = llread(hFile, stMem, wRestLines * linesize)
- VIDEO_RestoreImageRect stMem, 0, wScanTimes * wLinesPerScan, nWidth, wRestLines, 4, 0
- For ii = (wScanTimes - 1) To 0 Step -1
- nRet% = llread(hFile, stMem, wLinesPerScan * linesize)
- VIDEO_RestoreImageRect stMem, 0, ii * wLinesPerScan, nWidth, wLinesPerScan, 4, 0
- Next ii
- nRet% = lclose(hFile)
- nRet% = GlobalUnlock(gMem)
- Else
- MsgBox "Not Enough Memory"
- VIDEO_EnableVideo
- Exit Sub
- End If
- End If
- nRet% = GlobalFree(gMem)
- VIDEO_EnableVideo
- End Sub
- Private Sub mSave_Click()
- Dim nWidth, nHeight As Integer
- Dim totalsize As Long
- Dim bmpinfo As BITMAPINFOHEADER
- Dim bmpheader As BITMAPFILEHEADER
- Dim linesize As Long
- Dim imagesize As Long
- Dim stMem As Long
- Dim gMem As Integer
- Dim hFile As Integer
- Dim wLinesPerScan, wScanTimes, wRestLines As Integer
- Dim ii As Integer
- Dim szSaveFileName As String
- szSaveFileName = ""
- VIDEO_DisableVideo
- CMDialog1.Filter = "Windows Bitmap (*.bmp)|*.bmp||"
- CMDialog1.Flags = 0
- CMDialog1.Action = 1
- szSaveFileName = CMDialog1.filename
- If szSaveFileName = "" Then
- VIDEO_EnableVideo
- Exit Sub
- End If
- nWidth = ((ww + 3) \ 4) * 4
- nHeight = hh
- linesize = nWidth * 3
- imagesize = linesize * nHeight
- totalsize = imagesize + linesize
- bmpinfo.biSize = 40
- bmpinfo.biWidth = nWidth
- bmpinfo.biHeight = nHeight
- bmpinfo.biPlanes = 1
- bmpinfo.biBitCount = 24
- bmpinfo.biCompression = 0
- bmpinfo.biSizeImage = imagesize
- bmpinfo.biXPelsPerMeter = 0
- bmpinfo.biYPelsPerMeter = 0
- bmpinfo.biClrUsed = 0
- bmpinfo.biClrImportant = 0
- bmpheader.bfType = &H4D42
- bmpheader.bfOffBits = 14 + 40
- bmpheader.bfSize = bmpinfo.biSizeImage + bmpheader.bfOffBits
- bmpheader.bfReserved1 = 0
- bmpheader.bfReserved2 = 0
- wLinesPerScan = (31 * 1024) \ linesize
- wScanTimes = nHeight \ wLinesPerScan
- wRestLines = nHeight - (wScanTimes * wLinesPerScan)
- gMem = GlobalAlloc(GHND, 31 * 1024)
- If gMem > 0 Then
- stMem = GlobalLock(gMem)
- VIDEO_FreezeVideo
- hFile = lcreat(szSaveFileName, 0)
- If (hFile > 0) Then
- nRet% = lwrite(hFile, bmpheader, 14)
- nRet% = lwrite(hFile, bmpinfo, 40)
- VIDEO_LoadImageRect stMem, 0, wScanTimes * wLinesPerScan, nWidth, wRestLines, 4, 0
- nRet% = llwrite(hFile, stMem, wRestLines * linesize)
- For ii = (wScanTimes - 1) To 0 Step -1
- VIDEO_LoadImageRect stMem, 0, ii * wLinesPerScan, nWidth, wLinesPerScan, 4, 0
- nRet% = llwrite(hFile, stMem, wLinesPerScan * linesize)
- Next ii
- End If
- nRet% = lclose(hFile)
- nRet% = GlobalUnlock(gMem)
- Else
- MsgBox "Not Enough Memory"
- VIDEO_EnableVideo
- Exit Sub
- End If
- nRet% = GlobalFree(gMem)
- VIDEO_EnableVideo
- End Sub
- Private Sub mUnfreeze_Click()
- VIDEO_UnfreezeVideo
- End Sub
- Private Sub Timer1_Timer()
- Dim FRECT As RECT
- GetWindowRect Form1.hWnd, FRECT
- xx = FRECT.left + GetSystemMetrics(SM_CXFRAME)
- yy = FRECT.top + GetSystemMetrics(SM_CYFRAME) + GetSystemMetrics(SM_CYCAPTION) + GetSystemMetrics(SM_CYMENU)
- ww = FRECT.right - FRECT.left - 2 * GetSystemMetrics(SM_CXFRAME)
- hh = FRECT.bottom - FRECT.top - 2 * GetSystemMetrics(SM_CYFRAME) - GetSystemMetrics(SM_CYMENU) - GetSystemMetrics(SM_CYCAPTION)
- VIDEO_EnableVideo
- VIDEO_SetVideoPos xx, yy, ww, hh
- End Sub
-