Using Unicode font in C++ console app

后端 未结 3 1691
再見小時候
再見小時候 2020-12-29 13:46

How do I change the font in my C++ Windows console app?

It doesn\'t seem to use the font cmd.exe uses by default (Lucida Console). When I run my app through an exis

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-29 14:28

    Windows stores the cmd settings (including the font) in the registry using the exe path as the key. The root key is 'HKEY_CURRENT_USER\Console' so if you take a look in there with regedit you should see several sub-keys named after varous exe's.

    To copy the settings of an existing exe, you can export the key to a text file, then edit the file to change the key name to that of your exe, then reimport it.

    You can also progmatically modify the registry though i doubt that would take immediate effect w.r.t. to your console window.

提交回复
热议问题