SonicM3
asked on
How can i pull date from process to delphi
Hi, I can pull the process image names from taskmanger into delphi but I want to also pull in the description of each file.
images name username cpu memory description
for example i can pull in: sonicT.exe
but i want to pull in: sonicT.exe 1.1.0
If you check your own process window you will see descripton at the far raght, well I need to pull that into delphi.
This is my code to pull in image names:
images name username cpu memory description
for example i can pull in: sonicT.exe
but i want to pull in: sonicT.exe 1.1.0
If you check your own process window you will see descripton at the far raght, well I need to pull that into delphi.
This is my code to pull in image names:
procedure TForm1.Button1Click(Sender: TObject);
var
MyHandle: THandle;
Struct: TProcessEntry32;
begin
try
MyHandle:=CreateToolHelp32SnapShot(TH32CS_SNAPPROCESS, 0);
Struct.dwSize:=Sizeof(TProcessEntry32);
if Process32First(MyHandle, Struct) then
ListBox1.Items.Add(Struct.szExeFile);
while Process32Next(MyHandle, Struct) do
ListBox1.Items.Add(Struct.szExeFile);
except on exception do
ShowMessage('Error showing process list');
end
end;
what is this for ?
that's not the description, that's the file version !
that's not the description, that's the file version !
function GetFileVersion(const FileName: TFileName): string;
var
Major, Minor, Release, Build: word;
size, len: longword;
handle: THandle;
buffer: pchar;
pinfo: ^VS_FIXEDFILEINFO;
begin
Major := 0;
Minor := 0;
Release := 0;
Build := 0;
size := GetFileVersionInfoSize(Pointer(FileName), handle);
if size > 0 then
begin
GetMem(buffer, size);
if GetFileVersionInfo(Pointer(FileName), 0, size, buffer)
then
if VerQueryValue(buffer, '\', pointer(pinfo), len) then
begin
Major := HiWord(pinfo.dwFileVersionMS);
Minor := LoWord(pinfo.dwFileVersionMS);
Release := HiWord(pinfo.dwFileVersionLS);
Build := LoWord(pinfo.dwFileVersionLS);
end;
FreeMem(buffer);
end;
result := Format('%d.%d.%d.%d',[Major, Minor, Release, Build]);
end;
ASKER
yer i know i said i want the file description.
ignore the 1.1.0 my program shows the version inside description that was just example.
ignore the 1.1.0 my program shows the version inside description that was just example.
ASKER
just going to check the code now buddy
ASKER
when i paste this code in its just a blank screen any ideas?
ASKER
i need to know how to oupput results pls into a listbox via a button.
do you have anything else working in your "project"
besides this listing of running programs ?
besides this listing of running programs ?
ASKER
my project is massive..but i want to get this working in a blank project first so it outputs into a listbox when button1 is pressed.
ASKER
uses TLHelp32
procedure TForm1.Button1Click(Sender : TObject);
var
MyHandle: THandle;
Struct: TProcessEntry32;
begin
try
MyHandle:=CreateToolHelp32 SnapShot(T H32CS_SNAP PROCESS, 0);
Struct.dwSize:=Sizeof(TPro cessEntry3 2);
if Process32First(MyHandle, Struct) then
ListBox1.Items.Add(Struct. szExeFile) ;
while Process32Next(MyHandle, Struct) do
ListBox1.Items.Add(Struct. szExeFile) ;
except on exception do
ShowMessage('Error showing process list');
end
end;
this is the code im using VB, it works tho. Can that code be fitted into this code to see fileversion. ?
procedure TForm1.Button1Click(Sender
var
MyHandle: THandle;
Struct: TProcessEntry32;
begin
try
MyHandle:=CreateToolHelp32
Struct.dwSize:=Sizeof(TPro
if Process32First(MyHandle, Struct) then
ListBox1.Items.Add(Struct.
while Process32Next(MyHandle, Struct) do
ListBox1.Items.Add(Struct.
except on exception do
ShowMessage('Error showing process list');
end
end;
this is the code im using VB, it works tho. Can that code be fitted into this code to see fileversion. ?
ASKER
im not using vb, i mean its VB code but works perfect in delphi too.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
great
ASKER