I’ve been searching for a long time now for a way to check if a specific application is muted, and if it is, to un-mute it. This is for an application originally built for Windows XP, but when I run it on Windows 7/10/11 – it keep muting itself every so often during runtime.
I found @Simon Mourier’s Fantastic suggestion here but, when I try to test it in Visual Studio 2017 [C# – Console app(.NET Core)] I’m getting an error on the 2 instances of
Guid IID_IAudioSessionManager2 = typeof(IAudioSessionManager2).GUID;
The error I’m getting is
Error CS1061 ‘Type’ does not contain a definition for ‘GUID’ and no accessible extension method ‘GUID’ accepting a first argument of type ‘Type’ could be found (are you missing a using directive or an assembly reference?)
So, my question is – what am I doing wrong here?
I’ve found over a dozen different instances of this code being suggested via Google searches, and never a whisper of an error like mine.
2
Answers
Thanks all for the quick responses! @HansPassant's response held the answer for me, I targeted .NET Core 2.1 and it works fine now.
Make sure you have the required assembly reference added to your project. In this case, you need to reference the uuid.lib library, which contains the definition of GUID. Here’s how to add the reference:
Also make sure to add
using system
on the top of your file