CreateProcess Problem

C

Chris Jones

Hi,
I'm using C++ Builder to write an update program for our product. I need
to be able to kick off the individual update exes for the various modules.
When I use the CreateProcess API call, the process starts, but doesn't
receive focus. This is confusing to our users.
On older versions of Windows, the focus shifts to the new process on
startup. How can I force it to work in XP?

Thanks,
Chris
 
W

William DePalo [MVP VC++ ]

Chris Jones said:
On older versions of Windows, the focus shifts to the new process on
startup. How can I force it to work in XP?

You can try calling SetForegroundWindow() on a handle of a window in the
process that you want to jump to the fore. With the introduction of '98 on
9x kernels and 2000 on NT, MS changed the rules that surround taking the
focus. If the process that creates the child processes is in already the
foreground, it should have no problem moving a child into the foreground. If
it does not, Windows will likely just flash the child process' "button" in
the taskbar.

Check the docs for AllowSetForegroundWindow(), LockSetForegroundWindow()
which were added in support of the "new" foreground policy.

Regards,
Will
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top