捕获通过管道重定向时的SetConsoleTextAttribute的效果? [英] Capturing the effects of SetConsoleTextAttribute when redirected through a Pipe?

查看:207
本文介绍了捕获通过管道重定向时的SetConsoleTextAttribute的效果?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经将 CreateProcess 生成的子进程的 stdout 重定向到管道。它工作正常,除了,据我所知,没有关于颜色变化的信息通过。子进程正在使用 SetConsoleTextAttribute 来更改文本颜色 - 是否可以通过管道检测这种情况,如果是,如何?



我最终在 RichEdit 控件中显示输出,如果可能的话,我想捕获颜色信息。



这是在C和XP和Vista上的Win32 API。

解决方案

需要使用在这里找到的ReadConsoleOutput(和/或相关的): http://msdn.microsoft.com/en-us/library/ms682073(VS.85).aspx



希望有帮助。 / p>

I've redirected stdout of a child process spawned with CreateProcess to a pipe. It works fine except that, as far as I can tell, no information about color changes are coming through. The child process is using SetConsoleTextAttribute to change the text color--is it possible to detect this through the pipe and, if so, how?

I'm ultimately displaying the output in a RichEdit control and I would like to capture the color information if at all possible.

This is in C with the Win32 API on XP and Vista.

解决方案

You probably need to use ReadConsoleOutput (and/or related ones) found here: http://msdn.microsoft.com/en-us/library/ms682073(VS.85).aspx.

Hope that helps.

这篇关于捕获通过管道重定向时的SetConsoleTextAttribute的效果?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆