C++MFC 获取硬盘序列号,获取主机名字

mac2026-03-28  4

获取硬盘序列号

GetVolumeInformation("C:",NULL, MAX_PATH,&Serial,&Length,   NULL,NULL,MAX_PATH);   

 

文件服务器

在资源管理器的时候是\\IP\ShareName,所以应该是"\\\\IP\\ShareName"

 

获得主机名

char szhostname[128];

if (gethostname(szhostname, 128) == 0)//获得主机名

{

m_ComputerName.Format("%s", szhostname);

}

需要在 BOOL CCLDC_1stApp::InitInstance()

if (!AfxSocketInit())

{

AfxMessageBox("Socke初始化失败");

return FALSE;

}

最新回复(0)