• C#判断程序是否运行


    using System;
    using System.Collections.Generic;
    using System.Windows.Forms;
    using System.Diagnostics;
    using System.Collections;

    namespace DataUpper
    {
        
    static class Program
        
    {
            
    /// <summary>
            
    /// 应用程序的主入口点。
            
    /// </summary>

            [STAThread]
            
    static void Main()
            
    {
                
    int iProcessNum = 0;

                
    foreach (Process singleProc in Process.GetProcesses())
                
    {
                    
    if (singleProc.ProcessName == Process.GetCurrentProcess().ProcessName)
                    
    {
                        iProcessNum 
    += 1;
                    }

                }


                
    if (iProcessNum > 1)
                
    {
                    MessageBox.Show(
    "该程序已经在运行中!""天科多协议处理子程序", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }

                
    else
                
    {
                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(
    false);
                    Application.Run(
    new DataUpper());
                }

            }

        }

    }
  • 相关阅读:
    List<T>和ObservableCollection<T>的相互转换
    MySQL Cannot add or update a child row: a foreign key constraint fails
    Genymotion常见问题解决方案
    关于Socket的建立及连接
    在WPF中引用WinForm的控件
    WCF调试日志
    WebSocket简介
    关于依赖注入和依赖属性
    ASP.NET MVC 学习笔记1 Talk about controller & route
    【转】关于List排序的时效性
  • 原文地址:https://www.cnblogs.com/zhangpengshou/p/1345111.html
Copyright © 2020-2023  润新知