📄 form13.frm
字号:
Left = 4920
Stretch = -1 'True
Top = 3840
Width = 2775
End
End
Attribute VB_Name = "Form13"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Option Base 0
Private Type POINTAPI
x As Long
y As Long
End Type
Dim aa, cc As Integer
Dim s As String
Private Type PALETTEENTRY
peRed As Byte
peGreen As Byte
peBlue As Byte
peFlags As Byte
End Type
Private Type LOGPALETTE
palVersion As Integer
palNumEntries As Integer
palPalEntry(255) As PALETTEENTRY ' Enough for 256 colors.
End Type
Private Type GUID
Data1 As Long
Data2 As Integer
Data3 As Integer
Data4(7) As Byte
End Type
Private Const RASTERCAPS As Long = 38
Private Const RC_PALETTE As Long = &H100
Private Const SIZEPALETTE As Long = 104
Private Type RECT
Left As Long
TOp As Long
Right As Long
Bottom As Long
End Type
Private Type PicBmp
Size As Long
Type As Long
hBmp As Long
hPal As Long
Reserved As Long
End Type
Private Declare Function ConvertBMPtoJPG Lib "ImageUtils.dll" (ByVal strInputFile As String, ByVal strOutputFile As String, ByVal blnEnableOverWrite As Boolean, ByVal JPGCompressQuality As Integer, ByVal blnKeepBMP As Boolean) As Integer
Private Declare Function OleCreatePictureIndirect Lib "olepro32.dll" (PicDesc As PicBmp, RefIID As GUID, ByVal fPictureOwnsHandle As Long, IPic As IPicture) As Long
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Declare Function GetCursorPos Lib "USER32" (lpPoint As POINTAPI) As Long ' Declare API
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 GetDeviceCaps Lib "gdi32" (ByVal hdc As Long, ByVal iCapabilitiy As Long) As Long
Private Declare Function GetSystemPaletteEntries Lib "gdi32" (ByVal hdc As Long, ByVal wStartIndex As Long, ByVal wNumEntries As Long, lpPaletteEntries As PALETTEENTRY) As Long
Private Declare Function CreatePalette Lib "gdi32" (lpLogPalette As LOGPALETTE) As Long
Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
Private Declare Function BitBlt Lib "gdi32" (ByVal hDCDest As Long, ByVal XDest As Long, ByVal YDest As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hDCSrc As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Private Declare Function DeleteDC Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function GetForegroundWindow Lib "USER32" () As Long
Private Declare Function SelectPalette Lib "gdi32" (ByVal hdc As Long, ByVal hPalette As Long, ByVal bForceBackground As Long) As Long
Private Declare Function RealizePalette Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function GetWindowDC Lib "USER32" (ByVal hwnd As Long) As Long
Private Declare Function GetDC Lib "USER32" (ByVal hwnd As Long) As Long
Private Declare Function GetWindowRect Lib "USER32" (ByVal hwnd As Long, lpRect As RECT) As Long
Private Declare Function ReleaseDC Lib "USER32" (ByVal hwnd As Long, ByVal hdc As Long) As Long
Private Declare Function GetDesktopWindow Lib "USER32" () As Long
Dim dbfile, picname As String
Dim dirname As String
Private Sub AVCapture1_Click()
Picture1.Picture = Picture5.Image
End Sub
Private Sub Command1_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyEscape Then
Timer1.Interval = 0
End If
If KeyAscii = vbKeyRButton Then
' dirname = ""
'b = Len(Label6.Caption)
'dirname = App.Path & "\pic\" & Mid(Label2.Caption, 1, b)
Picture1.Picture = Picture1.Image
'SavePicture Picture5.Picture, dirname & ".jpg"
End If
End Sub
Private Sub Command2_Click()
Command1.Enabled = True
Command1.SetFocus
Timer1.Interval = 30
Label4.caption = "修改"
Label2.caption = Label2.caption & Label4.caption
End Sub
Private Sub Command3_Click()
Data1.DatabaseName = App.Path + "\" + "teacher.mdb"
Data1.RecordSource = "SELECT * FROM dm"
Data1.Refresh
'Data1.Recordset.Bookmark = Trim(S)
Command1.Enabled = True
Command1.SetFocus
Timer1.Interval = 30
End Sub
Private Sub Command4_Click()
Dim Myquery As String
On Error Resume Next
Timer1.Interval = 0
Myquery = Combo1 & " " & "=" & " '" & Text1.Text & "'"
Data1.RecordSource = "SELECT * FROM dm WHERE " & Myquery
Data1.Refresh
Data1.Recordset.MoveLast: Data1.Recordset.MoveFirst
MsgBox Data1.Recordset.RecordCount & " 条记录"
Image2.Picture = LoadPicture(App.Path & "\pic\" & Text1.Text & ".jpg")
End Sub
Private Sub Command5_Click()
Dim dd As Integer
On Error Resume Next
Data1.Recordset.MoveNext
If Data1.Recordset.EOF Then
Data1.Recordset.MoveLast
dd = aa
Image2.Picture = LoadPicture(App.Path & "\pic\" & Label2.caption & ".jpg")
Label1.caption = "第" + Trim(Str(dd)) + "位同学"
Else
dirname = App.Path & "\pic\" & Label2.caption & ".jpg"
If FileExists(dirname) Then
Image2.Picture = LoadPicture(dirname)
Label1.caption = "第" + Trim(Str(aa + 1)) + "位同学"
aa = aa + 1
Else
Image2.Picture = LoadPicture(App.Path & "\pic\black.jpg")
Label1.caption = "无这位同学的照片"
End If
'Image2.Picture = LoadPicture(App.Path & "\pic\" & Label2.Caption & ".jpg")
End If
End Sub
Private Sub Command6_Click()
Dim dd As Integer
On Error Resume Next
Data1.Recordset.MovePrevious
If Data1.Recordset.BOF Then
Data1.Recordset.MoveFirst
dd = aa
Image2.Picture = LoadPicture(App.Path & "\pic\" & Label2.caption & ".jpg")
Label1.caption = "第" + Trim(Str(dd)) + "位同学"
Else
dirname = App.Path & "\pic\" & Label2.caption & ".jpg"
If FileExists(dirname) Then
Image2.Picture = LoadPicture(dirname)
Label1.caption = "第" + Trim(Str(aa - 1)) + "位同学"
aa = aa - 1
Else
Image2.Picture = LoadPicture(App.Path & "\pic\black.jpg")
Label1.caption = "无这位同学的照片"
End If
'Image2.Picture = LoadPicture(App.Path & "\pic\" & Label2.Caption & ".jpg")
'Label1.Caption = "第" + Trim(Str(aa)) + "位同学"
End If
End Sub
Private Sub Form_Load()
Dim strACDName, strVCDName, strWidth, strHeight As String
strHeight = Str(AVCapture1.VideoHeight)
strWidth = Str(AVCapture1.VideoWidth)
strACDName = AVCapture1.GetACDName(AVCapture1.CurACD)
strVCDName = AVCapture1.GetVCDName(AVCapture1.CurVCD)
Form13.caption = "濮阳县三中照相程序"
Data1.DatabaseName = App.Path + "\" + "teacher.mdb"
Data1.RecordSource = "dm"
dirname = App.Path & "/pic/" & picname
If FileExists(dirname & ".jpg") Then
Image2.Picture = LoadPicture(dirname & ".jpg")
Else
Image2.Picture = LoadPicture(App.Path & "\pic\black.jpg")
End If
' cc = 1
aa = 1
End Sub
Public Function GetDcPic() As Long
Dim DeskHdc&, ret&
Dim Pxy As POINTAPI
' Get Desktop DC
DeskHdc = GetDC(0)
'Get mouse position
GetCursorPos Pxy
GetDcPic = BitBlt(Picture5.hdc, 0, 0, Picture5.Width + 45, Picture5.Height + 55, DeskHdc, Pxy.x, Pxy.y, vbSrcCopy) 'GetCursorPos(Pxy.X), GetCursorPos(Pxy.Y))
ret = ReleaseDC(0&, DeskHdc)
Picture5.Refresh
Picture1.Refresh
End Function
'
Function FileExists(fname$) As Boolean
On Error Resume Next '设置错误处理
Dim x As Integer
x = FreeFile '取得一个空闲文件句柄
Open fname$ For Input As x '试图打开该文件
If Err = 0 Then '如果打开成功
FileExists = True
Else '否则
FileExists = False
End If
Close x
End Function
Private Sub Command1_Click()
Dim bb As String
Dim b As Integer
On Error Resume Next
dirname = ""
b = Len(Label6.caption)
dirname = App.Path & "\pic\" & Mid(Label2.caption, 1, b)
Picture5.Picture = Picture5.Image
SavePicture Picture1.Picture, dirname & ".jpg"
Image2.Picture = LoadPicture(dirname & ".jpg")
List1.AddItem Label2.caption
s = Data1.Recordset.Bookmark
Data1.Recordset.MoveNext
If Data1.Recordset.EOF Then
Data1.Recordset.MoveLast
Command1.Enabled = False
Timer1.Interval = 0
aa = Data1.Recordset.RecordCount
Else
Timer1.Interval = 30
aa = aa + 1
End If
End Sub
Private Sub Timer1_Timer()
Dim bb As String
If Command1.Enabled = True Then
Command1.SetFocus
GetDcPic
bb = Str(aa)
Label1.caption = "第" + Trim(bb) + "位同学"
Else
MsgBox "end p"
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -