-
Notifications
You must be signed in to change notification settings - Fork 0
/
winanglearctest2.c
114 lines (102 loc) · 2.61 KB
/
winanglearctest2.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
// 8 september 2015
#define UNICODE
#define _UNICODE
#define STRICT
#define STRICT_TYPED_ITEMIDS
#define CINTERFACE
#define COBJMACROS
// see https://github.com/golang/go/issues/9916#issuecomment-74812211
#define INITGUID
#define _USE_MATH_DEFINES
// get Windows version right; right now Windows Vista
#define WINVER 0x0600 /* according to Microsoft's winnls.h */
#define _WIN32_WINNT 0x0600 /* according to Microsoft's sdkddkver.h */
#define _WIN32_WINDOWS 0x0600 /* according to Microsoft's pdh.h */
#define _WIN32_IE 0x0700 /* according to Microsoft's sdkddkver.h */
#define NTDDI_VERSION 0x06000000 /* according to Microsoft's sdkddkver.h */
#include <windows.h>
#include <commctrl.h>
#include <stdint.h>
#include <uxtheme.h>
#include <string.h>
#include <wchar.h>
#include <windowsx.h>
#include <vsstyle.h>
#include <vssym32.h>
#include <stdarg.h>
#include <oleacc.h>
#include <stdio.h>
#include <shobjidl.h>
#include <math.h>
HPEN pen;
LRESULT CALLBACK wndproc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
HDC dc;
PAINTSTRUCT ps;
HPEN prevpen;
switch (uMsg) {
case WM_PAINT:
dc = BeginPaint(hwnd, &ps);
prevpen = SelectObject(dc, pen);
SetDCPenColor(dc, RGB(0, 0, 0));
BeginPath(dc);
MoveToEx(dc, 100, 100, NULL);
AngleArc(dc, 100, 100, 50, 30, 300);
LineTo(dc, 100, 100);
EndPath(dc);
StrokePath(dc);
BeginPath(dc);
{ double r, theta; int x, y; int x2, y2;
x = 210;
y = 100;
x2 = 210;
y2 = 100;
r = 50;
theta = 30.0 * (M_PI / 180.0);
x += floor(r * cos(theta) + 0.5);
y -= floor(r * sin(theta) + 0.5);
theta = 330.0 * (M_PI / 180.0);
x2 += floor(r * cos(theta) + 0.5);
y2 -= floor(r * sin(theta) + 0.5);
Arc(dc, 210-50, 100-50, 210+50, 100+50,
x, y, x2, y2); }
// AngleArc(dc, 210, 100, 50, 30, 300);
CloseFigure(dc);
EndPath(dc);
StrokePath(dc);
SelectObject(dc, prevpen);
EndPaint(hwnd, &ps);
return 0;
case WM_CLOSE:
PostQuitMessage(0);
}
return DefWindowProcW(hwnd, uMsg, wParam, lParam);
}
int main(void)
{
HINSTANCE hInstance;
WNDCLASSW wc;
HWND mainwin;
MSG msg;
hInstance = GetModuleHandle(NULL);
pen = GetStockObject(DC_PEN);
ZeroMemory(&wc, sizeof (WNDCLASSW));
wc.lpszClassName = L"mainwin";
wc.lpfnWndProc = wndproc;
wc.hInstance = hInstance;
wc.hbrBackground = (HBRUSH) (COLOR_BTNFACE + 1);
RegisterClassW(&wc);
mainwin = CreateWindowExW(0,
L"mainwin", L"mainwin",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT,
400, 400,
NULL, NULL, hInstance, NULL);
ShowWindow(mainwin, SW_SHOWDEFAULT);
UpdateWindow(mainwin);
while (GetMessageW(&msg, NULL, 0, 0)) {
TranslateMessage(&msg);
DispatchMessageW(&msg);
}
return 0;
}