could some on help me with it i please tell me what i did rong

slipknotgen

New member
Joined
Aug 22, 2010
Messages
1
Programming Experience
3-5
Imports WMEncoderLib
Imports WMPLib
Imports WMPREVIEWLib
Imports System.IO
Public Class Form1

Dim Encoder As WMEncoder
Dim quality = "Windows Media Video 8 for Local Area Network (384 Kbps)"
Dim savefold

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If TextBox1.Text = "" Then
MsgBox("Please type a file name")
Else
Button1.Enabled = False
Button2.Enabled = True
MakeVideo()
End If
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Button2.Enabled = False
Button1.Enabled = True
Encoder.Stop()
End Sub


Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Try
AxWindowsMediaPlayer1.URL = "C:\SCVids\" + TextBox1.Text + ".avi"
Catch ex As Exception
End Try
End Sub

Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
If CheckBox1.Checked = True Then
quality = "Screen Video/Audio High (CBR)"
Else
quality = "Windows Media Video 8 for Local Area Network (384 Kbps)"
End If
End Sub

Private Sub MakeVideo()
Encoder = New WMEncoder
' Retrieve the source group collection and add a source group.
Dim SrcGrp As IWMEncSourceGroup2
Dim SrcGrpColl As IWMEncSourceGroupCollection
SrcGrpColl = Encoder.SourceGroupCollection
SrcGrp = SrcGrpColl.Add("SG_1")
' Add a video and audio source to the source group.
Dim SrcVid As IWMEncVideoSource2
Dim SrcAud As IWMEncAudioSource
SrcVid = SrcGrp.AddSource(WMENC_SOURCE_TYPE.WMENC_VIDEO)
SrcAud = SrcGrp.AddSource(WMENC_SOURCE_TYPE.WMENC_AUDIO)
' Identify the source files to encode.
SrcVid.SetInput("ScreenCap://ScreenCapture1")
SrcAud.SetInput("Device://Default_Audio_Device")
' Choose a profile from the collection.
Dim ProColl As IWMEncProfileCollection
Dim Pro As IWMEncProfile
Dim i As Integer
Dim lLength As Long
ProColl = Encoder.ProfileCollection
lLength = ProColl.Count
For i = 0 To lLength - 1
Pro = ProColl.Item(i)
If Pro.Name = quality Then
SrcGrp.Profile = Pro
Exit For
End If
Next
' Specify a file object in which to save encoded content.
Dim File As IWMEncFile
File = Encoder.File
File.LocalFileName = "C:\SCVids\" + TextBox1.Text + ".avi"
' Crop 2 pixels from each edge of the video image.
SrcVid.CroppingBottomMargin = 2
SrcVid.CroppingTopMargin = 2
SrcVid.CroppingLeftMargin = 2
SrcVid.CroppingRightMargin = 2
' Start the encoding process.
Encoder.Start()
End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Button2.Enabled = False
If Dir("C:\SCVids", vbDirectory) = "" Then MkDir("C:\SCVids")
End Sub
End Class
 
Back
Top