欢迎访问 生活随笔!

生活随笔

当前位置: 首页 > 编程资源 > 编程问答 >内容正文

编程问答

MFC实现 MSN QQ 窗口抖动

发布时间:2025/3/15 编程问答 26 豆豆
生活随笔 收集整理的这篇文章主要介绍了 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);
  }

总结

以上是生活随笔为你收集整理的MFC实现 MSN QQ 窗口抖动的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。