#include
#include
# define NUM 1000
# define TWOPI (2 * 3.1415)
LRESULT a CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM);
Int WINAPI WinMain (HINSTANCE HINSTANCE, HINSTANCE hPrevInstance,
PSTR szCmdLine, int iCmdShow)
{
The static TCHAR szAppName []=TEXT (" SineWave ");
The HWND HWND;
MSG MSG.
WNDCLASS WNDCLASS;
Wndclass. Style=CS_HREDRAW | CS_VREDRAW;
Wndclass. LpfnWndProc=WndProc;
Wndclass. CbClsExtra=0;
Wndclass. CbWndExtra=0;
Wndclass. HInstance=hInstance;
Wndclass. HIcon=LoadIcon (NULL, IDI_APPLICATION);
Wndclass. HCursor=LoadCursor (NULL, IDC_ARROW);
Wndclass. HbrBackground=(HBRUSH) GetStockObject (WHITE_BRUSH);
Wndclass. LpszMenuName=NULL;
Wndclass. LpszClassName=szAppName;
if(! RegisterClass (& amp; Wndclass))
{
MessageBox (NULL, TEXT (" above the program requires Windows NT version "),
SzAppName, MB_ICONERROR);
return 0;
}
HWND=CreateWindow (szAppName, TEXT (" sine curve with POLYLINE picture "), WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT CW_USEDEFAULT, CW_USEDEFAULT CW_USEDEFAULT,
NULL, NULL, hInstance, NULL);
ShowWindow (HWND, iCmdShow);
UpdateWindow (HWND);
While (GetMessage (& amp; MSG, NULL, 0, 0))
{
TranslateMessage (& amp; MSG);
DispatchMessage (& amp; MSG);
}
Return MSG. WParam;
}
LRESULT a CALLBACK WndProc (HWND HWND, UINT message, WPARAM WPARAM, LPARAM LPARAM)
{
Static int cxClient cyClient;
HDC HDC.
Int I;
PAINTSTRUCT ps;
POINT apt (NUM);
The switch (the message)
{
Case WM_SIZE:
CxClient=LOWORD (lParam);
CyClient=HIWORD (lParam);
return 0;
In case the WM_PAINT:
HDC=BeginPaint (HWND, & amp; Ps);
MoveToEx (HDC, 0, cyClient/2, NULL);
LineTo (HDC, cxClient cyClient/2);
for(i=0; i{
Apt [I]. X=I * cxClient/NUM;
Apt [I] y=(int) (cyClient/2 * (1 - sin (TWOPI * I/NUM)));
}
Polylines (HDC, apt, NUM);
return 0;
Case WM_DESTROY:
The PostQuitMessage (0);
return 0;
}
Return DefWindowProc (HWND, message, wParam, lParam);
}
CodePudding user response:
What's the problem? Mapped out in the right image or images are not mapped outCodePudding user response:
The example code inside a lot of, don't have to knock,MSDN98_1. ISO http://pan.baidu.com/s/1dDF41ix, MSDN98_2. ISO http://pan.baidu.com/s/1bnGo0Vl
CodePudding user response:
@ zhao4zhong1Oh, my mom, someone knocked at the hundreds of megabytes of code
CodePudding user response: