由买买提看人间百态

topics

全部话题 - 话题: cconsole
(共0页)
n**a
发帖数: 104
1
You can do that. All you need to do is to REDIRECT the input/output to
stdout/stdin.
You can use WIN32 API
BOOL WINAPI AllocConsole(void)
to allocate a console for the calling process (/DLL).
Further you can wrap in a class
CConsole:: CConsole()
{
AllocConsole();
freopen("CONOUT$","w+t",stdout);
freopen("CONIN$","r+t",stdin);
}
CConsole:: ~CConsole()
{
fclose(stdout);
fclose(stdin);
FreeConsole();
}
Then when you initialize your DLL, you create an instance of CConsole
(共0页)