精華區beta Programming 關於我們 聯絡資訊
※ 引述《computer168.bbs@bbs.mgt.ncu.edu.tw (冠蓋滿京華,斯人獨憔悴)》之銘言: > 小弟用的是 Delphi 6,想要寫個小程式讀取系統資訊,不知如何下手... > 包括 cpu type, cpu frequency, 風扇速度, 系統溫度, cpu溫度... > 請各位高手指點一下迷津....謝謝! 請先學一點組合語言 以下是抓cpu速度的程式 function GetCpuSpeed: Comp; { function to return the CPU clock speed only.} { Usage: MessageDlg(Format('%.1f MHz', [GetCpuSpeed]), mtConfirmation, [mbOk], 0); } var t: DWORD; mhi, mlo, nhi, nlo: DWORD; t0, t1, chi, clo, shr32: Comp; begin shr32 := 65536; shr32 := shr32 * 65536; t := GetTickCount; while t = GetTickCount do begin end; asm DB 0FH DB 031H mov mhi,edx mov mlo,eax end; while GetTickCount < (t + 1000) do begin end; asm DB 0FH DB 031H mov nhi,edx mov nlo,eax end; chi := mhi; if mhi < 0 then chi := chi + shr32; clo := mlo; if mlo < 0 then clo := clo + shr32; t0 := chi * shr32 + clo; chi := nhi; if nhi < 0 then chi := chi + shr32; clo := nlo; if nlo < 0 then clo := clo + shr32; t1 := chi * shr32 + clo; Result := (t1 - t0) / 1E6; end; -- ※ Origin: 楓橋驛站<bbs.cs.nthu.edu.tw> ◆ From: d883465.HSIN-A.ab.nthu.edu.tw