IWMEncBasicEdit::get_RunState
The get_RunState method retrieves a value indicating whether the basic edit process is running or stopped.
Syntax
HRESULT get_RunState(
WMENC_BASICEDIT_STATE* penumState
);
Parameters
penumState
[out] Pointer to a member of the WMENC_BASICEDIT_STATE enumeration type.
Return Values
If the method succeeds, it returns S_OK. If it fails, it supports the IErrorInfo interface and returns an HRESULT error code.
Return code | Number | Description |
E_POINTER | 0x80004003 | The pointer to the state is NULL. |
Remarks
Use the get_RunState method to determine if the basic edit process has stopped, for example if an error occurs. Use the get_ErrorState method to determine whether an error has occurred.
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();
}
// Get the error state.
long lErr;
{
hr = pBasicEdit->get_ErrorState(&lErr);
}
// Get the run state.
WMENC_BASICEDIT_STATE lRunState;
{
hr = pBasicEdit->get_RunState(&lRunState);
}
// Get the progress (percent complete).
long lProgress;
{
hr = pBasicEdit->get_ProgressPercent(&lProgress);
}
// 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