directshow的"hello world"(from sdk sample)

#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

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值