mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 18:15:11 +00:00
Added desktop part of explorer clone by Andrew "Silver Blade" Greenwood.
svn path=/trunk/; revision=5005
This commit is contained in:
parent
48802da388
commit
9fa9badcf4
4 changed files with 189 additions and 0 deletions
108
reactos/subsys/system/explorer/desktop.c
Normal file
108
reactos/subsys/system/explorer/desktop.c
Normal file
|
@ -0,0 +1,108 @@
|
||||||
|
/*
|
||||||
|
Desktop creation example
|
||||||
|
|
||||||
|
Silver Blade (silverblade_uk@hotmail.com)
|
||||||
|
5th July 2003
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <windows.h>
|
||||||
|
|
||||||
|
const char DesktopClassName[] = "DesktopWindow";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
LRESULT CALLBACK DeskWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
|
{
|
||||||
|
switch(uMsg)
|
||||||
|
{
|
||||||
|
case WM_CLOSE :
|
||||||
|
{
|
||||||
|
// Over-ride close. We need to close desktop some other way.
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
case WM_PAINT :
|
||||||
|
{
|
||||||
|
// We'd want to draw the desktop wallpaper here. Need to
|
||||||
|
// maintain a copy of the wallpaper in an off-screen DC and then
|
||||||
|
// bitblt (or stretchblt?) it to the screen appropriately. For
|
||||||
|
// now, though, we'll just draw some text.
|
||||||
|
|
||||||
|
PAINTSTRUCT ps;
|
||||||
|
HDC DesktopDC = BeginPaint(hwnd, &ps);
|
||||||
|
|
||||||
|
char Text [] = "ReactOS 0.1.2 Desktop Example\nby Silver Blade";
|
||||||
|
|
||||||
|
int Width, Height;
|
||||||
|
|
||||||
|
Width = GetSystemMetrics(SM_CXSCREEN);
|
||||||
|
Height = GetSystemMetrics(SM_CYSCREEN);
|
||||||
|
|
||||||
|
// This next part could be improved by working out how much
|
||||||
|
// space the text actually needs...
|
||||||
|
|
||||||
|
RECT r;
|
||||||
|
r.left = Width - 260;
|
||||||
|
r.top = Height - 80;
|
||||||
|
r.right = r.left + 250;
|
||||||
|
r.bottom = r.top + 40;
|
||||||
|
|
||||||
|
SetTextColor(DesktopDC, 0x00ffffff);
|
||||||
|
SetBkMode(DesktopDC, TRANSPARENT);
|
||||||
|
DrawText(DesktopDC, &Text, -1, &r, DT_RIGHT);
|
||||||
|
|
||||||
|
EndPaint(hwnd, &ps);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return DefWindowProc(hwnd, uMsg, wParam, lParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
WNDCLASSEX wc;
|
||||||
|
|
||||||
|
wc.cbSize = sizeof(WNDCLASSEX);
|
||||||
|
wc.style = 0;
|
||||||
|
wc.lpfnWndProc = &DeskWndProc;
|
||||||
|
wc.cbClsExtra = 0;
|
||||||
|
wc.cbWndExtra = 0;
|
||||||
|
wc.hInstance = GetModuleHandle(NULL);
|
||||||
|
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
|
||||||
|
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||||
|
wc.hbrBackground= (HBRUSH) GetStockObject(BLACK_BRUSH);
|
||||||
|
wc.lpszMenuName = NULL;
|
||||||
|
wc.lpszClassName= DesktopClassName;
|
||||||
|
wc.hIconSm = NULL;
|
||||||
|
|
||||||
|
if (! RegisterClassEx(&wc))
|
||||||
|
return 1; // error
|
||||||
|
|
||||||
|
|
||||||
|
HWND Desktop;
|
||||||
|
int Width, Height;
|
||||||
|
|
||||||
|
Width = GetSystemMetrics(SM_CXSCREEN);
|
||||||
|
Height = GetSystemMetrics(SM_CYSCREEN);
|
||||||
|
|
||||||
|
Desktop = CreateWindowEx(0, DesktopClassName, "Desktop",
|
||||||
|
WS_VISIBLE | WS_POPUP | WS_CLIPCHILDREN,
|
||||||
|
0, 0, Width, Height,
|
||||||
|
NULL, NULL, GetModuleHandle(NULL), NULL);
|
||||||
|
|
||||||
|
if (! Desktop)
|
||||||
|
return 1; // error
|
||||||
|
|
||||||
|
MSG Msg;
|
||||||
|
|
||||||
|
while (GetMessage(&Msg, 0, 0, 0) != 0)
|
||||||
|
{
|
||||||
|
TranslateMessage(&Msg);
|
||||||
|
DispatchMessage(&Msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0; // get the return code!
|
||||||
|
}
|
38
reactos/subsys/system/explorer/explorer.rc
Normal file
38
reactos/subsys/system/explorer/explorer.rc
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
#include <defines.h>
|
||||||
|
#include <reactos/resource.h>
|
||||||
|
|
||||||
|
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||||
|
|
||||||
|
VS_VERSION_INFO VERSIONINFO
|
||||||
|
FILEVERSION RES_UINT_FV_MAJOR,RES_UINT_FV_MINOR,RES_UINT_FV_REVISION,RES_UINT_FV_BUILD
|
||||||
|
PRODUCTVERSION RES_UINT_PV_MAJOR,RES_UINT_PV_MINOR,RES_UINT_PV_REVISION,RES_UINT_PV_BUILD
|
||||||
|
FILEFLAGSMASK 0x3fL
|
||||||
|
#ifdef _DEBUG
|
||||||
|
FILEFLAGS 0x1L
|
||||||
|
#else
|
||||||
|
FILEFLAGS 0x0L
|
||||||
|
#endif
|
||||||
|
FILEOS 0x40004L
|
||||||
|
FILETYPE 0x2L
|
||||||
|
FILESUBTYPE 0x0L
|
||||||
|
BEGIN
|
||||||
|
BLOCK "StringFileInfo"
|
||||||
|
BEGIN
|
||||||
|
BLOCK "040904b0"
|
||||||
|
BEGIN
|
||||||
|
VALUE "CompanyName", RES_STR_COMPANY_NAME
|
||||||
|
VALUE "FileDescription", "ReactOS Explorer\0"
|
||||||
|
VALUE "FileVersion", RES_STR_FILE_VERSION
|
||||||
|
VALUE "InternalName", "explorer\0"
|
||||||
|
VALUE "LegalCopyright", RES_STR_LEGAL_COPYRIGHT
|
||||||
|
VALUE "OriginalFilename", "explorer.exe\0"
|
||||||
|
VALUE "ProductName", RES_STR_PRODUCT_NAME
|
||||||
|
VALUE "ProductVersion", RES_STR_PRODUCT_VERSION
|
||||||
|
END
|
||||||
|
END
|
||||||
|
BLOCK "VarFileInfo"
|
||||||
|
BEGIN
|
||||||
|
VALUE "Translation", 0x409, 1200
|
||||||
|
END
|
||||||
|
END
|
||||||
|
|
18
reactos/subsys/system/explorer/makefile_rex
Normal file
18
reactos/subsys/system/explorer/makefile_rex
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
PATH_TO_TOP = ../../..
|
||||||
|
|
||||||
|
TARGET_TYPE = program
|
||||||
|
|
||||||
|
TARGET_APPTYPE = windows
|
||||||
|
|
||||||
|
TARGET_SDKLIBS = gdi32.a
|
||||||
|
|
||||||
|
TARGET_NAME = explorer
|
||||||
|
|
||||||
|
TARGET_OBJECTS = \
|
||||||
|
desktop.o
|
||||||
|
|
||||||
|
include $(PATH_TO_TOP)/rules.mak
|
||||||
|
|
||||||
|
include $(TOOLS_PATH)/helper.mk
|
||||||
|
|
||||||
|
# EOF
|
25
reactos/subsys/system/explorer/readme.txt
Normal file
25
reactos/subsys/system/explorer/readme.txt
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
Desktop Example
|
||||||
|
---------------
|
||||||
|
|
||||||
|
This program doesn't do much, apart from create a window which could be
|
||||||
|
used as a desktop.
|
||||||
|
|
||||||
|
It's pretty straightforward. It creates a window the size of the screen,
|
||||||
|
displays some text in the corner, and then disables ALT+F4.
|
||||||
|
|
||||||
|
Ideally, this would be incorporated into some other part of ReactOS, where
|
||||||
|
it could be closed in a controlled manner (ie, when the user wishes to exit
|
||||||
|
the GUI.)
|
||||||
|
|
||||||
|
Hope someone finds it of some use. I think it should run before the
|
||||||
|
explorer clone (taskbar) to get the wallpaper displayed (since when
|
||||||
|
explorer crashes on Windows, the wallpaper is always displayed, and there
|
||||||
|
is always a desktop, even with no icons, when the login window is shown.)
|
||||||
|
|
||||||
|
It obviously is in need of some improvement, such as wallpaper actually
|
||||||
|
being drawn (stretch, center/centre and tile...)
|
||||||
|
|
||||||
|
So, feel free to play around with it.
|
||||||
|
|
||||||
|
Andrew "Silver Blade" Greenwood
|
||||||
|
silverblade_uk@hotmail.com
|
Loading…
Reference in a new issue