0

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

Maksee
  • 2,311
  • 2
  • 24
  • 34
  • Have you tried setting "always on top"? – Anon. Jun 29 '10 at 22:00
  • 1
    Stealing focus is a huge pet peve of most users. I'd seriously meditate on whether this is a good idea. Just think of all the gamers you'll infuriate. – Cogwheel Jun 29 '10 at 22:01

1 Answers1

1

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 How to ensure process window launched by Process.Start(ProcessStartInfo) has focus of all Forms?.

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

Community
  • 1
  • 1
Oleg
  • 220,925
  • 34
  • 403
  • 798