Finding process name on OS

CK CK 3788 
Created at
Updated at  
408 0 0

`System.Diagnostics` in .NET is a namespace containing classes and methods for collecting performance data, tracing program execution, and interacting with the operating system's diagnostic tools. It provides utilities for gathering performance counters, logging events, profiling code, and debugging processes, allowing developers to analyze application behavior and identify bottlenecks or errors.

Following function is very useful when checking currently working process based on name.
 

using System.Diagnostics;

.
.
.

public bool IsProcessOpen(string name)
{
    foreach (Process clsProcess in Process.GetProcesses) {
        if (clsProcess.ProcessName.Contains(name))
        {
            return true;
        }
    }
    return false;
}


 

Tags C# Process Process System.Diagnostics clsProcess Facebook X
Comments 0
Similar posts
  1. Photoshop script programming in Javascript
    531
  2. How to get process id in C# like windows task manager ?
    870
  1. How to get process id in C# like windows task manager ?
    870
  2. How to implement switch statement in C# ?
    987
  3. How to implement while loop in C# ?
    1,341
  4. How to delete file ?
    1,192
  5. How to convert integer to text string ?
    697
  6. How to convert text string to integer ?
    610
  7. How to set an certain color as transparent color on bitmap
    512
  8. How to resize and save PNG or Jpeg Image file ?
    631
  9. How to display message box in C#
    1,109
  10. How to convert bitmap image to jpeg image ?
    356
  11. To load image from file
    450
  12. URL Encode, Decode function for MFC
    605
  13. How to load HTML resource on MFC ?
    841
  14. How to get GM Time as String ?
    422
  15. Makefile to automate the build process for C++
    279
  16. Convert System.DateTime to UNIX timestamp
    381
  17. Retrieve system information
    495
  18. How to call SetTimer function on MFC CDialog class ?
    650
  19. How to rename(change file name) in C# ?
    1,075
  20. Find Files in certain directory
    926
  21. Implementing C#'s foreach loop in Delphi 8
    459
  22. How to detect resource leaks in a Form
    939
  23. The best way to enable and disable buttons, menu items and toolbar buttons
    667
  24. How to exit from a console application
    811
  25. How to restrict a program to a single instance
    729
  26. Compress and decompress strings in C#
    971
  27. Graphics in C# - Irregular Forms
    908
  28. Extracting the Country from IP Address
    468
  29. How to run shell command by MFC ?
    435
  30. Binary Search Sample Code
    405
Recently updated
  1. Why 100% SEO Guarantees Better User Engagement and How to Achieve It in Your Service
    40
  2. Why SPF and DKIM Are Essential for Linux Email Servers?
    34
  3. How do I create animated background for Google Meet?
    20,613
  4. MaxMind GeoLite2 vs. DB-IP Lite vs. ip-api.com: Choosing the Right Free IP Geolocation Solution
    244
  5. Meet Valkey: Why Redis Changed Its License, Why Valkey is Better, and How to Use It as a Drop-in Replacement
    94
  6. How Rogue Web Scrapers Are Stealing My Content and Destroying My Server
    157
  7. Array of arguments passed to script in PHP
    90
  8. Invalid Auction Storms in Ad Tech
    98
  9. Building MRC-Compliant Instrumentation in Ad Tech: Implementation Steps and Key Challenges
    202
  10. The Two Clocks of Ad Server Architecture
    70
  11. Frequency Cap Architecture Overview
    514
  12. Collecting Proof-of-Play from 100,000 Screens
    146
  13. Vector Search in Relational Databases (RDBs): Trends & Usage Environments
    287
  14. What is RedisVL?
    109
  15. Designing a Skill Registry Architecture: Minimize Token Usage and Maximize AI Performance
    230
  16. TPU & GPU Cluster Management Tools
    244
  17. The Concept of Scaffolding in AI Agents
    233
  18. Beyond Static Pipelines: Architecting LLM Multi-Agent Systems for Autonomous Workflow Orchestration
    583
  19. AI-DLC vs. AI-SDLC: Model-Centric vs. System-Centric AI Development
    258
  20. Fine-Tuning Open-Weight LLMs: Training, Licensing, and Deploying Custom Models with Ollama
    339
  21. Inside the Next-Generation Streaming Architecture: Ultra-Low Latency, SGAI, and AI Codecs
    202
  22. Machine Learning: Training vs. Ranking
    221
  23. The Continuous Learning Machine: Designing a Loop That Actually Turns
    222
  24. The Next-Gen Low-Latency Standards: LL-HLS & MoQ
    195
  25. Designing a Data Curation System Around a Vector Database
    220
  26. Extracting Context from Live Video: The Architecture Got Simpler When We Stopped Building Features
    256
  27. The New Ad Stack Behind Live Sports Streaming: Inside SGAI, EABN, and the Standards Race to Fix Live Monetization
    656
  28. Designing MLOps Architectures to Handle Seasonal Data Drift in EV Fleet Models
    195
  29. From 15 to 40+ FPS: Accelerating PyTorch Object Detection on Automotive ECUs
    217
  30. Understanding Data Lineage
    260