Mouse Prank in C++

» 07 July 2012 » In C/C++, Programming »

Hooray for the new post. This post was actually a draft way back 2011. But hopefully, i’ll be motivated and keep on posting. I have many tricks to share!

Several years ago, me and my mates were having fun writing prank codes. I can barely remember them all, but here’s one.

One of the main reason why to code is fun. Of course, we all do want to have some fun. I’ll show and explain how to write a simple C++ program that will add weight to the cursor, making it difficult to use. Here’s the function that does the trick:

void heavyCursor(int weight) {
	POINT cPos;

	while (1) {
		GetCursorPos (&cPos);
		int x = cPos.x;
		int y = cPos.y;

		y += weight;

		SetCursorPos(x,y);
		Sleep(5);
	}
}

To clarify, yes it is an endless loop. This code will continually add points in the y axis and resets the cursor position in the screen. This will be fun, but very hard to stop. Sometimes it’s fun watching your friend struggle on reaching Task Manager just to stop this little program.

Tags: , , ,

Trackback URL

  • Imat90594

    patesting. imat here :D

    • Imat90594

      wahhh..eto gusto ko mangyre sa website ko :D

  • http://www.junocrates.co.uk/handling-equipment-rental Yvette Gilmore

    Coding is complicated. But yea it can be really fun. I once made some prank codes too. Should try this one. Hopefully it’ll work.