diff options
Diffstat (limited to 'xbmc/win32/XBMC_PC.cpp')
-rw-r--r-- | xbmc/win32/XBMC_PC.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/xbmc/win32/XBMC_PC.cpp b/xbmc/win32/XBMC_PC.cpp index 97b552e3c9..fa20f4a04d 100644 --- a/xbmc/win32/XBMC_PC.cpp +++ b/xbmc/win32/XBMC_PC.cpp @@ -32,6 +32,8 @@ #include "GUIInfoManager.h" #include "utils/StringUtils.h" #include "utils/CPUInfo.h" +#include <mmdeviceapi.h> +#include "win32/IMMNotificationClient.h" #ifndef _DEBUG #define XBMC_TRACK_EXCEPTIONS @@ -221,12 +223,28 @@ INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR commandLine, INT ) } #endif + HRESULT hr = E_FAIL; + IMMDeviceEnumerator *pEnumerator = NULL; + CMMNotificationClient cMMNC; + hr = CoCreateInstance(CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL, IID_IMMDeviceEnumerator, (void**)&pEnumerator); + if(SUCCEEDED(hr)) + { + pEnumerator->RegisterEndpointNotificationCallback(&cMMNC); + SAFE_RELEASE(pEnumerator); + } + g_application.Run(); // clear previously set timer resolution timeEndPeriod(1); // the end + hr = CoCreateInstance(CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL, IID_IMMDeviceEnumerator, (void**)&pEnumerator); + if(SUCCEEDED(hr)) + { + pEnumerator->UnregisterEndpointNotificationCallback(&cMMNC); + SAFE_RELEASE(pEnumerator); + } WSACleanup(); CoUninitialize(); |