emetress
2006-05-11 21:57:18 UTC
HI I get this error:
C1189: #error : Need to include strsafe.h after tchar.h
I included all the directories that I think I need and this is my
code,as you can see I have all the necessary includes..
#include <streams.h>
#include <Qedit.h>
#include <atlbase.h>
#include <dshow.h>
#include <stdio.h>
#include <initguid.h>
#include <tchar.h>
#include <strsafe.h>
#include "cabecera.h"
void main(){
CComPtr< ISampleGrabber > pGrabber;
CComPtr< IBaseFilter > pSource;
CComPtr< IGraphBuilder > pGraph;
CComPtr< IVideoWindow > pVideoWindow;
HRESULT hr;
// Create the sample grabber
pGrabber.CoCreateInstance( CLSID_SampleGrabber );
CComQIPtr< IBaseFilter, &IID_IBaseFilter > pGrabberBase( pGrabber );
hr = GetVideoInputFilter(&pSource);
// Create the graph
pGraph.CoCreateInstance( CLSID_FilterGraph );
// Put them in the graph
hr = pGraph->AddFilter( pSource, L"Source" );
hr = pGraph->AddFilter( pGrabberBase, L"Grabber" );
// Tell the grabber to grab 24-bit video. Must do this
// before connecting it
CMediaType GrabType;
GrabType.SetType( &MEDIATYPE_Video );
GrabType.SetSubtype( &MEDIASUBTYPE_RGB24 );
hr = pGrabber->SetMediaType( &GrabType );
// Get the output pin and the input pin
CComPtr< IPin > pSourcePin;
CComPtr< IPin > pGrabPin;
GetPin(pSource, PINDIR_OUTPUT, 0, &pSourcePin);
GetPin(pSource, PINDIR_INPUT, 0, &pGrabPin);
// ... and connect them
hr = pGraph->Connect( pSourcePin, pGrabPin );
// Render the grabber output pin (to a video renderer)
CComPtr <IPin> pGrabOutPin;
GetPin(pGrabberBase, PINDIR_OUTPUT,0,&pGrabOutPin );
hr = pGraph->Render( pGrabOutPin );
}
What am i doing wrong?
Thank you
C1189: #error : Need to include strsafe.h after tchar.h
I included all the directories that I think I need and this is my
code,as you can see I have all the necessary includes..
#include <streams.h>
#include <Qedit.h>
#include <atlbase.h>
#include <dshow.h>
#include <stdio.h>
#include <initguid.h>
#include <tchar.h>
#include <strsafe.h>
#include "cabecera.h"
void main(){
CComPtr< ISampleGrabber > pGrabber;
CComPtr< IBaseFilter > pSource;
CComPtr< IGraphBuilder > pGraph;
CComPtr< IVideoWindow > pVideoWindow;
HRESULT hr;
// Create the sample grabber
pGrabber.CoCreateInstance( CLSID_SampleGrabber );
CComQIPtr< IBaseFilter, &IID_IBaseFilter > pGrabberBase( pGrabber );
hr = GetVideoInputFilter(&pSource);
// Create the graph
pGraph.CoCreateInstance( CLSID_FilterGraph );
// Put them in the graph
hr = pGraph->AddFilter( pSource, L"Source" );
hr = pGraph->AddFilter( pGrabberBase, L"Grabber" );
// Tell the grabber to grab 24-bit video. Must do this
// before connecting it
CMediaType GrabType;
GrabType.SetType( &MEDIATYPE_Video );
GrabType.SetSubtype( &MEDIASUBTYPE_RGB24 );
hr = pGrabber->SetMediaType( &GrabType );
// Get the output pin and the input pin
CComPtr< IPin > pSourcePin;
CComPtr< IPin > pGrabPin;
GetPin(pSource, PINDIR_OUTPUT, 0, &pSourcePin);
GetPin(pSource, PINDIR_INPUT, 0, &pGrabPin);
// ... and connect them
hr = pGraph->Connect( pSourcePin, pGrabPin );
// Render the grabber output pin (to a video renderer)
CComPtr <IPin> pGrabOutPin;
GetPin(pGrabberBase, PINDIR_OUTPUT,0,&pGrabOutPin );
hr = pGraph->Render( pGrabOutPin );
}
What am i doing wrong?
Thank you