[ROSTESTS]: Add "sysicon" test back, and augment it.

svn path=/trunk/; revision=70710
This commit is contained in:
Hermès Bélusca-Maïto 2016-02-12 15:10:59 +00:00
parent 0455477600
commit 4d930e07e8
6 changed files with 154 additions and 110 deletions

View file

@ -13,7 +13,7 @@ add_subdirectory(kmtests)
#add_subdirectory(regtests) #add_subdirectory(regtests)
add_subdirectory(rosautotest) add_subdirectory(rosautotest)
add_subdirectory(tests) add_subdirectory(tests)
#add_subdirectory(win32) add_subdirectory(win32)
add_subdirectory(winetests) add_subdirectory(winetests)

View file

@ -1 +1,2 @@
add_subdirectory(kernel32) add_subdirectory(kernel32)
add_subdirectory(user32)

View file

@ -0,0 +1 @@
add_subdirectory(sysicon)

View file

@ -0,0 +1,10 @@
list(APPEND SOURCE
sysicon.c
sysicon.rc)
add_executable(sysicon ${SOURCE})
target_link_libraries(sysicon ${PSEH_LIB})
set_module_type(sysicon win32gui UNICODE)
add_importlibs(sysicon gdi32 user32 msvcrt kernel32)
add_cd_file(TARGET sysicon DESTINATION reactos/bin FOR all)

View file

@ -21,143 +21,175 @@
* about WS_EX_DLGMODALFRAME and WS_EX_TOOLWINDOW * about WS_EX_DLGMODALFRAME and WS_EX_TOOLWINDOW
*/ */
#include "windows.h" #include <windows.h>
#include "stdio.h" #include <stdio.h>
#include "resource.h"
WCHAR WndClass[] = L"sysicon_class"; WCHAR WndClass[] = L"sysicon_class";
HICON hIcon = NULL, hIconSm = NULL;
LRESULT CALLBACK WndProc(HWND hWnd, LRESULT CALLBACK WndProc(HWND hWnd,
UINT msg, UINT msg,
WPARAM wParam, WPARAM wParam,
LPARAM lParam) LPARAM lParam)
{ {
switch (msg)
switch (msg)
{
case WM_PAINT:
{ {
HDC hDc; case WM_PAINT:
PAINTSTRUCT Ps; {
RECT Rect; HDC hDc;
GetClientRect(hWnd, &Rect); PAINTSTRUCT Ps;
RECT Rect;
GetClientRect(hWnd, &Rect);
Rect.left = 10; Rect.left = 10;
Rect.top = 10; Rect.top = 10;
Rect.right-=10; Rect.right -= 10;
Rect.bottom = 25; Rect.bottom = 25;
hDc = BeginPaint(hWnd, &Ps); hDc = BeginPaint(hWnd, &Ps);
SetBkMode( hDc, TRANSPARENT ); SetBkMode(hDc, TRANSPARENT);
DrawCaption(hWnd, hDc, &Rect, DC_GRADIENT | DC_ACTIVE | DC_TEXT | DC_ICON); DrawCaption(hWnd, hDc, &Rect, DC_GRADIENT | DC_ACTIVE | DC_TEXT | DC_ICON);
EndPaint(hWnd, &Ps); EndPaint(hWnd, &Ps);
return 0; return 0;
} }
case WM_DESTROY: case WM_DESTROY:
PostQuitMessage(0); PostQuitMessage(0);
return 0; return 0;
} }
return DefWindowProc(hWnd, msg, wParam, lParam); return DefWindowProcW(hWnd, msg, wParam, lParam);
} }
int APIENTRY wWinMain(HINSTANCE hInst, int APIENTRY wWinMain(HINSTANCE hInst,
HINSTANCE hPrevInstance, HINSTANCE hPrevInstance,
LPWSTR lpCmdLine, LPWSTR lpCmdLine,
int nCmdShow) int nCmdShow)
{ {
HWND hWnd1, hWnd2, hWnd3; HWND hWnd1a, hWnd1b, hWnd2a, hWnd2b, hWnd3a, hWnd3b;
MSG msg; MSG msg;
WNDCLASSEX wcx; WNDCLASSEXW wcx;
UINT result; UINT result;
memset(&wcx, 0, sizeof(wcx)); memset(&wcx, 0, sizeof(wcx));
wcx.cbSize = sizeof(wcx); wcx.cbSize = sizeof(wcx);
wcx.lpfnWndProc = (WNDPROC) WndProc; wcx.lpfnWndProc = (WNDPROC) WndProc;
wcx.hInstance = hInst; wcx.hInstance = hInst;
wcx.hbrBackground = (HBRUSH)COLOR_WINDOW; wcx.hbrBackground = (HBRUSH)COLOR_WINDOW;
wcx.lpszClassName = WndClass; wcx.lpszClassName = WndClass;
if(!(result = RegisterClassEx(&wcx))) if (!(result = RegisterClassExW(&wcx)))
{ return 1;
return 1;
}
/* WS_EX_DLGMODALFRAME */ /* Load the user icons */
hWnd1 = CreateWindowEx(WS_EX_DLGMODALFRAME, hIcon = (HICON)LoadImageW(hInst, MAKEINTRESOURCEW(100), IMAGE_ICON, 0, 0, LR_SHARED | LR_DEFAULTSIZE);
WndClass, hIconSm = (HICON)CopyImage(hIcon, IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_COPYFROMRESOURCE);
L"WS_SYSMENU | WS_EX_DLGMODALFRAME",
WS_CAPTION | WS_SYSMENU ,
CW_USEDEFAULT,
CW_USEDEFAULT,
400,
100,
NULL,
0,
hInst,
NULL);
if(!hWnd1) /* WS_EX_DLGMODALFRAME */
{ hWnd1a = CreateWindowExW(WS_EX_DLGMODALFRAME,
return 1; WndClass,
} L"WS_SYSMENU | WS_EX_DLGMODALFRAME without user icon",
WS_CAPTION | WS_SYSMENU ,
CW_USEDEFAULT, CW_USEDEFAULT,
400, 100,
NULL, 0,
hInst, NULL);
if (!hWnd1a)
return 1;
ShowWindow(hWnd1, SW_SHOW); ShowWindow(hWnd1a, SW_SHOW);
UpdateWindow(hWnd1); UpdateWindow(hWnd1a);
hWnd2 = CreateWindowEx(WS_EX_TOOLWINDOW, /* WS_EX_DLGMODALFRAME */
WndClass, hWnd1b = CreateWindowExW(WS_EX_DLGMODALFRAME,
L"WS_SYSMENU | WS_EX_TOOLWINDOW", WndClass,
WS_CAPTION | WS_SYSMENU , L"WS_SYSMENU | WS_EX_DLGMODALFRAME with user icon",
CW_USEDEFAULT, WS_CAPTION | WS_SYSMENU ,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
400, 400, 100,
100, NULL, 0,
NULL, hInst, NULL);
0,
hInst,
NULL);
if(!hWnd2) if (!hWnd1b)
{ return 1;
return 1;
}
ShowWindow(hWnd2, SW_SHOW); ShowWindow(hWnd1b, SW_SHOW);
UpdateWindow(hWnd2); UpdateWindow(hWnd1b);
SendMessageW(hWnd1b, WM_SETICON, ICON_SMALL, (LPARAM)hIconSm);
SendMessageW(hWnd1b, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
hWnd3 = CreateWindowEx(0, hWnd2a = CreateWindowExW(WS_EX_TOOLWINDOW,
WndClass, WndClass,
L"WS_SYSMENU ", L"WS_SYSMENU | WS_EX_TOOLWINDOW without user icon",
WS_CAPTION | WS_SYSMENU , WS_CAPTION | WS_SYSMENU ,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, 400, 100,
400, NULL, 0,
100, hInst, NULL);
NULL, if (!hWnd2a)
0, return 1;
hInst,
NULL);
if(!hWnd3) ShowWindow(hWnd2a, SW_SHOW);
{ UpdateWindow(hWnd2a);
return 1;
}
ShowWindow(hWnd3, SW_SHOW); hWnd2b = CreateWindowExW(WS_EX_TOOLWINDOW,
UpdateWindow(hWnd3); WndClass,
L"WS_SYSMENU | WS_EX_TOOLWINDOW with user icon",
WS_CAPTION | WS_SYSMENU ,
CW_USEDEFAULT, CW_USEDEFAULT,
400, 100,
NULL, 0,
hInst, NULL);
if (!hWnd2b)
return 1;
while(GetMessage(&msg, NULL, 0, 0 )) ShowWindow(hWnd2b, SW_SHOW);
{ UpdateWindow(hWnd2b);
TranslateMessage(&msg); SendMessageW(hWnd2b, WM_SETICON, ICON_SMALL, (LPARAM)hIconSm);
DispatchMessage(&msg); SendMessageW(hWnd2b, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
}
UnregisterClass(WndClass, hInst); hWnd3a = CreateWindowExW(0,
return 0; WndClass,
L"WS_SYSMENU without user icon",
WS_CAPTION | WS_SYSMENU,
CW_USEDEFAULT, CW_USEDEFAULT,
400, 100,
NULL, 0,
hInst, NULL);
if (!hWnd3a)
return 1;
ShowWindow(hWnd3a, SW_SHOW);
UpdateWindow(hWnd3a);
hWnd3b = CreateWindowExW(0,
WndClass,
L"WS_SYSMENU with user icon",
WS_CAPTION | WS_SYSMENU,
CW_USEDEFAULT, CW_USEDEFAULT,
400, 100,
NULL, 0,
hInst, NULL);
if (!hWnd3b)
return 1;
ShowWindow(hWnd3b, SW_SHOW);
UpdateWindow(hWnd3b);
SendMessageW(hWnd3b, WM_SETICON, ICON_SMALL, (LPARAM)hIconSm);
SendMessageW(hWnd3b, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
while(GetMessageW(&msg, NULL, 0, 0 ))
{
TranslateMessage(&msg);
DispatchMessageW(&msg);
}
if (hIcon) DestroyIcon(hIcon);
if (hIconSm) DestroyIcon(hIconSm);
UnregisterClassW(WndClass, hInst);
return 0;
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB