這裡有幾個函式,用來得到機器的資訊:
1、得到登錄檔鍵值:這裡判斷norton的病毒庫版本
void cinfoshowdlg::getnortonversion()
dword datalen,type;
byte data[80];
result = regqueryvalueex(hkey,"patternfiledate",null,&type,data,&datalen);
if (result != 0)
char tmp;
int years,months,days;
tmp = data[0];
years = tmp%10;
tmp = data[1];
months = tmp + 1;
tmp = data[2];
days = tmp;
m_norton_version.format("200%d.%d.%d",years,months,days);
regclosekey(hkey);
}2、硬碟空間:
cstring cinfoshowdlg::getdisk(char *disk)
free_space = result_freespace.quadpart/1024/1024;
total_space = result_totalspace.quadpart/1024/1024;
free_percent = (float)free_space/total_space*100;
disk_space.format("%dm/ %dm (%d%%)",free_space,total_space,free_percent);
if((hostinfo = gethostbyname(name))!=null)
}wsacleanup();
}m_ipaddr = ip;
m_hostname.format("%s",name);
}4、網路狀態:建立乙個socket,ping自己。
int cinfoshowdlg::get***state()
memset(&pingsocket, 0, sizeof(pingsocket));
pingsocket.sin_family = af_i***;
pingsocket.sin_addr.s_addr = i***_addr(m_ipaddr);
pingsocket.sin_port = htons(ping_port);
confd = socket(af_i***, sock_stream, 0);
error = connect(confd,(struct sockaddr *)&pingsocket,sizeof(sockaddr_in));
error = send(confd,"!",1,0);
if(error == 0)
m_***_state.format("on");
updatedata(false);
return 0;
}
得到指定檔案的資訊
char szfilename c enochshen.exe dword dwsize getfileversioninfosize szfilename,null lpvoid pblock malloc dwsize getfileversioninfo szfilename,0,dwsize...
C 得到磁碟資訊
1 system.io.driveinfo drive system.io.driveinfo.getdrives for inti 0 i drive.length i 2 說明 name 碟符 totalfreespace 返回磁碟可用空間,返回值型別long。drivetype 磁碟型別 返回...
得到輪廓點的座標資訊
vv contours裡面就是輪廓點的座標資訊 for int i 0 i 如果你要獲取輪廓內部的點 那你演算法用錯了,contour是找邊緣。你要用的是blob,連通域。基於contour做乙個區域蔓延法就行。opencv如何獲取指定圓上所有畫素點的座標 csdn論壇 或者簡單點 建立一副尺寸夠大...