mirror of
https://github.com/reactos/reactos.git
synced 2024-09-30 22:47:28 +00:00
adding test app for the client area calculation using the WM_NCCALCSIZE message
svn path=/trunk/; revision=6223
This commit is contained in:
parent
569ba4e82d
commit
193d845613
|
@ -8,7 +8,7 @@ include $(PATH_TO_TOP)/rules.mak
|
|||
|
||||
# test_old tests
|
||||
TEST_APPS = SampleWindow alive apc args atomtest bench bitblt \
|
||||
button button2 capclock combo consume copymove count dibtest \
|
||||
button button2 capclock cliarea combo consume copymove count dibtest \
|
||||
dump_shared_data edit enumwnd event file gditest hello hivetest \
|
||||
icontest isotest lineclip linetest lock lpc messagebox mktime \
|
||||
mstest multiwin mutex nptest patblt pipe primitives pteb regtest \
|
||||
|
|
6
reactos/apps/tests/cliarea/.cvsignore
Normal file
6
reactos/apps/tests/cliarea/.cvsignore
Normal file
|
@ -0,0 +1,6 @@
|
|||
*.o
|
||||
*.d
|
||||
*.exe
|
||||
*.coff
|
||||
*.sym
|
||||
*.map
|
100
reactos/apps/tests/cliarea/cliarea.c
Normal file
100
reactos/apps/tests/cliarea/cliarea.c
Normal file
|
@ -0,0 +1,100 @@
|
|||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
|
||||
//HFONT tf;
|
||||
LRESULT WINAPI MainWndProc(HWND, UINT, WPARAM, LPARAM);
|
||||
|
||||
int WINAPI
|
||||
WinMain(HINSTANCE hInstance,
|
||||
HINSTANCE hPrevInstance,
|
||||
LPSTR lpszCmdLine,
|
||||
int nCmdShow)
|
||||
{
|
||||
WNDCLASS wc;
|
||||
MSG msg;
|
||||
HWND hWnd;
|
||||
|
||||
wc.lpszClassName = "CliAreaClass";
|
||||
wc.lpfnWndProc = MainWndProc;
|
||||
wc.style = CS_VREDRAW | CS_HREDRAW;
|
||||
wc.hInstance = hInstance;
|
||||
wc.hIcon = LoadIcon(NULL, (LPCTSTR)IDI_APPLICATION);
|
||||
wc.hCursor = LoadCursor(NULL, (LPCTSTR)IDC_ARROW);
|
||||
wc.hbrBackground = (HBRUSH)GetStockObject(GRAY_BRUSH);
|
||||
wc.lpszMenuName = NULL;
|
||||
wc.cbClsExtra = 0;
|
||||
wc.cbWndExtra = 0;
|
||||
if (RegisterClass(&wc) == 0)
|
||||
{
|
||||
fprintf(stderr, "RegisterClass failed (last error 0x%X)\n",
|
||||
GetLastError());
|
||||
return(1);
|
||||
}
|
||||
|
||||
hWnd = CreateWindow("CliAreaClass",
|
||||
"ClientArea Test",
|
||||
WS_OVERLAPPEDWINDOW|WS_HSCROLL|WS_VSCROLL,
|
||||
0,
|
||||
0,
|
||||
CW_USEDEFAULT,
|
||||
CW_USEDEFAULT,
|
||||
NULL,
|
||||
NULL,
|
||||
hInstance,
|
||||
NULL);
|
||||
if (hWnd == NULL)
|
||||
{
|
||||
fprintf(stderr, "CreateWindow failed (last error 0x%X)\n",
|
||||
GetLastError());
|
||||
return(1);
|
||||
}
|
||||
|
||||
//tf = CreateFontA(14, 0, 0, TA_BASELINE, FW_NORMAL, FALSE, FALSE, FALSE,
|
||||
// ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
|
||||
// DEFAULT_QUALITY, FIXED_PITCH|FF_DONTCARE, "Timmons");
|
||||
|
||||
ShowWindow(hWnd, nCmdShow);
|
||||
|
||||
while(GetMessage(&msg, NULL, 0, 0))
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
|
||||
//DeleteObject(tf);
|
||||
|
||||
return msg.wParam;
|
||||
}
|
||||
|
||||
LRESULT CALLBACK MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
PAINTSTRUCT ps;
|
||||
HDC hDC;
|
||||
RECT clr, wir;
|
||||
char txt[100];
|
||||
|
||||
switch(msg)
|
||||
{
|
||||
case WM_LBUTTONUP:
|
||||
{
|
||||
ULONG x, y;
|
||||
RECT Rect;
|
||||
GetWindowRect(hWnd, &Rect);
|
||||
SendMessage(hWnd, WM_NCCALCSIZE, 0, (LPARAM)(&Rect));
|
||||
hDC = GetWindowDC(0);
|
||||
Rectangle(hDC, Rect.left, Rect.top, Rect.right, Rect.bottom);
|
||||
sprintf(txt, "Client coordinates: %d, %d, %d, %d\0", Rect.left, Rect.top, Rect.right, Rect.bottom);
|
||||
TextOut(hDC, Rect.left + 1, Rect.top + 1, (LPCTSTR)txt, strlen(txt));
|
||||
ReleaseDC(0, hDC);
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_DESTROY:
|
||||
PostQuitMessage(0);
|
||||
break;
|
||||
|
||||
default:
|
||||
return DefWindowProc(hWnd, msg, wParam, lParam);
|
||||
}
|
||||
return 0;
|
||||
}
|
21
reactos/apps/tests/cliarea/makefile
Normal file
21
reactos/apps/tests/cliarea/makefile
Normal file
|
@ -0,0 +1,21 @@
|
|||
# $Id: makefile,v 1.1 2003/10/04 12:14:37 weiden Exp $
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET_NORC = yes
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = windows
|
||||
|
||||
TARGET_NAME = cliarea
|
||||
|
||||
TARGET_SDKLIBS = kernel32.a gdi32.a
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
Loading…
Reference in a new issue