Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6385657
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:55:37+00:00 2026-05-25T02:55:37+00:00

I’ve been trying to get a program working which uses the Windows audio APIs.

  • 0

I’ve been trying to get a program working which uses the Windows audio APIs.
The end result will be a programs that checks for volume changes in other audio process.
I’ve looked at some of the examples on the Microsoft site and have an undersatanding of what I should be doing.
However when I attempt to implement this I get some errors. I’m starting by trying to get a list, well actually just a count at the minute, of all the audio process running.
The code I’m using is based on the code on the Windows site however I get errors when I try to build it. The two main ones are:

  1. ‘IAudioSessionManager2’ : no GUID has been associated with this object
  2. use of undefined type ‘IAudioSessionManager2’

There is also a similar one for the 2nd one but relating to IAudioSessionEnumerator.

I’m quite new to C++ programming, more used to Java, so I’m thinking that it’s just some silly little mistake to do with header files or something, I’ve included the .h code and .cpp code below.
If anyone would be able to help me it would be much appreciated.

GetProcess.h

#ifndef GETPROCESS_H
#define GETPROCESS_H
#define SAFE_RELEASE(p) { if ( (p) ) { (p)->Release(); (p) = 0; } }

#include<Audiopolicy.h>
#include<Mmdeviceapi.h>
#include <stdio.h>
#include <iostream>

using namespace std; 
struct IAudioSessionManager2;
struct IAudioSessionEnumerator;
struct IAudioSessionControl;
struct IMMDevice;
struct IMMDeviceEnumerator;

ref class GetProcess
{
public:
    GetProcess();
};
#endif

GetProcess.cpp

#include "StdAfx.h"
#include "GetProcess.h"
#include<Audiopolicy.h>
#include<Mmdeviceapi.h>
#include <stdio.h>
#include <iostream>
#include <windows.h>


GetProcess::GetProcess()
{
    IMMDeviceEnumerator* deviceEnumerator = NULL;
    IMMDevice* device = NULL;
    IAudioSessionManager2* sessionManager = NULL;
    IAudioSessionEnumerator* sessionEnumerator = NULL;
    IAudioSessionControl* session = NULL;


    int numberOfProcesses = 0;
    int numberOfActiveProcesses = 0;

    AudioSessionState state;

    //create device enumerator
    CoCreateInstance(__uuidof(MMDeviceEnumerator), NULL, CLSCTX_ALL, __uuidof(IMMDeviceEnumerator), (void**)&deviceEnumerator);
    // get default device
    deviceEnumerator->GetDefaultAudioEndpoint(eRender, eConsole, &device);

    // activate session manager
    device->Activate(__uuidof(IAudioSessionManager2), CLSCTX_ALL, NULL, (void**)&sessionManager);
    //// make enum
    sessionManager->GetSessionEnumerator(&sessionEnumerator);
    sessionEnumerator ->GetCount(&numberOfProcesses);
    for (int i = 0; i < numberOfProcesses; i++)
    {
        sessionEnumerator->GetSession(i, &session);
        session->GetState(&state);
        if (state == 1)
        {
            numberOfActiveProcesses++;
        }
        SAFE_RELEASE(session);
    }

    //CLEANUP

    SAFE_RELEASE(deviceEnumerator);
    SAFE_RELEASE(device);
    SAFE_RELEASE(sessionEnumerator);
    SAFE_RELEASE(sessionManager);
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T02:55:38+00:00Added an answer on May 25, 2026 at 2:55 am

    You have version 6.0. You’ll need to download and install Windows SDK version 7.1. IAudioSessionManager2 is only available on Windows 7.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I used javascript for loading a picture on my website depending on which small
Basically, what I'm trying to create is a page of div tags, each has
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I need a function that will clean a strings' special characters. I do NOT
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.