示例代码如下:
procedure TForm1Button1Click(Sender: TObject);type
TCPUID = array[14] of longint;
function GetCPUID: TCPUID;
asm
PUSH EBX
PUSH EDI
MOV EDI,EAX
MOV EAX,1
DW $A20F
STOSD
MOV EAX,EBX
STOSD
MOV EAX,ECX
STOSD
MOV EAX,EDX
STOSD
POP EDI
POP EBX
end;
var
aCpuId: TCpuID;
begin
aCpuId := GetCPUID;
ShowMessage('CPU 序列号是: ' + IntToHex(aCpuId[4],8) + IntToHex(aCpuId[1],8));
end;
代码运行截图:
与实际的对比:
Dim MemoyCounter As New ComputerInfo()
Dim CPUCounter As New PerformanceCounter("Processor", "% Processor Time", "_Total")
Private Sub Timer1_Tick(ByVal sender As SystemObject, ByVal e As SystemEventArgs) Handles Timer1Tick
Dim CPU As Double = CPUCounterNextValue
Dim neicun As Double = (MemoyCounterTotalPhysicalMemory - MemoyCounterAvailablePhysicalMemory) / MemoyCounterTotalPhysicalMemory 100%
获取CPU及物理内存使用率
VB 我不熟,下面是用汇编写的,我运行过可以的。
//--------------------------------
model small
586
stack
code
idstring db 49 dup('$')
start:
mov ax,@code
mov ds,ax
lea di,idstring
mov eax,80000002h
cpuid
mov dword ptr [di],eax
mov dword ptr [di+4],ebx
mov dword ptr [di+8],ecx
mov dword ptr [di+12],edx
mov eax,80000003h
cpuid
mov dword ptr [di+16],eax
mov dword ptr [di+20],ebx
mov dword ptr [di+24],ecx
mov dword ptr [di+28],edx
mov eax,80000004h
cpuid
mov dword ptr [di+32],eax
mov dword ptr [di+36],ebx
mov dword ptr [di+40],ecx
mov dword ptr [di+44],edx
mov ah,09h
lea dx,idstring
int 21h
mov ah,4ch
int 21h
end start
//-------------------------------------------------------
程序确实可以执行,输出CPU的ID等信息。
注意:DOS下或MS-DOS下使用。
以上就是关于如何用 DELPHI 获取 CPU 的序列号全部的内容,包括:如何用 DELPHI 获取 CPU 的序列号、VB如何获取硬件信息比如CPU温度,显卡,CPUID号之类的、、VB.NET,部分机器获取不了CPU号(高分急用)等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)