source: trunk/DirectShowSpy/CoCreateFilterGraphInstance/CoCreateFilterGraphInstance.cpp @ 171

Last change on this file since 171 was 95, checked in by roman, 10 years ago

DirectShowSpy? moved from Assembla

  • Property svn:keywords set to Id
File size: 1.1 KB
Line 
1////////////////////////////////////////////////////////////
2// Copyright (C) Roman Ryltsov, 2008-2009
3// Created by Roman Ryltsov roman@alax.info
4//
5// $Id: CoCreateFilterGraphInstance.cpp 95 2012-08-17 17:21:13Z roman $
6
7#include "stdafx.h"
8#include <dshow.h>
9#include <qedit.h>
10
11#pragma comment (lib, "strmiids.lib")
12
13int _tmain(int argc, _TCHAR* argv[])
14{
15        _ATLTRY
16        {
17                ATLENSURE_SUCCEEDED(CoInitialize(NULL));
18                _ATLTRY
19                {
20                        MessageBox(NULL, _T("Before CoCreateInstance"), _T("Debug"), MB_OK);
21                        CComPtr<IFilterGraph> pFilterGraph;
22                        ATLENSURE_SUCCEEDED(pFilterGraph.CoCreateInstance(CLSID_FilterGraph));
23                        MessageBox(NULL, _T("After CoCreateInstance, Before AddFilter"), _T("Debug"), MB_OK);
24                        CComPtr<IBaseFilter> pBaseFilter;
25                        ATLENSURE_SUCCEEDED(pBaseFilter.CoCreateInstance(CLSID_SampleGrabber));
26                        ATLENSURE_SUCCEEDED(pFilterGraph->AddFilter(pBaseFilter, NULL));
27                        MessageBox(NULL, _T("After AddFilter"), _T("Debug"), MB_OK);
28                }
29                _ATLCATCHALL()
30                {
31                        CoUninitialize();
32                        _ATLRETHROW;
33                }
34                CoUninitialize();
35        }
36        _ATLCATCH(Exception)
37        {
38                _tprintf(_T("Fatal Error 0x%08x\n"), (HRESULT) Exception);
39        }
40        _ATLCATCHALL()
41        {
42                _tprintf(_T("Fatal Error\n"));
43        }
44        return 0;
45}
46
Note: See TracBrowser for help on using the repository browser.