Use the Win32API GetUserName
function. Example:
#include <windows.h>
#include <Lmcons.h>
char username[UNLEN+1];
DWORD username_len = UNLEN+1;
GetUserName(username, &username_len);
More Related Contents:
- How can I clear console
- How to get main window handle from process id?
- Deploying Qt 5 App on Windows
- Is there a limit on number of open files in Windows
- OpenCV with Network Cameras
- Qt 5.1.1: Application failed to start because platform plugin “windows” is missing
- Start Windows Service From Application without Admin right(c++)
- Create a directory if it doesn’t exist
- How do I input variables using cin without creating a new line?
- C++ compiling on Windows and Linux: ifdef switch [duplicate]
- Can I use CreateFile, but force the handle into a std::ofstream?
- What is the meaning and usage of __stdcall?
- How to properly uninitialize OpenSSL
- How should I use FormatMessage() properly in C++?
- Creating, opening and printing a word file from C++
- How do I tell CMake to use Clang on Windows?
- What std::locale names are available on common windows compilers?
- Converting YUV into BGR or RGB in OpenCV
- Is MsiOpenProduct the correct way to read properties from an installed product?
- Why does Windows 10 start extra threads in my program?
- Console output in a Qt GUI app?
- Using C++ to edit the registry
- Can OpenSSL on Windows use the system certificate store?
- Check the file-size without opening file in C++?
- C++ Memory Barriers for Atomics
- Win32: How to hide 3rd party windows in taskbar by hWnd
- Windows & C++: extern & __declspec(dllimport)
- Is rebasing DLLs (or providing an appropriate default load address) worth the trouble?
- How to get the Executable name of a window
- Wait for input for a certain time