views:

41

answers:

1

There are cases when one needs to start a process based on some events not involving activity of the mouse of keyboard (from hardware or time-based). It works with ShellExecute and ShellExecuteEx generally, but if there's a full-screen app (the one, created borderless with exactly the dimensions of the screen), this launched application don't become active or even visible. Is there a technique to bring such application to top over this full-screen app? I'm aware about ShellExecuteEx and hProcess manipulation, but it seems it involves very recent api (GetProcessId) and seems that this function has some limitations related to user rights.

Thanks

+1  A: 

You can use

SystemParametersInfo (SPI_SETFOREGROUNDLOCKTIMEOUT, 0, (PVOID)0,
                      SPIF_SENDWININICHANGE | SPIF_UPDATEINIFILE);

to do so before the process start, but you should do this temporary like described in http://stackoverflow.com/questions/3100934/how-to-ensure-process-window-launched-by-process-startprocessstartinfo-has-focu/3101061#3101061.

Please do this only you really need to start a process on top.

Oleg