/* Name: mouseloop Author: cLx Description: Fait un wrap de la souris sur les bords de l'ecran. Date: 26/09/04 19:31 Copyright: http://clx.freeshell.org/ */ #include <windows.h> int main(void) { POINT pt; bool rool; int width, height; if(!GetSystemMetrics(SM_MOUSEPRESENT)) { MessageBox (NULL, "A mouse is required for this program. :)" , "Error", MB_ICONHAND); return 1; } width = GetSystemMetrics(SM_CXSCREEN) - 2; height = GetSystemMetrics(SM_CYSCREEN) - 2; while(1){ GetCursorPos(&pt); if (pt.x < 1) { pt.x = width; rool = true; } else if (pt.x > width) { pt.x = 1; rool = true; } if (pt.y < 1) { pt.y = height; rool = true; } else if (pt.y > height) { pt.y = 1; rool = true; } if (rool) { SetCursorPos(pt.x, pt.y); rool = false; } Sleep(20); } return 0; }