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 窗口抖动的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 推荐常用算法之-基于内容的推荐(转自-B
- 下一篇: SiamMask:视频跟踪最高精度 (中