IWMEncFile2.FileSize

Windows Media Encoder SDK banner art

The FileSize property specifies and retrieves the file-size limit of the archived file.

Syntax

decimal = IWMEncFile2.FileSize;
IWMEncFile2.FileSize = decimal;

Parameters

This property takes no parameters.

Property Value

A Decimal indicating the size, in bytes, after which to stop archiving.

Remarks

The FileSize property allows you to set a size limit for an archival file. When the file reaches the specified size, archiving stops.

To retrieve the correct file size in milliseconds, you must multiply the return value by 10,000. Divide by 10,000 when you set the value.

Example Code

using WMEncoderLib;

try
{
// Create a WMEncoder object.
  WMEncoder Encoder;
  Encoder = new WMEncoder();

// Create a source group, add an audio source, and specify the
// default audio device as the source.
  IWMEncSourceGroupCollection SrcGrpColl;
  IWMEncSourceGroup SrcGrp;
  IWMEncSource SrcAud;
  SrcGrpColl = Encoder.SourceGroupCollection;
  SrcGrp = SrcGrpColl.Add("SG_1");
  SrcAud = SrcGrp.AddSource(WMENC_SOURCE_TYPE.WMENC_AUDIO);
  SrcAud.SetInput("Default_Audio_Device", "Device", "");

// Create an IWMEncFile2 object.
  IWMEncFile2 File;
  File = (IWMEncFile2)Encoder.File;

// Specify an output file.
  File.LocalFileName = "C:\\Test.wmv";

// Specify a file size of 300 Kbytes.
  File.FileSize = (300000/10000);
}

catch (Exception e)
{
     // TODO: Handle exceptions.
}

Requirements

Reference: Windows Media Encoder

Namespace: WMEncoderLib

Assembly: Interop.WMEncoderLib.dll

Library: WMEncoderLib.dll

See Also