如下
extern "C" int WINAPI _tWinMain(HINSTANCE hInstance,
HINSTANCE /*hPrevInstance*/, LPTSTR lpCmdLine, int /*nShowCmd*/)
{
cout << "????????" << endl;
printf("!!!!!!!\n");
AllocConsole();
DWORD dw;
WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE), "hello", 5, &dw, 0);现在发现只有用WriteConsole才能看到输出,而cout以及printf的输出被导向output窗口的build窗格中
extern "C" int WINAPI _tWinMain(HINSTANCE hInstance,
HINSTANCE /*hPrevInstance*/, LPTSTR lpCmdLine, int /*nShowCmd*/)
{
cout << "????????" << endl;
printf("!!!!!!!\n");
AllocConsole();
DWORD dw;
WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE), "hello", 5, &dw, 0);现在发现只有用WriteConsole才能看到输出,而cout以及printf的输出被导向output窗口的build窗格中
// Allocate a new console.
AllocConsole();
// Redirect stdout to the console.
freopen("CONOUT$", "wta+", stdout);
Run();
// Free the console.
FreeConsole();
for more ,see
PRB: ATL Service Run from the IDE Doesn't Log Events to Console
ID: Q199060
http://codeguru.earthweb.com/debug/consol_output.shtml