VB6 Save Cam Capture to file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Wernerh
    New Member
    • Jul 2007
    • 104

    VB6 Save Cam Capture to file

    Hi everyone. Please could anyone tell me where I am going wrong in this code. I have a webcam connected that captures the a pic through this code. When I execute the code it does not save it to the file and folder path I have set. It comes up with the c:\my Documents Save dialog box.

    (Code)
    Private Sub mnuSaveFrame_Cl ick()
    Dim FileName As String
    Dim retVal As Boolean

    retVal = VBGetSaveFileNa me(FileName = "c:\Program files\Sg\Pic Men\Men1.bmp", _
    filter:="DIB Bitmap Files (*.bmp)|*.bmp", _
    DlgTitle:="Save Picture", _
    DefaultExt:="bm p", _
    Owner:=Me.hWnd)

    If False <> retVal Then
    retVal = capFileSaveDIB( hCapWnd, FileName)
    If True <> retVal Then
    MsgBox "Problem saving frame", vbInformation, App.Title
    End If
    End If

    End Sub

    Thanks
  • Robbie
    New Member
    • Mar 2007
    • 180

    #2
    I don't know if that's for VB6 (haven't used a save dialog like that before), but shouldn't the Get be Set in VBGetSaveFilena me?

    EDIT: Are you saying that' you're controlling a cam through VB? If so, could you please let me know how you're managing to do so? ><

    Comment

    • Wernerh
      New Member
      • Jul 2007
      • 104

      #3
      I have been able to sort it out. My new code is this :

      (code)VB
      Private Sub mnuSaveFrame_Cl ick()
      Dim FileName As String
      Dim retVal As Boolean

      retVal = VBGetSaveFileNa me(FileName, _
      filter:="DIB Bitmap Files (*.bmp)|*.bmp", _
      DlgTitle:="Save Picture", _
      InitDir:="c:\pr ogram files\sg\pic men", _
      DefaultExt:="bm p", _
      Owner:=Me.hWnd)

      If False <> retVal Then
      retVal = capFileSaveDIB( hCapWnd, FileName)
      If True <> retVal Then
      MsgBox "Problem saving frame", vbInformation, App.Title
      End If
      End If

      End Sub

      I have vb Initialise the cam and then use this script to save the image to a dir. Was that your question?

      Comment

      • Wernerh
        New Member
        • Jul 2007
        • 104

        #4
        Originally posted by Wernerh
        I have been able to sort it out. My new code is this :

        (code)VB
        Private Sub mnuSaveFrame_Cl ick()
        Dim FileName As String
        Dim retVal As Boolean

        retVal = VBGetSaveFileNa me(FileName, _
        filter:="DIB Bitmap Files (*.bmp)|*.bmp", _
        DlgTitle:="Save Picture", _
        InitDir:="c:\pr ogram files\sg\pic men", _
        DefaultExt:="bm p", _
        Owner:=Me.hWnd)

        If False <> retVal Then
        retVal = capFileSaveDIB( hCapWnd, FileName)
        If True <> retVal Then
        MsgBox "Problem saving frame", vbInformation, App.Title
        End If
        End If

        End Sub

        I have vb Initialise the cam and then use this script to save the image to a dir. Was that your question?
        It does not use the default cam software, it is completely standalone operational vb application. Can also create AVI etc.

        Comment

        • Robbie
          New Member
          • Mar 2007
          • 180

          #5
          Well done with getting it to work. :)

          Originally posted by Wernerh
          It does not use the default cam software, it is completely standalone operational vb application. Can also create AVI etc.
          That's what I was wondering how you did. I mean, what the code for initializing it is, and getting a current image from it.

          I've been trying to do this, but I've only managed a measly 5 FPS or so, because it copies it to the clipboard, then loads that in a PictureBox, then you can save it.

          So if you could show me what code you use, I would be very grateful! ^^;;

          Comment

          • Wernerh
            New Member
            • Jul 2007
            • 104

            #6
            I would have to email you the sample application to do show you, can you send me your email address?

            Comment

            • Robbie
              New Member
              • Mar 2007
              • 180

              #7
              Originally posted by Wernerh
              I would have to email you the sample application to do show you, can you send me your email address?
              Thanks! Well, you should be able to on my profile, but I just tested that, and it says that I've chosen not to share my email address, even though that's not true.

              So you can use this link to upload it directly to my server if you like
              (Link will only work for a few hours, for safety reasons ^-')

              Comment

              • Wernerh
                New Member
                • Jul 2007
                • 104

                #8
                Originally posted by Robbie
                Thanks! Well, you should be able to on my profile, but I just tested that, and it says that I've chosen not to share my email address, even though that's not true.

                So you can use this link to upload it directly to my server if you like
                (Link will only work for a few hours, for safety reasons ^-')

                http://robbi-985.homeip.net:8000/tempupload.html
                Hi,

                Did it for you and also a txt file called wernerh for you to read.

                Cheers

                Comment

                • Robbie
                  New Member
                  • Mar 2007
                  • 180

                  #9
                  Originally posted by Wernerh
                  Hi,

                  Did it for you and also a txt file called wernerh for you to read.

                  Cheers
                  Thanks very much! =D
                  Now all I've gotta do is filter through all the code to find what I need, and try to understand it. --;
                  By the way, I'm using it to control a robotic arm using a camera. If I manage, I'll upload a video of it to YouTube or somewhere like that. ;)

                  Comment

                  • gbayhan
                    New Member
                    • Sep 2008
                    • 3

                    #10
                    Hi,

                    I'm also interested in this thread. Can you also please send me the code?!
                    If you'd like to send, here is my email, gbayhan@bayhanm uhendislik.com

                    Thank you so much...

                    Comment

                    • Wernerh
                      New Member
                      • Jul 2007
                      • 104

                      #11
                      Hi, have mailed you the source code

                      Comment

                      • Wernerh
                        New Member
                        • Jul 2007
                        • 104

                        #12
                        gbayhan your mail address comes back with error

                        Comment

                        • gbayhan
                          New Member
                          • Sep 2008
                          • 3

                          #13
                          Wernerh, i got your mail... i dont know why you get an error mail.
                          Thank you for your help... :)

                          Comment

                          Working...