从我的C#程序拥有的系统任务栏中的应用程序中获取工具提示文本

时间:2018-08-12 22:19:15

标签: c# process tooltip system-tray

我正在创建一个程序,该程序启动命令行实用程序以将文本转换为音频文件(Balabolka命令行实用程序)。命令行标志之一允许程序在工具栏任务栏区域中以工具提示的形式显示其转换进度。

我想从程序中截取工具提示文本,以便可以在表单的进度栏中显示转换的进度,但是我不确定如何获取该信息。这是我当前用于启动应用程序的代码:

// Command line arguments for Balabolka
string arguments = "-f \"book.html\" -w \"book.wav\" -n \"Amy\" -tray";

// Set the working directory to the folder containing the Balabolka utility
Directory.SetCurrentDirectory("C:\\Balabolka");

// Launch the command line utility and serve other UI messages while waiting for it to close
using (Process balcon = Process.Start("balcon.exe", arguments))
{
    while (!balcon.HasExited)
    {
        Application.DoEvents();
        caption = balcon.MainWindowTitle; //<-- This doesn't get the info I want. It only returns "balabolka"
    }
}

正确的工具提示文字显示为Balabolka [25%],如果可以的话,我可以解析出该数字。

我确实在搜索时碰到过这篇文章: Get ToolTip Text from Icon in System Tray

但是我想知道是否可能有一种更简单的方法来完成此任务,因为在这种情况下,我是一个开始该过程并了解一些信息的人?

0 个答案:

没有答案