如题代码如下:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
namespace 单点登陆
{
    public delegate bool EnumChildWindowsPro(int H, int L);
    class Program
    {
        public const int PROCESS_ALL_ACCESS = 0x0010;
        private static int h = 0;
        private static StringBuilder p = new StringBuilder(255);        [DllImport("user32.dll", EntryPoint = "FindWindow")]
        public static extern int FindWindow(string WinHandler, string WinTitle);
        [DllImport("user32.dll", EntryPoint = "FindWindowEx")]
        public static extern int FindWindowEx(int PH, int CH, string CC, string CTitle);
        [DllImport("user32.dll", EntryPoint = "EnumChildWindows")]
        public static extern int EnumChildWindows(int H, EnumChildWindowsPro myCallBack, int L);
        [DllImport("user32.dll", EntryPoint = "GetWindowThreadProcessId")]
        public static extern int GetWindowThreadProcessId(int H, int L);
        [DllImport("user32.dll", EntryPoint = "GetWindowModuleFileName")]
        public static extern int GetWindowModuleFileName(int H, StringBuilder P, int PathLen);
        [DllImport("user32.dll", EntryPoint = "IsWindow")]
        public static extern bool IsWindow(int H);
        [DllImport("kernel32.dll", EntryPoint = "OpenProcess")]
        public static extern int OpenProcess(int Rights, bool B, int PId);
        
        static void Main()
        {
            h = FindWindow(null, "迅雷5");
            if (h > 0)
            {
                if (IsWindow(h))
                {
                    int h2 = GetWindowModuleFileName(h, p, 255);
                    Console.WriteLine("h2 = " + h2.ToString());
                    Console.WriteLine(p.ToString());
                    Console.ReadLine();
                }
            }
            else
            {
                Console.WriteLine("迅雷!");
                Console.ReadLine();
            }
        }
    }
}