private void Form1_FormClosed(object sender, FormClosedEventArgs e) { if (_IsLibraryCreated == true) { DestroyLibrary(); DLLImporter.FreeLibrary(_dllLibrary); } try { foreach (Process proc in Process.GetProcessesByName("ComCommunicator")) { proc.Kill(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void button3_Click(object sender, EventArgs e) { if (_dllLibrary != IntPtr.Zero) { if (_IsLibraryCreated == true) { DestroyLibrary(); } DLLImporter.FreeLibrary(_dllLibrary); textBox2.Clear(); textBox2.ReadOnly = false; button1.Enabled = true; button3.Enabled = false; _dllLibrary = IntPtr.Zero; label8.Visible = false; textBox3.Clear(); } else { MessageBox.Show("No library loaded!", "Warning", MessageBoxButtons.OK); } }