Try: 

   ### Getting the parent process id using WMI ###

   # Get the WMI root on the users machine

   my $ppid;

   my $objWMIService =
Win32::OLE->GetObject("winmgmts:\\\\.\\root\\CIMV2");

   if ( defined($objWMIService) ) {

      # Get the object corresponding to Win32_Process where process id
is the current process          

      my $objProcessList = $objWMIService->ExecQuery("Select
ParentProcessId from Win32_Process WHERE ProcessId = $$");

      if (defined($objProcessList)) {

         # Get the parent process ids

         foreach my $prsObj (in($objProcessList)) {

            $ppid = $prsObj->ParentProcessId;

            last;

         }                          

      }

   }

 

________________________________

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of James
Couball
Sent: Thursday, May 03, 2007 3:20 PM
To: activeperl@listserv.ActiveState.com
Subject: getppid() on Windows

 

 

Is there a way to get the parent process id of a Windows process just
like getppid() (since getppid() doesn't seem to be implemented in
ActiveState perl)?

 

Sincerely,

James Couball

_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to