Win32 ::SetForegroundWindow() not working all the time

后端 未结 2 440
情话喂你
情话喂你 2020-12-18 03:43

I\'m working on a messenging tool. The messaging window is part of a whole application. I need the window to go to the front when there are some messages coming. I\'am using

2条回答
  •  不思量自难忘°
    2020-12-18 04:12

    The system restricts which processes can set the foreground window. A process can set the foreground window only if one of the following conditions is true:

    • The process is the foreground process.
    • The process was started by the foreground process.
    • The process received the last input event.
    • There is no foreground process.
    • The foreground process is being debugged.
    • The foreground is not locked (see LockSetForegroundWindow).
    • The foreground lock time-out has expired (see SPI_GETFOREGROUNDLOCKTIMEOUT in SystemParametersInfo).
    • No menus are active.

    See the SetForegroundWindow() docs for more details.

提交回复
热议问题