1

我正在开发一个从服务器运行并监视另一组服务器上的进程的 C# 程序。我正在监视的进程都具有相同的 exe 名称,但不同的窗口标题名称。我正在寻找一种从这些进程中远程提取 Windows 标题名称的方法。

基本上我想做的是以下内容;

        Process[] processList = Process.GetProcesses("ServerName");
        foreach (Process p in processList)
        {
            try
            {
                Console.WriteLine(p.MainWindowTitle);

            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }
        }

但是,.NET 不支持此功能

有谁知道另一种方式?

4

1 回答 1

0

I won't tell you this is the best approach, but it's possible to use it. You could create a simple service (windows service) and install it on each server. You might want to implement auto update functionality and therefore after installation you don't have to reinstall this service app on every machine. And this service app gets processes and associated windows titles (it may be more than one window within single process) and returns it to the machine that queries that information. I think you could use WCF here. And other advantage is that you can add more other functionality more easier.

于 2012-07-05T21:21:37.807 回答