Console output window in DLL

Posted by user303907 on Stack Overflow See other posts from Stack Overflow or by user303907
Published on 2010-05-03T06:18:46Z Indexed on 2010/05/03 6:28 UTC
Read the original article Hit count: 319

Filed under:

Hello,

I am trying to redirect the output from my DLL to an external console window for easy debugging.

I have been told about AllocConsole but I am not able to reproduce it, i.e. the console window does not appear.

My current environment is Visual Studio 2005.

I tried the following example which is gotten off the Internet,

AllocConsole();
HANDLE han = GetStdHandle(STD_OUTPUT_HANDLE);
WriteConsole(han,"hello",6,new DWORD,0);

yet nothing happens. Can someone point me in the right direction if creating a console window via DLL is possible in the first place.

Thanks in advance!

© Stack Overflow or respective owner

Related posts about c++