【问题标题】:Failed to create a fuilscreen console window in C无法在 C 中创建全屏控制台窗口
【发布时间】:2014-01-02 03:18:30
【问题描述】:
#define _WIN32_WINNT 0x0601
#include <windows.h>

int main() 
{
    HWND StdHandle = GetStdHandle (STD_OUTPUT_HANDLE);
    SetConsoleDisplayMode (StdHandle, CONSOLE_FULLSCREEN_MODE, 0);
    system ("pause");
}

The Community Additions written by Jim Michaels 表示,如果您的应用需要 Windows 7,则必须在文件顶部 #include 之前添加#define _WIN32_WINNT 0x0601

this thread 表示微软删除了该功能(WDDM 显示驱动程序)。

哪个是正确的?

我的目标是创建一个全屏控制台窗口,但最终失败了。为什么?

【问题讨论】:

  • 我尝试提高我的回答技巧。请告诉我为什么你接受但没有投票,我下次会做得更好。

标签: c winapi fullscreen mingw32


【解决方案1】:

Windows 七:

#include <Windows.h>
int main()
{
    HANDLE hStdHandle = GetStdHandle (STD_OUTPUT_HANDLE);
    BOOL bWin32Ret = SetConsoleDisplayMode (hStdHandle, CONSOLE_FULLSCREEN_MODE, 0);
    if ( bWin32Ret == 0 )
    {
        DWORD dwLastError = GetLastError(); // 120
    }
}

winerror.h摘录

// This function is not supported on this system.
//
#define ERROR_CALL_NOT_IMPLEMENTED       120L

#define 用于_WIN32_WINNT 不会改变任何东西。

【讨论】:

  • 好答案,我 +1 :)
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2011-07-01
  • 2013-06-13
  • 1970-01-01
  • 2011-05-24
  • 2013-06-12
  • 2010-09-08
  • 1970-01-01
相关资源
最近更新 更多