Wednesday, January 19, 2011

Video Recording in AVI format using HyCam SDK

For this tutorial you need to install HyCam SDK on your computer then add reference which is shown below in screen shot with red square marking.


Following screen shows the design mode of form
Imports HyCam2
Public Class Form1
    Dim cam1 As New HyCam2.HyCam2
    Dim sfd As New SaveFileDialog
    Private Sub btnStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStart.Click
        sfd.Filter = "AVI Files (*.avi)|*.avi|All Files(*.*)|*.*"
        sfd.FileName = "Save.avi"
        sfd.DefaultExt = "*.avi"
        sfd.ShowDialog()
        cam1.FileName = sfd.FileName.ToString
        cam1.RecordCursor = True
        cam1.RecordSound = True
        cam1.StartX = My.Computer.Screen.Bounds.X
        cam1.StartY = My.Computer.Screen.Bounds.Y
        cam1.Height = My.Computer.Screen.Bounds.Height
        cam1.Width = My.Computer.Screen.Bounds.Width
        cam1.StartRec()
    End Sub

    Private Sub BtnStop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnStop.Click
        cam1.StopRec()
    End Sub

    Private Sub camOn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles camOn.Click
        AxWindowsMediaPlayer1.Visible = True
        Dim str As String
        str = sfd.FileName
        AxWindowsMediaPlayer1.launchURL(str)
    End Sub

    Private Sub camOff_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles camOff.Click
        AxWindowsMediaPlayer1.Visible = False
    End Sub
End Class


No comments:

Post a Comment