protected override void ThreadProc() { try { listview.Invoke( new Form1.Delegate_ListViewUpdate( Update_ListView), new object[] { PROGRAM_STRING.RDON } ); }catch (Exception e) { MessageBox.Show(e.Message); } while (true) { try { PProcess pProcess = new PProcess(); pProcess.Initialize(); int pid = MonitorThraed.Run(Encoding.Default.GetBytes(DevicePDO)); if (pid > 0) { string pName = pProcess.GetProcessNameFromID(pid); string sDetect = pName + "에서 탐지되었습니다."; listview.Invoke( new Form1.Delegate_ListViewUpdate( Update_ListView), new object[] { sDetect } ); if (MessageBox.Show(sDetect + "\n종료하시겠습니까?", "경고", MessageBoxButtons.YesNo) == DialogResult.Yes) { PProcess.KillProcess(pid); } else { ; } } } catch (ManagementException) { return; } catch (ThreadInterruptedException) { return; } catch (ThreadAbortException) { return; } } }
public Form1() { InitializeComponent(); monitor = new MonitorThraed(listView1); RealDetection = false; }