skip to Main Content

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


  1. Chosen as BEST ANSWER

    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.


  2. 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:

    1. Right-click on your project in the Solution Explorer.
    2. Select "Add" -> "Reference".
    3. In the "Reference Manager" window, go to "Assemblies" or "Browse" (depending on your Visual Studio version).
    4. Locate and select the uuid.lib library and click "OK" to add the reference.

    Also make sure to add using system on the top of your file

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search