VS C++ converting int to char (string)

Wojciech Sobiesiak 71 Reputation points
2023-01-28T11:40:41.69+00:00

Hello.

I have a problem with such thing.

Output is as show at the bottom of page.

Can anyone know how to show text inside the edit window as number? (and how to get a number from window as text)

Help pages on the internet are not readable.

The output is something like "˙ĚĚĚĚĚĚĚĚĚĚĚĚ"

111111

int cxScreen, cyScreen;
            cxScreen = GetSystemMetrics(SM_CXSCREEN);
            char str_ll[20];// = std::to_string(cxScreen);
           
            
            IntToChar(cxScreen,&str_ll[0]);
            
                SetWindowTextA(hText,str_ll);
Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,426 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,537 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Viorel 112.5K Reputation points
    2023-01-28T12:25:18.37+00:00

    If your edit control has an ID, then consider the SetDlgItemInt function.

    Or try this: SetWindowTextA( hText, std::to_string( cxScreen ).c_str( ) ).

    0 comments No comments