终于成功了,研究了一上午,呵呵
水平低,实现这么点小功能也蛮有成就感的,一定得加到我毕业设计里
嘿嘿
好了 代码贴出来
说实话这方法我自己都感觉好笨
哪位高手有好方法的,还请指教
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);
}
1580

被折叠的 条评论
为什么被折叠?



