Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IPolicyConfigVista SetDefaultEndpoint is not implemented #1355

Closed
yan0lovesha opened this issue Nov 23, 2021 · 2 comments
Closed

IPolicyConfigVista SetDefaultEndpoint is not implemented #1355

yan0lovesha opened this issue Nov 23, 2021 · 2 comments

Comments

@yan0lovesha
Copy link

yan0lovesha commented Nov 23, 2021

The API in PolicyConfig.h which shown in below sample code is not implemented.

#include "Mmdeviceapi.h"
#include "PolicyConfig.h"
#include "Propidl.h"
#include "Functiondiscoverykeys_devpkey.h"
HRESULT SetDefaultAudioPlaybackDevice( LPCWSTR devID )
{
    IPolicyConfigVista *pPolicyConfig;
    ERole reserved = eConsole;

    HRESULT hr = CoCreateInstance(__uuidof(CPolicyConfigVistaClient), 
        NULL, CLSCTX_ALL, __uuidof(IPolicyConfigVista), (LPVOID *)&pPolicyConfig);
    if (SUCCEEDED(hr))
    {
        hr = pPolicyConfig->SetDefaultEndpoint(devID, reserved);
        pPolicyConfig->Release();
    }
    return hr;
}
@riverar
Copy link
Collaborator

riverar commented Nov 23, 2021

PolicyConfig/SetDefaultAudioPlaybackDevice are not supported/documented APIs. Was something I added to my app EarTrumpet 6 or so years ago then became "documented" 😂.

You can certainly CoCreateInstance/QI for these manually but this is not a windows crate issue. Closing.

@riverar riverar closed this as completed Nov 23, 2021
@yan0lovesha
Copy link
Author

Just left my implementation here in case any others get to this issue.
https://github.com/yan0lovesha/AudioSwitch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants