[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,21 +21,19 @@
* 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: case WM_PAINT:
{ {
HDC hDc; HDC hDc;
@ -45,11 +43,11 @@ LRESULT CALLBACK WndProc(HWND hWnd,
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);
@ -63,7 +61,7 @@ LRESULT CALLBACK WndProc(HWND hWnd,
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,
@ -71,9 +69,9 @@ int APIENTRY wWinMain(HINSTANCE hInst,
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));
@ -83,81 +81,115 @@ int APIENTRY wWinMain(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;
}
/* Load the user icons */
hIcon = (HICON)LoadImageW(hInst, MAKEINTRESOURCEW(100), IMAGE_ICON, 0, 0, LR_SHARED | LR_DEFAULTSIZE);
hIconSm = (HICON)CopyImage(hIcon, IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_COPYFROMRESOURCE);
/* WS_EX_DLGMODALFRAME */ /* WS_EX_DLGMODALFRAME */
hWnd1 = CreateWindowEx(WS_EX_DLGMODALFRAME, hWnd1a = CreateWindowExW(WS_EX_DLGMODALFRAME,
WndClass, WndClass,
L"WS_SYSMENU | WS_EX_DLGMODALFRAME", L"WS_SYSMENU | WS_EX_DLGMODALFRAME 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 (!hWnd1a)
0,
hInst,
NULL);
if(!hWnd1)
{
return 1; return 1;
}
ShowWindow(hWnd1, SW_SHOW); ShowWindow(hWnd1a, SW_SHOW);
UpdateWindow(hWnd1); UpdateWindow(hWnd1a);
hWnd2 = CreateWindowEx(WS_EX_TOOLWINDOW, /* WS_EX_DLGMODALFRAME */
hWnd1b = CreateWindowExW(WS_EX_DLGMODALFRAME,
WndClass, WndClass,
L"WS_SYSMENU | WS_EX_TOOLWINDOW", L"WS_SYSMENU | WS_EX_DLGMODALFRAME with 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,
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,
hInst,
NULL);
if(!hWnd3)
{
return 1; return 1;
}
ShowWindow(hWnd3, SW_SHOW); ShowWindow(hWnd2a, SW_SHOW);
UpdateWindow(hWnd3); UpdateWindow(hWnd2a);
while(GetMessage(&msg, NULL, 0, 0 )) hWnd2b = CreateWindowExW(WS_EX_TOOLWINDOW,
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;
ShowWindow(hWnd2b, SW_SHOW);
UpdateWindow(hWnd2b);
SendMessageW(hWnd2b, WM_SETICON, ICON_SMALL, (LPARAM)hIconSm);
SendMessageW(hWnd2b, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
hWnd3a = CreateWindowExW(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); TranslateMessage(&msg);
DispatchMessage(&msg); DispatchMessageW(&msg);
} }
UnregisterClass(WndClass, hInst); if (hIcon) DestroyIcon(hIcon);
if (hIconSm) DestroyIcon(hIconSm);
UnregisterClassW(WndClass, hInst);
return 0; return 0;
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB