Click here to Skip to main content
16,006,531 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Accessing data of excel sheet through mfc application Pin
Matthew Faithfull18-Nov-07 22:18
Matthew Faithfull18-Nov-07 22:18 
QuestionProblem in Getting Handle of EditBox. Pin
Atul2318-Nov-07 19:57
Atul2318-Nov-07 19:57 
AnswerRe: Problem in Getting Handle of EditBox. Pin
Peter Weyzen18-Nov-07 20:06
Peter Weyzen18-Nov-07 20:06 
QuestionRe: Problem in Getting Handle of EditBox. Pin
Hamid_RT18-Nov-07 21:58
Hamid_RT18-Nov-07 21:58 
Questionhow to disable a button in toolbar? Pin
panthal18-Nov-07 19:25
panthal18-Nov-07 19:25 
AnswerRe: how to disable a button in toolbar? Pin
Rajesh R Subramanian18-Nov-07 22:07
professionalRajesh R Subramanian18-Nov-07 22:07 
QuestionInternet Explorer Security Setting of Trusted Sites Programmatically - Please Guide Pin
h@$@n18-Nov-07 18:48
h@$@n18-Nov-07 18:48 
Questionhow to create an exe from an dll file. Pin
amiya das18-Nov-07 18:36
amiya das18-Nov-07 18:36 
I took the code form http://www.gdcl.co.uk/downloads.htm for mpeg1 parser filter and registered the sample parser with the help of regsvr32. then i wrote the following program to create an exe file to play the sample parser.

here CLSID_SampleWaveParser is the guid that is used for samplewave parser in the mpeg1 file.


When i execute the following code it executes successifully untill the end of the file which ever i have selected but after completion of the file it give the following error.

4 objects left active. in 316 line of dllentry.cpp.

can u tell me how can i remove this error.

or is there any other method to create an executable file for the dll which is created by the mpeg1 wave parser.

#include <InitGuid.h>

#include <DShow.h>

//0xD84E3EC9, 0x3233, 0x4177, 0xA3, 0xAF, 0x13, 0xB6, 0xF9,0x33, 0x49, 0x8D);

// our own definition of Wave Parser based on CLSID we found in registry

#define INITGUID // have to define this so next line actually creates GUID structure

DEFINE_GUID(CLSID_SampleWaveParser,0xD84E3EC9, 0x3233, 0x4177, 0xA3, 0xAF, 0x13, 0xB6, 0xF9,0x33, 0x49, 0x8D);

void main(void)

{

HRESULT hr;

IGraphBuilder* g_pGraphBuilder = NULL; // assume graph builder already created

IBaseFilter* g_pSource = NULL;

IBaseFilter* g_pWaveParser = NULL;

IBaseFilter* g_pSoundRender = NULL;

IFileSourceFilter *pFileSourceInt = NULL;


IMediaControl *gControl = NULL;

IMediaEvent *gEvent = NULL;


IEnumPins* EnumPins = NULL;

IPin* OutPin = NULL;

IPin* InPin = NULL;

ULONG fetched;

PIN_INFO pinfo;


long evCode=10;



CoInitialize(NULL);

CoCreateInstance(CLSID_FilterGraph, NULL,CLSCTX_INPROC_SERVER,IID_IGraphBuilder, (void **)&g_pGraphBuilder);

CoCreateInstance(CLSID_SampleWaveParser, NULL, CLSCTX_INPROC_SERVER, IID_IBaseFilter, (void**)&g_pWaveParser);

CoCreateInstance(CLSID_AsyncReader, NULL, CLSCTX_INPROC_SERVER, IID_IBaseFilter, (void**)&g_pSource);

CoCreateInstance(CLSID_DSoundRender, NULL, CLSCTX_INPROC_SERVER, IID_IBaseFilter, (void**)&g_pSoundRender);


g_pGraphBuilder->AddFilter(g_pSource,NULL);

g_pGraphBuilder->AddFilter(g_pWaveParser, NULL);

g_pGraphBuilder->AddFilter(g_pSoundRender,NULL);


hr = g_pSource->QueryInterface(IID_IFileSourceFilter, (void**)&pFileSourceInt);

hr = pFileSourceInt->Load(L"D:\\test.rpm",NULL);

if( hr == E_FAIL)

printf("\n Failed to open the file\n");

// find source output

g_pSource->EnumPins(&EnumPins);

EnumPins->Reset();

EnumPins->Next(1, &OutPin, &fetched); // only 1 pin for source, so we know this is the one we need

EnumPins->Release();


// find wave parser input

g_pWaveParser->EnumPins(&EnumPins);

EnumPins->Reset();

EnumPins->Next(1, &InPin, &fetched);

InPin->QueryPinInfo(&pinfo);

pinfo.pFilter->Release(); // make sure you release the returned IBaseFilter interface

if (pinfo.dir == PINDIR_OUTPUT) // check if we have wrong pin (not input pin)

{

InPin->Release();

EnumPins->Next(1, &InPin, &fetched); // if so, get next pin

}

// connect

g_pGraphBuilder->Connect(OutPin, InPin);

InPin->Release();

// OutPin->Release();

// find wave parser audio output pin

EnumPins->Next(1, &OutPin, &fetched);

EnumPins->Next(1, &OutPin, &fetched);

OutPin->QueryPinInfo(&pinfo);

if (pinfo.dir == PINDIR_INPUT)

{

OutPin->Release();

EnumPins->Next(1, &OutPin, &fetched);

OutPin->QueryPinInfo(&pinfo);

}

EnumPins->Release();

OutPin->Release();

// find renderer input

g_pSoundRender->EnumPins(&EnumPins);

EnumPins->Reset();

EnumPins->Next(1, &InPin, &fetched); // renderer has only 1 pin, so this is the pin we need

EnumPins->Release();

// connect

g_pGraphBuilder->Connect(OutPin, InPin);

InPin->Release();

OutPin->Release();



hr = g_pGraphBuilder->QueryInterface(IID_IMediaControl, (void **)&gControl);

hr = g_pGraphBuilder->QueryInterface(IID_IMediaEvent, (void **)&gEvent);

hr = gControl->Run();

gEvent->WaitForCompletion(INFINITE,&evCode);

hr = gControl->Stop();



gControl->Release();

gEvent->Release();

g_pWaveParser->Release();

g_pSoundRender->Release();

g_pSource->Release();

g_pGraphBuilder->Release();

CoUninitialize();

}



amiya kumar das
QuestionHow compile this managed c++ help urgently needed Pin
G.Makesh18-Nov-07 18:35
G.Makesh18-Nov-07 18:35 
AnswerRe: How compile this managed c++ help urgently needed Pin
Nelek18-Nov-07 22:23
protectorNelek18-Nov-07 22:23 
QuestionDelete or Destroy? Pin
Oliver12318-Nov-07 18:19
Oliver12318-Nov-07 18:19 
AnswerRe: Delete or Destroy? Pin
CooperWu18-Nov-07 18:30
CooperWu18-Nov-07 18:30 
AnswerRe: Delete or Destroy? Pin
Peter Weyzen18-Nov-07 19:22
Peter Weyzen18-Nov-07 19:22 
AnswerRe: Delete or Destroy? Pin
jhwurmbach18-Nov-07 22:19
jhwurmbach18-Nov-07 22:19 
QuestionData connection is failed Pin
CodingLover18-Nov-07 17:55
CodingLover18-Nov-07 17:55 
AnswerRe: Data connection is failed Pin
manish.patel18-Nov-07 18:10
manish.patel18-Nov-07 18:10 
GeneralRe: Data connection is failed Pin
CodingLover18-Nov-07 18:40
CodingLover18-Nov-07 18:40 
QuestionPassing and receving value through ShellExecute Pin
neha.agarwal2718-Nov-07 17:36
neha.agarwal2718-Nov-07 17:36 
AnswerRe: Passing and receving value through ShellExecute Pin
Sarath C18-Nov-07 17:45
Sarath C18-Nov-07 17:45 
QuestionRe: Passing and receving value through ShellExecute [modified] Pin
Rajesh R Subramanian18-Nov-07 22:16
professionalRajesh R Subramanian18-Nov-07 22:16 
AnswerRe: Passing and receving value through ShellExecute Pin
neha.agarwal2718-Nov-07 23:02
neha.agarwal2718-Nov-07 23:02 
GeneralRe: Passing and receving value through ShellExecute Pin
Rajesh R Subramanian18-Nov-07 23:22
professionalRajesh R Subramanian18-Nov-07 23:22 
GeneralRe: Passing and receving value through ShellExecute Pin
neha.agarwal2718-Nov-07 23:26
neha.agarwal2718-Nov-07 23:26 
GeneralRe: Passing and receving value through ShellExecute Pin
Rajesh R Subramanian18-Nov-07 23:31
professionalRajesh R Subramanian18-Nov-07 23:31 
GeneralRe: Passing and receving value through ShellExecute Pin
neha.agarwal2718-Nov-07 23:51
neha.agarwal2718-Nov-07 23:51 

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.