DraguVaso
Tue Jul 13 09:36:47 CDT 2004
Thanks,
I just found another solution that gives me more possiblity's (checking on
the URL):
Public Shared Function ProcessTelematique2() As Integer
'Add SHDocVW.dll in the References to use this function
Dim IEWin As SHDocVw.InternetExplorer
Dim winShell = New SHDocVw.ShellWindows
For Each IEWin In winShell
MessageSilent(IEWin.LocationURL())
If (LCase(Left(IEWin.LocationURL(), 33)) =
"
http://intranet.ctlmbe.fr/beinet/") Then
Return IEWin.HWND
Exit Function
End If
Next
Return 0
End Function
Thanks anyways,
Pieter
"Stoitcho Goutsev (100) [C# MVP]" <100@100.com> wrote in message
news:%23pDLwHOaEHA.808@tk2msftngp13.phx.gbl...
> Hi DraguVaso,
>
> Explorers (window and internet) create only one process. They spawn
threads
> for each individual GUI. If I'm not mistaken office products work the same
> way. Process.MainWindowHandle enumerates all top-level windwos and returns
> the first which is created by the given process. So it returns one of the
> provess top-level widnows whichever is enumerated first.
>
> I'm pretty sure if there is no managed solution for your problem so you
> need to go ahead and use PInvoke.
> Probably you have several solutions but I'll give you two of them:
> 1. Use EnumWindows (as Process.MainWindowHandle does) and filter IE
windows
> using GetWindowThreadProcessId API
> 2. Get all process' threads (Process.Threads property) and then call
> EnumTreadWindows to narrow down the number of windows to enumerate
>
> --
> HTH
> Stoitcho Goutsev (100) [C# MVP]
>
>
> "DraguVaso" <pietercoucke@hotmail.com> wrote in message
> news:OSSLrkNaEHA.3244@TK2MSFTNGP12.phx.gbl...
> > Hi,
> >
> > I need to do osme handlings with an Internet Explorer Window. The
problem
> > is: when the user has one ore more Internet Explorers opened, this is
> > (sometimes) indicated in the Task Manager as one process and not 2 or
> more.
> > When trying to get all the IE-windowd with the "For Each p In
> > Process.GetProcessesByName("IEXPLORE")"-function, I only get 1 process
> > returned, which has as "p.MainWindowTitle" the MainWindowTitle of one of
> the
> > open IE-windows.
> >
> > Like that I'm not able to work with that IE-window I need. Does anybody
> how
> > to get arroudn this problem? Is there a way to go directly by the
> > Windows/Applications and not the Processes?
> >
> > Thanks,
> >
> > Pieter
> >
> >
>
>