Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/xpath/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从我的C#程序生成的系统托盘中的应用程序获取工具提示文本_C#_Process_Tooltip_System Tray - Fatal编程技术网

从我的C#程序生成的系统托盘中的应用程序获取工具提示文本

从我的C#程序生成的系统托盘中的应用程序获取工具提示文本,c#,process,tooltip,system-tray,C#,Process,Tooltip,System Tray,我正在创建一个程序,启动一个命令行实用程序将文本转换为音频文件(Balabolka命令行实用程序)。其中一个命令行标志允许程序将其转换进度显示为任务栏托盘区域中的工具提示 我想截取程序中的工具提示文本,以便在表单的进度栏中显示转换进度,但我不确定如何获取该信息。以下是我当前使用的启动应用程序的代码: // Command line arguments for Balabolka string arguments = "-f \"book.html\" -w \"book.wav\" -n \"A

我正在创建一个程序,启动一个命令行实用程序将文本转换为音频文件(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的命令行参数
字符串参数=“-f\”book.html\“-w\”book.wav\“-n\”Amy\“-tray”;
//将工作目录设置为包含Balabolka实用程序的文件夹
目录.SetCurrentDirectory(“C:\\Balabolka”);
//启动命令行实用程序并在等待其关闭时提供其他UI消息
使用(Process balcon=Process.Start(“balcon.exe”,参数))
{
当(!balcon.已退出)
{
Application.DoEvents();

caption=balcon.MainWindowTitle;//有时事情并不容易。Process.Start会为您提供-这是您获取文本的来源-但不会为您获取所需的systray句柄。PInvoke和
不安全的
代码可能看起来(好的,是!)有点吓人,但链接的答案似乎对你有用。这个命令行实用程序不是在其
stdout
中输出任何你可以读取的东西吗?你试过了吗?这是最后一个程序的简化代码示例。稍后,该实用程序将用于管道原始PCM数据输出(通过stdout)转换成LAME.exe,将其转换为mp3文件。因此,我不相信通过直接监视stdout可以获得任何有用的信息。因此…我试图从我发布的链接中获取代码示例(这篇文章由用户michalczerwinski发布。但我不确定他使用的是什么PInvoke。我找到了一个Visual Studio的PInvoke.net插件,还通过NuGet看到了很多可用的库。不过,我在网上找到的一些参数与他的代码不匹配……有这方面经验的人能给我一些建议吗?我很抱歉。)我正在努力获取完全运行代码示例所需的缺少的声明和枚举。。。