Start external app with ShellExecuteEx and wait until it become initialized

蹲街弑〆低调 提交于 2019-11-30 14:05:32

You can probably achieve what you need by calling WaitForInputIdle() on each process handle returned by ShellExecute().

Waits until the specified process has finished processing its initial input and is waiting for user input with no input pending, or until the time-out interval has elapsed.

If your application has some custom initialization logic that doesn't run in UI thread then WaitForInputIdle might not help. In that case you need a mechanism to signal the previous app that you're done initializing.

For signaling you can use named pipes, sockets, some RPC mechanism or a simple file based lock.

You can always use IPC and Interpocess Synchronization to make your application communicate with (and wait for, if needed) each other, as long as you code both applications.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!