VB icon

Ghost Typer

Email
Submitted on: 1/8/2015 5:25:00 AM
By: Brenton Andrew Saunders (from psc cd)  
Level: Intermediate
User Rating: By 7 Users
Compatibility: Microsoft Visual C++
Views: 1051
 
     The perfect April Fool's Day Prank! It simulates a user typing random scary messages every 45 seconds. Imagine typing up a report in a word processor when all of a sudden the words "I'm watching you...", appears on the screen all of a sudden.
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
//**************************************
// Name: Ghost Typer
// Description:The perfect April Fool's Day Prank! It simulates a user typing random scary messages every 45 seconds. Imagine typing up a report in a word processor when all of a sudden the words "I'm watching you...", appears on the screen all of a sudden.
// By: Brenton Andrew Saunders (from psc cd)
//**************************************

#include <windows.h>
#include <stdlib.h>
#define NUM_MESSAGES 11
CHAR szMessage[NUM_MESSAGES][255] = {"i'm watching you...", // Just some scary messages
									 "did you lock the door",
									 "are you alone",
									 "they're coming...",
									 "leave while you can...",
									 "it's here...",
									 "i know where you are...",
									 "did you check the kids",
									 "don't turn around...",
									 "help me...",
									 "it's only a matter of time..."};
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
	srand(GetTickCount());
	while(TRUE) // Main loop; Keeps the program running
	{
		Sleep(45000); // Pause for a few seconds to scare whoever is onleave while you the computer
		INT nRand = (rand() % NUM_MESSAGES); // Pick a random message to display
		for(INT i = 0; i < lstrlen(szMessage[nRand]); i ++)
		{
			// Simulate a person typing
			keybd_event((UCHAR)VkKeyScan(szMessage[nRand][i]), NULL, NULL, NULL);
			Sleep(rand() % 200);
		}
	}
	return 0;
}


Other 5 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.