Click here to Skip to main content
15,899,474 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: extracting portion of string Pin
Rajesh R Subramanian25-Jun-08 23:46
professionalRajesh R Subramanian25-Jun-08 23:46 
AnswerRe: extracting portion of string Pin
Iain Clarke, Warrior Programmer25-Jun-08 23:47
Iain Clarke, Warrior Programmer25-Jun-08 23:47 
AnswerRe: extracting portion of string Pin
Hamid_RT27-Jun-08 8:13
Hamid_RT27-Jun-08 8:13 
QuestionValidation for CString type variable. Pin
Le@rner25-Jun-08 23:24
Le@rner25-Jun-08 23:24 
AnswerRe: Validation for CString type variable. [modified] Pin
toxcct25-Jun-08 23:26
toxcct25-Jun-08 23:26 
GeneralRe: Validation for CString type variable. Pin
Naveen25-Jun-08 23:31
Naveen25-Jun-08 23:31 
GeneralRe: Validation for CString type variable. Pin
toxcct25-Jun-08 23:33
toxcct25-Jun-08 23:33 
QuestionC++ directshow dll help Pin
boyindie25-Jun-08 23:14
boyindie25-Jun-08 23:14 
Hi

I have been fighting with this for days moving from random error to random error.

I am trying to write what is effectively a software driver for a decklink blackmagic capture card using the directshow api.

The code I have here is basically the sample code from the MSDN website to get all the video devices on the system

but I just seem to get errors everytime I try to compile this!
#pragma once
#include "stdafx.h"

#define DllExport __declspec(dllexport)
#pragma comment(lib,"Strmiids.lib")//Includes the directshow library

class VideoCapture
{
//constructor
public:
	VideoCapture(void);
	 void getNames();
	 void getDevice();
	 void createFilter();

	
public:
	~VideoCapture(void);



};

// test.cpp : Defines the entry point for the DLL application.
//
#include "stdafx.h"
#include "VideoCapture.h"
#include "dshow.h"
#include "Atlbase.h"
#include "Atlcom.h"



#ifdef _MANAGED
#pragma managed(push, off)
#endif

BOOL APIENTRY DllMain( HMODULE hModule,
                       DWORD  ul_reason_for_call,
                       LPVOID lpReserved
					 )
{
    return TRUE;
}

#ifdef _MANAGED
#pragma managed(pop)
#endif



VideoCapture::VideoCapture(void)
{
}

VideoCapture::~VideoCapture(void)
{
}
     ICreateDevEnum *pDevEnum;
	 IEnumMoniker *pEnum =NULL;
	 HWND hList; 
	 IMoniker *pMoniker = NULL;
	 IFilterGraph *m_pGraph=NULL;
	 VARIANT varName;
	 IPropertyBag *pPropBag = NULL;
	 HRESULT hr;


	 __declspec(dllexport) void __cdecl getDevice()
	{
	hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL,
    CLSCTX_INPROC_SERVER, IID_ICreateDevEnum, 
    reinterpret_cast<void**>(&pDevEnum));
	if (SUCCEEDED(hr))
	{
		// Create an enumerator for the video capture category.
		hr = pDevEnum->CreateClassEnumerator(
        CLSID_VideoInputDeviceCategory,
        &pEnum, 0);
	}
  }

	__declspec(dllexport) void __cdecl getNames()
	{
		while (pEnum->Next(1, &pMoniker, NULL) == S_OK)
		{
		 
			hr = pMoniker->BindToStorage(0, 0, IID_IPropertyBag, 
			(void**)(&pPropBag));
			if (FAILED(hr))
			 {
				 pMoniker->Release();
				continue;  // Skip this one, maybe the next one will work.
			 } 
				// Find the description or friendly name.
				
				VariantInit(&varName);
				hr = pPropBag->Read(L"Description", &varName, 0);
			   if (FAILED(hr))
			    {
					hr = pPropBag->Read(L"FriendlyName", &varName, 0);
				}
				if (SUCCEEDED(hr))
				{
					// Add it to the application's list box.
					USES_CONVERSION;
					(long)SendMessage(hList, LB_ADDSTRING, 0, 
					(LPARAM)OLE2T(varName.bstrVal));
					VariantClear(&varName); 
				}
			pPropBag->Release();
			pMoniker->Release();
		}
	}

	__declspec(dllexport) void __cdecl createFilter()
  {
	  IBaseFilter *pCap = NULL;
	  hr = pMoniker->BindToObject(0,0,IID_IBaseFilter,(void**)&pCap);
	  if (SUCCEEDED(hr))
	  {
		  hr = m_pGraph->AddFilter(pCap,L"Capture Filter");
	  }
  }


It seems determined to return this error to me no matter what order I put the includes in at the top, and if I put one of them completely out of place i get around 114 errors returned back to me

The error is:
Fatal error c1189: #error : Need to include strsafe.h after tchar.h

any help with this would be greatly appreciated

Cheers
boyindie
AnswerRe: C++ directshow dll help Pin
Mark Salsbery26-Jun-08 7:04
Mark Salsbery26-Jun-08 7:04 
Questionhow to calculate all columns amount? [modified] Pin
gentleguy25-Jun-08 23:08
gentleguy25-Jun-08 23:08 
QuestionRe: how to calculate all columns amount? Pin
Rajesh R Subramanian25-Jun-08 23:11
professionalRajesh R Subramanian25-Jun-08 23:11 
AnswerRe: how to calculate all columns amount? Pin
gentleguy25-Jun-08 23:36
gentleguy25-Jun-08 23:36 
AnswerRe: how to calculate all columns amount? Pin
Saurabh.Garg25-Jun-08 23:35
Saurabh.Garg25-Jun-08 23:35 
GeneralRe: how to calculate all columns amount? Pin
gentleguy25-Jun-08 23:46
gentleguy25-Jun-08 23:46 
GeneralRe: how to calculate all columns amount? Pin
gentleguy25-Jun-08 23:55
gentleguy25-Jun-08 23:55 
GeneralRe: how to calculate all columns amount? Pin
Saurabh.Garg26-Jun-08 0:05
Saurabh.Garg26-Jun-08 0:05 
GeneralRe: how to calculate all columns amount? [modified] Pin
gentleguy28-Jun-08 1:06
gentleguy28-Jun-08 1:06 
GeneralRe: how to calculate all columns amount? Pin
gentleguy28-Jun-08 23:02
gentleguy28-Jun-08 23:02 
AnswerRe: how to calculate all columns amount? Pin
Iain Clarke, Warrior Programmer25-Jun-08 23:44
Iain Clarke, Warrior Programmer25-Jun-08 23:44 
GeneralRe: how to calculate all columns amount? Pin
gentleguy25-Jun-08 23:51
gentleguy25-Jun-08 23:51 
GeneralRe: how to calculate all columns amount? Pin
Iain Clarke, Warrior Programmer26-Jun-08 0:17
Iain Clarke, Warrior Programmer26-Jun-08 0:17 
GeneralRe: how to calculate all columns amount? [modified] Pin
gentleguy26-Jun-08 1:28
gentleguy26-Jun-08 1:28 
GeneralRe: how to calculate all columns amount? Pin
Iain Clarke, Warrior Programmer26-Jun-08 2:23
Iain Clarke, Warrior Programmer26-Jun-08 2:23 
GeneralRe: how to calculate all columns amount? Pin
gentleguy26-Jun-08 15:23
gentleguy26-Jun-08 15:23 
GeneralRe: how to calculate all columns amount? Pin
Iain Clarke, Warrior Programmer26-Jun-08 21:46
Iain Clarke, Warrior Programmer26-Jun-08 21:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.