AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren

Pfad zur Exe von hProcess

Ein Thema von Neutral General · begonnen am 3. Jan 2007 · letzter Beitrag vom 3. Jan 2007
 
Benutzerbild von ErazerZ
ErazerZ

Registriert seit: 27. Mai 2005
Ort: Baden
315 Beiträge
 
Delphi 2007 Enterprise
 
#6

Re: Pfad zur Exe von hProcess

  Alt 3. Jan 2007, 13:52
Delphi-Quellcode:
uses PsApi;

function GetProcessExeName(hProcess: THandle): String;
var
  lpBuffer: array[0..MAX_PATH -1] of Char;
begin
  ZeroMemory(@lpBuffer, SizeOf(lpBuffer));
  GetModuleFileNameEx(hProcess, 0, lpBuffer, SizeOf(lpBuffer));
  Result := String(lpBuffer);
end;

procedure TForm1.FormCreate(Sender: TObject);
var
  lpStartupInfo: TStartupInfo;
  lpProcessInformation: TProcessInformation;
begin
  ZeroMemory(@lpStartupInfo, sizeof(TStartupInfo));
  lpStartupInfo.cb := sizeof(TStartupInfo);
  lpStartupInfo.dwFlags := STARTF_USESHOWWINDOW;
  lpStartupInfo.wShowWindow := SW_SHOW;
  ZeroMemory(@lpProcessInformation, sizeof(TProcessInformation));
  CreateProcess(nil, 'notepad.exe', nil, nil, False, CREATE_NEW_CONSOLE, nil, nil, lpStartupInfo, lpProcessInformation);
  Application.MessageBox(PAnsiChar(GetProcessExeName(lpprocessinformation.hProcess)), 'Path', MB_ICONINFORMATION);
  TerminateProcess(lpProcessInformation.hProcess, 0);
  Application.Terminate;
end;
So, das funktioniert bei mir, aber halt nur mit PsApi und GetModuleFileNameEx (d.h. Requires Windows Vista, Windows XP, Windows 2000 Professional, or Windows NT Workstation 4.0.)
  Mit Zitat antworten Zitat
 

Themen-Optionen Thema durchsuchen
Thema durchsuchen:

Erweiterte Suche
Ansicht

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 23:31 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz