On Thu Sep 11 03:53:29 2025 +0000, Rémi Bernon wrote:
HRESULT hr; if (FAILED(hr = WindowsCreateString( media_player_name, wcslen( media_player_name ), &str ))) return hr; if (SUCCEEDED(hr = RoActivateInstance( str, &inspectable ))) { hr = IInspectable_QueryInterface( inspectable, &IID_IMediaPlayer, (void **)media_player ); IInspectable_Release( inspectable ); } WindowsDeleteString( str ); return hr;
Otherwise you'd call WindowsDeleteString even if WindowsCreateString failed (no big deal but still).
Yeah, that's why I initialized the HSTRING to NULL. Though, this looks better style-wise, thanks.