【问题标题】:c++ Having trouble about changing name on console windowc ++在控制台窗口上更改名称时遇到问题
【发布时间】:2016-08-27 22:09:16
【问题描述】:
LPCTSTR Process = ("Test game");



LPCTSTR windowName = Process(" Text");
system("color 0a");
SetConsoleTitle(windowName);

任何人都可以做这个吗?

【问题讨论】:

    标签: c++ window


    【解决方案1】:

    要更改当前控制台标题,您可以使用SetConsoleTitle WinAPI 函数:

    #include <iostream>
    #include <Windows.h>
    
    int main(){
        wchar_t newTitle[255] = L"My New Console Title";
        SetConsoleTitle(newTitle); // set the current console title
        return 0;
    }
    

    【讨论】:

    • 但我想同时拥有 LPCTSTR 和一些文本,所以我可以说测试游戏文本,如上面的示例所示
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-01-05
    • 2019-02-11
    • 1970-01-01
    • 1970-01-01
    • 2022-06-16
    • 1970-01-01
    • 2011-12-23
    相关资源
    最近更新 更多