none
Error hycam2 RRS feed

  • Question

  • I add reference Hycam2 the when i Debug it got error. I use Visual Basic 2015. 

    An exception of type 'System.Runtime.InteropServices.COMException' occurred in mscorlib.dll but was not handled in user code

    Code:

    Imports System.Drawing.Imaging
    Imports System.Runtime.InteropServices.COMException
    Public Class Form1

        Dim Cam As New HyCam2.HyCam2 
        Private Sub Button8_Click(sender As Object, e As EventArgs) Handles Button8.Click

            Dim bounds As Rectangle
            Dim screenshot As System.Drawing.Bitmap
            Dim graph As Graphics
            bounds = Screen.PrimaryScreen.Bounds
            screenshot = New System.Drawing.Bitmap(bounds.Width, bounds.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb)
            graph = Graphics.FromImage(screenshot)
            graph.CopyFromScreen(bounds.X, bounds.Y, 0, 0, bounds.Size, CopyPixelOperation.SourceCopy)
            PictureBox1.Image = screenshot
        End Sub

        Private Sub Button9_Click(sender As Object, e As EventArgs) Handles Button9.Click
            Dim savefiledialog1 As New SaveFileDialog
            Try
                savefiledialog1.Title = "Save As"
                savefiledialog1.FileName = ".bmp"
                savefiledialog1.Filter = "Bitmap |*.bmp"
                If savefiledialog1.ShowDialog() = DialogResult.OK Then
                    PictureBox1.Image.Save(savefiledialog1.FileName, System.Drawing.Imaging.ImageFormat.Bmp)
                End If
            Catch ex As Exception

            End Try
        End Sub

        Private Sub Button10_Click(sender As Object, e As EventArgs) Handles Button10.Click
            Me.Hide()
        End Sub

        Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
            Cam.SelectWindow()
        End Sub

        Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
            Cam.SelectRegion()
            TextBox1.Text = Cam.Width
            TextBox2.Text = Cam.Height
            TextBox3.Text = Cam.StartY
            TextBox4.Text = Cam.StartY
        End Sub

        Private Sub CheckBox1_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox1.CheckedChanged
            If CheckBox1.Text = True Then
                Cam.RecordCursor = True
            End If
            If CheckBox1.Checked = False Then
                Cam.RecordCursor = False
            End If
        End Sub

        Private Sub CheckBox2_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox2.CheckedChanged
            If CheckBox2.Text = True Then
                Cam.RecordSound = True
            End If
            If CheckBox2.Checked = False Then
                Cam.RecordSound = False
            End If
        End Sub

        Private Sub CheckBox3_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox3.CheckedChanged
            If CheckBox3.Text = True Then
                Cam.AddClickStarbursts = True
            End If
            If CheckBox1.Checked = False Then
                Cam.AddClickStarbursts = False
            End If
        End Sub

        Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
            Me.Hide()
        End Sub

        Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
            Cam.Play()
        End Sub

        Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
            Cam.StartRec()
        End Sub

        Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
            Cam.StopRec()
        End Sub

        Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click
            Cam.PauseRec()
        End Sub

        Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
            TextBox1.Text = Cam.Width
        End Sub

        Private Sub TextBox2_TextChanged(sender As Object, e As EventArgs) Handles TextBox2.TextChanged
            TextBox2.Text = Cam.Height
        End Sub

        Private Sub TextBox3_TextChanged(sender As Object, e As EventArgs) Handles TextBox3.TextChanged
            TextBox3.Text = Cam.StartY
        End Sub

        Private Sub TextBox4_TextChanged(sender As Object, e As EventArgs) Handles TextBox4.TextChanged
            TextBox4.Text = Cam.StartX
        End Sub
    End Class

    Tuesday, February 6, 2018 7:45 AM

Answers

All replies