Esempio n. 1
0
        private static Boolean GetRadioInstance(out IRadioInstance Radio)
        {
            Boolean Result = false;

            Radio = null;

            IMediaRadioManager RadioMan;
            Guid  Iid = typeof(IMediaRadioManager).GUID;
            Int32 Res = CoCreateInstance(ref CLSID_BluetoothRadioManager, IntPtr.Zero,
                                         CLSCTX_INPROC_SERVER, ref Iid, out RadioMan);

            if (Succeeded(Res))
            {
                IRadioInstanceCollection Instances;

                if (Succeeded(RadioMan.GetRadioInstances(out Instances)))
                {
                    UInt32 Cnt;
                    if (Succeeded(Instances.GetCount(out Cnt)) && Cnt > 0)
                    {
                        Result = Succeeded(Instances.GetAt(0, out Radio));
                    }

                    Instances = null;
                }

                RadioMan = null;
            }

            return(Result);
        }