工作的简化形式在按钮单击处理程序中给出。示例输出未显示在窗口中。帮我解决这个..
void CConsoleWriteExDlg::OnBnClickedButtonConsole()
{
if (::AllocConsole())
{
HANDLE hOutConsole = ::GetStdHandle(STD_OUTPUT_HANDLE);
DWORD bytes_written;
::WriteConsole(hOutConsole, "Sample Output", sizeof(TCHAR) * strlen("Sample Output"), &bytes_written, NULL);
::FreeConsole();
}
}