// глобальная область
_int64 ni, n[32];
double nt[32*8];
char sx[(32+1)*4];
LRESULT CALLBACK ChildProc(HWND, UINT, WPARAM,LPARAM);
void MyFun(_int64* TBs)
{
/*-
Расчёты
*/
HINSTANCE hinst;
WNDCLASS w;
HWND hwnd =FindWindow ("ChildWClass", "title");
if (hwnd==0)
{
hinst=GetModuleHandle(NULL);
memset(&w, 0, sizeof(WNDCLASS));
w.lpfnWndProc = ChildProc;
w.hInstance = hinst;
w.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
w.lpszClassName = "ChildWClass";
w.hIcon = LoadIcon (hinst, 0);
w.hCursor= NULL;
RegisterClass(&w);
hwnd=CreateWindow("ChildWClass", "title",
WS_MAXIMIZEBOX | WS_MINIMIZEBOX | WS_SIZEBOX | WS_SYSMENU | WS_BORDER | WS_VISIBLE,
30,30,500,300, 0, NULL, hinst, NULL);
ShowWindow(hwnd, SW_SHOWNORMAL);
}
InvalidateRect(hwnd, NULL, true);
}
// обработчик сообщений окна
LRESULT CALLBACK ChildProc(HWND hwnd, UINT Message,
WPARAM wparam, LPARAM lparam)
{
static _int64 HWin=300, LWin=500;
PAINTSTRUCT ps;
HDC hdc;
HBRUSH hBrush;
HPEN hPen;
/* вычисления параметров отрисовки*/
if (Message == WM_PAINT)
{
hdc = BeginPaint(hwnd, &ps);
// TODO: добавьте любой код отрисовки...
hPen=CreatePen(PS_SOLID,1,RGB(0,0,0)); SelectObject(hdc,hPen);
hBrush=CreateSolidBrush(RGB(0,0,255)); SelectObject(hdc,hBrush);
MoveToEx(hdc, 1, HWin-25, NULL); LineTo(hdc, LWin, HWin-25);
MoveToEx(hdc, 15,HWin-25, NULL); LineTo(hdc, 15, HWin-20);
TextOut(hdc, 5, HWin-20, sx, 4);
for (int ii=1; ii<=ni; ii++)
{ MoveToEx(hdc,15+di*ii,HWin-25,NULL); LineTo(hdc,15+di*ii,HWin-20);
TextOut(hdc,5+di*ii, HWin-20, sx+ii*4, 4);
Rectangle(hdc,15+di*(ii-1),floor(HWin-25-n[ii-1]*r),14+di*ii,HWin-25);
}
/* и т.п. */
DeleteObject(hPen);
DeleteObject(hBrush);
ReleaseDC(hwnd,hdc);
//
EndPaint(hwnd, &ps);
}
if (Message == WM_SIZE)
{
HWin=HIWORD(lparam); // высота
LWin=LOWORD(lparam); // ширина
InvalidateRect(hwnd, NULL, true);
}
if (Message == WM_DESTROY)
{
return 0;
}
return DefWindowProc(hwnd, Message, wparam, lparam);
}