现在的位置: 首页 > 综合 > 正文

MFC中创建console窗口

2014年08月28日 ⁄ 综合 ⁄ 共 366字 ⁄ 字号 评论关闭
HANDLE m_hConsoleOutput = NULL;
if (!m_hConsoleOutput)
{
    AllocConsole();
    m_hConsoleOutput = GetStdHandle(STD_OUTPUT_HANDLE);
    char str[512] = "start Console Log...\n";
    WriteConsole(m_hConsoleOutput, str, strlen(str), NULL, NULL);
}
if (m_hConsoleOutput)
{
    char str[512] = "destroy console...\n";
    WriteConsole(m_hConsoleOutput, str, strlen(str), NULL, NULL);
    CloseHandle(m_hConsoleOutput);
    FreeConsole();
}

抱歉!评论已关闭.