<i id='DsntK'><tr id='DsntK'><dt id='DsntK'><q id='DsntK'><span id='DsntK'><b id='DsntK'><form id='DsntK'><ins id='DsntK'></ins><ul id='DsntK'></ul><sub id='DsntK'></sub></form><legend id='DsntK'></legend><bdo id='DsntK'><pre id='DsntK'><center id='DsntK'></center></pre></bdo></b><th id='DsntK'></th></span></q></dt></tr></i><div id='DsntK'><tfoot id='DsntK'></tfoot><dl id='DsntK'><fieldset id='DsntK'></fieldset></dl></div>

        <bdo id='DsntK'></bdo><ul id='DsntK'></ul>
    1. <tfoot id='DsntK'></tfoot>
      1. <legend id='DsntK'><style id='DsntK'><dir id='DsntK'><q id='DsntK'></q></dir></style></legend>

        <small id='DsntK'></small><noframes id='DsntK'>

      2. AllocConsole() 不显示 cout

        AllocConsole() not displaying cout(AllocConsole() 不显示 cout)
        <i id='7dBpe'><tr id='7dBpe'><dt id='7dBpe'><q id='7dBpe'><span id='7dBpe'><b id='7dBpe'><form id='7dBpe'><ins id='7dBpe'></ins><ul id='7dBpe'></ul><sub id='7dBpe'></sub></form><legend id='7dBpe'></legend><bdo id='7dBpe'><pre id='7dBpe'><center id='7dBpe'></center></pre></bdo></b><th id='7dBpe'></th></span></q></dt></tr></i><div id='7dBpe'><tfoot id='7dBpe'></tfoot><dl id='7dBpe'><fieldset id='7dBpe'></fieldset></dl></div>
          <tbody id='7dBpe'></tbody>

              <small id='7dBpe'></small><noframes id='7dBpe'>

                <tfoot id='7dBpe'></tfoot>
              • <legend id='7dBpe'><style id='7dBpe'><dir id='7dBpe'><q id='7dBpe'></q></dir></style></legend>

                • <bdo id='7dBpe'></bdo><ul id='7dBpe'></ul>
                  本文介绍了AllocConsole() 不显示 cout的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个 DLL,我在其中使用 AllocConsole() 和 cout 来显示用于调试目的的数据.
                  它曾经工作得很好,但自从我将编译器 (Visual Studio 2012) 更新到最新版本后,dll 只显示控制台,而不显示打印/输出.
                  我不知道为什么会这样.
                  有什么想法吗?

                  I have a DLL where I use AllocConsole() and cout to display data for debugging purposes.
                  It used to work fine but since I updated my compiler (Visual Studio 2012) to the latest the dll just shows the console but not the prints/couts.
                  I am out of idea's as to why this is happening.
                  Any idea's?

                  我的部分代码

                  __declspec(dllexport) INT APIENTRY DllMain(HMODULE hDLL, DWORD Reason, LPVOID Reserved)
                  {
                      switch(Reason)
                      {
                      case DLL_PROCESS_ATTACH:    
                          AllocConsole();
                  
                          DisableThreadLibraryCalls(hDLL);
                  
                          //
                          DetourTransactionBegin();
                          DetourUpdateThread(GetCurrentThread());
                          DetourAttach(&(PVOID&)pSend, MySend);
                          if(DetourTransactionCommit() == NO_ERROR)
                               cout << "[" << MySend << "] successfully detoured." << endl;
                  

                  但没有显示任何内容.

                  推荐答案

                  我依稀记得您可能需要将标准输出重定向到控制台.不过我可能是错的(因为你的代码更早运行):

                  I vaguely recall that you might need to redirect the stdout to the console. I might be wrong though (since you had your code working earlier):

                  AllocConsole();
                  freopen("CONOUT$", "w", stdout);
                  std::cout << "This works" << std::endl;
                  

                  这篇关于AllocConsole() 不显示 cout的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  What is inside .lib file of Static library, Statically linked dynamic library and dynamically linked dynamic library?(静态库、静态链接动态库和动态链接动态库的 .lib 文件里面是什么?)
                  How do I load a C DLL from the SXS in Python?(如何从 Python 中的 SXS 加载 C DLL?)
                  Can Cython code be compiled to a dll so C++ application can call it?(Cython 代码可以编译成 dll 以便 C++ 应用程序可以调用它吗?)
                  Delay Loading DLLs(延迟加载 DLL)
                  Throwing C++ exceptions across DLL boundaries(跨 DLL 边界抛出 C++ 异常)
                  Loading a dll from a dll?(从 dll 加载 dll?)
                    <legend id='o3x8T'><style id='o3x8T'><dir id='o3x8T'><q id='o3x8T'></q></dir></style></legend>

                    • <bdo id='o3x8T'></bdo><ul id='o3x8T'></ul>
                    • <i id='o3x8T'><tr id='o3x8T'><dt id='o3x8T'><q id='o3x8T'><span id='o3x8T'><b id='o3x8T'><form id='o3x8T'><ins id='o3x8T'></ins><ul id='o3x8T'></ul><sub id='o3x8T'></sub></form><legend id='o3x8T'></legend><bdo id='o3x8T'><pre id='o3x8T'><center id='o3x8T'></center></pre></bdo></b><th id='o3x8T'></th></span></q></dt></tr></i><div id='o3x8T'><tfoot id='o3x8T'></tfoot><dl id='o3x8T'><fieldset id='o3x8T'></fieldset></dl></div>
                      <tfoot id='o3x8T'></tfoot>

                      <small id='o3x8T'></small><noframes id='o3x8T'>

                          <tbody id='o3x8T'></tbody>