Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Windows.h>
- #include <tchar.h>
- LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
- TCHAR WinName[]=_T("MainFrame");
- int APIENTRY WinMain (HINSTANCE This, HINSTANCE Prev, LPSTR cmd, int mode)
- {
- HWND hWnd;
- MSG msg;
- WNDCLASS wc;
- wc.hInstance=This;
- wc.lpszClassName=WinName;
- wc.lpfnWndProc=WndProc;
- wc.style= CS_HREDRAW;
- wc.hIcon=LoadIcon(NULL,IDI_APPLICATION);
- wc.hCursor=LoadCursor(NULL,IDC_ARROW);
- wc.lpszMenuName=NULL;
- wc.cbClsExtra=0;
- wc.cbWndExtra=0;
- wc.hbrBackground=(HBRUSH)(COLOR_WINDOW+1);
- if(!RegisterClass(&wc))return 0;
- hWnd= CreateWindow (WinName,
- _T("каркас Windows приложения"),
- WS_OVERLAPPEDWINDOW,
- CW_USEDEFAULT,
- CW_USEDEFAULT,
- CW_USEDEFAULT,
- CW_USEDEFAULT,
- HWND_DESKTOP,
- NULL,
- This,
- NULL);
- ShowWindow(hWnd,mode);
- while(GetMessage(&msg,NULL,0,0))
- {TranslateMessage(&msg);
- DispatchMessage(&msg);
- } return 0;
- }
- LRESULT CALLBACK WndProc(HWND hWnd, UINT message ,WPARAM wParam, LPARAM lParam)
- {
- PAINTSTRUCT ps;
- HDC hdc; int x,y;
- static int sx,sy;
- switch(message)
- {
- case WM_SIZE:{
- sx= LOWORD(lParam);
- sy= HIWORD(lParam);
- break;
- }
- case WM_PAINT:
- hdc=BeginPaint(hWnd,&ps);
- for(x=0;x<sx;x+=sx/10)
- {
- MoveToEx(hdc,x,0,NULL);
- LineTo(hdc,x,sy);
- }
- for(y=0;y<sy;y+=sy/10)
- {
- MoveToEx(hdc,0,y,NULL);
- LineTo(hdc,sx,y);
- }
- MoveToEx(hdc, 0,0,NULL);
- Ellipse(hdc, 200 , 200, 500 , 600);
- LineTo(hdc, sx, sy);
- EndPaint(hWnd,&ps);
- break;
- case WM_DESTROY: PostQuitMessage(0);
- break;
- default:
- return DefWindowProc(hWnd,message,wParam,lParam);
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment