/// <summary> /// Returns a collection of destinations specified within the system. /// </summary> /// <returns>A DestinationInfo collection with details of all the destinations in the system.</returns> public DestinationInfoCollection EnumDestinations() { DestinationInfo destInfo = new DestinationInfo(); IntPtr hDestInfo = IntPtr.Zero; DestinationInfoCollection dests = new DestinationInfoCollection(); bool loop = true; int i = 0; int ret = 0; lock (syncRoot) { do { hDestInfo = MarshalEx.AllocHLocal((uint)DestinationInfo.NativeSize); ret = ConnMgrEnumDestinations(i++, hDestInfo); if (ret == -2147467259) { loop = false; break; } DestinationInfo cm = new DestinationInfo(hDestInfo); dests.Add(cm); MarshalEx.FreeHLocal(hDestInfo); }while(loop); } return(dests); }
/// <summary> /// Returns a collection of destinations specified within the system. /// </summary> /// <returns>A DestinationInfo collection with details of all the destinations in the system.</returns> public DestinationInfoCollection EnumDestinations() { DestinationInfoCollection dests = new DestinationInfoCollection(); int i = 0; lock (syncRoot) { do { IntPtr hDestInfo = Marshal.AllocHGlobal(DestinationInfo.NativeSize); long ret = SafeNativeMethods.ConnMgrEnumDestinations(i++, hDestInfo); if (ret != 0) { break; } DestinationInfo cm = new DestinationInfo(hDestInfo); dests.Add(cm); Marshal.FreeHGlobal(hDestInfo); }while (true); } return(dests); }
/// <summary> /// Returns a collection of destinations specified within the system. /// </summary> /// <returns>A DestinationInfo collection with details of all the destinations in the system.</returns> public DestinationInfoCollection EnumDestinations() { DestinationInfo destInfo = new DestinationInfo(); IntPtr hDestInfo = IntPtr.Zero; DestinationInfoCollection dests = new DestinationInfoCollection(); bool loop = true; int i = 0; int ret = 0; lock(syncRoot) { do { hDestInfo = MarshalEx.AllocHLocal((uint)DestinationInfo.NativeSize); ret = ConnMgrEnumDestinations(i++, hDestInfo); if(ret == -2147467259) { loop = false; break; } DestinationInfo cm = new DestinationInfo(hDestInfo); dests.Add(cm); MarshalEx.FreeHLocal(hDestInfo); } while(loop); } return dests; }