Hi all
My friend sent me this C++ program that opens up notepad and starts typing, its a joke he made to scare his little brother, I tried to modify it to display more of the message "Im watching you" but when I do it wont compile and I dont understand the error message, Im a noob lol
Heres the code all I did was copy and paste the spooky message a few more times underneath the original spooky messages, so instead of displaying the message 4 times it displayed it 6 times
#include <windows.h>
#include <cstdlib>
using namespace std;
int main(int argc,char *argv[])
{
//hides your program from the desktop
HWND hwnd1 = FindWindow(NULL,argv[0]);
ShowWindow(hwnd1,SW_HIDE);
//array for your messge
char text[75]= {'i','m',' ','w','a','t','c','h','i','n','g'
,' ','y','o','u','.','.','.'
,' ','i','m',' ','w','a','t','c','h','i','n','g'
,' ','y','o','u','.','.','.'
,' ','i','m',' ','w','a','t','c','h','i','n','g'
,' ','y','o','u','.','.','.'
,' ','i','m',' ','w','a','t','c','h','i','n','g'
,' ','y','o','u','.','.','.'};
//this allows your program to execute a minute later
Sleep(15000);
//plays the scary file - must link libwinmm.a
PlaySound("C:/scary1.wav",NULL, SND_FILENAME);
//Sleep(3000);
//opens Microsoft Word
ShellExecute(NULL, "open","C:/WINDOWS/system32/notepad.exe"
, NULL, NULL, SW_SHOWNORMAL);
HWND hwnd2= FindWindow(NULL,"Untitled - Notepad");
//makes Word the active window
SetActiveWindow(hwnd2);
Sleep(2000);
//simulates a mouse left click
mouse_event(MOUSEEVENTF_LEFTDOWN,200,200,0,0);
mouse_event(MOUSEEVENTF_LEFTUP,200,200,0,0);
// Sleep(1000);
//writes your scary message
for(int i=0;i<75;i++){
keybd_event(VkKeyScan(text[i]),0,0,0);
Sleep(rand() %200);
}
return 0;
}
Many thanks
HLA91