高分求在atl进程外服务中使用cout及printf向屏幕输出的方法

duyanning 2003-04-28 10:36:40
如下
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窗格中
...全文
43 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
kingzai 2003-04-28
  • 打赏
  • 举报
回复
this support RESOLUTION to deal with it.
// 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



tpmao 2003-04-28
  • 打赏
  • 举报
回复
能否说清楚写!!!!!

3,245

社区成员

发帖
与我相关
我的任务
社区描述
ATL,Active Template Library活动(动态)模板库,是一种微软程序库,支持利用C++语言编写ASP代码以及其它ActiveX程序。
社区管理员
  • ATL/ActiveX/COM社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧