变更一下代码文目录名,防止qt编译中文路径出错。

This commit is contained in:
2020-07-14 11:17:31 +08:00
parent 05dacbfec4
commit fc2d04d57b
119 changed files with 41 additions and 13 deletions

View File

@@ -0,0 +1,25 @@

#include "system_util.h"
using namespace std;
const unsigned int BUFFER_SIZE = 1024;
std::wstring getUserName()
{
wstring userName;
wchar_t szUserName[BUFFER_SIZE];
DWORD userNameBufferSize = BUFFER_SIZE;
if ( GetUserNameW( szUserName, &userNameBufferSize ) == false )
{
throw runtime_error("获取操作系统用户名失败!");
}
if ( userNameBufferSize != 0 )
{
userName = szUserName;
}
return userName;
}

View File

@@ -0,0 +1,8 @@

#pragma once
#include <windows.h>
#include <string>
#include <stdexcept>
std::wstring getUserName();