1 | #define _CRT_SECURE_NO_DEPRECATE |
---|
2 | #define WINVER 0x0500 |
---|
3 | #define _WIN32_WINNT 0x0500 |
---|
4 | #define _WIN32_WINDOWS 0x0500 |
---|
5 | #define _WIN32_IE 0x0600 |
---|
6 | // |
---|
7 | |
---|
8 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers |
---|
9 | #include <windows.h> |
---|
10 | #include <stdlib.h> |
---|
11 | #include <stdio.h> |
---|
12 | #include <commdlg.h> |
---|
13 | #include <map> |
---|
14 | #include <string> |
---|
15 | #include "..\Include\SharedUtilities.h" |
---|
16 | #include "..\Include\GDIMetaLib.h" |
---|
17 | |
---|
18 | // Global Variables: |
---|
19 | HINSTANCE hInst; // current instance |
---|
20 | |
---|
21 | HBRUSH GetGDISysColorBrush(int iIndex) |
---|
22 | { |
---|
23 | return GetSysColorBrush(iIndex); |
---|
24 | } |
---|
25 | DWORD GetGDISysColor(int iIndex) |
---|
26 | { |
---|
27 | return GetSysColor(iIndex); |
---|
28 | } |
---|
29 | |
---|
30 | HINSTANCE GetCurrentInstance(void) |
---|
31 | { |
---|
32 | return hInst; |
---|
33 | } |
---|
34 | |
---|
35 | int APIENTRY WinMain(HINSTANCE hInstance, |
---|
36 | HINSTANCE hPrevInstance, |
---|
37 | LPTSTR lpCmdLine, |
---|
38 | int nCmdShow) |
---|
39 | { |
---|
40 | INITCOMMONCONTROLSEX ex; |
---|
41 | ex.dwSize=sizeof(INITCOMMONCONTROLSEX); |
---|
42 | ex.dwICC=ICC_WIN95_CLASSES; |
---|
43 | InitCommonControlsEx(&ex); |
---|
44 | |
---|
45 | GDI::MetaControl::RegisterClasses(); |
---|
46 | |
---|
47 | CDDParse p; |
---|
48 | CDDObject *pMeta=p.ParseFromFile("TestMeta.DDConf"); |
---|
49 | HWND hMetaWnd=::CreateWindow("MetaControl", "My Test Meta", WS_VISIBLE|WS_BORDER|WS_CLIPCHILDREN|WS_SIZEBOX|WS_VSCROLL, 50, 50, 400, 400, NULL, NULL, NULL, NULL); |
---|
50 | GDI::MetaControl meta; |
---|
51 | meta.Attach(hMetaWnd); |
---|
52 | meta.CreateFromMeta(pMeta); |
---|
53 | |
---|
54 | // Main message loop: |
---|
55 | MSG msg; |
---|
56 | while (GetMessage(&msg, NULL, 0, 0)) |
---|
57 | { |
---|
58 | if(msg.message==WM_KEYDOWN && msg.wParam==27) |
---|
59 | { |
---|
60 | break; |
---|
61 | } |
---|
62 | if(msg.message==WM_KEYUP && msg.wParam==65) |
---|
63 | { |
---|
64 | meta.CreateFromMeta(pMeta); |
---|
65 | } |
---|
66 | TranslateMessage(&msg); |
---|
67 | DispatchMessage(&msg); |
---|
68 | } |
---|
69 | |
---|
70 | GDI::MetaControl::UnregisterClasses(); |
---|
71 | |
---|
72 | return (int) msg.wParam; |
---|
73 | } |
---|