This is a multi-part message in MIME format.
--===============1192138264==
Content-class: urn:content-classes:message
Content-Type: multipart/alternative;
boundary="----_=_NextPart_001_01C78DD2.46259FD8"
This is a multi-part message in MIME format.
------_=_NextPart_001_01C78DD2.46259FD8
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Try:=20
### Getting the parent process id using WMI ###
# Get the WMI root on the users machine
my $ppid;
my $objWMIService =3D
Win32::OLE->GetObject("winmgmts:\\\\.\\root\\CIMV2");
if ( defined($objWMIService) ) {
# Get the object corresponding to Win32_Process where process id
is the current process =20
my $objProcessList =3D $objWMIService->ExecQuery("Select
ParentProcessId from Win32_Process WHERE ProcessId =3D $$");
if (defined($objProcessList)) {
# Get the parent process ids
foreach my $prsObj (in($objProcessList)) {
$ppid =3D $prsObj->ParentProcessId;
last;
} =20
}
}
=20
________________________________
From: activeperl-bounces@listserv.ActiveState.com
[mailto:activeperl-bounces@listserv.ActiveState.com] On Behalf Of James
Couball
Sent: Thursday, May 03, 2007 3:20 PM
To: activeperl@listserv.ActiveState.com
Subject: getppid() on Windows
=20
=20
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)?
=20
Sincerely,
James Couball
------_=_NextPart_001_01C78DD2.46259FD8
Content-Type: text/html;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'>Try:
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'> ### Getting the parent =
process id using
WMI ###
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'> # Get the WMI root on =
the users machine
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'> my =
$ppid;
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'> my $objWMIService =3D
Win32::OLE->GetObject("winmgmts:\\\\.\\root\\CIMV2");=
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'> if ( =
defined($objWMIService) ) {
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'> # =
Get the object corresponding to
Win32_Process where process id is the current =
process =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'> my =
$objProcessList =3D
$objWMIService->ExecQuery("Select ParentProcessId from =
Win32_Process
WHERE ProcessId =3D $$");
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'> if =
(defined($objProcessList)) {
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'> =
# Get the parent process ids
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'> =
foreach my $prsObj
(in($objProcessList)) {
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'> =
$ppid =3D
$prsObj->ParentProcessId;
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'> =
last;
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'> =
=
} =
&=
nbsp;
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'> =
}
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'> }
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'>
size=3D3
face=3D"Times New Roman">
style=3D'font-size:10.0pt;
font-family:Tahoma;font-weight:bold'>From:
size=3D2
face=3DTahoma>
activeperl-bounces@listserv.ActiveState.com
[mailto:activeperl-bounces@listserv.ActiveState.com]
style=3D'font-weight:
bold'>On Behalf Of James Couball
Sent: Thursday, May 03, =
2007 3:20
PM
To:
activeperl@listserv.ActiveState.com
Subject: getppid() on =
Windows
style=3D'font-size:
12.0pt'>
style=3D'font-size:10.0pt;
font-family:Arial'>
style=3D'font-size:10.0pt;
font-family:Arial'>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)?
style=3D'font-size:10.0pt;
font-family:Arial'>
style=3D'font-size:10.0pt;
font-family:Arial'>Sincerely,
style=3D'font-size:10.0pt;
font-family:Arial'>James Couball