获取标准输出时对调用非托管的DLL? [英] Getting stdout when p-invoking to unmanaged DLL?

查看:90
本文介绍了获取标准输出时对调用非托管的DLL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经得到了正在写日志信息到标准输出的非托管的DLL。我打电话此DLL从一个WPF应用程序P-调用,我需要得到标准的输出流日志。我试过Console.SetOut,但这似乎只捕捉使用Console.Write书面资料等。

I've got an unmanaged DLL that is writing log messages to standard output. I'm calling this DLL with P-invokes from a WPF app and I need to get the standard output stream log. I've tried Console.SetOut, but that only seems to capture information written using Console.Write, etc.

任何人有什么想法?我发现类似的问题其他地方问,但是他们没有答案。

Anyone have any ideas? I've found similar questions asked elsewhere but they don't have answers.

推荐答案

既然你已经打电话PInvoke的,我想你不会介意的额外调用 SetStdHandle 。类似的线程是在这里 http://stackoverflow.com/questions/1579074/redirect-stdoutstderr -on-C-窗口服务

Since you're already calling PInvoke, I guess you wont mind an extra call to SetStdHandle. A similar thread is here http://stackoverflow.com/questions/1579074/redirect-stdoutstderr-on-c-windows-service

这篇关于获取标准输出时对调用非托管的DLL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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