#include <windows.h>
#include <stdlib.h>
#include <math.h>
#define PI 3.14
#define NUMBER_OF_ROTATE 3
double DegreeToRadian(double deg)
{
return deg * (PI / 180.0);
}
void TurnWindow(HWND hWnd)
{
int nWidth = GetSystemMetrics(SM_CXSCREEN);
int nHeight = GetSystemMetrics(SM_CYSCREEN);
double r = nHeight/4;
for (int i = 0; i < 360*NUMBER_OF_ROTATE; i+=1) {
double radian = DegreeToRadian(i);
double x = r * cos(radian) + nWidth/2;
double y = r * sin(radian) + nHeight/2;
SetForegroundWindow(hWnd);
MoveWindow(hWnd, (int)x, (int)y, 300, 300, TRUE);
Sleep(5);
}
}
BOOL CALLBACK WndEnumProc(HWND hWnd, LPARAM)
{
char szClassName[256];
::GetClassNameA(hWnd, szClassName, _countof(szClassName));
if (::lstrcmpiA(szClassName, "NOTEPAD") == 0) {
TurnWindow(hWnd);
}
return TRUE;
}
int main()
{
WinExec("notepad", SW_SHOW);
::EnumWindows(WndEnumProc, 0);
return 0;
}
如果文章或资源对您有帮助,欢迎打赏作者。一路走来,感谢有您!
txttool.com 说一段 esp56物联 查询128 IP查询