How to use the unregistered ScrRecX
Usually you need to register an ActiveX component before using
it, by using this command: regsvr32 ScrRecX.dll
Sometimes, however you want to use the unregistered ActiveX (for
example, in the portable version of your application).
Visual C++ Example
HRESULT CreateComObject(HMODULE hLib, REFCLSID rclsid, REFIID riid, LPVOID* ppv)
{
PDLLGETCLASSOBJECT pGCO = (PDLLGETCLASSOBJECT)::GetProcAddress(hLib, "DllGetClassObject");
if( pGCO == NULL )
return E_POINTER;
CComPtr<IClassFactory> pFactory;
HRESULT hr = pGCO(rclsid, IID_IClassFactory, (void**)&pFactory);
if ( FAILED(hr) )
return hr;
hr = pFactory->CreateInstance(NULL, riid, ppv);
if ( FAILED(hr) )
return hr;
return S_OK;
}
...
#import "ScrRecX.dll" no_namespace named_guids raw_interfaces_only
...
CComPtr< IFMScrRec > pRec;
hLib = LoadLibrary(_T("ScrRecX.dll"));
if ( !hLib )
{
// Process error
}
HRESULT hr = CreateComObject(hLib, CLSID_FMScrRec, IID_IFMScrRec, (void**)pRec);
if ( FAILED(hr) )
{
// Process error
}
...
Events
If you use the unregistered ScrRecX object, events never fire.
In this case you need to set a windos handle WindowHandle property to receive
windows messages instead of events:
VideoRecorder.put_WindowHandle((OLE_HANDLE)HandleToLong(hWnd));
In this case a specified window will receive the following
messages:
#define WM_RECORDING_COMPLETE (WM_APP + 300)
#define WM_RECORDING_ERROR (WM_APP + 310)
#define WM_ENCODING_COMPLETE (WM_APP + 320)
#define WM_ENCODING_ERROR (WM_APP + 330)
#define WM_ENCODING_PROGRESS (WM_APP + 340)
See Also:
RecordingComplete
event
RecordingError event
EncodingComplete
event
EncodingError event
EncodingProgress
event
|