G
Guest
Dear all,
I have an application which is suppose to start another executable process.
As soon as that process is running, I need to retrive its handle. The
problem of the particular process I am starting is that it has a welcome
window first which gets displayed and then the real windows after a while,in
other words it means that the process name is the same, but the handle I need
to retrive is the one from the final window and not the welome window.
So in real that means that from my main application I need to wait for a
while that the whol process started is really finishe to load befor getting
the real handle I am interresting on. The problem I get if I set a kind of
small loop in my main application is that the process I try to start is
freezed as long as I remain in my main application loop.
In other words how can I start my process, asynchronously from my main
application and then after a while try to retrive its handle ??
For you infor I use the follwoing code to starting it:
=================================================
.......
Dim myProcessStartInfo As New ProcessStartInfo(m_sIntouchInstallPath &
"\view.exe")
myProcessStartInfo.UseShellExecute = False
myProcess.StartInfo = myProcessStartInfo
myProcess.StartInfo.WindowStyle =
ProcessWindowStyle.Normal
myProcess.Start()
AddHandler myProcess.Exited, AddressOf MyProcessExited
' Set 'EnableRaisingEvents' to true, to raise
'Exited' event when process is terminated.
myProcess.EnableRaisingEvents = True
Dim i As Integer
While m_iViewerHandle = 0 Or i < 10
m_iViewerHandle = FindWindow(vbNullString, "VIEW")
i = i + 1
End While
m_iHandle = m_iViewerHandle
Return m_iHandle
.......
With this code, as long as I am in my While.... loop, the process I start is
freeze and my all application gets "No responding status".
To sumurize the situation I need to:
- strart my exe process without locking my my application
- retrive the correct window handle
Thanks to help me to solve my issue.
regards
CALDERARA Serge
I have an application which is suppose to start another executable process.
As soon as that process is running, I need to retrive its handle. The
problem of the particular process I am starting is that it has a welcome
window first which gets displayed and then the real windows after a while,in
other words it means that the process name is the same, but the handle I need
to retrive is the one from the final window and not the welome window.
So in real that means that from my main application I need to wait for a
while that the whol process started is really finishe to load befor getting
the real handle I am interresting on. The problem I get if I set a kind of
small loop in my main application is that the process I try to start is
freezed as long as I remain in my main application loop.
In other words how can I start my process, asynchronously from my main
application and then after a while try to retrive its handle ??
For you infor I use the follwoing code to starting it:
=================================================
.......
Dim myProcessStartInfo As New ProcessStartInfo(m_sIntouchInstallPath &
"\view.exe")
myProcessStartInfo.UseShellExecute = False
myProcess.StartInfo = myProcessStartInfo
myProcess.StartInfo.WindowStyle =
ProcessWindowStyle.Normal
myProcess.Start()
AddHandler myProcess.Exited, AddressOf MyProcessExited
' Set 'EnableRaisingEvents' to true, to raise
'Exited' event when process is terminated.
myProcess.EnableRaisingEvents = True
Dim i As Integer
While m_iViewerHandle = 0 Or i < 10
m_iViewerHandle = FindWindow(vbNullString, "VIEW")
i = i + 1
End While
m_iHandle = m_iViewerHandle
Return m_iHandle
.......
With this code, as long as I am in my While.... loop, the process I start is
freeze and my all application gets "No responding status".
To sumurize the situation I need to:
- strart my exe process without locking my my application
- retrive the correct window handle
Thanks to help me to solve my issue.
regards
CALDERARA Serge