Click here to Skip to main content
15,881,882 members
Home / Discussions / C#
   

C#

 
JokeRe: collapsing xml elements into attributes in c# Pin
swjam15-May-12 4:39
swjam15-May-12 4:39 
GeneralRe: collapsing xml elements into attributes in c# Pin
Dave Kreskowiak15-May-12 5:02
mveDave Kreskowiak15-May-12 5:02 
GeneralRe: collapsing xml elements into attributes in c# Pin
PIEBALDconsult15-May-12 5:37
mvePIEBALDconsult15-May-12 5:37 
GeneralRe: collapsing xml elements into attributes in c# Pin
Dave Kreskowiak15-May-12 7:26
mveDave Kreskowiak15-May-12 7:26 
GeneralRe: collapsing xml elements into attributes in c# Pin
PIEBALDconsult15-May-12 5:38
mvePIEBALDconsult15-May-12 5:38 
GeneralRe: collapsing xml elements into attributes in c# Pin
Mycroft Holmes15-May-12 14:28
professionalMycroft Holmes15-May-12 14:28 
GeneralRe: collapsing xml elements into attributes in c# Pin
PIEBALDconsult15-May-12 14:34
mvePIEBALDconsult15-May-12 14:34 
QuestionRedirecting output from an unmanaged dll Pin
andreas0414-May-12 23:19
andreas0414-May-12 23:19 
Hello,

i have the following code, which redirects the
output from a unmanged dll into a file:

[DllImport("Kernel32.dll", SetLastError = true) ]
public static extern int SetStdHandle(int device, IntPtr handle);


FileStream filestream;
StreamWriter streamwriter;

void Redirect()
{
int status;
IntPtr handle;
filestream = new FileStream("logfile.txt", FileMode.Create);
streamwriter = new StreamWriter(filestream);
streamwriter.AutoFlush = true;
Console.SetOut(streamwriter);
Console.SetError(streamwriter);

handle = filestream.Handle;
status = SetStdHandle(-11, handle); // set stdout
// Check status as needed
status = SetStdHandle(-12, handle); // set stderr
// Check status as needed
}

But I don't want to write the output into a
file.

The output should be written into a winform-control
or a memorystream.

The dll runs in a different process.

The dll ist a "black box" for me,
so I can not modify the source-code.

How can I do that?

Regards
Andreas
AnswerRe: Redirecting output from an unmanaged dll Pin
BobJanova15-May-12 0:27
BobJanova15-May-12 0:27 
AnswerRe: Redirecting output from an unmanaged dll Pin
Richard MacCutchan15-May-12 1:37
mveRichard MacCutchan15-May-12 1:37 
AnswerRe: Redirecting output from an unmanaged dll Pin
Sentenryu15-May-12 5:40
Sentenryu15-May-12 5:40 
Questionproviding images as a stream Pin
VinVan8114-May-12 22:12
VinVan8114-May-12 22:12 
AnswerRe: providing images as a stream Pin
Andy41114-May-12 22:32
Andy41114-May-12 22:32 
GeneralRe: providing images as a stream Pin
VinVan8115-May-12 0:36
VinVan8115-May-12 0:36 
AnswerRe: providing images as a stream Pin
BobJanova15-May-12 0:25
BobJanova15-May-12 0:25 
GeneralRe: providing images as a stream Pin
VinVan8115-May-12 0:34
VinVan8115-May-12 0:34 
QuestionFind centerpoint in circle Pin
nordsluttning14-May-12 21:44
nordsluttning14-May-12 21:44 
AnswerRe: Find centerpoint in circle Pin
Pete O'Hanlon14-May-12 22:02
mvePete O'Hanlon14-May-12 22:02 
AnswerRe: Find centerpoint in circle Pin
Bernhard Hiller15-May-12 3:05
Bernhard Hiller15-May-12 3:05 
GeneralVisual Studio Editor Question Pin
BobInNJ14-May-12 12:40
BobInNJ14-May-12 12:40 
AnswerRe: Visual Studio Editor Question Pin
JOAT-MON14-May-12 12:50
JOAT-MON14-May-12 12:50 
GeneralRe: Visual Studio Editor Question Pin
BobInNJ14-May-12 13:50
BobInNJ14-May-12 13:50 
GeneralRe: Visual Studio Editor Question Pin
Alan Balkany15-May-12 4:58
Alan Balkany15-May-12 4:58 
GeneralRe: Visual Studio Editor Question Pin
PIEBALDconsult14-May-12 12:54
mvePIEBALDconsult14-May-12 12:54 
GeneralRe: Visual Studio Editor Question Pin
R. Giskard Reventlov14-May-12 13:14
R. Giskard Reventlov14-May-12 13:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.