Autor Beitrag
Ultrabeamer
Hält's aus hier
Beiträge: 14



BeitragVerfasst: So 02.03.03 23:55 
Hi,

ich würd gerne ein Systeminfo machen, dass die Systeminformationen ausliest und anzeigt.

Das soll alles drin sein:

Name: (auf den Windows registriert wurde)

Betriebssystem: (nur der Name des Betriebsystems)

CPU: (Name)
Taktrate: (in MHz)
RAM: (Menge in MB).

Kann mir da jemand weiterhelfen?

Danke schon mal.
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mo 03.03.03 00:18 
Betriebssystem:
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
function GetOperatingSystem : String;
var
  osVerInfo    : TOSVersionInfo;
  majorVer, minorVer : Integer; 
begin
  result := 'unbekannt';
  { set operating system type flag }
  osVerInfo.dwOSVersionInfoSize := SizeOf(TOSVersionInfo);
  if GetVersionEx(osVerInfo) then
  begin
   majorVer := osVerInfo.dwMajorVersion;
   minorVer := osVerInfo.dwMinorVersion;
    case osVerInfo.dwPlatformId of
      VER_PLATFORM_WIN32_NT : { Windows NT/2000 }
        begin
          if majorVer <= 4 then
            result := 'Windows NT'
          else if (majorVer = 5AND (minorVer= 0then
            result := 'Windows 2000'
          else if (majorVer = 5AND (minorVer = 1then
            result := 'Windows XP'
          else
            result := 'unbekannt';
          result := result + ' (' +osverInfo.szCSDVersion+')';;
        end
      VER_PLATFORM_WIN32_WINDOWS :  { Windows 9x/ME } 
        begin
          if (majorVer = 4AND (minorVer = 0then 
            result := 'Windows 95'
          else if (majorVer = 4AND (minorVer = 10then 
          begin 
            if osVerInfo.szCSDVersion[1] = 'A' then
              result := 'Windows 98 SE'
            else 
              result := 'Windows 98';
          end 
          else if (majorVer = 4AND (minorVer = 90then
            result := 'Windows Millennium'
          else 
            result := 'unbekannt';
        end
    else
      result := 'unbekannt'
    end
  end
  else 
    result := 'unbekannt'
end;

Speicher:
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
function GetTotalMemory: Int64;
var
   Memory : TMemoryStatus;
begin
     Memory.dwLength := SizeOf(Memory);
     GlobalMemoryStatus(Memory);
     Result := Memory.dwTotalPhys;
end;

function GetAvailMemory: Int64;
var
   Memory : TMemoryStatus;
begin
     Memory.dwLength := SizeOf(Memory);
     GlobalMemoryStatus(Memory);
     Result := Memory.dwAvailPhys;
end;

function GetTotalPageFile: Int64;
var
   Memory : TMemoryStatus;
begin
     Memory.dwLength := SizeOf(Memory);
     GlobalMemoryStatus(Memory);
     Result := Memory.dwTotalPageFile;
end;

function GetAvailPageFile: Int64;
var
   Memory : TMemoryStatus;
begin
     Memory.dwLength := SizeOf(Memory);
     GlobalMemoryStatus(Memory);
     Result := Memory.dwAvailPageFile;
end;

function GetUsedMemory: Int64;
var
   Memory : TMemoryStatus;
begin
     Memory.dwLength := SizeOf(Memory);
     GlobalMemoryStatus(Memory);
     Result := Memory.dwMemoryLoad;
end;

CPU:
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
224:
225:
226:
227:
228:
229:
230:
231:
232:
233:
234:
235:
236:
237:
238:
239:
240:
241:
242:
243:
244:
245:
246:
247:
248:
249:
250:
251:
252:
253:
254:
255:
256:
257:
258:
259:
260:
261:
262:
263:
264:
265:
266:
267:
268:
269:
270:
271:
272:
273:
274:
275:
276:
277:
278:
279:
280:
281:
282:
283:
284:
285:
286:
287:
288:
289:
290:
291:
292:
293:
294:
295:
296:
297:
298:
299:
300:
301:
302:
303:
304:
305:
306:
307:
308:
309:
310:
311:
312:
313:
314:
315:
316:
317:
318:
319:
320:
321:
322:
323:
324:
325:
326:
327:
328:
329:
330:
331:
332:
333:
334:
335:
336:
337:
338:
339:
340:
341:
342:
343:
344:
345:
346:
347:
348:
349:
350:
351:
352:
353:
354:
355:
356:
357:
358:
359:
360:
361:
362:
unit ProcessorInfo;

interface

type
  TCpuInfo = Record
    VendorIDString: String;
    Manufacturer: String;
    CPU_Name: String;
    PType: Byte;
    Family: Byte;
    Model: Byte;
    Stepping: Byte;
    Features: Cardinal;
    MMX: Boolean;
    IDFDIVOK: Boolean;
  end;

    function TestFDIVInstruction: Boolean;
    function GetProcessorType:string;
    function GetProcessorCount:integer;
    function CPUID: TCpuInfo;
    procedure GetCPUInfo(Var CPUInfo: TCpuInfo);
    function GetCPUSpeed: string;

implementation
uses
  shellapi,mmsystem,Windows, Messages, SysUtils, Classes;

Const
     InfoStrings: Array[0..1of String = ('FDIV instruction is Flawed',
                                           'FDIV instruction is OK');

Const
  // Constants to be used with Feature Flag set of a CPU
  // eg. IF (Features and FPU_FLAG = FPU_FLAG) THEN CPU has Floating-Point unit on chip
  // However, Intel claims that in future models, a zero in the feature flags will
  // mean that the chip has that feature, however, the following flags will work for
  // any production 80x86 chip or clone.
  // eg. IF (Features and FPU_FLAG = 0) then CPU has Floating-Point unit on chip
  FPU_FLAG = $00000001// Floating-Point unit on chip
  VME_FLAG = $00000002// Virtual Mode Extention
   DE_FLAG = $00000004// Debugging Extention
  PSE_FLAG = $00000008// Page Size Extention
  TSC_FLAG = $00000010// Time Stamp Counter
  MSR_FLAG = $00000020// Model Specific Registers
  PAE_FLAG = $00000040// Physical Address Extention
  MCE_FLAG = $00000080// Machine Check Exception
  CX8_FLAG = $00000100// CMPXCHG8 Instruction
 APIC_FLAG = $00000200// Software-accessible local APIC on Chip
  BIT_10   = $00000400// Reserved, do not count on value
  SEP_FLAG = $00000800// Fast System Call
 MTRR_FLAG = $00001000// Memory Type Range Registers
  PGE_FLAG = $00002000// Page Global Enable
  MCA_FLAG = $00004000// Machine Check Architecture
 CMOV_FLAG = $00008000// Conditional Move Instruction
  BIT_16   = $00010000// Reserved, do not count on value
  BIT_17   = $00020000// Reserved, do not count on value
  BIT_18   = $00040000// Reserved, do not count on value
  BIT_19   = $00080000// Reserved, do not count on value
  BIT_20   = $00100000// Reserved, do not count on value
  BIT_21   = $00200000// Reserved, do not count on value
  BIT_22   = $00400000// Reserved, do not count on value
  MMX_FLAG = $00800000// MMX technology
  BIT_24   = $01000000// Reserved, do not count on value
  BIT_25   = $02000000// Reserved, do not count on value
  BIT_26   = $04000000// Reserved, do not count on value
  BIT_27   = $08000000// Reserved, do not count on value
  BIT_28   = $10000000// Reserved, do not count on value
  BIT_29   = $20000000// Reserved, do not count on value
  BIT_30   = $40000000// Reserved, do not count on value
  BIT_31   = $80000000// Reserved, do not count on value


procedure GetCPUInfo(Var CPUInfo: TCpuInfo);
begin
  CPUInfo := CPUID;
  CPUInfo.IDFDIVOK := TestFDIVInstruction;
  if (CPUInfo.Features and MMX_FLAG) = MMX_FLAG then
     CPUInfo.MMX := True
  else
    CPUInfo.MMX := False;
end;


Function CPUID: TCpuInfo;
type
    regconvert = record
          bits0_7: Byte;
          bits8_15: Byte;
          bits16_23: Byte;
          bits24_31: Byte;
    end;
var
   CPUInfo: TCpuInfo;
   TEBX, TEDX, TECX: Cardinal;
   TString: String;
   VString: String;
begin
     asm
        MOV  [CPUInfo.PType], 0
        MOV  [CPUInfo.Model], 0
        MOV  [CPUInfo.Stepping], 0
        MOV  [CPUInfo.Features], 0

        push eax
        push ebp
        push ebx
        push ecx
        push edi
        push edx
        push esi

     @@Check_80486:
        MOV  [CPUInfo.Family], 4
        MOV  TEBX, 0
        MOV  TEDX, 0
        MOV  TECX, 0
        PUSHFD
        POP  EAX
        MOV  ECX,  EAX
        XOR  EAX,  200000H
        PUSH EAX
        POPFD
        PUSHFD
        POP  EAX
        XOR  EAX,  ECX
        JE   @@DONE_CPU_TYPE

     @@Has_CPUID_Instruction:
        MOV  EAX,  0
        DB   0FH
        DB   0A2H

        MOV  TEBX, EBX
        MOV  TEDX, EDX
        MOV  TECX, ECX

        MOV  EAX,  1
        DB   0FH
        DB   0A2H

        MOV  [CPUInfo.Features], EDX

        MOV  ECX,  EAX

        AND  EAX,  3000H
        SHR  EAX,  12
        MOV  [CPUInfo.PType], AL

        MOV  EAX,  ECX

        AND  EAX,  0F00H
        SHR  EAX,  8
        MOV  [CPUInfo.Family], AL

        MOV  EAX,  ECX

        AND  EAX,  00F0H
        SHR  EAX,  4
        MOV  [CPUInfo.MODEL], AL

        MOV  EAX,  ECX

        AND  EAX,  000FH
        MOV  [CPUInfo.Stepping], AL

     @@DONE_CPU_TYPE:

        pop  esi
        pop  edx
        pop  edi
        pop  ecx
        pop  ebx
        pop  ebp
        pop  eax
     end;

     If (TEBX = 0and (TEDX = 0and (TECX = 0and (CPUInfo.Family = 4then
     begin
          CPUInfo.VendorIDString := 'Unknown';
          CPUInfo.Manufacturer := 'Unknown';
          CPUInfo.CPU_Name := 'Generic 486';
     end
     else
     begin
          With regconvert(TEBX) do
          begin
               TString := CHR(bits0_7) + CHR(bits8_15) + CHR(bits16_23) + CHR(bits24_31);
          end;
          With regconvert(TEDX) do
          begin
               TString := TString + CHR(bits0_7) + CHR(bits8_15) + CHR(bits16_23) + CHR(bits24_31);
          end;
          With regconvert(TECX) do
          begin
               TString := TString + CHR(bits0_7) + CHR(bits8_15) + CHR(bits16_23) + CHR(bits24_31);
          end;
          VString := TString;
          CPUInfo.VendorIDString := TString;
          If (CPUInfo.VendorIDString = 'GenuineIntel'then
          begin
               CPUInfo.Manufacturer := 'Intel';
               Case CPUInfo.Family of
               4Case CPUInfo.Model of
                  1: CPUInfo.CPU_Name := 'Intel 486DX Processor';
                  2: CPUInfo.CPU_Name := 'Intel 486SX Processor';
                  3: CPUInfo.CPU_Name := 'Intel DX2 Processor';
                  4: CPUInfo.CPU_Name := 'Intel 486 Processor';
                  5: CPUInfo.CPU_Name := 'Intel SX2 Processor';
                  7: CPUInfo.CPU_Name := 'Write-Back Enhanced Intel DX2 Processor';
                  8: CPUInfo.CPU_Name := 'Intel DX4 Processor';
                  else CPUInfo.CPU_Name := 'Intel 486 Processor';
                  end;
               5: CPUInfo.CPU_Name := 'Pentium';
               6Case CPUInfo.Model of
                  1: CPUInfo.CPU_Name := 'Pentium Pro';
                  3: CPUInfo.CPU_Name := 'Pentium II (Model 3)';
                  5: CPUInfo.CPU_Name := 'Pentium II (Model 5)';
                  6: CPUInfo.CPU_Name := 'Intel Celeron (Model 6)';
                  7: CPUInfo.CPU_Name := 'Pentium II (Model 7)';
                  8: CPUInfo.CPU_Name := 'Pentium III (Model 8)';
                  else CPUInfo.CPU_Name := Format('P6 (Model %d)', [CPUInfo.Model]);
                  end;
               else CPUInfo.CPU_Name := Format('P%d', [CPUInfo.Family]);
               end;
          end
          else if (CPUInfo.VendorIDString = 'CyrixInstead'then
          begin
                CPUInfo.Manufacturer := 'Cyrix';
                Case CPUInfo.Family of
                5: CPUInfo.CPU_Name := 'Cyrix 6x86';
                6: CPUInfo.CPU_Name := 'Cyrix M2';
                else CPUInfo.CPU_Name := Format('%dx86', [CPUInfo.Family]);
                end;
          end
          else if (CPUInfo.VendorIDString = 'AuthenticAMD'then
          begin
               CPUInfo.Manufacturer := 'AMD';
               Case CPUInfo.Family of
               4: CPUInfo.CPU_Name := 'Am486 or Am5x86';
               5Case CPUInfo.Model of
                  0: CPUInfo.CPU_Name := 'AMD-K5 (Model 0)';
                  1: CPUInfo.CPU_Name := 'AMD-K5 (Model 1)';
                  2: CPUInfo.CPU_Name := 'AMD-K5 (Model 2)';
                  3: CPUInfo.CPU_Name := 'AMD-K5 (Model 3)';
                  6: CPUInfo.CPU_Name := 'AMD-K6';
                  7: CPUInfo.CPU_Name := 'AMD-K6 (Model 7)';
                  8: CPUInfo.CPU_Name := 'AMD-K6-2 (Model 8)';
                  9: CPUInfo.CPU_Name := 'AMD-K6-III (Model 9)';
                  else CPUInfo.CPU_Name := 'Unknown AMD Model';
                  end;
               6Case CPUInfo.Model of
                  1: CPUInfo.CPU_Name := 'AMD Athlon (Model 1)';
                  2: CPUInfo.CPU_Name := 'AMD Athlon (Model 2)';
                  3: CPUInfo.CPU_Name := 'AMD Duron';
                  4: CPUINfo.CPU_Name := 'AMD Athlon (Model 4)';
                  else CPUInfo.CPU_Name := 'Unknown AMD Chip';
                  end;
               end;
          end
          else
          begin
               CPUInfo.VendorIDString := TString;
               CPUInfo.Manufacturer := 'Unknown';
               CPUInfo.CPU_Name := 'Unknown';
          end;
     end;
     Result := CPUInfo;
end;

Function TestFDIVInstruction: Boolean;
var
   TopNum:    Double;
   BottomNum: Double;
   One:       Double;
   ISOK:      Boolean;
begin
     { The following code was found in Borlands
       fdiv.asm file in the Delphi 3\Source\RTL\SYS
       directory, ( I made some minor modifications )
       therefor I cannot take credit for it }


     TopNum     := 2658955;
     BottomNum  := PI;
     One        := 1;

     asm
        PUSH    EAX
        FLD     [TopNum]
        FDIV    [BottomNum]
        FMUL    [BottomNum]
        FSUBR   [TopNum]
        FCOMP   [One]
        FSTSW   AX
        SHR     EAX, 8
        AND     EAX, 01H
        MOV     ISOK, AL
        POP     EAX
     end;
     Result := ISOK;
end;


function getprocessortype:string;
var
   systeminfo:tsysteminfo;
   zw:string;
begin
     getsysteminfo(systeminfo);
     case systeminfo.dwprocessortype of
          386:zw:='Intel 80386';
          486:zw:='Intel 80486';
          586:zw:='Intel Pentium';
          860:zw:='Intel 860';
          2000:zw:='MIPS R2000';
          3000:zw:='MIPS R3000';
          4000:zw:='MIPS R4000';
         21064:zw:='ALPHA 21064';
     else ZW:='Processor nicht klassifiziert';
     end;

     result:=zw;
end;

function GetProcessorCount:integer;
var
systeminfo:tsysteminfo;
begin
     getsysteminfo(systeminfo);
     result:=systeminfo.dwnumberofprocessors;
end;

function GetCPUSpeed: string;
const
     TimeOfDelay = 500;
var
   TimerHigh,
   TimerLow: DWord;
   //s : string;
   //f : real;
begin
     SetPriorityClass(GetCurrentProcess, REALTIME_PRIORITY_CLASS);
     SetThreadPriority(GetCurrentThread,
     THREAD_PRIORITY_TIME_CRITICAL);
     asm
        dw 310Fh
        mov TimerLow, eax
        mov TimerHigh, edx
     end;
     Sleep(TimeOfDelay);
     asm
        dw 310Fh
        sub eax, TimerLow
        sub edx, TimerHigh
        mov TimerLow, eax
        mov TimerHigh, edx
     end;
     Result := format('%.0f', [TimerLow / (1000.0 * TimeOfDelay)])+ ' MHz';
end;

end.

Sonst noch Wünsche?

Moderiert von user profile iconTino: Code- durch Delphi-Tags ersetzt.
Ultrabeamer Threadstarter
Hält's aus hier
Beiträge: 14



BeitragVerfasst: Mo 03.03.03 00:24 
Hui, danke! Das ging aber schnell :)

Werde ich gleich mal ausprobieren.


Sooo. Gehen wir mal davon aus, dass ich ein leeres "Program" habe (Form1). Da möchte ich jetzt eine Übersicht.

CPU:
RAM:
Betriebssystem:

Dazu möchte ich einen Button, der die Informationen auf Wunsch aktualisieren kann.

Kannst du mir bitte weiterhelfen, was ich genau machen muss? Ich habe leider absolut keine Ahnung :(
wulfskin
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1349
Erhaltene Danke: 1

Win XP
D5 Pers (SSL), D2005 Pro, C, C#
BeitragVerfasst: Mo 03.03.03 11:06 
Hallo Ultrabeamer!

Keine Ahnung haben und mit sowas beginnen, naja ;)!
Aber egal, hier eine kurze Anleitung:
  • Plaziere 3 Labels auf dem Formular
  • Plaziere einen Button auf dem Formular
  • Click doppelt auf den Button und schreibe folgendes:
    ausblenden Quelltext
    1:
    2:
    3:
      Label1.Caption := 'CPU: ' +  GetProcessorType;
      Label2.Caption := 'RAM: ' + IntToStr(GetTotalMemory) + 'bytes';
      Label3.Caption := 'OS: ' + GetOperatingSystem;
Gruß wulfskin!

_________________
Manche antworten um ihren Beitragszähler zu erhöhen, andere um zu Helfen.
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mo 03.03.03 11:10 
Ein Buch täte, glaube ich, ganz gut oder alternativ ein gutes Tutorial. :roll:
Ultrabeamer Threadstarter
Hält's aus hier
Beiträge: 14



BeitragVerfasst: Mo 03.03.03 12:38 
Danke

Ich habe das jetzt mal gemacht und naja, wie soll ich sagen... :lol:
so arg viel weiter bin ich doch nicht gekommen :roll:

Also, dass was wulfskin geschrieben hat, ist 100% klar, allerdings funktioniert das irgendwie nicht, weil ich nicht weiß, wie und wo ich das einbinden soll, was Luckie oben geschrieben hat.

Was muss ich denn da bei uses ergänzen?

Danke für eure Geduld.


P.S.: Ich kauf mir irgendwann ein Buch, muss aber erst die Klasse schaffen ;)

_________________
Achtung, Anfänger ohne jegliche Ahnung :P
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Mo 03.03.03 13:45 
Die Funktionen die Luckie gepostet hat würde ich erstmal in einer eigenen Unit unterbringen. Die Unit kannst Du zum Beispiel SysInfo.pas nennen. Dann brauchst Du nur noch die o. g. neue Unit in der Usesklausel hinzufügen (also zum Beispiel in Unit1.pas).

Gruß
TINO
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mo 03.03.03 13:47 
.. und im Interfaceteil die Funktionen deklarieren, damit du auf sie zugreifen kannst, siehe die CPU-Info Unit.
Ultrabeamer Threadstarter
Hält's aus hier
Beiträge: 14



BeitragVerfasst: Mo 03.03.03 16:02 
Ich habe jetzt ein neues Projekt erstellt.

Unit1.pas
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
Label1.Caption := 'CPU: ' +  GetProcessorType;
Label2.Caption := 'RAM: ' + IntToStr(GetTotalMemory) + 'bytes';
Label3.Caption := 'OS: ' + GetOperatingSystem;
end;

end.

Unit2.pas
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
unit Unit2;

interface

implementation

end.

So, nun weiß ich überhaupt nicht, wo ich das einfügen muss, was Luckie geschrieben hat :cry:
Wenn ich das nach "unit Unit2;" einfüge kommt immer eine Fehlermeldung.

Kann mir bitte jemand die komplette Unit1 und Unit2 schicken?

Würde freuen, wenn sich jemand eventuell die Arbeit machen würde.
Danke schon mal.

P.S.: Sorry, wenn ich euch nerve :P

_________________
Achtung, Anfänger ohne jegliche Ahnung :P
grayfox
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 800

win98, winXP
D4 Standard; D6 Personal
BeitragVerfasst: Mo 03.03.03 17:11 
hallo ultrabeamer!

deine unit sollte so aussehen:

(*$UNTESTED ;) *)
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
unit Unit2; 

interface 

--> hierhin kommen die deklarationen der proceduren und functions

function GetOperatingSystem : String
function GetTotalMemory: Int64;
function GetAvailMemory: Int64; 
function GetTotalPageFile: Int64; 
function GetAvailPageFile: Int64; 
function GetUsedMemory: Int64; 

implementation 

--> hier kopierst du den kompletten source-code mit allen functionen und proceduren lt deiner definition rein:

function GetOperatingSystem : String
var 
  osVerInfo    : TOSVersionInfo; 
  majorVer, minorVer : Integer; 
begin 
  result := 'unbekannt'

   usw.......

end

function GetTotalMemory: Int64; 
var 
   Memory : TMemoryStatus; 
begin 
           usw..... 
end

usw...


usw....


end.

die prozessorinfo lässt am besten wie sie ist, und übernimmst sie als unit

im form1 fügst unter 'implementation' folgendes ein:

ausblenden Delphi-Quelltext
1:
2:
uses 
prozessorinfo, unit2;

deiner unit2 solltest aber einen 'sprechenden namen' geben... möglicherweise bekommst noch fehlermeldungen, dass irgendwelche units fehlen, dann trägst sie eben in der 'uses'- zeile nach.

mfg, stefan

Moderiert von user profile iconTino: Code- durch Delphi-Tags ersetzt.
Leathl
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 276



BeitragVerfasst: Mo 03.03.03 17:50 
---


Zuletzt bearbeitet von Leathl am So 16.08.09 12:57, insgesamt 1-mal bearbeitet
Ultrabeamer Threadstarter
Hält's aus hier
Beiträge: 14



BeitragVerfasst: Mo 03.03.03 21:10 
Hi,

danke! Ich habs ausprobiert, es kommena llerdings folgende Fehlermeldungen:

Zitat:

[Error] Unit1.pas(29): Declaration expected but 'UNIT' found
[Error] Unit1.pas(38 ): Identifier redeclared: 'TForm1'
[Error] Unit1.pas(51): Identifier redeclared: 'Form1'
[Error] Unit1.pas(53): '.' expected but 'IMPLEMENTATION' found
[Error] Unit1.pas(15): Unsatisfied forward or external declaration: 'TForm1.FormCreate'
[Error] Unit1.pas(43): Unsatisfied forward or external declaration: 'TForm1.Button1Click'
[Fatal Error] Project1.dpr(6): Could not compile used unit 'Unit1.pas'


:?

_________________
Achtung, Anfänger ohne jegliche Ahnung :P
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mo 03.03.03 22:22 
So. Ohne Grundlagen wird das hier nichts. Leg das Projekt erstmal bei Seite und beschäftige dich mit einem Grundlagen-Buch oder -Tutorial. Wenn du dann weißt, wie man mit Units arbeitet, Prozeduren / Funktionen schreibt aufruft und in andere Units auslagert, dann können wir hier weiter machen. Aber mit deinem momentanen Wissensstand hat das keinen Sinn und Zweck.

Sorry aber das ist die nackte Wahrheit.
Ultrabeamer Threadstarter
Hält's aus hier
Beiträge: 14



BeitragVerfasst: Mo 03.03.03 22:49 
Joa, danke für deine ehrlichen Worte. Das habe ich mir auch schon gedacht... Naja, wenn ich mal die Zeit dazu finde, werde ich mich mal näher damit beschäftigen. Zur Zeit geht aber die Schule vor und ich werde mich damit erst in den Sommerferien beschäftigen können.

Trotzdem vielen, vielen Dank für eure schnelle und kompetente Hilfe!

Ich werde dieses Forum mal im Auge behalten für eventuelle spätere Fragen, wenn ich mich mal besser damit auskenne.

Viele Grüße

_________________
Achtung, Anfänger ohne jegliche Ahnung :P
Thunder00
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 52



BeitragVerfasst: Di 13.05.03 16:41 
Das Proggi/der Code erkennt meinen AMD Duron als Intel Pentium.

Weiß noch einer wie man die CPUID bei AMDs T-Breds rausfinden kann (obs n 680 oder n 681 is)??

_________________
If you can't make it good, at least make it looks good. (Bill Gates)
Ultrabeamer Threadstarter
Hält's aus hier
Beiträge: 14



BeitragVerfasst: Di 13.05.03 17:37 
Hi,

das geht z.B. mit WCPUID :wink:

_________________
Achtung, Anfänger ohne jegliche Ahnung :P
elysm
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 25


D6 Enter, D6 Pers, D7 Pro
BeitragVerfasst: Fr 01.08.03 13:13 
hey leutz,
wie thunder00 schon bemerkte erkennt das proggi einen AMD als Intel prozessor!

ich hab mir das alles mal angeguckt, über die procedure: procedure GetCPUInfo(Var CPUInfo: TCpuInfo); kann man doch testen lassen ob MMX unterstüzt wird oder?

dann dazu meine frage: wie kann ich es benutzen? z.b. label1.caption:=....


und dann haben wir da noch die function: Function CPUID: TCpuInfo; die liest doch die CPU aus!?

da genau das selbe: wie kann ich es benutzen?


wär cool wenn ihr mir da helfen könntet!
mfg el