>>316
WM_PAINTの中を次のように書き換えると速くなるよ

PAINTSTRUCT ps;
RECT rc;
HDC hdc = BeginPaint(wnd, &ps);
scope(exit) EndPaint(wnd, &ps);
GetClientRect(wnd, &rc);
SelectObject(hdc, GetStockObject(BLACK_BRUSH));
Ellipse(hdc, 0, 0, square_edge, square_edge);
HDC hmemdc = CreateCompatibleDC(hdc);
HBITMAP hbmp = CreateCompatibleBitmap(hdc, width, height);
HBITMAP holdbmp = cast(HBITMAP)SelectObject(hmemdc, hbmp);
BitBlt(hmemdc, 0, 0, width, height, hdc, 0, 0, SRCCOPY);
double surface = 0;
COLORREF b = cast(COLORREF)0;
int x, y;
for(y = 0; y < radius; ++y)
for(x = 0; x < radius; ++x)
if(GetPixel(hmemdc, x, y) == b) surface += 1;
SelectObject(hmemdc, holdbmp);
DeleteObject(hbmp);
DeleteDC(hmemdc);
SelectObject(hdc, GetStockObject(SYSTEM_FIXED_FONT));
string pi = format(message, 4.0 * surface / cast(double)(radius * radius));
TextOutA(hdc, 40, 40 + square_edge, pi.toMBSz(), pi.length);
writefln("%s", pi);
break;