S
siddharthkhare
Hi all,
I am trying to launch an process in .net as follows.I want to wait
till mainwindow handle is initialized. fowlloing code works some times
i.e i can read the value of mainwindow handle but some times it
returns 0. I see the IE launched but still mainwindow handle is 0.
I have pasted the code below.
Question on waitforinputidle()
A.Help on this method says "if process does not have a message queue,
WaitForInputIdle returns immediately"
so if i lauch internet explorer but there are no messages waiting to
be processed by this instance of IE is it possible for
waitforinputidle() to return uninitialized value of mian windows
which is 0?
B. my orginal code was like this..
m_IeProcess = Process.Start("IExplore.exe");
if i change this to
m_IeProcess = Process.Start("IExplore.exe","www.yahoo.com");
does it ensures that now if i do wait WaitForInputIdle(); and
refresh()..then check the hadle it will have value.
since we are redirecting to a URL immediatley would it ensure that
there is something(message) waiting to be proceesed and thus for IE to
navigate to this URL it has to first initialize ..including setting up
handle.
question is ...if this 'redirect to URL' same as message that
waitforinputidle() will wait for?
or message here means like user tryping key stocks which will go to
windows message que
ue?
c. if B above is not the solution ..what else can i try.except for
looping and retry. looping and retry are not really clean reliable
solutions
=============================================
m_IeProcess = Process.Start("IExplore.exe");
m_IeProcess.WaitForInputIdle();
m_IeProcess.Refresh();
//check if still 0
if (m_IeProcess.MainWindowHandle == Intptr.Zero )
{
//still zero
}
thanks
Sidd
I am trying to launch an process in .net as follows.I want to wait
till mainwindow handle is initialized. fowlloing code works some times
i.e i can read the value of mainwindow handle but some times it
returns 0. I see the IE launched but still mainwindow handle is 0.
I have pasted the code below.
Question on waitforinputidle()
A.Help on this method says "if process does not have a message queue,
WaitForInputIdle returns immediately"
so if i lauch internet explorer but there are no messages waiting to
be processed by this instance of IE is it possible for
waitforinputidle() to return uninitialized value of mian windows
which is 0?
B. my orginal code was like this..
m_IeProcess = Process.Start("IExplore.exe");
if i change this to
m_IeProcess = Process.Start("IExplore.exe","www.yahoo.com");
does it ensures that now if i do wait WaitForInputIdle(); and
refresh()..then check the hadle it will have value.
since we are redirecting to a URL immediatley would it ensure that
there is something(message) waiting to be proceesed and thus for IE to
navigate to this URL it has to first initialize ..including setting up
handle.
question is ...if this 'redirect to URL' same as message that
waitforinputidle() will wait for?
or message here means like user tryping key stocks which will go to
windows message que
ue?
c. if B above is not the solution ..what else can i try.except for
looping and retry. looping and retry are not really clean reliable
solutions
=============================================
m_IeProcess = Process.Start("IExplore.exe");
m_IeProcess.WaitForInputIdle();
m_IeProcess.Refresh();
//check if still 0
if (m_IeProcess.MainWindowHandle == Intptr.Zero )
{
//still zero
}
thanks
Sidd