Autor Beitrag
Fabian E.
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 554

Windows 7 Ultimate
Visual Studio 2008 Pro, Visual Studion 2010 Ultimate
BeitragVerfasst: Do 01.11.07 21:00 
hallo,

ich möchte aus einer exe die dateibeschreibung bzw. den namen auslesen.
das heißt aus "winword.exe" wird dann "Microsoft Office Word 2007"
den pfad der exe hab ich. ist das möglich?

vielen dank!

gruß

Doppelpost in der Dp: www.delphipraxis.net...eibung+auslesen.html
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Do 01.11.07 23:54 
Nur so zum Hinwies:
Dieses Posting ist ein Doppelpost in der DP (wie schon erwähnt) und wurde dort auch gelöst!

_________________
In the beginning was the word.
And the word was content-type: text/plain.
Mindforce
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 358

Win XP Pro / MCE, Win 98, Slax (Linux)
Delphi 07 PRO, Delphi 3+7 (mit Prdx)
BeitragVerfasst: Fr 02.11.07 01:30 
Tja.. Ich habe den Code leider nur sozugagen "falschherum" benutzt:

ausblenden 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:
uses TLHelp32;

...

procedure WindowTitleToEXE(fenstertitel: stringvar ergebnis: TStringList);
var PID: DWord;
  aSnapShotHandle: THandle;
  ContinueLoop: Boolean;
  aProcessEntry32: TProcessEntry32;
begin
  ergebnis.clear;
  GetWindowThreadProcessID(FindWindow(nil, PChar(fenstertitel)), @PID);
  aSnapShotHandle := CreateToolHelp32SnapShot(TH32CS_SNAPPROCESS, 0);
  try
    aProcessEntry32.dwSize := SizeOf(aProcessEntry32);
    ContinueLoop := Process32First(aSnapShotHandle, aProcessEntry32);
    while Integer(ContinueLoop) <> 0 do begin
      if aProcessEntry32.th32ProcessID = PID then
        ergebnis.Add(aProcessEntry32.szExeFile);
      ContinueLoop := Process32Next(aSnapShotHandle, aProcessEntry32);
    end;
  finally
    CloseHandle(aSnapShotHandle);
  end;


Und dann der Aufruf:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
procedure TForm1.Button1Click(Sender: TObject);
var slist: TStringList;
begin
  slist:=TStringList.Create;
  try
    WindowTitleToEXE('Notepad', slist);
    ListBox1.Items.AddStrings(slist);
  finally
    slist.free;
  end;
end;


Ich schätze man kann den Code auh umschreiben.
Aber du hättest auch ruhig mal bei dsdt.info oder einfach hier in der Delphi- Suche suchen können...

M!ndbyte

_________________
Our force; in mind.