Video Screen Capture

  1. 5 weeks ago

    Dean D

    Nov 3 Santa Ynez California

    Users of an in-house app I wrote sometimes complain of random crashes that we are unable to duplicate. I spent a few hours figuring out the COM interface for the Snagit screen shot and video capture tool and am posting it here so others can use it. Snagit comes with a 15 day free trial and costs $49 if you want a licensed copy. This code captures the window that calls the routine, but it can also be set to capture the whole screen or set portions of it.

    Public Sub StartCapture()
      if Running Then 
        EndCapture
        app.SleepCurrentThread 500
      end if
      Running = True
      VideoCapt = new SNAGITLib.VideoCapture
      VideoCapt.MuteMic = True
      VideoCapt.MuteSystemAudio = True
      VideoCapt.ForegroundPreview = False
      VideoCapt.EnablePreviewWindow = False
      VideoCapt.OutputVideoFile.Directory = SpecialFolder.Documents.Child("SnagIt").NativePath
      VideoCapt.OutputVideoFile.FileNamingMethod = SNAGITLib.snagOuputFileNamingMethod.sofnmAuto
      VideoCapt.Input = SNAGITLib.snagVideoInput.sviWindow
      VideoCapt.InputWindowOptions.SelectionMethod = SNAGITLib.snagWindowSelectionMethod.swsmActive
      VideoCapt.IncludeCursor = True
      VideoCapt.HideRecordingUI = True
      VideoCapt.Start
      TimeOutTimer.Period = TimeOut * 1000
      TimeOutTimer.Mode = Timer.ModeSingle
      
    End Sub
    

    To stop the recording

    Public Sub EndCapture()
      TimeOutTimer.Mode = Timer.ModeOff
      VideoCapt.Stop
      Running = False
      VideoCapt = nil
      End Sub

    Running is a boolean and the code stops the current instance before launching another one. Not doing this causes the MuteMic and MuteSystgemAudio routines to crash requiring a Windows restart before the routine will work again. The timer halts the video after a specified period. Installing Snagit will create the specified folder or you can put the files anywhere.

  2. Tim J

    Nov 3 Pre-Release Testers, Xojo Pro Dehydrating in AZ

    Does this sort the crash, or are you asking if any of us have an idea as to the crash?

  3. Dean D

    Nov 3 Santa Ynez California
    Edited 5 weeks ago

    Snagit COM server will crash if you open two instances at the same time and you set MuteMic or MuteSystemAudio true. Its just a warning to anyone wanting to use the program.

  4. Victor M

    Nov 3 Pre-Release Testers

    How can I test your application?

  5. Dean D

    Nov 6 Santa Ynez California
    Edited 5 weeks ago

    Download Snagit from their website. The first 15 days are free, I tested it on a window with a button with the first part of the code above in the action event and with a label where the time updated every second. A second button with the bottom part of the code sample stops the capture. You also need to Insert the ActiveX Compnent SNAGIT 1.0 Type Library into your app.

or Sign Up to reply!