#include <streams.h>
void __cdecl main(void)
{
IGraphBuilder *pGraph;
IMediaControl *pMediaControl;
CoInitialize(NULL);
// Create the filter graph manager.
CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC,
IID_IGraphBuilder, (void **)&pGraph);
pGraph->QueryInterface(IID_IMediaControl, (void **)&pMediaControl);
// Build the graph. (IMPORTANT: Change string to a file on your system.)
pGraph->RenderFile(L"//Hello_World.avi", NULL);
// Run the graph.
pMediaControl->Run();
// Block until the user clicks the OK button.
// The filter graph runs on a separate thread.
MessageBox(NULL, _T("Click me to end playback."), _T("DirectShow"), MB_OK);
// Clean up.
pMediaControl->Release();
pGraph->Release();
CoUninitialize();
}
以上是源码,在pb4.2中建一个console application,然后在project settings的link中加入3个库(strmbase.lib,strmiid.lib,ole32.lib),然后编译,在下载到sdk的emulator中就可以了.
要注意:1.你的sdk必须包含directshow,否则用pb定制一个.
2.不要忘了在emulator里放那个hello world.avi