c++ - AllocConsole Questions -
i read msdn documentation on allocconsole
, not understand 1 word referring purpose. in minor dll tutorial attaches dll simple console application , in dll, allocconsole
called. when remove dll code, nothing changes during runtime. i'm curious main purpose:
case dll_process_attach: allocconsole(); printf("\ninjected successfully!"); msgbox(true); break;
this has no difference during runtime when remove allocconsole.
the msdn documentation allocconsole says:
a process can associated 1 console, allocconsole function fails if calling process has console. process can use freeconsole function detach current console, can call allocconsole create new console or attachconsole attach console.
so, call if process doesn't have console want have one. common example of might in windows (gui) application, not automatically create , display console. (unlike console application, does, making allocconsole rather useless.)
Comments
Post a Comment