AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Code-Bibliothek Library: Windows API / MS.NET Framework API Delphi Anwendungspfad über das Fenster-Handle ermitteln
Thema durchsuchen
Ansicht
Themen-Optionen

Anwendungspfad über das Fenster-Handle ermitteln

Ein Thema von smallsmoker · begonnen am 1. Okt 2008
Antwort Antwort
Benutzerbild von smallsmoker
smallsmoker

Registriert seit: 12. Nov 2007
Ort: Duisburg
283 Beiträge
 
#1

Anwendungspfad über das Fenster-Handle ermitteln

  Alt 1. Okt 2008, 22:12
hi,
wie bekomme ich von einem window handle den dazugehörigen exepath ?
da ich das hier nicht gefunden habe poste ich mal meine lösung

Delphi-Quellcode:
uses
  PSAPI, TlHelp32;

[..]

function GetExeNamefromHwnd(hwindow: HWND): String;
var
  ModuleEntry: TModuleEntry32;
  hModuleEntry: THandle;
  ProcessId: Cardinal;
begin
  Result := '';
  GetWindowThreadProcessId(hwindow,ProcessId);
  if ProcessID <> INVALID_HANDLE_VALUE then
    hModuleEntry := CreateToolHelp32Snapshot(TH32CS_SNAPMODULE, ProcessId);
    if hModuleEntry <> INVALID_HANDLE_VALUE then
    begin
      ModuleEntry.dwSize := SizeOf(TModuleEntry32);
      if Module32First(hModuleEntry, ModuleEntry) then
        Result := MOduleEntry.szExePath;
      CloseHandle(hModuleEntry);
    end;
end;
Delphi-Quellcode:
//Beispielaufruf
procedure TForm1.Button1Click(Sender: TObject);
begin
  Label1.Caption := GetExeNamefromHwnd(Self.Handle);
end;
mfg smallsmoker

suchwörter: hwnd Fenster pfad

[edit=Daniel G]Code ergänzt. Mfg, Daniel G[/edit]
[edit=Daniel G]Titel des Beitrags angepasst. Mfg, Daniel G[/edit]
  Mit Zitat antworten Zitat
Antwort Antwort

Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 13:42 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz