c语言小爱心代码

308 阅读1分钟

#include <stdio.h> #include <windows.h> #include <commctrl.h>

#pragma comment( linker, "/subsystem:"windows" /entry:"mainCRTStartup"" ) int main() { HWND hwnd; hwnd=FindWindow("ConsoleWindowClass",NULL); if(hwnd) { ShowWindow(hwnd,SW_HIDE); } HWND mgHwnd = FindWindowA("Progman","Program Manager");
HWND bzHwnd = FindWindowExA(mgHwnd,0,"SHELLDLL_DefView",0);
HWND tbHwnd = FindWindowExA(bzHwnd, 0, "SysListView32","FolderView");
int count = SendMessageA(tbHwnd,LVM_GETITEMCOUNT,0,0);
for(int i=0;i<count;i++) SendMessageA(tbHwnd,LVM_SETITEMPOSITION, i, (100 << 16) + -100);

POINT arr[14] = { {868, 316}, { 730,207 }, { 591,221 },{ 515,327 },{ 542,469 },
{ 610,624 },{ 723,746 }, { 870,814 },{ 1012,744 },{ 1130,626 },
{ 1219,485 }, { 1225,328 },{ 1156,225 }, { 1012,217 } };
	
POINT temp;
while (1)
{
	for (int i = 0; i < count; i++) {
		if (i < 14)
			SendMessageA(tbHwnd, LVM_SETITEMPOSITION, i, (arr[i].y << 16) + arr[i].x);
		else
			SendMessageA(tbHwnd, LVM_SETITEMPOSITION, i, -100);
	}

	temp.x = arr[13].x;
	temp.y = arr[13].y;
	//13-1
	for (int i = 13; i > 0; i--)
	{
		arr[i].x = arr[i - 1].x;
		arr[i].y = arr[i - 1].y;
	}
	arr[0].x = temp.x;
	arr[0].y = temp.y;

	Sleep(50);
}

return 0;

}