void Move()
{
srand((unsigned)time(NULL));
HWND hWnd = ::AfxGetMainWnd()->GetSafeHwnd();
RECT rcOld, rcNew;
::GetWindowRect(hWnd, &rcOld);
::memcpy(&rcNew, &rcOld, sizeof(RECT));
int iWidth = rcOld.right-rcOld.left;
int iHeight = rcOld.bottom-rcOld.top;
int x = 0, y = 0;
for (int i =0; i<80; i++)
{
x = rand()%60-30;
y = rand()%60-30;
::MoveWindow(hWnd, rcNew.left+x, rcNew.top+y, iWidth, iHeight, TRUE);
}
::MoveWindow(hWnd, rcOld.left, rcOld.top, iWidth, iHeight, TRUE);
}
本文为“技术点滴”的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。