MFC实现 MSN QQ 窗口抖动

 

终于成功了,研究了一上午,呵呵

水平低,实现这么点小功能也蛮有成就感的,一定得加到我毕业设计里

嘿嘿

好了 代码贴出来

说实话这方法我自己都感觉好笨

哪位高手有好方法的,还请指教

void CWindouDlg::OnButton1()
{
 // TODO: Add your control notification handler code here

PlaySound(MAKEINTRESOURCE(IDR_WAVE1),AfxGetResourceHandle(),SND_ASYNC|
    SND_RESOURCE|SND_NODEFAULT);//使用PlaySound需要包含头文件Header: Declared in mmsystem.h.
                                //Import Library: Use winmm.lib.

 int ty=7;
 CRect   m_rect;  
 GetWindowRect(&m_rect);  
 for(int i=0;i<70;i++)
 {
 SetWindowPos( NULL,m_rect.left,m_rect.top,0,0,SWP_NOSIZE );
  m_rect.top = m_rect.top + ty; 
  m_rect.left = m_rect.left - ty;
  SetWindowPos( NULL,m_rect.left,m_rect.top,0,0,SWP_NOSIZE );
  m_rect.top = m_rect.top - ty; 
  m_rect.left = m_rect.left + ty;
  SetWindowPos( NULL,m_rect.left,m_rect.top,0,0,SWP_NOSIZE );
  m_rect.top = m_rect.top - ty; 
  m_rect.left = m_rect.left + ty;
  SetWindowPos( NULL,m_rect.left,m_rect.top,0,0,SWP_NOSIZE );
  m_rect.top = m_rect.top + ty; 
  m_rect.left = m_rect.left - ty;
  SetWindowPos( NULL,m_rect.left,m_rect.top,0,0,SWP_NOSIZE );
 }
}

吃饭的时候又想了想回来又弄了一下,比上午弄的那个更像MSN 和QQ了 嘿嘿 代码差不多

 int ty=5;
 CRect   m_rect;  
 GetWindowRect(&m_rect); 
 int recordy=m_rect.left;
 int recordx=m_rect.top;

for(int i=0;i<3;i++)
 {
    m_rect.left=recordy;
    m_rect.top=recordx;
    m_rect.top = m_rect.top + ty; 
    m_rect.left = m_rect.left - ty;
    SetWindowPos( NULL,m_rect.left,m_rect.top,0,0,SWP_NOSIZE );Sleep(35);
    m_rect.top = m_rect.top -ty;
    SetWindowPos( NULL,m_rect.left,m_rect.top,0,0,SWP_NOSIZE );Sleep(35);
    m_rect.top = m_rect.top -2*ty;
    SetWindowPos( NULL,m_rect.left,m_rect.top,0,0,SWP_NOSIZE );Sleep(35);
    m_rect.left=m_rect.left+ty;
    SetWindowPos( NULL,m_rect.left,m_rect.top,0,0,SWP_NOSIZE );Sleep(35);
    m_rect.left=m_rect.left+2*ty;
    SetWindowPos( NULL,m_rect.left,m_rect.top,0,0,SWP_NOSIZE );Sleep(35);
    m_rect.top = m_rect.top + ty; 
    SetWindowPos( NULL,m_rect.left,m_rect.top,0,0,SWP_NOSIZE );Sleep(35);
    m_rect.top=m_rect.top+2*ty;
    SetWindowPos( NULL,m_rect.left,m_rect.top,0,0,SWP_NOSIZE );
    SetWindowPos( NULL,recordy,recordx,0,0,SWP_NOSIZE );
    Sleep(35);
  }

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值