Partage
  • Partager sur Facebook
  • Partager sur Twitter

[VB.NET] Erreur de publication

help me...

    22 avril 2011 à 9:18:16

    Bonjour a tous,

    Après avoir fait de gros progrès sur VB.NET, enfin, je suis passé du niveau 000 à 0 :lol: . Je suis confronté un problème de publication, le message d'erreur! :(

    Voici la bête: :colere2:

    Image utilisateur


    Merci pour votre aide

    ;)

    Imports DirectX.Capture
    Imports System.Drawing
    Imports System.Drawing.Imaging
    
    Public Class Form1
        Inherits System.Windows.Forms.Form
        Dim logg As String
        Dim i As String
        Dim i1 As String
        Dim xls As Object
        Dim xlsfeuille As Object
        Friend WithEvents Timer1 As System.Windows.Forms.Timer
        Friend WithEvents Label2 As System.Windows.Forms.Label
        Dim xlsclasseur As Object
    
    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
            'démarage horloge'
            Timer1.Start()
            'affectation valeur varible excel'
            i = 2
            i1 = 2
    
    
            Dim j As Short
            Dim f As Filter
            Try
                'listage des peripheriques video installés sur la machine
                ComboBox1.Items.Clear()
                For j = 0 To Dispositivos.VideoInputDevices.Count - 1
                    f = Dispositivos.VideoInputDevices(j)
                    ComboBox1.Items.Add(f.Name)
                Next
                If j > 0 Then ComboBox1.SelectedIndex = 0
    
                'listage des peripheriques audio installés sur la machine
                ComboBox2.Items.Clear()
                For j = 0 To Dispositivos.AudioInputDevices.Count - 1
                    f = Dispositivos.AudioInputDevices(j)
                    ComboBox2.Items.Add(f.Name)
                Next
                If j > 0 Then ComboBox2.SelectedIndex = 0
    
    
                'pre configuration du capturing
                'definission de la camera
                CaptureInformation2.Camera = Dispositivos.VideoInputDevices(ComboBox1.SelectedIndex)
                'mise en place du stream video et audio
                CaptureInformation2.CaptureInfo = New DirectX.Capture.Capture(CaptureInformation2.Camera, Dispositivos.AudioInputDevices(ComboBox2.SelectedIndex))
                'renseignement du panneau d'affichage de la video
                CaptureInformation2.CaptureInfo.PreviewWindow = PicCam
                'compteur pour les capture d'image (frame video)
                CaptureInformation2.Counter = 1
                CaptureInformation2.CounterFrames = 1
                'configurations avancées
                Configurer()
                'pour faire plus joli
                Button_photo.Enabled = False
                'pour la gestion evennementiel de la capture d'ecran je cree un gestionnaire d evennement sur Framecapturecomplete
                AddHandler CaptureInformation2.CaptureInfo.FrameCaptureComplete, AddressOf NewCaptureReady
            Catch ex As Exception
                MsgBox(ex.Message)
                End
            End Try
    
        End Sub
        Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
            Label1.Text = Now.ToLongDateString
            Label2.Text = Now.ToLongTimeString
        End Sub
    
        Private Sub Configurer()
            Try
                'configurations avancées
                'configuration du systeme de compression video et audio
                'fafa modif'CaptureInformation2.CaptureInfo.VideoCompressor = Dispositivos.VideoCompressors(1) 'compression video
                'taille de la video
                CaptureInformation2.CaptureInfo.FrameSize = New Size(320, 240) 'taille de la video
                'FPS de la video
                CaptureInformation2.CaptureInfo.FrameRate = 50 'FPS
                'fichier .avi
                ''CaptureInformation.CaptureInfo.Filename = Application.StartupPath + "\essai.avi"
                'lancement du streaming d'affichage
                CaptureInformation2.CaptureInfo.RenderPreview()
            Catch ex As Exception
                MsgBox(ex.Message)
                End
            End Try
        End Sub
    
        Private Sub NewCaptureReady(ByVal Sender As System.Windows.Forms.PictureBox)
            'appele par le gestionnaire de handler sur l'evennement "FrameCapture
            'ma picture capturé est arrivée...
    
            Dim la As PictureBox = CType(Sender, PictureBox) 'la je converti mon picturebox en picturebox...je sais pas pourquoi, fo le faire sinom ca marche pas
    
            Try
                PicCapture.Image = la.Image 'j affecte ma capture d'image a mon picturebox qui attend que ca.
            Catch ex As Exception
                MsgBox(ex.Message)
                End
            End Try
        End Sub
    
        Sub Tue(ByVal Chem As String)
            Try
                My.Computer.FileSystem.DeleteFile(Chem)
            Catch ex As Exception
                'rien
    
            End Try
        End Sub
    
        Private Sub CmdCapture_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmdCapture.Click
    
            'demande une capture DirectX ...et lorsqu'elle est ready je la recoit par le Handler cree un peut plus haut
            'Dim StartTime = Now    ' Starting date/time.
            CaptureInformation2.CaptureInfo.CaptureFrame()
            Do While PicCapture.Image Is Nothing
                Application.DoEvents()
            Loop
            PicCapture.Image.Save(System.AppDomain.CurrentDomain.BaseDirectory() & Date.Now.Year & "-" & Date.Now.Month & "-" & Date.Now.Day & "_" & Date.Now.Hour & "h" & Date.Now.Minute & Date.Now.Second & "s" & Date.Now.Millisecond & "ms" & "_capture.jpg", System.Drawing.Imaging.ImageFormat.Jpeg)
            MsgBox("save ok")
        End Sub
    
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            'Pas arrivé à l'heure
            If (Date.Now.Hour = 8 And Date.Now.Minute > 15 And Date.Now.Minute < 45) = False Then
                'Envoi message visuel si pas a l'heure'
                MsgBox("Bienvenue au DEC")
                Try
                    'Création du fichier Excel
    
                    'Dim i1 As String
                    'i1 = 1
                    logg = TextBox1.Text
                    xls = CreateObject("Excel.Application")
                    xlsclasseur = xls.Workbooks.Open("c:\appli\arrivee.xls")
                    xlsfeuille = xlsclasseur.Worksheets(1)
                    xlsfeuille.Cells(i, 2).Value = logg
                    xlsfeuille.Cells(i, 3).Value = Date.Now.Hour & "h" & Date.Now.Minute
                    i = i + 1
                    'i1 = i1 + 1
                    xlsclasseur.Save()
                    xls.Application.Quit()
                    'xls.application.open("f:\testvba\Fiche_de_Prenom_Nom.xls")
                    xls = Nothing
                    'prise de photo'
                    CaptureInformation2.CaptureInfo.CaptureFrame()
                    Do While PicCapture.Image Is Nothing
                        Application.DoEvents()
                    Loop
                    PicCapture.Image.Save(System.AppDomain.CurrentDomain.BaseDirectory() & Date.Now.Year & "-" & Date.Now.Month & "-" & Date.Now.Day & "_" & Date.Now.Hour & "h" & Date.Now.Minute & "m" & Date.Now.Second & "s" & Date.Now.Millisecond & "ms" & "_capture.jpg", System.Drawing.Imaging.ImageFormat.Jpeg)
                    MsgBox("save ok")
                Catch ex As Exception
    
                End Try
            End If
            'Envoi message visuel si a l'heure'
            If (Date.Now.Hour = 8 And Date.Now.Minute > 15 And Date.Now.Minute < 45) = True Then
                MsgBox("Bienvenue au DEC")
                'Création du fichier Excel
                Try
                    'Dim i1 As String
                    'i1 = 1
                    logg = TextBox1.Text
                    xls = CreateObject("Excel.Application")
                    xlsclasseur = xls.Workbooks.Open("c:\appli\arrivee.xls")
                    xlsfeuille = xlsclasseur.Worksheets(1)
                    xlsfeuille.Cells(i, 2).Value = logg
                    xlsfeuille.Cells(i, 3).Value = "OK"
                    i = i + 1
                    'i1 = i1 + 1
                    xlsclasseur.Save()
                    xls.Application.Quit()
                    'xls.application.open("f:\testvba\Fiche_de_Prenom_Nom.xls")
                    xls = Nothing
                    'prise de photo'
                    CaptureInformation2.CaptureInfo.CaptureFrame()
                    Do While PicCapture.Image Is Nothing
                        Application.DoEvents()
                    Loop
                    PicCapture.Image.Save(System.AppDomain.CurrentDomain.BaseDirectory() & Date.Now.Year & "-" & Date.Now.Month & "-" & Date.Now.Day & "_" & Date.Now.Hour & "h" & Date.Now.Minute & "m" & Date.Now.Second & "s" & Date.Now.Millisecond & "ms" & "_capture.jpg", System.Drawing.Imaging.ImageFormat.Jpeg)
                    MsgBox("save ok")
                Catch ex As Exception
                End Try
            End If
        End Sub
    
        Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
            'Pas arrivé à l'heure
            If (Date.Now.Hour = 17 And Date.Now.Minute > 1 And Date.Now.Minute < 30) = False Then
                'Envoi message visuel si pas a l'heure'
                MsgBox("Bienvenue au DEC")
                Try
                    'Création du fichier Excel
                    logg = TextBox2.Text
                    xls = CreateObject("Excel.Application")
                    xlsclasseur = xls.Workbooks.Open("c:\appli\arrivee.xls")
                    xlsfeuille = xlsclasseur.Worksheets(1)
                    xlsfeuille.Cells(i1, 5).Value = logg
                    xlsfeuille.Cells(i1, 6).Value = Date.Now.Hour & "h" & Date.Now.Minute
                    i1 = i1 + 1
                    xlsclasseur.Save()
                    xls.Application.Quit()
                    'xls.application.open("f:\testvba\Fiche_de_Prenom_Nom.xls")
                    xls = Nothing
                Catch ex As Exception
    
                End Try
            End If
            'Envoi message visuel si a l'heure'
            If (Date.Now.Hour = 17 And Date.Now.Minute > 1 And Date.Now.Minute < 30) = True Then
                MsgBox("Bienvenue au DEC")
                'Création du fichier Excel
                Try
                    'Dim i1 As String
                    logg = TextBox2.Text
                    xls = CreateObject("Excel.Application")
                    xlsclasseur = xls.Workbooks.Open("c:\appli\arrivee.xls")
                    xlsfeuille = xlsclasseur.Worksheets(1)
                    xlsfeuille.Cells(i1, 5).Value = logg
                    xlsfeuille.Cells(i1, 6).Value = "OK"
                    i1 = i1 + 1
                    xlsclasseur.Save()
                    xls.Application.Quit()
                    xls = Nothing
                Catch ex As Exception
    
                End Try
            End If
        End Sub
    End Class
    
    • Partager sur Facebook
    • Partager sur Twitter

    [VB.NET] Erreur de publication

    × Après avoir cliqué sur "Répondre" vous serez invité à vous connecter pour que votre message soit publié.
    × Attention, ce sujet est très ancien. Le déterrer n'est pas forcément approprié. Nous te conseillons de créer un nouveau sujet pour poser ta question.
    • Editeur
    • Markdown