Advertisement
Guest User

wndproc

a guest
Oct 20th, 2018
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.45 KB | None | 0 0
  1. case WM_TIMER:
  2. {
  3.     if (wp == timerIdWindowUpdate)
  4.     {
  5.         WINDOWPLACEMENT windowPlacement = { sizeof(WINDOWPLACEMENT), };
  6.         if (::GetWindowPlacement(cmdHanlde, &windowPlacement))
  7.         {
  8.             if (windowPlacement.showCmd == SW_SHOWMINIMIZED
  9.                 || !IsWindowVisible(cmdHanlde))
  10.             {              
  11.                 ShowWindow(hwnd,SW_HIDE);
  12.             }
  13.             else
  14.             {
  15.                 RECT rect = {};
  16.                 ::GetWindowRect(cmdHanlde, &rect);
  17.                 MONITORINFO monInfo;
  18.                 monInfo.cbSize = sizeof(MONITORINFO);
  19.                 GetMonitorInfoW(MonitorFromWindow(cmdHanlde, MONITOR_DEFAULTTONEAREST), &monInfo);
  20.                 if (cmdHanlde != NULL && ::IsZoomed(cmdHanlde))
  21.                 {
  22.                     rect.left = monInfo.rcWork.left;
  23.                     rect.top = monInfo.rcWork.top;
  24.                     rect.bottom = monInfo.rcWork.bottom > rect.bottom ? rect.bottom : monInfo.rcWork.bottom;
  25.                     rect.right = monInfo.rcWork.right > rect.right ? rect.right : monInfo.rcWork.right;
  26.                 }
  27.                
  28.                 ::SetWindowPos(hwnd, cmdHanlde, rect.left-4, rect.top-4, rect.right + 8 - rect.left, rect.bottom + 8 - rect.top,
  29.                     SWP_SHOWWINDOW );
  30.                
  31.                
  32.  
  33.             }
  34.         }
  35.     }
  36.     else if (wp == timerIdFrameColor)
  37.     {
  38.         tick = !tick;
  39.         ::RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE);
  40.     }
  41.     break;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement