Create an instance of the ltmfCapture class. This is accomplished using the Win32 CoCreateInstance function, as follows:
IltmfCapture* pCapture;
CoCreateInstance(&CLSID_ltmfCapture, NULL, CLSCTX_INPROC_SERVER,&IID_IltmfCapture,(void**) &pCapture);
IltmfCapture* pCapture;
CoCreateInstance(&CLSID_ltmfCapture, NULL, CLSCTX_INPROC_SERVER,&IID_IltmfCapture, (void**) &pCapture);
Define the notification window, which receives the capture status notifications:
HWND hwndNotify;
#define WM_CAPTURENOTIFY (WM_USER + 1000)
IltmfCapture_SetNotifyWindow(pCapture, (long)hwndNotify, WM_CAPTURENOTIFY);
HWND hwndNotify;
#define WM_CAPTURENOTIFY (WM_USER + 1000)
pCapture->SetNotifyWindow((long)hwndNotify, WM_CAPTURENOTIFY);
✎ NOTE
A capture can be accomplished without using a notification window, but the user would be required to poll the objects state to determine when the capture has finished.
Define a frame window for the video preview:
HWND hwndFrame;
IltmfCapture_put_VideoWindowFrame(pCapture, (long)hwndFrame);
HWND hwndFrame;
pCapture->put_VideoWindowFrame((long)hwndFrame);
The user is required to create the window that serves as the video frame. ltmfCapture will subclass this window, so there is no need to forward any messages to the ltmfCapture object. By default, ltmfCapture will automatically maximize the video within the frame window. The video will automatically resize when the frame window size changes.
✎ NOTE
The notification window and the video frame window can be the same.
Set the Target file:
BSTR bstr;
bstr = SysAllocString(L"c:\\captured.wmv");
IltmfCapture_put_Target
BSTR bstr;
::SysAllocString(L"c:\\captured.wmv");
pCapture->put_TargetFile(bstr);
::SysFreeString(bstr);
Set the video device:
IltmfDevices* devices;
IltmfCapture_get_VideoDevices(pCapture, &devices);
IltmfDevices_put_Selection(devices, 0);
IltmfDevices_Release(devices);
IltmfDevices* devices;
pCapture->get_VideoDevices(&devices);
devices->put_Selection(0);
devices->Release();
Set the audio device:
HIltmfDevices* devices;
IltmfCapture_get_AudioDevices(pCapture, &devices);
IltmfDevices_put_Selection(devices, 0);
IltmfDevices_Release(devices);
IltmfDevices* devices;
pCapture->get_AudioDevices(&devices);
devices->put_Selection(0);
devices->Release();
Set the target format :
IltmfCapture_put_TargetFormat(pCapture, ltmfCapture_TargetFormat_WMV);
pCapture->put_TargetFormat(ltmfCapture_TargetFormat_WMV);
To start capturing, call the StartCapture function as follows:
IltmfCapture_StartCapture(pCapture, ltmfCapture_Mode_VideoAndAudio)
pCapture->StartCapture(ltmfCapture_Mode_VideoAndAudio);
To stop capturing, call the StopCapture function as follows:
IltmfCapture_StopCapture(pCapture);
pCapture->StopCapture();
Release the capture object (and all active objects) when you are done.
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.