Simple Multiple Window Test

svn path=/trunk/; revision=4761
This commit is contained in:
Richard Campbell
2003-05-26 10:51:20 +00:00
parent ab5ce5a163
commit 2d32e95fa9
3 changed files with 117 additions and 1 deletions
+1 -1
View File
@@ -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 =
+21
View File
@@ -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
+95
View File
@@ -0,0 +1,95 @@
#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;
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;
}