I have written this utility (exe) which can be said from within this host application and I like it The utility can only be called from the host application. Running it out or from a different host should immediately end the utility.
Is there a way to find out the process of starting my process?
Thanks for the reply.
You can use the function to enumerate the process list that is running and then The function for which the identifier is the process that created this process (its basic process).
Check out this example.
Psapi, Windows, TLHLP32, uses SysUtils; Function GetTheParentProcessFileName (): string; Conf Buffer Size = 40 9 6; Var handle snapshot: Thandal; Enterprise Process: Process Entry 32; Current process ID: DWOD; Handlift Prokr: Thandal; Parentprosses ID: Dedorf; Parental processing: Boolean; Parent Proclam: String; Starting parent processing found: = false; Handle snapshot: = ContentHold 3 snapshot (TH32CS_SNAPPROCESS, 0); // handle the process if HandleSnapShot & lt; & Gt; INVALID_HANDLE_VALUE Then start EntryParentProc.dwSize: = SizeOf (EntryParentProc); If Process32First (HandleSnapShot, EntryParentProc) then starts / first process the currentProcessId: GetCurrentProcessId (); // Get current process repeat ID if EntryParentProc.th32ProcessID = CurrentProcessId then starts ParentProcessId: = EntryParentProc.th32ParentProcessID; // Get the basic process ID HandleParentProc: = OpenProcess (PROCESS_QUERY_INFORMATION or PROCESS_VM_READ, False, ParentProcessId); If Handlerentent Pro & lt; & Gt; 0 Then start Parent Processes: = True; Setlanda (parentpropass, buffers); GetModuleFileNameEx (Handlerent Pro, 0, Pichar (Parent Process Path), Buffers); Parent Proclam: = Pichar (Parent Proclam); CloseHandle (HandleParentProc); End; break; End; Until Process32Next (HandleSnapShot, EntryParentProc) is not; End; CloseHandle (HandleSnapShot); End; If parent processing results then: Results = ParentProcPath and Results: = ''; End;
Comments
Post a Comment