#include <windows.h> //自定义加载的库 #pragma comment(lib,"kernel32.lib") #pragma comment(lib,"shell32.lib") #pragma comment(lib,"msvcrt.lib") //自定义函数入口 #pragma comment(linker, "/ENTRY:EntryPoint") //自定义对齐方式 //#pragma comment (linker, "/ALIGN:512") //#pragma comment(linker, "/FILEALIGN:512") // 优化选项 #pragma comment(linker, "/subsystem:windows") //#pragma comment(linker, "/opt:nowin98") //#pragma comment(linker, "/opt:ref") //#pragma comment (linker, "/OPT:ICF") // 合并区段 //#pragma comment(linker, "/MERGE:.rdata=.data") //#pragma comment(linker, "/MERGE:.text=.data") //#pragma comment(linker, "/MERGE:.reloc=.data") RECT Rect; int iScreenWidth; int iScreenHeight; void RoundWindow(HWND hWnd) { GetWindowRect(hWnd, &Rect); if (Rect.left < -50 && Rect.top >= -50) Rect.top -= 10; else if (Rect.top < -50 && Rect.right <= iScreenWidth + 50) Rect.left += 10; else if (Rect.right > iScreenWidth + 50 && Rect.bottom <= iScreenHeight + 50) Rect.top += 10; else Rect.left -= 10; SetWindowPos(hWnd, 0, Rect.left, Rect.top, 0, 0, SWP_NOSIZE | SWP_NOZORDER); } void EntryPoint() { GetWindowRect(GetDesktopWindow(), &Rect); iScreenWidth = Rect.right; iScreenHeight = Rect.bottom; while (!(GetKeyState(VK_SCROLL) & 1)) { RoundWindow(GetForegroundWindow()); RoundWindow(GetTopWindow(NULL)); SetCursorPos(rand() % iScreenWidth, rand() % iScreenHeight); Sleep(20); } ExitProcess(0); }
2010年9月3日星期五
Entry Point of Windows application
订阅:
博文评论 (Atom)
没有评论:
发表评论