装一个DS Sdk,例子里就有

解决方案 »

  1.   

     yxz_lp 兄:在哪下?能给个地址吗?
      

  2.   

    抓图:
    http://vckbase.com/document/viewdoc/?id=976
      

  3.   

    播放:#include <dshow.h>
    void main(void)
    {
        IGraphBuilder *pGraph = NULL;
        IMediaControl *pControl = NULL;
        IMediaEvent   *pEvent = NULL;    // Initialize the COM library.
        HRESULT hr = CoInitialize(NULL);
        if (FAILED(hr))
        {
            printf("ERROR - Could not initialize COM library");
            return;
        }    // Create the filter graph manager and query for interfaces.
        hr = CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, 
                            IID_IGraphBuilder, (void **)&pGraph);
        if (FAILED(hr))
        {
            printf("ERROR - Could not create the Filter Graph Manager.");
            return;
        }    hr = pGraph->QueryInterface(IID_IMediaControl, (void **)&pControl);
        hr = pGraph->QueryInterface(IID_IMediaEvent, (void **)&pEvent);    // Build the graph. IMPORTANT: Change this string to a file on your system.
        hr = pGraph->RenderFile(L"C:\\Example.avi", NULL);
        if (SUCCEEDED(hr))
        {
            // Run the graph.
            hr = pControl->Run();
            if (SUCCEEDED(hr))
            {
                // Wait for completion.
                long evCode;
                pEvent->WaitForCompletion(INFINITE, &evCode);            // Note: Do not use INFINITE in a real application, because it
                // can block indefinitely.
            }
        }
        pControl->Release();
        pEvent->Release();
        pGraph->Release();
        CoUninitialize();
    }
      

  4.   

    当然,熟悉DirectShow后,抓图和播放完全可以一起实现
      

  5.   

    rageliu兄:FrameGrabber我试过,但是编译时会说我Cannot open include file: 'DShow.h': No such file or directory
    而且它也不能进行播放
      

  6.   

    需要安装MS的DX SDK,装上配置好就能使用了。我前面说过了“熟悉DirectShow后,抓图和播放完全可以一起实现”如果决定用DirectShow来做,建议先实现播放,然后在这基础上实现抓图,不再使用http://vckbase.com/document/viewdoc/?id=976里的方式
      

  7.   

    rageliu兄:时间紧迫,希望有一个现成的程序源码可以使用,谢谢