Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

138 lines
3.3 KiB

  1. /*===========================================================================*/
  2. /* Copyright (c) 1987 - 1988, Future Soft Engineering, Inc. */
  3. /* Houston, Texas */
  4. /*===========================================================================*/
  5. #define NOLSTRING TRUE
  6. #include <windows.h>
  7. #include "port1632.h"
  8. #include "dynacomm.h"
  9. #define ID_FLASHEVENT 1
  10. #define FLASH_ELAPSE 450
  11. /*****************************************************************************/
  12. /* nextFlash() - */
  13. /*****************************************************************************/
  14. void APIENTRY nextFlash(HWND hWnd, UINT message, UINT_PTR nIDEvent, DWORD sysTime)
  15. {
  16. RECT rect;
  17. HDC hDC;
  18. rect.left = 0;
  19. rect.top = 0;
  20. rect.right = 16*icon.dx;
  21. rect.bottom = 16*icon.dy;
  22. InvertRect(hDC = GetDC(hWnd), &rect);
  23. ReleaseDC(hWnd, hDC);
  24. }
  25. /*****************************************************************************/
  26. /* myDrawIcon() - */
  27. /*****************************************************************************/
  28. void myDrawIcon(HDC hDC, BOOL bErase)
  29. {
  30. INT i, x, y;
  31. RECT rect;
  32. DrawIcon(hDC, 0, 0, icon.hIcon);
  33. if((progress > 0) && !icon.flash)
  34. {
  35. i = progress-1;
  36. y = i/16;
  37. x = i%16;
  38. rect.left = 0;
  39. rect.top = 0;
  40. rect.right = 16*icon.dx;
  41. if(x < 16-1)
  42. rect.bottom = y*icon.dy;
  43. else
  44. rect.bottom = (y+1)*icon.dy;
  45. InvertRect(hDC, &rect);
  46. if(x < 16-1)
  47. {
  48. rect.left = 0;
  49. rect.top = y*icon.dy;
  50. rect.right = (x+1)*icon.dx;
  51. rect.bottom = (y+1)*icon.dy;
  52. InvertRect(hDC, &rect);
  53. }
  54. icon.last = progress;
  55. }
  56. }
  57. /*****************************************************************************/
  58. /* updateIcon() */
  59. /*****************************************************************************/
  60. void updateIcon()
  61. {
  62. INT i, x, y;
  63. HDC hDC;
  64. RECT rect;
  65. UpdateWindow(hItWnd); /* jtf 3.20 */
  66. hDC = GetDC(hItWnd);
  67. i = icon.last;
  68. y = i / 16;
  69. x = i % 16;
  70. while(i < progress)
  71. {
  72. rect.left = x*icon.dx;
  73. rect.top = y*icon.dy;
  74. rect.right = (x+1)*icon.dx;
  75. rect.bottom = (y+1)*icon.dy;
  76. InvertRect(hDC, &rect);
  77. i++;
  78. if(x < 16-1)
  79. x++;
  80. else
  81. {
  82. x = 0;
  83. if(y < 16-1)
  84. y++;
  85. else
  86. y = 0;
  87. }
  88. }
  89. icon.last = progress;
  90. ReleaseDC(hItWnd, hDC);
  91. }
  92. /*****************************************************************************/
  93. /* flashIcon() - */
  94. /*****************************************************************************/
  95. void flashIcon(BOOL bInitFlash, BOOL bEndProc)
  96. {
  97. HDC hDC;
  98. if(bEndProc)
  99. {
  100. progress = 0;
  101. icon.last = 0;
  102. }
  103. if (IsIconic (hItWnd))
  104. {
  105. if(icon.flash = bInitFlash)
  106. SetTimer(hItWnd, ID_FLASHEVENT, FLASH_ELAPSE, nextFlash);
  107. else
  108. KillTimer(hItWnd, ID_FLASHEVENT);
  109. myDrawIcon(hDC = GetDC(hItWnd), TRUE);
  110. ReleaseDC(hItWnd, hDC);
  111. }
  112. }