2

Hi in Windows 10 some applications like calculator ,if I run calc.exe it spawns the calculator.exe and and immediately exit cal.exe.my requirement is get the main window handle of this child process (calculator.exe) For getting the child process from parent process I tried following poweshell script. function Find-ChildProcess { param($ID=$PID)

Get-WmiObject -Class Win32_Process -Filter "ParentProcessID=$ID" | Select-Object -Property ProcessName, ProcessID, CommandLine }

This wokes with few applications like notepad but I am not getting child process for process like calculator and internet explorer.. Thank you

Sandeep Ks
  • 504
  • 3
  • 13
  • 2
    not exist general solution fo this. process can have many child processes direct and indirect. visa versa every process have inherited from process id (usual this is parent but not always) but this id valid only until parent process run. after it exit - this id already point to nothing and then can be reused for another process or thread – RbMm May 25 '17 at 23:05
  • 2
    and also window can belong to another process too. say *Calculator* (class *ApplicationFrameWindow*) belong not to *calculator.exe* but to *ApplicationFrameHost.exe* exe – RbMm May 25 '17 at 23:14
  • Thanks for your reply – Sandeep Ks May 26 '17 at 03:34

0 Answers0