
Добавил:
korayakov
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:
#define STRICT
#include <windows.h>
#include <windowsx.h>
#include <math.h>
#include "WndProc.cpp"
void mySin(int N, double *X, double *Y)
{
double x1 = -1, x2 = 10, y, dx = (x2-x1)/N;
for(int i=0; i<N; i++)
{
X[i] = x1 +dx*(i-1); Y[i] = 0.2*X[i]*sin(2*X[i]);
}
}
BOOL Register(HINSTANCE hInst);
HWND Create(HINSTANCE hInst,int nCmdShow);
LRESULT CALLBACK WndProc(HWND hwnd, UINT Message,
WPARAM wParam, LPARAM lParam);
static char szAppName[] = "Paint";
//в®зЄ ўе®¤
#pragma argsused
int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrevInstance,
LPSTR lpszCmdParam, int nCmdShow)
{
MSG Msg;
mySin(Nmas, X, Y);
if(!hPrevInstance)
if(!Register(hInst))
return FALSE;
if(!Create(hInst,nCmdShow))
return FALSE;
while(GetMessage(&Msg,NULL,0,0))
{
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
return Msg.wParam;
}
//ђҐЈЁбва жЁп ®Є
BOOL Register(HINSTANCE hInst)
{
WNDCLASS WndClass;
WndClass.style = CS_HREDRAW | CS_VREDRAW;
WndClass.lpfnWndProc = WndProc;
WndClass.cbClsExtra = 0;
WndClass.cbWndExtra = 0;
WndClass.hInstance = hInst;
WndClass.hIcon = LoadIcon(NULL,IDI_APPLICATION);
WndClass.hCursor = LoadCursor(NULL,IDC_ARROW);
WndClass.hbrBackground = GetStockBrush(WHITE_BRUSH);
WndClass.lpszClassName = szAppName;
return RegisterClass(&WndClass);
}
//‘®§¤ ЁҐ ®Є
HWND Create(HINSTANCE hInst,int nCmdShow)
{
HWND hWindow = CreateWindow(szAppName,szAppName,
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,CW_USEDEFAULT,
CW_USEDEFAULT,CW_USEDEFAULT,
NULL,NULL,hInst,NULL);
if(hWindow == NULL)
return hWindow;
ShowWindow(hWindow,nCmdShow);
UpdateWindow(hWindow);
return hWindow;
}