模拟QQ窗口抖动效果(通过MoveWindow和Sleep进行模拟)

[cpp] view plain copy
 
  1. RECT rtWindow;  
  2.     GetWindowRect(&rtWindow);  
  3.     //long x = 400;  
  4.     //long y = 200;  
  5.     long x = rtWindow.left;  
  6.     long y = rtWindow.top;  
  7.     long cxWidth = rtWindow.right-rtWindow.left;  
  8.     long cyHeight = rtWindow.bottom-rtWindow.top;  
  9.     const long nOffset  = 9;  
  10.     const long SLEEP_INTERAL = 60;  
  11.       
  12.     for(long i=0; i<=2; ++i)  
  13.     {  
  14.         ::MoveWindow(m_hWnd, x+nOffset, y-nOffset, cxWidth, cyHeight, TRUE);  
  15.         ::Sleep(SLEEP_INTERAL);  
  16.         ::MoveWindow(m_hWnd, x-nOffset, y-nOffset, cxWidth, cyHeight, TRUE);  
  17.         ::Sleep(SLEEP_INTERAL);  
  18.         ::MoveWindow(m_hWnd, x-nOffset, y+nOffset, cxWidth, cyHeight, TRUE);  
  19.         ::Sleep(SLEEP_INTERAL);  
  20.         ::MoveWindow(m_hWnd, x+nOffset, y+nOffset ,cxWidth, cyHeight, TRUE);  
  21.         ::Sleep(SLEEP_INTERAL);  
  22.         ::MoveWindow(m_hWnd, x, y, cxWidth, cyHeight, TRUE);  
  23.         ::Sleep(SLEEP_INTERAL);  
  24.     }  

参考:http://www.rupeng.com/forum/thread-6423-1-1.html

http://blog.csdn.net/analogous_love/article/details/47979739

原文地址:https://www.cnblogs.com/findumars/p/7128402.html