WinQueryExtIdFocus
Definition for 16-bit programs:
USHORT EXPENTRY WinQueryExtIdFocus(PUSHORT pSessionId);
Definition for 32-bit programs:
USHORT APIENTRY16 WIN16QUERYEXTIDFOCUS(PUSHORT pSessionId); #define WinQueryExtIdFocus WIN16QUERYEXTIDFOCUS
Notes:
When the Session Manager switches to another session (because of a DosSMSwitch() call), it calls internally WinSetExtIdFocus() too, if PM is present, to notify it about session switching. This API can be used to query the last session told to PM.
Experiment shows that this API can be used to see if PM is the current foreground full-screen session, or not. The DosQuerySysState() API with the parameter QSV_FOREGROUND_FS_SESSION should return the session ID of the current foreground session, which is always 1 for PM. Unfortunately, it returns some other session ID, because it changes as the user changes focus between windowed VIO applications.
The WinQueryExtIdFocus() returns the same session ID that is returned by DosQuerySysState() when the PM is in foreground, but returns a different one, if PM is in the background.