Advertisement
Guest User

Untitled

a guest
Jul 19th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.23 KB | None | 0 0
  1. int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
  2. LPSTR lpCmdLine, int nCmdShow)
  3. {
  4. WNDCLASSEX cl;
  5. cl.cbSize = sizeof(WNDCLASSEX);
  6. cl.style = CS_HREDRAW | CS_VREDRAW;
  7. cl.lpfnWndProc = WndProc1;
  8. cl.cbClsExtra = 0;
  9. cl.cbWndExtra = 0;
  10. cl.hInstance = hInstance;
  11. cl.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_APPLICATION));
  12. cl.hCursor = LoadCursor(NULL, IDC_ARROW);
  13. cl.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
  14. cl.lpszMenuName = NULL;
  15. cl.lpszClassName = szWindowClass;
  16. cl.hIconSm = LoadIcon(cl.hInstance, MAKEINTRESOURCE(IDI_APPLICATION));
  17. if (!RegisterClassEx(&cl))
  18. {
  19. MessageBox(NULL,
  20. "Call to RegisterClassEx failed!",
  21. "Win32 Guided Tour",
  22. NULL);
  23. return 1;
  24. }
  25. hInst = hInstance;
  26.  
  27. HWND hWnd1 = CreateWindow(szWindowClass,//имя класса
  28. szTitle,//имя окна
  29. WS_OVERLAPPEDWINDOW,//стиль окна
  30. 0, 0,//левый верхний угол x_and_y
  31. A.length=600,//длина окна
  32. A.height=600,//высота окна
  33. NULL, NULL,//родит.окно и меню
  34. hInstance, NULL);//экземпляр приложения и указатель на данные WM_CREATE
  35. if (!hWnd1)
  36. {
  37. MessageBox(NULL,
  38. "Call to CreateWindow failed!",
  39. "Win32 Guided Tour",
  40. NULL);
  41.  
  42. return 1;
  43. }
  44. ShowWindow(hWnd1,nCmdShow);
  45. UpdateWindow(hWnd1);
  46.  
  47. MSG msg;
  48. while (GetMessage(&msg, NULL, 0, 0))
  49. {
  50. TranslateMessage(&msg);
  51. DispatchMessage(&msg);
  52. }
  53. return (int) msg.wParam;
  54. }
  55.  
  56.  
  57. LRESULT CALLBACK WndProc1(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
  58. {
  59. PAINTSTRUCT ps;
  60. HDC hdc=GetDC(hWnd);
  61. switch (message)
  62. {
  63. case WM_CREATE:
  64. SetTimer(hWnd, 1, 50, TimeProc1);
  65. break;
  66. case WM_PAINT:
  67. hdc = BeginPaint(hWnd, &ps);
  68. PICTURE(hdc, hWnd);
  69. EndPaint(hWnd, &ps);
  70. break;
  71. case WM_DESTROY:
  72. KillTimer(hWnd, 1);
  73. PostQuitMessage(0);
  74. break;
  75. default:
  76. return DefWindowProc(hWnd, message, wParam, lParam);
  77. break;
  78. }
  79. ReleaseDC(hWnd, hdc);
  80. DeleteDC(hdc);
  81. return 0;
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement