紧急帮助:从我的申请开始一个过程??? [英] URGEN HELP: Starting a process from my application ???

查看:65
本文介绍了紧急帮助:从我的申请开始一个过程???的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的,


我有一个应用程序,假设启动另一个可执行程序。

一旦该进程运行,我需要检索它的手柄。我开始的特定过程的

问题是它首先显示一个欢迎的

窗口,然后在一段时间后显示真实的窗口,

换句话说它意味着进程名称是相同的,但我需要的句柄

来自最后一个窗口,而不是窗口。


所以实际上这意味着从我的主应用程序中我需要等待一个

而whol进程启动时真的需要加载才能获得

我正在进行的实际操作。如果我在我的主应用程序中设置一种

小循环,我得到的问题是我尝试启动的过程是

冻结,只要我留在我的主要应用程序循环。


换句话说,如何从我的主要的
应用程序异步启动我的进程,然后尝试重新检查它的句柄?


对于你infor我使用下面的代码来启动它:

================== ===============================


.......

Dim myProcessStartInfo作为新的ProcessStartInfo(m_sIntouchInstallPath&

" \ view.exe")

myProcessStartInfo.UseShellExecute = False

myProcess.StartInfo = myProcessStartInfo

myProcess.StartInfo.WindowStyle =

ProcessWindowStyle.Normal


myProcess.Start ()

AddHandler myProcess.Exited,AddressOf MyProcessExited

''将'EnableRaisingEvents''设置为true,以提高
''退出''事件。

myProcess.EnableRaisingEvents = True


Dim i As Integer


而m_iViewerHandle = 0或i< 10

m_iViewerHandle = FindWindow(vbNullString," VIEW")

i = i + 1

结束时


m_iHandle = m_iViewerHandle

返回m_iHandle

.......


使用此代码,因为我在我的While ....循环中,我开始的过程是冻结我的所有应用程序获得无响应状态。


为了总结我需要的情况:

- 在没有锁定我的应用程序的情况下执行我的exe程序

- 检索正确的窗口句柄

感谢帮我解决我的问题。

问候

CALDERARA Serge

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

推荐答案

我建​​议打电话你的while循环中的myProcess.WaitForExit(1000)。这将

控制其他应用程序(允许它们处理事件)并在一秒钟后(1000 mS)回到




问候

John


" serge calderara"写道:
I suggest calling myProcess.WaitForExit(1000) in your while loop. This will
give control to other apps (allowing them to process events) and come back to
your loop after a second (1000 mS).

Regards
John

"serge calderara" wrote:
亲爱的,

我有一个应用程序,假设启动另一个可执行程序。
一旦该进程运行,我需要检索它的手柄。我开始的特定过程的问题是,它首先显示一个欢迎的窗口,然后在一段时间之后显示真实的窗口,
换句话说它意味着进程名称是一样的,但是我需要回复的手柄是最后一个窗口而不是窗口的窗口。

所以实际上这意味着从我的主应用程序中我需要等待
而whol过程开始的时候真的很有意义,因为我正在进行实际处理。如果我在主应用程序中设置一种小循环,我得到的问题是,只要我保持在主应用程序循环中,我尝试启动的过程就会冻结。

换句话说,如何从我的主要应用程序异步启动我的进程,然后尝试重新检查它的句柄?

对于你infor我使用下面的代码开始吧:
========================================== =======

......将myProcessStartInfo视为新的ProcessStartInfo(m_sIntouchInstallPath&
" \ view.exe")
myProcessStartInfo.UseShellExecute = False
myProcess.StartInfo = myProcessStartInfo
myProcess.StartInfo.WindowStyle =
ProcessWindowStyle.Normal

myProcess.Start()
AddHandler myProcess.Exited,AddressOf MyProcessExited
' '设置''EnableRaisingEvents''为true,在进程终止时提升
''退出''事件。
myProcess.EnableRaisingEvents = True

Dim i As Integer m_iViewerHandle = FindWindow(vbNullString," VIEW")
i = i + 1
结束时

m_iHandle = m_iViewerHandle
返回m_iHandle
......

使用这段代码,只要我在我的While ....循环中,我开始的过程就是冻结,我的所有应用程序都得到了 ;没有响应状态。

为了总结我需要的情况:
- 在不锁定我的应用程序的情况下调整我的exe进程
- 检索正确的窗口句柄

感谢帮助我解决我的问题。
问候语
CALDERARA Serge
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



HI john,


为你的答案提供帮助。我试着根据你的b / b
来改变我的代码,但它仍然是一样的。有了这个while循环我的应用程序

在一个非响应satus和我的过程是部分启动但锁定在

欢迎屏幕。


现在如果我用任务管理器关闭我的主应用程序,我的启动过程

继续执行并完全打开.....


其他任何其他想法如何启动该过程并在没有

锁定整个应用程序的情况下检索其句柄?它似乎都在相同的上下文中运行并且

线程可能是原因..如果是这样shouzdl我创建一个线程

启动我的进程?


修改循环如下:

而m_iViewerHandle = 0

------> myProcess.WaitForExit(1000)

System.Threading.Thread.Sleep(500)

m_iViewerHandle = FindWindow(vbNullString," VIEW

- "& m_sApplicationPath)

结束时


为您提供帮助

serge


John Roper写道:
HI john,

Thnaks for your answer. I give a try by changing my code according to your
advise but it is still the same. Having this while loop place my application
in a Non Responding satus and my process is partialy started but lock at the
welcome screen.

Now if I close my main application with task manager, my started process
continue to execute and open fully .....

Any other idea how to start that process and retrive its handle without
locking the whole application ? it seems it all runs in the same context and
threads that is may be the reason.. if so shouzdl I create a thread that
launch my process ?

The modify loop isas follow :
While m_iViewerHandle = 0
------> myProcess.WaitForExit(1000)
System.Threading.Thread.Sleep(500)
m_iViewerHandle = FindWindow(vbNullString, "VIEW
- " & m_sApplicationPath)
End While

Thnaks for your help
serge

"John Roper" wrote:
我建议你在while循环中调用myProcess.WaitForExit(1000)。这将控制其他应用程序(允许它们处理事件)并在一秒钟后(1000 mS)返回到你的循环。

问候
John

serge calderara写道:
I suggest calling myProcess.WaitForExit(1000) in your while loop. This will
give control to other apps (allowing them to process events) and come back to
your loop after a second (1000 mS).

Regards
John

"serge calderara" wrote:
亲爱的,

我有一个应用程序,假设启动另一个可执行程序。
一旦该进程运行,我需要检索它的手柄。我开始的特定过程的问题是,它首先显示一个欢迎的窗口,然后在一段时间之后显示真实的窗口,
换句话说它意味着进程名称是一样的,但是我需要回复的手柄是最后一个窗口而不是窗口的窗口。

所以实际上这意味着从我的主应用程序中我需要等待
而whol过程开始的时候真的很有意义,因为我正在进行实际处理。如果我在主应用程序中设置一种小循环,我得到的问题是,只要我保持在主应用程序循环中,我尝试启动的过程就会冻结。

换句话说,如何从我的主要应用程序异步启动我的进程,然后尝试重新检查它的句柄?

对于你infor我使用下面的代码开始吧:
========================================== =======

......将myProcessStartInfo视为新的ProcessStartInfo(m_sIntouchInstallPath&
" \ view.exe")
myProcessStartInfo.UseShellExecute = False
myProcess.StartInfo = myProcessStartInfo
myProcess.StartInfo.WindowStyle =
ProcessWindowStyle.Normal

myProcess.Start()
AddHandler myProcess.Exited,AddressOf MyProcessExited
' '设置''EnableRaisingEvents''为true,在进程终止时提升
''退出''事件。
myProcess.EnableRaisingEvents = True

Dim i As Integer m_iViewerHandle = FindWindow(vbNullString," VIEW")
i = i + 1
结束时

m_iHandle = m_iViewerHandle
返回m_iHandle
......

使用这段代码,只要我在我的While ....循环中,我开始的过程就是冻结,我的所有应用程序都得到了 ;没有响应状态。

为了总结我需要的情况:
- 在不锁定我的应用程序的情况下调整我的exe进程
- 检索正确的窗口句柄

感谢帮助我解决我的问题。
问候语
CALDERARA Serge
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



嗨Serge,


您的应用程序会在您等待和睡眠时冻结,但新过程

不应该。也许值得尝试UseShellExecute = True?如果你要改变标准输出/输出,你只需要
真的需要设置为False。


干杯

John


" serge calderara"写道:
Hi Serge,

Your app will freeze while you wait and sleep, but the new process
shouldn''t. Perhaps it would be worth trying UseShellExecute = True? You only
really need to set this to False if you are going to change stdin/out.

Cheers
John

"serge calderara" wrote:
HI john,

为你的答案提供帮助。我试着根据你的建议改变我的代码,但它仍然是一样的。有了这个while循环将我的应用程序放在一个非响应的satus中,我的过程部分启动,但锁定在
欢迎屏幕。

现在如果我用任务关闭我的主应用程序经理,我的开始流程
继续执行并完全打开.....

任何其他想法如何启动该过程并在不锁定整个应用程序的情况下重置其句柄?它似乎都在相同的上下文中运行并且
线程可能是原因..如果是这样shouzdl我创建了一个启动我的进程的线程?

修改循环isas如下:
m_iViewerHandle = 0
------> myProcess.WaitForExit(1000)
System.Threading.Thread.Sleep(500)
m_iViewerHandle = FindWindow(vbNullString," VIEW
- &&;& m_sApplicationPath)
结束时

为你的帮助提供帮助


John Roper写道:
HI john,

Thnaks for your answer. I give a try by changing my code according to your
advise but it is still the same. Having this while loop place my application
in a Non Responding satus and my process is partialy started but lock at the
welcome screen.

Now if I close my main application with task manager, my started process
continue to execute and open fully .....

Any other idea how to start that process and retrive its handle without
locking the whole application ? it seems it all runs in the same context and
threads that is may be the reason.. if so shouzdl I create a thread that
launch my process ?

The modify loop isas follow :
While m_iViewerHandle = 0
------> myProcess.WaitForExit(1000)
System.Threading.Thread.Sleep(500)
m_iViewerHandle = FindWindow(vbNullString, "VIEW
- " & m_sApplicationPath)
End While

Thnaks for your help
serge

"John Roper" wrote:
我建议你在while循环中调用myProcess.WaitForExit(1000)。这将控制其他应用程序(允许它们处理事件)并在一秒钟后(1000 mS)返回到你的循环。

问候
John

serge calderara写道:
I suggest calling myProcess.WaitForExit(1000) in your while loop. This will
give control to other apps (allowing them to process events) and come back to
your loop after a second (1000 mS).

Regards
John

"serge calderara" wrote:
亲爱的,

我有一个应用程序,假设启动另一个可执行程序。
一旦该进程运行,我需要检索它的手柄。我开始的特定过程的问题是,它首先显示一个欢迎的窗口,然后在一段时间之后显示真实的窗口,
换句话说它意味着进程名称是一样的,但是我需要回复的手柄是最后一个窗口而不是窗口的窗口。

所以实际上这意味着从我的主应用程序中我需要等待
而whol过程开始的时候真的很有意义,因为我正在进行实际处理。如果我在主应用程序中设置一种小循环,我得到的问题是,只要我保持在主应用程序循环中,我尝试启动的过程就会冻结。

换句话说,如何从我的主要应用程序异步启动我的进程,然后尝试重新检查它的句柄?

对于你infor我使用下面的代码开始吧:
========================================== =======

......将myProcessStartInfo视为新的ProcessStartInfo(m_sIntouchInstallPath&
" \ view.exe")
myProcessStartInfo.UseShellExecute = False
myProcess.StartInfo = myProcessStartInfo
myProcess.StartInfo.WindowStyle =
ProcessWindowStyle.Normal

myProcess.Start()
AddHandler myProcess.Exited,AddressOf MyProcessExited
' '设置''EnableRaisingEvents''为true,在进程终止时提升
''退出''事件。
myProcess.EnableRaisingEvents = True

Dim i As Integer m_iViewerHandle = FindWindow(vbNullString," VIEW")
i = i + 1
结束时

m_iHandle = m_iViewerHandle
返回m_iHandle
......

使用这段代码,只要我在我的While ....循环中,我开始的过程就是冻结,我的所有应用程序都得到了 ;没有响应状态。

为了总结我需要的情况:
- 在不锁定我的应用程序的情况下调整我的exe进程
- 检索正确的窗口句柄

感谢您帮助我解决我的问题。
问候语
CALDERARA Serge
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



这篇关于紧急帮助:从我的申请开始一个过程???的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆