user switch actions

Hello!

I have an application with audio,
which don't like user switching.

How I can recognize user switching.

I traced the windows callback messages
and I see no specific message to use.

Have you an idea?

Erhy


switch to an other user

22:15:45|647 WndProc: switch (uMsg) NOTHING FOUND uMsg= X'46' ---WM_WINDOWPOSCHANGING
22:15:45|647 WndProc: switch (uMsg) NOTHING FOUND uMsg= X'83' ---WM_NCCALCSIZE
22:15:45|821 WndProc: switch (uMsg) NOTHING FOUND uMsg= X'47' ---WM_WINDOWPOSCHANGED
22:15:45|821 WndProc: switch (uMsg) NOTHING FOUND uMsg= X'D' ---WM_GETTEXT
22:15:45|821 WndProc: switch (uMsg) NOTHING FOUND uMsg= X'83' ---WM_NCCALCSIZE
22:15:45|821 WndProc: switch (uMsg) NOTHING FOUND uMsg= X'31E' --Desktop Window Manager (DWM) enabled or disabled


back to the user who owns this window

22:16:32|346 WndProc: switch (uMsg) NOTHING FOUND uMsg= X'7E' ---display resolution has changed
22:16:32|405 WndProc: switch (uMsg) NOTHING FOUND uMsg= X'7E'
22:16:32|742 WndProc: switch (uMsg) NOTHING FOUND uMsg= X'15' ---WM_SYSCOLORCHANGE
22:16:32|742 WndProc: switch (uMsg) NOTHING FOUND uMsg= X'1E' ---WM_TIMECHANGE
22:16:32|742 WndProc: switch (uMsg) NOTHING FOUND uMsg= X'31B' --unknown
22:16:32|743 WndProc: switch (uMsg) NOTHING FOUND uMsg= X'31A' ----theme change event
22:16:32|743 WndProc: switch (uMsg) NOTHING FOUND uMsg= X'46' ---WM_WINDOWPOSCHANGING
22:16:32|743 WndProc: switch (uMsg) NOTHING FOUND uMsg= X'83' ---WM_NCCALCSIZE
22:16:32|743 WndProc: switch (uMsg) NOTHING FOUND uMsg= X'47'
22:16:32|743 WndProc: switch (uMsg) NOTHING FOUND uMsg= X'46'
22:16:32|743 WndProc: switch (uMsg) NOTHING FOUND uMsg= X'83'
22:16:32|744 WndProc: switch (uMsg) NOTHING FOUND uMsg= X'47'
22:16:32|744 WndProc: switch (uMsg) NOTHING FOUND uMsg= X'D'
22:16:32|744 WndProc: switch (uMsg) NOTHING FOUND uMsg= X'83'
22:16:32|744 WndProc: switch (uMsg) NOTHING FOUND uMsg= X'31B' --unknown
22:16:32|744 WndProc: switch (uMsg) NOTHING FOUND uMsg= X'1A'
22:16:33|216 WndProc: switch (uMsg) NOTHING FOUND uMsg= X'1A'
22:16:35|386 WndProc: switch (uMsg) NOTHING FOUND uMsg= X'320' --WM_DWMCOLORIZATIONCOLORCHANGED
22:16:35|394 WndProc: switch (uMsg) NOTHING FOUND uMsg= X'46'
22:16:35|394 WndProc: switch (uMsg) NOTHING FOUND uMsg= X'83'
22:16:35|394 WndProc: switch (uMsg) NOTHING FOUND uMsg= X'85'
22:16:35|395 WndProc: switch (uMsg) NOTHING FOUND uMsg= X'47'
22:16:35|395 WndProc: switch (uMsg) NOTHING FOUND uMsg= X'83'
22:16:35|396 WndProc: switch (uMsg) NOTHING FOUND uMsg= X'85'
22:16:35|396 WndProc: switch (uMsg) NOTHING FOUND uMsg= X'46'
22:16:35|397 WndProc: switch (uMsg) NOTHING FOUND uMsg= X'83'
22:16:35|400 WndProc: switch (uMsg) NOTHING FOUND uMsg= X'85'
22:16:35|406 WndProc: switch (uMsg) NOTHING FOUND uMsg= X'47'
22:16:35|417 WndProc: switch (uMsg) NOTHING FOUND uMsg= X'83'
22:16:35|418 WndProc: switch (uMsg) NOTHING FOUND uMsg= X'85'
22:16:35|422 WndProc: switch (uMsg) NOTHING FOUND uMsg= X'31E' --Desktop Window Manager (DWM) enabled or disabled
22:16:35|423 WndProc: switch (uMsg) NOTHING FOUND uMsg= X'31F' --Sent when the non-client area rendering policy has changed
the solution to get messages according user switch is,
to call after CreateWindow :

WTSRegisterSessionNotification( hMyWnd, NOTIFY_FOR_THIS_SESSION);

then I coded in the windows message loop

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
case WM_WTSSESSION_CHANGE:
	switch (wParam)
	{
		
	case WTS_CONSOLE_DISCONNECT:
		stop_consuming_audio();
		break;

	case WTS_SESSION_LOCK:
		stop_consuming_audio();
		break;

	case WTS_CONSOLE_CONNECT:
		start_consuming_audio();
		break;

	case WTS_SESSION_UNLOCK:
		start_consuming_audio();
		break;
        }
break;


Topic archived. No new replies allowed.