void prog_close() { if (list_clients != null) { foreach (DdeClient dc in list_clients) { try { if (dc.IsConnected) { dc.Disconnect(); dc.Dispose(); } } catch (Exception ex) { this.Invoke((MethodInvoker)(() => lbMsg.Items.Add(DateTime.Now.ToString("HH:mm:ss") + " prog_close-" + ex.Message))); } } } list_clients.Clear(); if (DDEServer != null) { try { DDEServer._ThreadTimer.Dispose(); DDEServer.Disconnect(); DDEServer.Dispose(); } catch { } } DDEServer = null; try { if (tempHashTable.Count > 0) { foreach (WebDownload wd in tempHashTable) { GC.SuppressFinalize(wd); } } } catch { } }