2 * Explorer desktop support
4 * Copyright 2006 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include <wine/debug.h>
23 #include "explorer_private.h"
25 WINE_DEFAULT_DEBUG_CHANNEL(explorer);
27 #define DESKTOP_CLASS_ATOM MAKEINTATOMW(32769)
29 static LRESULT WINAPI desktop_wnd_proc( HWND hwnd, UINT message, WPARAM wp, LPARAM lp )
31 WINE_TRACE( "got msg %x wp %x lp %lx\n", message, wp, lp );
36 if ((wp & 0xfff0) == SC_CLOSE) ExitWindows( 0, 0 );
40 return (LRESULT)SetCursor( LoadCursorA( 0, (LPSTR)IDC_ARROW ) );
46 PaintDesktop( (HDC)wp );
52 BeginPaint( hwnd, &ps );
53 if (ps.fErase) PaintDesktop( ps.hdc );
54 EndPaint( hwnd, &ps );
61 void manage_desktop(void)
64 HWND hwnd = CreateWindowExW( 0, DESKTOP_CLASS_ATOM, NULL,
65 WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
66 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN),
68 if (hwnd != GetDesktopWindow()) return; /* some other process beat us to it */
69 SetWindowLongPtrW( hwnd, GWLP_WNDPROC, (LONG_PTR)desktop_wnd_proc );
71 WINE_TRACE( "explorer starting on hwnd %p\n", hwnd );
72 while (GetMessageW( &msg, 0, 0, 0 )) DispatchMessageW( &msg );
73 WINE_TRACE( "explorer exiting for hwnd %p\n", hwnd );