获取标准输出时对调用非托管的DLL? [英] Getting stdout when p-invoking to unmanaged 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屋!