I'm building a mixer app and need to get the user-friendly names for each audio session.
I tried:
IAudioSessionControl::GetDisplayName()method, but it returned empty string for each session.Calling
QueryFullProcessImageName()andGetModuleFileNameEx(), but they only outputC:\Users\since I have Cyrillic letters in the path. But even if they did output the full path, I assume it would end with something like...\brave.exe(correct me if I'm wrong), which is not a user-friendly name likeBrave Browserin Windows' built-in mixer.I also tried getting all process names and PIDs like this, and later match them to session process IDs, which successfully gave me names like
chrome.exeorsteam.exe, but they are still, again, not quite what I want:std::vector<std::pair<DWORD, wchar_t*>> processes; HANDLE handle = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); PROCESSENTRY32 entry; entry.dwSize = sizeof(PROCESSENTRY32); Process32First(handle, &entry); do { processes.emplace_back(entry.th32ProcessID, entry.szExeFile); } while (Process32Next(handle, &entry)); CloseHandle(handle);
What I want is to retrieve names like in the built-in mixer app, ie Steam, Chrome Browser, Zoom Meetings, etc.
Is there a way to achieve this? Or does Microsoft use some kind of black magic here?