Switch to Bing in English
Copilot
Your everyday AI companion
About 1,100,000 results
    Upvotes29edited Jan 6, 2017 at 8:18

    Windows

    You can try to use GetComputerName and GetUserName, here is a example:

    #define INFO_BUFFER_SIZE 32767
    TCHAR infoBuf[INFO_BUFFER_SIZE];
    DWORD bufCharCount = INFO_BUFFER_SIZE;

    // Get and display the name of the computer.
    if( !GetComputerName( infoBuf, &bufCharCount ) )
    printError( TEXT("GetComputerName") );
    _tprintf( TEXT("\nComputer name: %s"), infoBuf );

    // Get and display the user name.
    if( !GetUserName( infoBuf, &bufCharCount ) )
    printError( TEXT("GetUserName") );
    _tprintf( TEXT("\nUser name: %s"), infoBuf );
    Content Under CC-BY-SA license
    Was this helpful?
  1. GetComputerNameA function (winbase.h) - Win32 apps

  2. GetComputerNameA 関数 (winbase.h) - Win32 apps ...

  3. People also ask
  4. c++ - Get Computer Name and logged user name - Stack ...

  5. コンピュータ名を取得する - わびさびサンプルソース

  6. Win32API コンピュータ名を取得する GetComputerName - s-kita ...

  7. GetComputerNameExA function (sysinfoapi.h) - Win32 apps

  8. Declare Function Api_GetComputerName& Lib "kernel32 ...

  9. Get computername from hostname in C++? - Stack Overflow

  10. _GetComputerName関数 - Win32 apps | Microsoft Learn

  11. 自分のコンピューター名を表示する

  12. Some results have been removed
By using this site you agree to the use of cookies for analytics, personalized content, and ads.Learn more about third party cookies|Microsoft Privacy Policy