2 * Focus and activation functions
4 * Copyright 1993 David Metcalfe
5 * Copyright 1995 Alex Korobka
6 * Copyright 1994, 2002 Alexandre Julliard
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 #include "user_private.h"
24 #include "wine/server.h"
27 /*******************************************************************
28 * SetForegroundWindow (USER32.@)
30 BOOL WINAPI
SetForegroundWindow( HWND hwnd
)
32 return NtUserSetForegroundWindow( hwnd
);
36 /*******************************************************************
37 * GetActiveWindow (USER32.@)
39 HWND WINAPI
GetActiveWindow(void)
42 info
.cbSize
= sizeof(info
);
43 return NtUserGetGUIThreadInfo( GetCurrentThreadId(), &info
) ? info
.hwndActive
: 0;
47 /*****************************************************************
50 HWND WINAPI
GetFocus(void)
53 info
.cbSize
= sizeof(info
);
54 return NtUserGetGUIThreadInfo( GetCurrentThreadId(), &info
) ? info
.hwndFocus
: 0;
58 /***********************************************************************
59 * SetShellWindowEx (USER32.@)
60 * hwndShell = Progman[Program Manager]
61 * |-> SHELLDLL_DefView
62 * hwndListView = | |-> SysListView32
63 * | | |-> tooltips_class32
69 BOOL WINAPI
SetShellWindowEx(HWND hwndShell
, HWND hwndListView
)
76 if (GetWindowLongW(hwndShell
, GWL_EXSTYLE
) & WS_EX_TOPMOST
)
79 if (hwndListView
!= hwndShell
)
80 if (GetWindowLongW(hwndListView
, GWL_EXSTYLE
) & WS_EX_TOPMOST
)
83 if (hwndListView
&& hwndListView
!=hwndShell
)
84 NtUserSetWindowPos( hwndListView
, HWND_BOTTOM
, 0, 0, 0, 0, SWP_NOMOVE
|SWP_NOSIZE
|SWP_NOACTIVATE
);
86 NtUserSetWindowPos( hwndShell
, HWND_BOTTOM
, 0, 0, 0, 0, SWP_NOMOVE
|SWP_NOSIZE
|SWP_NOACTIVATE
);
88 SERVER_START_REQ(set_global_windows
)
90 req
->flags
= SET_GLOBAL_SHELL_WINDOWS
;
91 req
->shell_window
= wine_server_user_handle( hwndShell
);
92 req
->shell_listview
= wine_server_user_handle( hwndListView
);
93 ret
= !wine_server_call_err(req
);
101 /*******************************************************************
102 * SetShellWindow (USER32.@)
104 BOOL WINAPI
SetShellWindow(HWND hwndShell
)
106 return SetShellWindowEx(hwndShell
, hwndShell
);
110 /*******************************************************************
111 * GetShellWindow (USER32.@)
113 HWND WINAPI
GetShellWindow(void)
117 SERVER_START_REQ(set_global_windows
)
120 if (!wine_server_call_err(req
))
121 hwndShell
= wine_server_ptr_handle( reply
->old_shell_window
);
129 /***********************************************************************
130 * SetProgmanWindow (USER32.@)
132 HWND WINAPI
SetProgmanWindow ( HWND hwnd
)
134 SERVER_START_REQ(set_global_windows
)
136 req
->flags
= SET_GLOBAL_PROGMAN_WINDOW
;
137 req
->progman_window
= wine_server_user_handle( hwnd
);
138 if (wine_server_call_err( req
)) hwnd
= 0;
145 /***********************************************************************
146 * GetProgmanWindow (USER32.@)
148 HWND WINAPI
GetProgmanWindow(void)
152 SERVER_START_REQ(set_global_windows
)
155 if (!wine_server_call_err(req
))
156 ret
= wine_server_ptr_handle( reply
->old_progman_window
);
163 /***********************************************************************
164 * SetTaskmanWindow (USER32.@)
166 * hwnd = MSTaskSwWClass
167 * |-> SysTabControl32
169 HWND WINAPI
SetTaskmanWindow ( HWND hwnd
)
171 SERVER_START_REQ(set_global_windows
)
173 req
->flags
= SET_GLOBAL_TASKMAN_WINDOW
;
174 req
->taskman_window
= wine_server_user_handle( hwnd
);
175 if (wine_server_call_err( req
)) hwnd
= 0;
181 /***********************************************************************
182 * GetTaskmanWindow (USER32.@)
184 HWND WINAPI
GetTaskmanWindow(void)
188 SERVER_START_REQ(set_global_windows
)
191 if (!wine_server_call_err(req
))
192 ret
= wine_server_ptr_handle( reply
->old_taskman_window
);