Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
- LPSTR lpCmdLine, int nCmdShow)
- {
- WNDCLASSEX cl;
- cl.cbSize = sizeof(WNDCLASSEX);
- cl.style = CS_HREDRAW | CS_VREDRAW;
- cl.lpfnWndProc = WndProc1;
- cl.cbClsExtra = 0;
- cl.cbWndExtra = 0;
- cl.hInstance = hInstance;
- cl.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_APPLICATION));
- cl.hCursor = LoadCursor(NULL, IDC_ARROW);
- cl.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
- cl.lpszMenuName = NULL;
- cl.lpszClassName = szWindowClass;
- cl.hIconSm = LoadIcon(cl.hInstance, MAKEINTRESOURCE(IDI_APPLICATION));
- if (!RegisterClassEx(&cl))
- {
- MessageBox(NULL,
- "Call to RegisterClassEx failed!",
- "Win32 Guided Tour",
- NULL);
- return 1;
- }
- hInst = hInstance;
- HWND hWnd1 = CreateWindow(szWindowClass,//имя класса
- szTitle,//имя окна
- WS_OVERLAPPEDWINDOW,//стиль окна
- 0, 0,//левый верхний угол x_and_y
- A.length=600,//длина окна
- A.height=600,//высота окна
- NULL, NULL,//родит.окно и меню
- hInstance, NULL);//экземпляр приложения и указатель на данные WM_CREATE
- if (!hWnd1)
- {
- MessageBox(NULL,
- "Call to CreateWindow failed!",
- "Win32 Guided Tour",
- NULL);
- return 1;
- }
- ShowWindow(hWnd1,nCmdShow);
- UpdateWindow(hWnd1);
- MSG msg;
- while (GetMessage(&msg, NULL, 0, 0))
- {
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- }
- return (int) msg.wParam;
- }
- LRESULT CALLBACK WndProc1(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
- {
- PAINTSTRUCT ps;
- HDC hdc=GetDC(hWnd);
- switch (message)
- {
- case WM_CREATE:
- SetTimer(hWnd, 1, 50, TimeProc1);
- break;
- case WM_PAINT:
- hdc = BeginPaint(hWnd, &ps);
- PICTURE(hdc, hWnd);
- EndPaint(hWnd, &ps);
- break;
- case WM_DESTROY:
- KillTimer(hWnd, 1);
- PostQuitMessage(0);
- break;
- default:
- return DefWindowProc(hWnd, message, wParam, lParam);
- break;
- }
- ReleaseDC(hWnd, hdc);
- DeleteDC(hdc);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement