From 193d845613de19ce53c5339748dba5341edbcbf7 Mon Sep 17 00:00:00 2001 From: Thomas Bluemel Date: Sat, 4 Oct 2003 12:14:37 +0000 Subject: [PATCH] adding test app for the client area calculation using the WM_NCCALCSIZE message svn path=/trunk/; revision=6223 --- reactos/apps/tests/Makefile | 2 +- reactos/apps/tests/cliarea/.cvsignore | 6 ++ reactos/apps/tests/cliarea/cliarea.c | 100 ++++++++++++++++++++++++++ reactos/apps/tests/cliarea/makefile | 21 ++++++ 4 files changed, 128 insertions(+), 1 deletion(-) create mode 100644 reactos/apps/tests/cliarea/.cvsignore create mode 100644 reactos/apps/tests/cliarea/cliarea.c create mode 100644 reactos/apps/tests/cliarea/makefile diff --git a/reactos/apps/tests/Makefile b/reactos/apps/tests/Makefile index 2f2e622c4a9..84efc73a1c2 100644 --- a/reactos/apps/tests/Makefile +++ b/reactos/apps/tests/Makefile @@ -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 \ diff --git a/reactos/apps/tests/cliarea/.cvsignore b/reactos/apps/tests/cliarea/.cvsignore new file mode 100644 index 00000000000..d63774a7353 --- /dev/null +++ b/reactos/apps/tests/cliarea/.cvsignore @@ -0,0 +1,6 @@ +*.o +*.d +*.exe +*.coff +*.sym +*.map diff --git a/reactos/apps/tests/cliarea/cliarea.c b/reactos/apps/tests/cliarea/cliarea.c new file mode 100644 index 00000000000..f74f7eb5eda --- /dev/null +++ b/reactos/apps/tests/cliarea/cliarea.c @@ -0,0 +1,100 @@ +#include +#include + +//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; +} diff --git a/reactos/apps/tests/cliarea/makefile b/reactos/apps/tests/cliarea/makefile new file mode 100644 index 00000000000..b8cce1a50d6 --- /dev/null +++ b/reactos/apps/tests/cliarea/makefile @@ -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