Click here to Skip to main content
15,908,013 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionhelp translate the problem of network projects Pin
linhluu11-Nov-10 6:48
linhluu11-Nov-10 6:48 
AnswerRe: help translate the problem of network projects Pin
Richard MacCutchan11-Nov-10 22:19
mveRichard MacCutchan11-Nov-10 22:19 
QuestionCreating Library Modules in VS ...?? Pin
AmbiguousName11-Nov-10 1:40
AmbiguousName11-Nov-10 1:40 
AnswerRe: Creating Library Modules in VS ...?? Pin
Richard MacCutchan11-Nov-10 2:20
mveRichard MacCutchan11-Nov-10 2:20 
AnswerRe: Creating Library Modules in VS ...?? Pin
«_Superman_»11-Nov-10 6:23
professional«_Superman_»11-Nov-10 6:23 
QuestionHow to make it effective to ::SetSysColors(COLOR_SCROLLBAR...)? Pin
dancingfish11-Nov-10 0:29
dancingfish11-Nov-10 0:29 
AnswerRe: How to make it effective to ::SetSysColors(COLOR_SCROLLBAR...)? Pin
«_Superman_»11-Nov-10 6:28
professional«_Superman_»11-Nov-10 6:28 
QuestionAudio Detect from Microphone problem Pin
cougar1010-Nov-10 21:05
cougar1010-Nov-10 21:05 
1st of all, i am a newbie to Directshow programming..

i need to create a console program that detects audio from microphone..

in the code, i have a function which reads all the audio input device that i have.
and it returns the friendly name (as string) of the device that the microphone is plugged in.

below is the function code.:

string Get_FName(GUID DEVICECLSID)
{
	HRESULT hr;	// COM result
	ICreateDevEnum *pDeviceEnum = NULL;// Create the System Device Enumerator.
	IEnumMoniker *pEnumCat = NULL;// Device enumeration moniker
	wstring inname;
	
	hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED );// Initialise COM
	hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC_SERVER,IID_ICreateDevEnum, (void **)&pDeviceEnum);
	
	if (FAILED(hr))
	{

		//break;
	}

// Obtain a class enumerator for the audio input category.
	hr = pDeviceEnum->CreateClassEnumerator(DEVICECLSID, &pEnumCat, 0);

if (hr == S_OK) 
{
    // Enumerate the monikers.
    IMoniker *pDeviceMonik = NULL;
    ULONG cFetched;
	while(pEnumCat->Next(1, &pDeviceMonik, &cFetched) == S_OK)

    {
		

        IPropertyBag *pPropBag;
        hr = pDeviceMonik->BindToStorage(0, 0, IID_IPropertyBag,(void **)&pPropBag);
        if (SUCCEEDED(hr))
        {
            VARIANT varName;
            VariantInit(&varName);
			hr = pPropBag->Read(L"FriendlyName", &varName, 0);
      		if (SUCCEEDED(hr))
            {	
				inname = varName.bstrVal;
				hr = pDeviceMonik->IsRunning(0,0,0);// nt sure bout this part
				if ( hr == S_OK){ goto skip;}
			}
    		
            
			VariantClear(&varName);
			pPropBag->Release();
        }
        pDeviceMonik->Release();
    }
    pEnumCat->Release();
}
skip:
pDeviceEnum->Release();
string s(inname.begin(), inname.end());
s.assign(inname.begin(), inname.end());


								
return s;
}



the problem is that, i have two input devices..
Microphone (Realtek...
Realtek (Audio ...

the program does not return the friendly name of the device which i plugged my microphone in. it simply returns the later device.
i need a code that detects wether the device is plugged in or not..thank in advance
QuestionHow to add Image as Object on Image? Pin
002comp10-Nov-10 16:36
002comp10-Nov-10 16:36 
AnswerRe: How to add Image as Object on Image? Pin
«_Superman_»11-Nov-10 6:35
professional«_Superman_»11-Nov-10 6:35 
GeneralRe: How to add Image as Object on Image? Pin
002comp11-Nov-10 17:14
002comp11-Nov-10 17:14 
QuestionCreate Bitmap from Memory Pin
Richard Andrew x6410-Nov-10 13:17
professionalRichard Andrew x6410-Nov-10 13:17 
AnswerRe: Create Bitmap from Memory Pin
Richard Andrew x6410-Nov-10 13:42
professionalRichard Andrew x6410-Nov-10 13:42 
QuestionIs there something like a CD/DVD GUID and how to obtain it if yes? Pin
Code-o-mat10-Nov-10 6:00
Code-o-mat10-Nov-10 6:00 
AnswerRe: Is there something like a CD/DVD GUID and how to obtain it if yes? Pin
David Crow10-Nov-10 8:29
David Crow10-Nov-10 8:29 
GeneralRe: Is there something like a CD/DVD GUID and how to obtain it if yes? Pin
Sauro Viti10-Nov-10 8:42
professionalSauro Viti10-Nov-10 8:42 
GeneralRe: Is there something like a CD/DVD GUID and how to obtain it if yes? Pin
Code-o-mat10-Nov-10 9:14
Code-o-mat10-Nov-10 9:14 
GeneralRe: Is there something like a CD/DVD GUID and how to obtain it if yes? Pin
David Crow10-Nov-10 9:39
David Crow10-Nov-10 9:39 
GeneralRe: Is there something like a CD/DVD GUID and how to obtain it if yes? Pin
Code-o-mat10-Nov-10 9:48
Code-o-mat10-Nov-10 9:48 
AnswerRe: Is there something like a CD/DVD GUID and how to obtain it if yes? Pin
Chris Meech10-Nov-10 9:58
Chris Meech10-Nov-10 9:58 
GeneralRe: Is there something like a CD/DVD GUID and how to obtain it if yes? Pin
Code-o-mat10-Nov-10 10:48
Code-o-mat10-Nov-10 10:48 
JokeRe: Is there something like a CD/DVD GUID and how to obtain it if yes? Pin
Peter_in_278010-Nov-10 11:18
professionalPeter_in_278010-Nov-10 11:18 
GeneralRe: Is there something like a CD/DVD GUID and how to obtain it if yes? Pin
Code-o-mat10-Nov-10 21:24
Code-o-mat10-Nov-10 21:24 
AnswerRe: Is there something like a CD/DVD GUID and how to obtain it if yes? Pin
Luc Pattyn10-Nov-10 12:16
sitebuilderLuc Pattyn10-Nov-10 12:16 
GeneralRe: Is there something like a CD/DVD GUID and how to obtain it if yes? Pin
Code-o-mat10-Nov-10 21:36
Code-o-mat10-Nov-10 21:36 

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.