you'll need to get the hWnd of the browser first
require 'Win32API'
ie = IE.new
ie.goto "www.google.com"
hWnd = ie.ie.hWnd
pid=" " * 32
thread= Win32API.new("user32", "GetWindowThreadProcessId", 'IP',
'I').Call(hWnd,pid)
puts pid.unpack("L")[0]
----- Original Message -----
From: Chris McMahon <[EMAIL PROTECTED]>
Date: Monday, November 7, 2005 10:33 am
Subject: Re: [Wtr-general] iexplore process remains after closing IE?
> Paul, I'm not following your example below. It's clearly valid code,
> I run it and pid.unpack("L")[0] is "538976288", but I don't get how
> the pid is related to a Watir "IE.new". Sorry if it's a silly
> question, but I'm not getting it...
> -Chris
>
> On 11/5/05, Paul Rogers <[EMAIL PROTECTED]> wrote:
> > Try this
> >
> > require 'Win32API'
> >
> > hWnd = 985158 # use the hWnd for your process
> > # pid is a dword
> > pid=" " * 32
> > thread= Win32API.new("user32", "GetWindowThreadProcessId", 'IP',
> > 'I').Call(hWnd,pid)
> > puts pid.unpack("L")[0]
> >
> > I think you can do ie.hWnd to get the hWnd on the second line
> >
> > Paul
> >
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [EMAIL PROTECTED] On Behalf Of Sy Ali
> > Sent: 04 November 2005 15:04
> > To: [email protected]
> > Subject: Re: [Wtr-general] iexplore process remains after
> closing IE?
> >
> >
> > On 10/31/05, Jeff Wood <[EMAIL PROTECTED]> wrote:
> > > require 'watir'
> > > include Watir
> > >
> > > ie = IE.new
> > > ie.goto "www.google.com"
> > > ie.close
> >
> > Is there a way to report the pid of IE.new ?
> >
> > _______________________________________________
> > Wtr-general mailing list
> > [email protected]
> > http://rubyforge.org/mailman/listinfo/wtr-general
> >
> > _______________________________________________
> > Wtr-general mailing list
> > [email protected]
> > http://rubyforge.org/mailman/listinfo/wtr-general
> >
>
> _______________________________________________
> Wtr-general mailing list
> [email protected]
> http://rubyforge.org/mailman/listinfo/wtr-general
>
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general