Ultima modifica:
Sto cercando di riunire delle informazioni in un Tmemo:
Ho fatto le opportune modifiche:Riesco a ottenere i dati in un ShowMessage ma non riesco a usare ne un Label ne il Memo perchè ho bisogno di convertire i dati in stringa. Mi da questo errore:Codice:function GetCPUSpeed: Double; const DelayTime = 500; var TimerHi, TimerLo: DWORD; PriorityClass, Priority: Integer; begin PriorityClass := GetPriorityClass(GetCurrentProcess); Priority := GetThreadPriority(GetCurrentThread); SetPriorityClass(GetCurrentProcess, REALTIME_PRIORITY_CLASS); SetThreadPriority(GetCurrentThread, THREAD_PRIORITY_TIME_CRITICAL); Sleep(10); asm dw 310Fh mov TimerLo, eax mov TimerHi, edx end; Sleep(DelayTime); asm dw 310Fh sub eax, TimerLo sbb edx, TimerHi mov TimerLo, eax mov TimerHi, edx end; SetThreadPriority(GetCurrentThread, Priority); SetPriorityClass(GetCurrentProcess, PriorityClass); Result := TimerLo / (1000 * DelayTime); end; procedure TForm1.Button1Click(Sender: TObject); begin ShowMessage(Format('Your CPU speed: %f MHz', [GetCPUSpeed])); Label1.caption := GetCPUSpeed; Memo1.Lines := GetCPUSpeed; end;
[DCC Error] speed_cpu.pas(62): E2010 Incompatible types: 'string' and 'Double'
Codice:
procedure TForm1.FormCreate(Sender: TObject);
var
ids: TidIpWatch;
Speed: Double;
begin
ids := TidIpWatch.Create;
Speed := GetCPUSpeed;
Memo1.Text := 'IP:' + (ids.LocalIP);
Memo1.Text := (Tipo_cpu);
Memo1.Text := Format('%f', [Speed]);
ids.Free;
end;