以后慢慢更新.
代码1(获取CPU核心数量):
$s=DllStructCreate('byte[12];ptr[2];dword[4];word[2]')
DllCall('kernel32.dll','int','GetSystemInfo','ptr',DllStructGetPtr($s))
MsgBox(32,"",DllStructGetData($s,3))
代码2(获取系统有没有电池/检测笔记本的一个手段之一)
;~ typedef struct _SYSTEM_POWER_STATUS {
;~ BYTE ACLineStatus;
;~ BYTE BatteryFlag;
;~ BYTE BatteryLifePercent;
;~ BYTE Reserved1;
;~ DWORD BatteryLifeTime;
;~ DWORD BatteryFullLifeTime;
;~ } SYSTEM_POWER_STATUS, *LPSYSTEM_POWER_STATUS;
$_SYSTEM_POWER_STATUS=DllStructCreate('byte[4];dword[2]')
DllCall('Kernel32.dll','bool','GetSystemPowerStatus','ptr',DllStructGetPtr($_SYSTEM_POWER_STATUS))
MsgBox(32,"电池状态",DllStructGetData($_SYSTEM_POWER_STATUS,1,2))
MsgBox(32,"电源状态",DllStructGetData($_SYSTEM_POWER_STATUS,1,1))
MsgBox(32,"电源状态百分比",DllStructGetData($_SYSTEM_POWER_STATUS,1,3))
MsgBox(32,"电池剩余时间(DWORD)",DllStructGetData($_SYSTEM_POWER_STATUS,2,1))
MsgBox(32,"电池总的时间(DWORD)",DllStructGetData($_SYSTEM_POWER_STATUS,2,2))
;~ Value Meaning
;~ 1 High—the battery capacity is at more than 66 percent
;~ 2 Low—the battery capacity is at less than 33 percent
;~ 4 Critical—the battery capacity is at less than five percent
;~ 8 Charging
;~ 128 No system battery
;~ 255 Unknown status—unable to read the battery flag information
|