一般的对话框,文档,包括驱动程序里可以使用TRACE。但DLL里只能用OutputString,不能使用printf一类的可以格式化输出的函数吗?下面的单引号实际上是双引号,BLOG系统显示的时候自动替换的。 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, and in the constructor, the console will be attached to the process. Then you can use cout, cin to redirect input/output stream. Good luck. 针对WIN32 DLL加入下面的代码就可以了。 BOOL APIENTRY DllMain( HANDLE hModule, { } |
|