mirror of
https://github.com/reactos/reactos.git
synced 2025-04-21 12:40:33 +00:00
[ROSTESTS]: Add "sysicon" test back, and augment it.
svn path=/trunk/; revision=70710
This commit is contained in:
parent
0455477600
commit
4d930e07e8
6 changed files with 154 additions and 110 deletions
|
@ -13,7 +13,7 @@ add_subdirectory(kmtests)
|
|||
#add_subdirectory(regtests)
|
||||
add_subdirectory(rosautotest)
|
||||
add_subdirectory(tests)
|
||||
#add_subdirectory(win32)
|
||||
add_subdirectory(win32)
|
||||
add_subdirectory(winetests)
|
||||
|
||||
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
add_subdirectory(kernel32)
|
||||
add_subdirectory(user32)
|
||||
|
|
1
rostests/win32/user32/CMakeLists.txt
Normal file
1
rostests/win32/user32/CMakeLists.txt
Normal file
|
@ -0,0 +1 @@
|
|||
add_subdirectory(sysicon)
|
10
rostests/win32/user32/sysicon/CMakeLists.txt
Normal file
10
rostests/win32/user32/sysicon/CMakeLists.txt
Normal 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)
|
|
@ -21,143 +21,175 @@
|
|||
* about WS_EX_DLGMODALFRAME and WS_EX_TOOLWINDOW
|
||||
*/
|
||||
|
||||
#include "windows.h"
|
||||
#include "stdio.h"
|
||||
#include "resource.h"
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
|
||||
WCHAR WndClass[] = L"sysicon_class";
|
||||
HICON hIcon = NULL, hIconSm = NULL;
|
||||
|
||||
LRESULT CALLBACK WndProc(HWND hWnd,
|
||||
UINT msg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
UINT msg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
{
|
||||
|
||||
switch (msg)
|
||||
{
|
||||
|
||||
case WM_PAINT:
|
||||
switch (msg)
|
||||
{
|
||||
HDC hDc;
|
||||
PAINTSTRUCT Ps;
|
||||
RECT Rect;
|
||||
GetClientRect(hWnd, &Rect);
|
||||
case WM_PAINT:
|
||||
{
|
||||
HDC hDc;
|
||||
PAINTSTRUCT Ps;
|
||||
RECT Rect;
|
||||
GetClientRect(hWnd, &Rect);
|
||||
|
||||
Rect.left = 10;
|
||||
Rect.top = 10;
|
||||
Rect.right-=10;
|
||||
Rect.bottom = 25;
|
||||
Rect.left = 10;
|
||||
Rect.top = 10;
|
||||
Rect.right -= 10;
|
||||
Rect.bottom = 25;
|
||||
|
||||
hDc = BeginPaint(hWnd, &Ps);
|
||||
SetBkMode( hDc, TRANSPARENT );
|
||||
hDc = BeginPaint(hWnd, &Ps);
|
||||
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:
|
||||
PostQuitMessage(0);
|
||||
return 0;
|
||||
}
|
||||
case WM_DESTROY:
|
||||
PostQuitMessage(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return DefWindowProc(hWnd, msg, wParam, lParam);
|
||||
return DefWindowProcW(hWnd, msg, wParam, lParam);
|
||||
}
|
||||
|
||||
int APIENTRY wWinMain(HINSTANCE hInst,
|
||||
HINSTANCE hPrevInstance,
|
||||
LPWSTR lpCmdLine,
|
||||
int nCmdShow)
|
||||
HINSTANCE hPrevInstance,
|
||||
LPWSTR lpCmdLine,
|
||||
int nCmdShow)
|
||||
{
|
||||
HWND hWnd1, hWnd2, hWnd3;
|
||||
MSG msg;
|
||||
WNDCLASSEX wcx;
|
||||
UINT result;
|
||||
HWND hWnd1a, hWnd1b, hWnd2a, hWnd2b, hWnd3a, hWnd3b;
|
||||
MSG msg;
|
||||
WNDCLASSEXW wcx;
|
||||
UINT result;
|
||||
|
||||
memset(&wcx, 0, sizeof(wcx));
|
||||
wcx.cbSize = sizeof(wcx);
|
||||
wcx.lpfnWndProc = (WNDPROC) WndProc;
|
||||
wcx.hInstance = hInst;
|
||||
wcx.hbrBackground = (HBRUSH)COLOR_WINDOW;
|
||||
wcx.lpszClassName = WndClass;
|
||||
memset(&wcx, 0, sizeof(wcx));
|
||||
wcx.cbSize = sizeof(wcx);
|
||||
wcx.lpfnWndProc = (WNDPROC) WndProc;
|
||||
wcx.hInstance = hInst;
|
||||
wcx.hbrBackground = (HBRUSH)COLOR_WINDOW;
|
||||
wcx.lpszClassName = WndClass;
|
||||
|
||||
if(!(result = RegisterClassEx(&wcx)))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
if (!(result = RegisterClassExW(&wcx)))
|
||||
return 1;
|
||||
|
||||
/* WS_EX_DLGMODALFRAME */
|
||||
hWnd1 = CreateWindowEx(WS_EX_DLGMODALFRAME,
|
||||
WndClass,
|
||||
L"WS_SYSMENU | WS_EX_DLGMODALFRAME",
|
||||
WS_CAPTION | WS_SYSMENU ,
|
||||
CW_USEDEFAULT,
|
||||
CW_USEDEFAULT,
|
||||
400,
|
||||
100,
|
||||
NULL,
|
||||
0,
|
||||
hInst,
|
||||
NULL);
|
||||
/* 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);
|
||||
|
||||
if(!hWnd1)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
/* WS_EX_DLGMODALFRAME */
|
||||
hWnd1a = CreateWindowExW(WS_EX_DLGMODALFRAME,
|
||||
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);
|
||||
UpdateWindow(hWnd1);
|
||||
ShowWindow(hWnd1a, SW_SHOW);
|
||||
UpdateWindow(hWnd1a);
|
||||
|
||||
hWnd2 = CreateWindowEx(WS_EX_TOOLWINDOW,
|
||||
WndClass,
|
||||
L"WS_SYSMENU | WS_EX_TOOLWINDOW",
|
||||
WS_CAPTION | WS_SYSMENU ,
|
||||
CW_USEDEFAULT,
|
||||
CW_USEDEFAULT,
|
||||
400,
|
||||
100,
|
||||
NULL,
|
||||
0,
|
||||
hInst,
|
||||
NULL);
|
||||
/* WS_EX_DLGMODALFRAME */
|
||||
hWnd1b = CreateWindowExW(WS_EX_DLGMODALFRAME,
|
||||
WndClass,
|
||||
L"WS_SYSMENU | WS_EX_DLGMODALFRAME with user icon",
|
||||
WS_CAPTION | WS_SYSMENU ,
|
||||
CW_USEDEFAULT, CW_USEDEFAULT,
|
||||
400, 100,
|
||||
NULL, 0,
|
||||
hInst, NULL);
|
||||
|
||||
if(!hWnd2)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
if (!hWnd1b)
|
||||
return 1;
|
||||
|
||||
ShowWindow(hWnd2, SW_SHOW);
|
||||
UpdateWindow(hWnd2);
|
||||
ShowWindow(hWnd1b, SW_SHOW);
|
||||
UpdateWindow(hWnd1b);
|
||||
SendMessageW(hWnd1b, WM_SETICON, ICON_SMALL, (LPARAM)hIconSm);
|
||||
SendMessageW(hWnd1b, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
|
||||
|
||||
hWnd3 = CreateWindowEx(0,
|
||||
WndClass,
|
||||
L"WS_SYSMENU ",
|
||||
WS_CAPTION | WS_SYSMENU ,
|
||||
CW_USEDEFAULT,
|
||||
CW_USEDEFAULT,
|
||||
400,
|
||||
100,
|
||||
NULL,
|
||||
0,
|
||||
hInst,
|
||||
NULL);
|
||||
hWnd2a = CreateWindowExW(WS_EX_TOOLWINDOW,
|
||||
WndClass,
|
||||
L"WS_SYSMENU | WS_EX_TOOLWINDOW without user icon",
|
||||
WS_CAPTION | WS_SYSMENU ,
|
||||
CW_USEDEFAULT, CW_USEDEFAULT,
|
||||
400, 100,
|
||||
NULL, 0,
|
||||
hInst, NULL);
|
||||
if (!hWnd2a)
|
||||
return 1;
|
||||
|
||||
if(!hWnd3)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
ShowWindow(hWnd2a, SW_SHOW);
|
||||
UpdateWindow(hWnd2a);
|
||||
|
||||
ShowWindow(hWnd3, SW_SHOW);
|
||||
UpdateWindow(hWnd3);
|
||||
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;
|
||||
|
||||
while(GetMessage(&msg, NULL, 0, 0 ))
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
ShowWindow(hWnd2b, SW_SHOW);
|
||||
UpdateWindow(hWnd2b);
|
||||
SendMessageW(hWnd2b, WM_SETICON, ICON_SMALL, (LPARAM)hIconSm);
|
||||
SendMessageW(hWnd2b, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
|
||||
|
||||
UnregisterClass(WndClass, hInst);
|
||||
return 0;
|
||||
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);
|
||||
DispatchMessageW(&msg);
|
||||
}
|
||||
|
||||
if (hIcon) DestroyIcon(hIcon);
|
||||
if (hIconSm) DestroyIcon(hIconSm);
|
||||
|
||||
UnregisterClassW(WndClass, hInst);
|
||||
return 0;
|
||||
}
|
||||
|
|
BIN
rostests/win32/user32/sysicon/sysicon.ico
Normal file
BIN
rostests/win32/user32/sysicon/sysicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 22 KiB |
Loading…
Reference in a new issue