增加获取当前登录用户名功能,增加送返修工单excel文件读取功能。

This commit is contained in:
2019-12-26 16:32:40 +08:00
parent 330d2923b0
commit aaec461d4a
10 changed files with 812 additions and 19 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();