Quantcast
Channel: Visual C forum
Viewing all articles
Browse latest Browse all 15302

Opening MMDevice API

$
0
0

I am stuck at an early point and have tried all sorts of things without success. My aim is a WASAPI rendering program with some complications, but at this point I am trying to get an MMDeviceEnumerator and getting nowhere. Here is my code:

// Trying to enumerate devices
#include "stdafx.h"
#include <mmdeviceapi.h>

_TCHAR * temp;
IMMDeviceEnumerator *pEnumerator;
int _tmain(int argc, _TCHAR* argv[])
{
	printf("Hello, WASAPI\n");
	scanf_s("%s",&temp);
	const CLSID CLSID_MMDeviceEnumerator = __uuidof(MMDeviceEnumerator);
	const IID IID_IMMDeviceEnumerator = __uuidof(IMMDeviceEnumerator);
	HRESULT hr = CoCreateInstance(
         CLSID_MMDeviceEnumerator, NULL,
         CLSCTX_ALL, IID_IMMDeviceEnumerator,
         (void**)&pEnumerator);
	printf("%x\n",hr);
	scanf_s("%s", &temp);
	return 0;
}

I receive back an error code 0x800401f0 which is apparently a CoCreate error saying that CoCreate was not called. I would appreciate some guidance. I thought I was following

http://msdn.microsoft.com/en-us/library/windows/desktop/dd371455%28v=vs.85%29.aspx

Thank you in advance!


gabriel weinreich



Viewing all articles
Browse latest Browse all 15302

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>