请教,MFC怎样获取硬件信息,包括CPU,硬盘,网卡等

networmrlc 2018-01-19 05:14:58
请教,MFC怎样获取硬件信息,包括CPU,硬盘,网卡等。谢谢!
...全文
2441 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
RuningPigNO1 2018-04-13
  • 打赏
  • 举报
回复
你想要的这些我刚做完,觉得有用可以看看https://blog.csdn.net/github_37567324
RuningPigNO1 2018-04-13
  • 打赏
  • 举报
回复
你想要的这些我刚做完,觉得有用可以看看
https://blog.csdn.net/github_37567324
半雨微凉丶 2018-02-02
  • 打赏
  • 举报
回复
char vendor_serialnumber[0x14] = { 0 };
char* SoftAuther::GetCpuID()
{
	std::array<int, 4> cpui;   
    __cpuid(cpui.data(), 0x0);    
    int nIds_ = cpui[0];
    std::vector<std::array<int, 4>> data_;  //保存遍历到的所有cpui的值    
    for (int i=0;i<=nIds_;++i)
    {
        __cpuidex(cpui.data(), i, 0);
        data_.push_back(cpui);
    }
    //reinterpret_cast<int*>(vendor) //*reinterpret_cast<int*>(vendor)
    //索引0 0+4 0+8的值构成了CPU芯片的名称
    char vendor[0x20] = { 0 };
    *reinterpret_cast<int*>(vendor) = data_[0][1];
    *reinterpret_cast<int*>(vendor + 4) = data_[0][3];
    *reinterpret_cast<int*>(vendor + 8) = data_[0][2];     
    std::string vendor_ = vendor;
    sprintf_s(vendor_serialnumber, sizeof(vendor_serialnumber), "%08X", data_[1][0]);
    return vendor_serialnumber;
}
获取cpuid
待续_1006 2018-01-30
  • 打赏
  • 举报
回复

/******************************************************************
* Function Name: GetLocalMac
* Function: 获取本机MAC地址
* Input Parameters: NULL
* OutPut Parameters: NULL
* Return Value: 本机MAC地址
********************************************************************/
CString CFlyCheckImageApp::GetLocalMac()
{
	CString strMacTemp;

	ULONG ulOutBufLen = sizeof(IP_ADAPTER_INFO);
	PIP_ADAPTER_INFO pAdapterInfo = (IP_ADAPTER_INFO*)malloc(sizeof(IP_ADAPTER_INFO));
	if(pAdapterInfo == NULL)
		return NULL;
	if(GetAdaptersInfo(pAdapterInfo, &ulOutBufLen) == ERROR_BUFFER_OVERFLOW) 
	{
		free(pAdapterInfo);
		pAdapterInfo = (IP_ADAPTER_INFO *)malloc(ulOutBufLen);
		if (pAdapterInfo == NULL) 
			return NULL;
	}

	if(GetAdaptersInfo(pAdapterInfo, &ulOutBufLen) == NO_ERROR)
	{
		for(PIP_ADAPTER_INFO pAdapter = pAdapterInfo; pAdapter != NULL; pAdapter = pAdapter->Next)
		{
			// 确保是有线物理网卡 
			if(pAdapter->Type != MIB_IF_TYPE_ETHERNET || pAdapter->Type == 71 || strstr(pAdapter->Description,"Bluetooth") >0)
				continue;
			if(pAdapter->AddressLength != 6)
				continue;
			strMacTemp.Format("%02X:%02X:%02X:%02X:%02X:%02X",				
				int (pAdapter->Address[0]),
				int (pAdapter->Address[1]),
				int (pAdapter->Address[2]),
				int (pAdapter->Address[3]),
				int (pAdapter->Address[4]),
				int (pAdapter->Address[5]));
			break;
		}
	}
	free(pAdapterInfo);

	return strMacTemp;
}
networmrlc 2018-01-29
  • 打赏
  • 举报
回复
请教smwhotjay:能不能说得详细点,谢谢了!
赵4老师 2018-01-23
  • 打赏
  • 举报
回复
百度搜相关关键字。
sichuanwww 2018-01-22
  • 打赏
  • 举报
回复
就是API函数的问题
chinayu2007 2018-01-22
  • 打赏
  • 举报
回复
想知道,在win10下,怎么获取固态硬盘的ID?
Eleven 2018-01-22
  • 打赏
  • 举报
回复
可以通过WMI来获取~~
赵4老师 2018-01-22
  • 打赏
  • 举报
回复
奉劝楼主不要把有限的生命浪费在无限的加密解密死循环中!
smwhotjay 2018-01-20
  • 打赏
  • 举报
回复
1.wmi 2. cmd systeminfo
输出类似
OS 名称:          Microsoft Windows XP Professional
OS 版本:          5.1.2600 Service Pack 3 Build 2600
OS 制造商:        Microsoft Corporation
OS 配置:          独立工作站
OS 构件类型:      Multiprocessor Free
注册的所有人:     微软用户
注册的组织:       微软公司
产品 ID:          71481-610-8134005-21407
初始安装日期:     2011-01-02, 21:50:55
系统启动时间:     3 天 1 小时 11 分 8 秒
系统制造商:       BIOSTAR Group
系统型号:         H61MHB
系统类型:         X86-based PC
处理器:           安装了 1 个处理器。
                  [01]: x86 Family 6 Model 58 Stepping 9 GenuineIntel ~2594 Mhz
BIOS 版本:        ALASKA - 1072009
Windows 目录:     C:\WINDOWS
系统目录:         C:\WINDOWS\system32

2,641

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 硬件/系统
社区管理员
  • 硬件/系统社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧