首页 > 解决方案 > 从我的 C# 程序生成的系统托盘中的应用程序中获取工具提示文本

问题描述

我正在创建一个启动命令行实用程序以将文本转换为音频文件的程序(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

但我想知道是否可能有一种更简单的方法来实现这一点,因为在这种情况下我是开始这个​​过程的人并且有一些关于它的信息?

标签: c#processtooltipsystem-tray

解决方案


推荐阅读