ReactOS 0.4.16-dev-197-g92996da
enhmetafile.c File Reference
#include <windows.h>
#include <stdio.h>
#include <string.h>
Include dependency graph for enhmetafile.c:

Go to the source code of this file.

Functions

LRESULT WINAPI MainWndProc (HWND, UINT, WPARAM, LPARAM)
 
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow)
 

Variables

HENHMETAFILE EnhMetafile
 
SIZE EnhMetafileSize
 

Function Documentation

◆ MainWndProc()

LRESULT WINAPI MainWndProc ( HWND  hWnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 89 of file enhmetafile.c.

90{
91 switch(msg)
92 {
93
94 case WM_PAINT:
95 {
96 PAINTSTRUCT ps;
97 RECT rc;
98 HDC hDC;
99 int bk;
100
101 GetClientRect(hWnd, &rc);
102 hDC = BeginPaint(hWnd, &ps);
103 rc.left = (rc.right / 2) - (EnhMetafileSize.cx / 2);
104 rc.top = (rc.bottom / 2) - (EnhMetafileSize.cy / 2);
105 rc.right = rc.left + EnhMetafileSize.cx;
106 rc.bottom = rc.top + EnhMetafileSize.cy;
108 Rectangle(hDC, rc.left - 1, rc.top - 1, rc.right + 1, rc.bottom + 1);
109 SetBkMode(hDC, bk);
111 EndPaint(hWnd, &ps);
112 break;
113 }
114
115 case WM_DESTROY:
117 break;
118
119 default:
121 }
122 return 0;
123}
static HDC hDC
Definition: 3dtext.c:33
#define msg(x)
Definition: auth_time.c:54
HWND hWnd
Definition: settings.c:17
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
HENHMETAFILE EnhMetafile
Definition: enhmetafile.c:6
SIZE EnhMetafileSize
Definition: enhmetafile.c:7
static HDC
Definition: imagelist.c:88
#define DefWindowProc
Definition: ros2win.h:31
LONG cx
Definition: kdterminal.h:27
LONG cy
Definition: kdterminal.h:28
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
#define TRANSPARENT
Definition: wingdi.h:950
BOOL WINAPI Rectangle(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1056
BOOL WINAPI PlayEnhMetaFile(_In_ HDC, _In_ HENHMETAFILE, _In_ LPCRECT)
#define WM_PAINT
Definition: winuser.h:1623
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
#define WM_DESTROY
Definition: winuser.h:1612
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)

Referenced by WinMain().

◆ WinMain()

int WINAPI WinMain ( HINSTANCE  hInstance,
HINSTANCE  hPrevInstance,
LPSTR  lpszCmdLine,
int  nCmdShow 
)

Definition at line 11 of file enhmetafile.c.

15{
16 WNDCLASS wc;
17 MSG msg;
18 HWND hWnd;
19 ENHMETAHEADER emh;
20
21 EnhMetafile = GetEnhMetaFile("test.emf");
22 if(!EnhMetafile)
23 {
24 fprintf(stderr, "GetEnhMetaFile failed (last error 0x%lX)\n",
25 GetLastError());
26 return(1);
27 }
31
32 wc.lpszClassName = "EnhMetaFileClass";
38 wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
39 wc.lpszMenuName = NULL;
40 wc.cbClsExtra = 0;
41 wc.cbWndExtra = 0;
42 if (RegisterClass(&wc) == 0)
43 {
45 fprintf(stderr, "RegisterClass failed (last error 0x%lX)\n",
46 GetLastError());
47 return(1);
48 }
49
50 hWnd = CreateWindow("EnhMetaFileClass",
51 "Enhanced Metafile test",
53 0,
54 0,
57 NULL,
58 NULL,
60 NULL);
61 if (hWnd == NULL)
62 {
64 fprintf(stderr, "CreateWindow failed (last error 0x%lX)\n",
65 GetLastError());
66 return(1);
67 }
68
69 //tf = CreateFontA(14, 0, 0, TA_BASELINE, FW_NORMAL, FALSE, FALSE, FALSE,
70 // ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
71 // DEFAULT_QUALITY, FIXED_PITCH|FF_DONTCARE, "Timmons");
72
73 ShowWindow(hWnd, nCmdShow);
74
75 while(GetMessage(&msg, NULL, 0, 0))
76 {
79 }
80
82
83 //DeleteObject(tf);
84 UnregisterClass("EnhMetaFileClass", hInstance);
85
86 return msg.wParam;
87}
HINSTANCE hInstance
Definition: charmap.c:19
#define NULL
Definition: types.h:112
#define stderr
Definition: stdio.h:100
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
LRESULT WINAPI MainWndProc(HWND, UINT, WPARAM, LPARAM)
Definition: enhmetafile.c:89
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
long bottom
Definition: polytest.cpp:53
long right
Definition: polytest.cpp:53
long top
Definition: polytest.cpp:53
long left
Definition: polytest.cpp:53
HBRUSH hbrBackground
Definition: winuser.h:3173
HICON hIcon
Definition: winuser.h:3171
HINSTANCE hInstance
Definition: winuser.h:3170
HCURSOR hCursor
Definition: winuser.h:3172
int cbWndExtra
Definition: winuser.h:3169
UINT style
Definition: winuser.h:3166
LPCSTR lpszMenuName
Definition: winuser.h:3174
LPCSTR lpszClassName
Definition: winuser.h:3175
WNDPROC lpfnWndProc
Definition: winuser.h:3167
int cbClsExtra
Definition: winuser.h:3168
RECTL rclBounds
Definition: wingdi.h:2322
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
BOOL WINAPI DeleteEnhMetaFile(_In_opt_ HENHMETAFILE)
UINT WINAPI GetEnhMetaFileHeader(_In_ HENHMETAFILE hemf, _In_ UINT nSize, _Out_writes_bytes_opt_(nSize) LPENHMETAHEADER lpEnhMetaHeader)
#define GetEnhMetaFile
Definition: wingdi.h:4461
#define CS_VREDRAW
Definition: winuser.h:658
BOOL WINAPI TranslateMessage(_In_ const MSG *)
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define CS_HREDRAW
Definition: winuser.h:653
#define IDC_ARROW
Definition: winuser.h:687
#define UnregisterClass
Definition: winuser.h:5873
#define IDI_APPLICATION
Definition: winuser.h:704
#define CreateWindow
Definition: winuser.h:5766
#define GetMessage
Definition: winuser.h:5802
#define LoadIcon
Definition: winuser.h:5825
#define LoadCursor
Definition: winuser.h:5824
#define SM_CXSIZEFRAME
Definition: winuser.h:996
#define RegisterClass
Definition: winuser.h:5848
#define DispatchMessage
Definition: winuser.h:5777
#define SM_CYCAPTION
Definition: winuser.h:966
#define SM_CYSIZEFRAME
Definition: winuser.h:998
int WINAPI GetSystemMetrics(_In_ int)
#define COLOR_BTNFACE
Definition: winuser.h:931
const CHAR * LPCTSTR
Definition: xmlstorage.h:193

Variable Documentation

◆ EnhMetafile

HENHMETAFILE EnhMetafile

Definition at line 6 of file enhmetafile.c.

Referenced by MainWndProc(), and WinMain().

◆ EnhMetafileSize

SIZE EnhMetafileSize

Definition at line 7 of file enhmetafile.c.

Referenced by MainWndProc(), and WinMain().