IWMEncBasicEdit::Start
The Start method starts the basic edit process to modify the input file as specified.
Syntax
HRESULT Start();
Parameters
This method takes no parameters.
Return Values
If the method succeeds, it returns S_OK. If it fails, it supports the IErrorInfo interface and returns an HRESULT error code.
Remarks
Use the Stop method to manually stop the process. Use the get_RunState method to determine whether the process has stopped. Use the _IWMEncBasicEditEvents::OnStateChange event to receive notifications about state changes in the IWMEncBasicEdit interface.
Example Code
// Include libraries.
#include <windows.h>
#include <atlbase.h>
#include <comdef.h>
#include "C:\WMSDK\WMEncSDK9\include\wmencode.h"
#include <conio.h> // for kbhit()
HRESULT hr;
IWMEncBasicEdit* pBasicEdit;
WMENC_LONGLONG LMarkin, LMarkout;
// Initialize the COM library and retrieve a pointer to an IWMEncBasicEdit interface.
hr = CoInitialize(NULL);
if ( SUCCEEDED( hr ) )
{
hr = CoCreateInstance(CLSID_WMEncBasicEdit,
NULL,
CLSCTX_INPROC_SERVER,
IID_IWMEncBasicEdit,
(void**) &pBasicEdit);
}
// Specify the input and output files.
if ( SUCCEEDED( hr ) )
{
hr = pBasicEdit->put_MediaFile(CComBSTR("C:\\InputFile.wmv"));
}
if ( SUCCEEDED( hr ) )
{
hr = pBasicEdit->put_OutputFile(CComBSTR("C:\\OutputFile.wmv"));
}
// Specify a configuration file.
if ( SUCCEEDED( hr ) )
{
hr = pBasicEdit->put_ConfigFile(CComBSTR("C:\\ConfigFile.txt"));
}
// Add indexing to the file.
if ( SUCCEEDED( hr ) )
{
hr = pBasicEdit->put_Index(VARIANT_TRUE);
}
// Specify the mark-in and mark-out times.
LMarkin.int64 = 50000000; // 5 seconds
LMarkout.int64 = 250000000; // 25 seconds
if ( SUCCEEDED( hr ) )
{
hr = pBasicEdit->put_MarkIn(LMarkin);
}
if ( SUCCEEDED( hr ) )
{
hr = pBasicEdit->put_MarkOut(LMarkout);
}
// Start editing.
if ( SUCCEEDED( hr ) )
{
hr = pBasicEdit->Start();
}
// Leave the console window open until the process has finished.
printf("When editing stops, press a key to close the console window.");
// Wait for a key press.
while(!kbhit())
_asm nop;
// Release pointers.
if ( pBasicEdit )
{
pBasicEdit->Release();
pBasicEdit = NULL;
}
Requirements
Header: wmencode.h
Library: wmenc.exe
See Also