Récupérer les information de mon PC avec Msinfo32.exe

yvessimon Messages postés 637 Date d'inscription mardi 22 avril 2003 Statut Membre Dernière intervention 9 janvier 2017 - 30 janv. 2006 à 10:04
yvessimon Messages postés 637 Date d'inscription mardi 22 avril 2003 Statut Membre Dernière intervention 9 janvier 2017 - 1 févr. 2006 à 13:45
Msinfo32.exe permet d'avoir des informations sur le PC.

Avec shellExecute il est possible d'exécuter Msinfo32.exe, ce qui ouvre une fénêtre.

Est-il possible de récupérer les informations de cette fénêtre ouverte par Msinfo32.exe avec DELPHI7 ?

yvessimon

4 réponses

cs_ManChesTer Messages postés 374 Date d'inscription vendredi 20 octobre 2000 Statut Modérateur Dernière intervention 15 janvier 2021
30 janv. 2006 à 21:37
Oui, tu lance Msinfo32 /report c:\MesInfo.txt

Le fichier C:\mes infos.txt contiend les infos....

Bon Coding ....

ManChesTer.
0
yvessimon Messages postés 637 Date d'inscription mardi 22 avril 2003 Statut Membre Dernière intervention 9 janvier 2017
31 janv. 2006 à 09:07
Avec windows 2000 je n'obtiens pas le fichier texte !

de plus il faut sélectionner la configuration puis exporter la fénêtre.



Comment passer ces paramètres avec Shellexecute ?



Merci

yvessimon
0
cs_ManChesTer Messages postés 374 Date d'inscription vendredi 20 octobre 2000 Statut Modérateur Dernière intervention 15 janvier 2021
31 janv. 2006 à 17:51
Voici un code qui ne me pose aucun problemes (adapter le path dans certans cas.....)

Function RunAndWait(Fname:String;TimeOut:Longint):Boolean; // Execute a file and wait until the end
var SInfo : TStartupInfo;
PInfo : TProcessInformation;
begin
Result:=False;
FillChar(SInfo,SizeOf(SInfo),0);
SInfo.cb:=SizeOf(TStartupInfo);
SInfo.dwFlags:=STARTF_USESHOWWINDOW or STARTF_FORCEONFEEDBACK;
SInfo.wShowWindow:=SW_SHOW;
if CreateProcess(nil,Pchar(Fname),nil,nil,False,NORMAL_PRIORITY_CLASS,nil,nil,SInfo,PInfo) then
if not WaitForSingleObject(PInfo.hProcess,TimeOut)=WAIT_FAILED then
Result:=True;
end;


procedure TForm1.Button1Click(Sender: TObject);
var Windir : Array[0..Max_Path] of Char;
DirOf : String;
j : integer;
begin
GetWindowsDirectory(Windir,Max_PAth);
DirOf:=String(Windir)+'\System32\DllCache\Msinfo32.Exe /report c:\MesInfo.txt';
RunAndWait(DirOf,-1); // lancer MsInfo32 et attendre qu'il se ferme
j:=0;
repeat
Sleep(10); // attendre que le fichier soit dispo....
inc(j);
until (fileexists('c:\MesInfo.txt')) or (j>100);
if j<=100 then
Memo1.Lines.LoadFromFile('c:\MesInfo.TXT')
else
Showmessage('Fichier info introuvable....');
end;

Bon Coding ....

ManChesTer.
0
yvessimon Messages postés 637 Date d'inscription mardi 22 avril 2003 Statut Membre Dernière intervention 9 janvier 2017
1 févr. 2006 à 13:45
Effectivement c'est mieux.



Par contre le fichier texte généré ne peut être lu tel quel., seulement 4 caractères s'affichent.



Je dois faire un copier coller puis sauvegarde avec un notepad pour avoir un fichier correct.

yvessimon
0
Rejoignez-nous