Exemplo n.º 1
0
        private static bool EnumCallback(IntPtr lpGuid, IntPtr lpcstrDescription, IntPtr lpcstrModule, IntPtr lpContext)
        {
            var device = new DirectSoundDeviceInfo();

            if (lpGuid == IntPtr.Zero)
            {
                device.Guid = Guid.Empty;
            }
            else
            {
                byte[] guidBytes = new byte[16];
                Marshal.Copy(lpGuid, guidBytes, 0, 16);
                device.Guid = new Guid(guidBytes);
            }
            device.Description = Marshal.PtrToStringAnsi(lpcstrDescription);
            if (lpcstrModule != null)
            {
                device.ModuleName = Marshal.PtrToStringAnsi(lpcstrModule);
            }
            devices.Add(device);
            return(true);
        }
Exemplo n.º 2
0
 private static bool EnumCallback(IntPtr lpGuid, IntPtr lpcstrDescription, IntPtr lpcstrModule, IntPtr lpContext)
 {
     var device = new DirectSoundDeviceInfo();
     if (lpGuid == IntPtr.Zero)
     {
         device.Guid = Guid.Empty;
     }
     else
     {
         byte[] guidBytes = new byte[16];
         Marshal.Copy(lpGuid, guidBytes, 0, 16);
         device.Guid = new Guid(guidBytes);
     }
     device.Description =  Marshal.PtrToStringAnsi(lpcstrDescription);
     if (lpcstrModule != null)
     {
         device.ModuleName = Marshal.PtrToStringAnsi(lpcstrModule);
     }
     devices.Add(device);
     return true;
 }