title: how can i print out a messages to console at mfc application
body: <p>i trying to print out some logs to console for mfc application</p>
  <p>(cuz, i want to execute a this app 2 ways.
  normally gui way and cui by 'cmd', i won't execute sub console )</p>
  <p>i capture console arguments on &quot;CXXXApp::InitInstance()&quot; by</p>
  <pre><code>LPWSTR* argv = CommandLineToArgvW(GetCommandLineW(), &amp;argc);
  </code></pre>
  <p>it works well, but when i print out a message like below</p>
  <pre><code>fwprintf_s(stdout blah blah);
  wprintf_s( blah blah);
  std::wcout&lt;&lt;blah blah;
  WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE), blahblah);
  </code></pre>
  <p>anything does not works on 'cmd'</p>
  <p>i think something to lock a stdout and stderr
  but i cannnot find it</p>
  <hr />
  <p>i want to build one executable app that can run in both, windows and console.
  and i did it <strong>but i can not print out logs on console</strong></p>