Getting stdout when p-invoking to unmanaged DLL?
I've got an unmanaged DLL that is writing log messages to standar开发者_如何学运维d 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.
Since you're already calling PInvoke, I guess you wont mind an extra call to SetStdHandle. A similar thread is here Redirect stdout+stderr on a C# Windows service
精彩评论