mirror of
https://github.com/reactos/reactos.git
synced 2024-08-08 12:18:13 +00:00
added test app for enhanced meta files
svn path=/trunk/; revision=6649
This commit is contained in:
parent
ef913e1a3b
commit
67e13dd228
|
@ -15,7 +15,7 @@ mktime mstest multiwin mutex nptest patblt pipe primitives pteb regtest \
|
|||
sectest sertest shaptest shm statst statst2 stretchblt suspend \
|
||||
tcpsvr terminate txtscale thread thread_msg tokentest vmtest \
|
||||
winhello winhello2 wm_erasebkgnd wm_paint eventpair threadwait \
|
||||
map_dup_inherit p_dup_handle apc2
|
||||
map_dup_inherit p_dup_handle apc2 enhmetafile
|
||||
|
||||
TEST_MISC =
|
||||
|
||||
|
|
6
reactos/apps/tests/enhmetafile/.cvsignore
Normal file
6
reactos/apps/tests/enhmetafile/.cvsignore
Normal file
|
@ -0,0 +1,6 @@
|
|||
*.o
|
||||
*.d
|
||||
*.exe
|
||||
*.coff
|
||||
*.sym
|
||||
*.map
|
108
reactos/apps/tests/enhmetafile/enhmetafile.c
Normal file
108
reactos/apps/tests/enhmetafile/enhmetafile.c
Normal file
|
@ -0,0 +1,108 @@
|
|||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
//HFONT tf;
|
||||
HENHMETAFILE EnhMetafile;
|
||||
LRESULT WINAPI MainWndProc(HWND, UINT, WPARAM, LPARAM);
|
||||
|
||||
int WINAPI
|
||||
WinMain(HINSTANCE hInstance,
|
||||
HINSTANCE hPrevInstance,
|
||||
LPSTR lpszCmdLine,
|
||||
int nCmdShow)
|
||||
{
|
||||
WNDCLASS wc;
|
||||
MSG msg;
|
||||
HWND hWnd;
|
||||
|
||||
EnhMetafile = GetEnhMetaFile("test.emf");
|
||||
if(!EnhMetafile)
|
||||
{
|
||||
fprintf(stderr, "GetEnhMetaFile failed (last error 0x%lX)\n",
|
||||
GetLastError());
|
||||
return(1);
|
||||
}
|
||||
|
||||
wc.lpszClassName = "EnhMetaFileClass";
|
||||
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)(COLOR_BTNFACE + 1);
|
||||
wc.lpszMenuName = NULL;
|
||||
wc.cbClsExtra = 0;
|
||||
wc.cbWndExtra = 0;
|
||||
if (RegisterClass(&wc) == 0)
|
||||
{
|
||||
DeleteEnhMetaFile(EnhMetafile);
|
||||
fprintf(stderr, "RegisterClass failed (last error 0x%lX)\n",
|
||||
GetLastError());
|
||||
return(1);
|
||||
}
|
||||
|
||||
hWnd = CreateWindow("EnhMetaFileClass",
|
||||
"Enhanced Metafile test",
|
||||
WS_OVERLAPPEDWINDOW,
|
||||
0,
|
||||
0,
|
||||
250,
|
||||
200,
|
||||
NULL,
|
||||
NULL,
|
||||
hInstance,
|
||||
NULL);
|
||||
if (hWnd == NULL)
|
||||
{
|
||||
DeleteEnhMetaFile(EnhMetafile);
|
||||
fprintf(stderr, "CreateWindow failed (last error 0x%lX)\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);
|
||||
}
|
||||
|
||||
DeleteEnhMetaFile(EnhMetafile);
|
||||
|
||||
//DeleteObject(tf);
|
||||
UnregisterClass("EnhMetaFileClass", hInstance);
|
||||
|
||||
return msg.wParam;
|
||||
}
|
||||
|
||||
LRESULT CALLBACK MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
PAINTSTRUCT ps;
|
||||
RECT rc;
|
||||
HDC hDC;
|
||||
|
||||
switch(msg)
|
||||
{
|
||||
|
||||
case WM_PAINT:
|
||||
GetClientRect(hWnd, &rc);
|
||||
hDC = BeginPaint(hWnd, &ps);
|
||||
PlayEnhMetaFile(hDC, EnhMetafile, &rc);
|
||||
EndPaint(hWnd, &ps);
|
||||
break;
|
||||
|
||||
case WM_DESTROY:
|
||||
PostQuitMessage(0);
|
||||
break;
|
||||
|
||||
default:
|
||||
return DefWindowProc(hWnd, msg, wParam, lParam);
|
||||
}
|
||||
return 0;
|
||||
}
|
23
reactos/apps/tests/enhmetafile/makefile
Normal file
23
reactos/apps/tests/enhmetafile/makefile
Normal file
|
@ -0,0 +1,23 @@
|
|||
# $Id: makefile,v 1.1 2003/11/15 14:05:30 weiden Exp $
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET_NORC = yes
|
||||
|
||||
TARGET_TYPE = program
|
||||
|
||||
TARGET_APPTYPE = windows
|
||||
|
||||
TARGET_NAME = enhmetafile
|
||||
|
||||
TARGET_SDKLIBS = kernel32.a gdi32.a
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
TARGET_CFLAGS = -Wall -Werror
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
# EOF
|
BIN
reactos/apps/tests/enhmetafile/test.emf
Normal file
BIN
reactos/apps/tests/enhmetafile/test.emf
Normal file
Binary file not shown.
Loading…
Reference in a new issue