G
G
Guerro692020-08-28 14:44:30
C++ / C#
Guerro69, 2020-08-28 14:44:30

C++ how to make normal display of characters?

I need to find the NFSMW game window and get its PID, but the problem is that the window of this game contains the symbol ™, which is not displayed correctly in c++, how to fix it?

#include <iostream>
#include <Windows.h>
#include <string>

using namespace std;

int main()
{
    DWORD pid;
    LPCSTR WindowName = "Need for Speed™ Most Wanted";
    HWND window = FindWindowA(0, WindowName);
    GetWindowThreadProcessId(window, &pid);
    cout<<window<<", "<<pid<<", "<<WindowName<<endl;
    // Вывод: 0, 3, Need for SpeedтДв Most Wanted
}

Compiler: g++

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Adamos, 2020-08-28
@Guerro69

character that is not displayed correctly in c++

This is not a character that is displayed incorrectly. This is a traditional mess with encodings in the Windows console.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question