Catatan Pekerjaan

Website ini merupakan sarana untuk mengekspresikan apa yang saya pikirkan daripada ngruntel/nggedibal di otak, jadi lebih baik saya menuangkan disini

Kill Program By Process Name .NET

Kill Program By Process Name .NET

Killing the process outright is possible, but outright rude and dangerous: what if the user has important unsaved changes in an open document? Not to mention the stale temporary files this will leave behind.

Sample code :

                Dim lstOprograms As String() = {
                     "Unknown",
                     "TPC.exe",
                     "TPC"}
                For Each prog As Process In Process.GetProcesses
                    For Each nm As String In lstOprograms
                        If prog.ProcessName = nm Then
                            prog.Kill()
                            Exit For
                        End If
                    Next
                Next

Kill Program By Process Name .NET

Post a Comment