#include <iostream>
#include <WINDOWS.H>
using namespace std;
void copySelf()
{
char szSelfName[MAX_PATH] ;
char szDestName[MAX_PATH] ;
char szSystemPath[MAX_PATH] ;
char szWindowPath[MAX_PATH] ;
GetModuleFileName(NULL,szSelfName,MAX_PATH);
cout<<szSelfName<<endl;
GetSystemDirectory(szSystemPath,MAX_PATH);
cout<<szSystemPath<<endl;
GetWindowsDirectory(szWindowPath,MAX_PATH);
cout<<szWindowPath<<endl;
strcpy(szDestName,"Z:\\sougou");
strcat(szDestName,"\\va_test.exe");
if(CopyFile(szSelfName,szDestName,FALSE))
{
cout<<"copy !"<<endl;
}
}
void GetSysInfo()
{
char szComputerName[MAXBYTE];
char szUserName[MAXBYTE];
OSVERSIONINFO OsVer;
OsVer.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);//不指定大小得到的是随机数
GetVersionEx(&OsVer);
//cout<<OsVer.dwMajorVersion<<" "<<OsVer.dwMinorVersion<<" "<<OsVer.dwOSVersi
windows api 之复制文件到指定目录和获得系统信息
最新推荐文章于 2021-03-28 10:44:37 发布