From 2d32e95fa98f023f7af57908fd624742b45bfd61 Mon Sep 17 00:00:00 2001 From: Richard Campbell Date: Mon, 26 May 2003 10:51:20 +0000 Subject: [PATCH] Simple Multiple Window Test svn path=/trunk/; revision=4761 --- reactos/apps/tests/Makefile | 2 +- reactos/apps/tests/multiwin/makefile | 21 ++++++ reactos/apps/tests/multiwin/multiwin.c | 95 ++++++++++++++++++++++++++ 3 files changed, 117 insertions(+), 1 deletion(-) create mode 100644 reactos/apps/tests/multiwin/makefile create mode 100644 reactos/apps/tests/multiwin/multiwin.c diff --git a/reactos/apps/tests/Makefile b/reactos/apps/tests/Makefile index d5192155d83..5f7a92d2101 100644 --- a/reactos/apps/tests/Makefile +++ b/reactos/apps/tests/Makefile @@ -15,7 +15,7 @@ TEST_APPS = alive apc args atomtest bench bitblt consume copymove count \ dump_shared_data event file gditest hello isotest lpc messagebox \ mstest mutex event file gditest hello isotest lpc messagebox mstest \ mutex nptest pteb regtest sectest shm thread tokentest vmtest \ - winhello dibtest lock hivetest shaptest wm_paint + winhello dibtest lock hivetest shaptest wm_paint multiwin TEST_MISC = diff --git a/reactos/apps/tests/multiwin/makefile b/reactos/apps/tests/multiwin/makefile new file mode 100644 index 00000000000..889dc7cdd0f --- /dev/null +++ b/reactos/apps/tests/multiwin/makefile @@ -0,0 +1,21 @@ +# $Id: makefile,v 1.1 2003/05/26 10:51:20 rcampbell Exp $ + +PATH_TO_TOP = ../../.. + +TARGET_NORC = yes + +TARGET_TYPE = program + +TARGET_APPTYPE = windows + +TARGET_NAME = multiwin + +TARGET_SDKLIBS = kernel32.a gdi32.a + +TARGET_OBJECTS = $(TARGET_NAME).o + +include $(PATH_TO_TOP)/rules.mak + +include $(TOOLS_PATH)/helper.mk + +# EOF diff --git a/reactos/apps/tests/multiwin/multiwin.c b/reactos/apps/tests/multiwin/multiwin.c new file mode 100644 index 00000000000..b30021923be --- /dev/null +++ b/reactos/apps/tests/multiwin/multiwin.c @@ -0,0 +1,95 @@ +#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; + HWND hWnd2; + + wc.lpszClassName = "MultiWinClass"; + wc.lpfnWndProc = MainWndProc; + wc.style = CS_VREDRAW | CS_HREDRAW; + wc.hInstance = hInstance; + wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); + wc.hCursor = LoadCursor(NULL, 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("MultiWinClass", + "Window1", + WS_OVERLAPPEDWINDOW|WS_VISIBLE, + 0, + 0, + 320, + 240, + NULL, + NULL, + hInstance, + NULL); + + hWnd2 = hWnd = CreateWindow("MultiWinClass", + "Window2", + WS_CAPTION|WS_SYSMENU|WS_VISIBLE, + 400, + 0, + 160, + 120, + NULL, + NULL, + hInstance, + NULL); + + if (!hWnd || !hWnd2) + { + fprintf(stderr, "CreateWindow failed (last error 0x%X)\n", + GetLastError()); + return(1); + } + ShowWindow(hWnd, nCmdShow); + + while(GetMessage(&msg, NULL, 0, 0)) + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + return msg.wParam; +} + +LRESULT CALLBACK MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + PAINTSTRUCT ps; + HDC hDC; + + switch(msg) + { + case WM_PAINT: + hDC = BeginPaint(hWnd, &ps); + EndPaint(hWnd, &ps); + break; + + case WM_DESTROY: + PostQuitMessage(0); + break; + + default: + return DefWindowProc(hWnd, msg, wParam, lParam); + } + return 0; +}