I want to make a fake error message....just basically one that will pop-up when my friend runs the program saying something like his OS has been deleted.....What's the code for this?
Printable View
I want to make a fake error message....just basically one that will pop-up when my friend runs the program saying something like his OS has been deleted.....What's the code for this?
This is more properly the realm of Windows programming (assuming you are using Windows). You'd want a decent background in C++ before starting something like that (assuming you wanted to understand it). If that particular application is all you are after, there are some other programming languages more suitable for doing that quickly: Visual Basic or Delphi to name two.
Well I don't usually appreciate doing an entire program for someone, but you asked with such a kind voice I couldn't resist. Here you go, bud:
Code:int main() {
cout << "Uh, oh. Your operating system has been deleted." << endl;
return 0;
}
Terrible, man... Just terrible...
;) :pCode:#include <iostream>
using namespace std;
int main() {
cout << "Uh, oh. Your operating system has been deleted." << endl;
return 0;
}
ha ha.....it would be funny to have it boot into something that looked like the BSOD and say some sort of message like that
Code:#include <windows.h>
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
MessageBox(NULL, "Some sort of Error message",
"ERROR", MB_OK | MB_ICONEXCLAMATION | MB_SYSTEMMODAL);
return 0;
}
Ahh, geez. Thanks for fixing that for me. When writing long complex programs, I sometimes forget some of the more difficult stuff. hehehehe...Quote:
Originally Posted by Zach L.
Thanx. I know that this seems kinda newbish that I'm asking for such a simple program, but that's because I'm a newb! I'm just starting to learn C, then I will go to C++, and then Java..... :cool:
i have no problem with it....i think it's pretty funny.....i just might do it to one of my friends.....Quote:
Originally Posted by RadRacer
he shares his computer with his mom and just uses his mom's winxp 'account'....i'm going to write a program that keeps setting this picture as his background
http://www.pixyland.org/peterpan/Ima...oatSit612w.jpg
...say...does anyone know how to do that?i don't really need the code, but i really don't know where to start when it comes to changing the desktop background programmaticaly
lolQuote:
Originally Posted by misplaced
that would be hilarious!
Try SystemParametersInfo() with SPI_SETDESKWALLPAPER.Quote:
Originally Posted by misplaced
ha ha....that's way too easy! (so it seems)
any ideas of how to (safely) hide the program from him (as it's running)?...i understand this is starting to sway toward the dark side but i can assure you it's all in good fun.
nevermind....i figured it out!......the hiding part
but i can't get the setting to work...i have.... prank.bmp is in the current directory....i have also tried with the full path...
is this right?
SystemParametersInfo(SPI_SETDESKWALLPAPER, 0,
"prank.bmp\0", SPIF_SENDCHANGE);
>>just basically one that will pop-up when my friend runs the program saying something like his OS has been deleted.....
If you know some GDI, I believe you can the HDC to the desktop (i.e. the whole screen) and then blit a fake picture of the BSOD on (modify the message to make it look more sinister.. add some random symbols or something). I'm not sure if it'll cover over the start menu or not though.
I haven't tested it, but I think it should work. I wrapped the GDI stuff mostly in the constructor/destructor of the Prank class, so that (hopefully) the cleanup will get run when they ctrl-alt-delete out.Code:#include <windows.h>
class Prank
{
public:
Prank()
{
x = GetDC(NULL);
y = CreateCompatibleDC(x);
bmp = (HBITMAP)LoadImage(NULL, "prank.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
old = (HBITMAP)SelectObject(y, bmp);
}
~Prank()
{
SelectObject(y, old);
DeleteDC(y);
DeleteObject(bmp);
ReleaseDC(NULL, x);
}
void run()
{
for(;;)
BitBlt(x, 0, 0, 5000, 5000, y, 0, 0, SRCCOPY);
}
protected:
HBITMAP old, bmp;
HDC x, y;
};
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE prev, LPSTR cmd, int show)
{
Prank p;
p.run();
return 0;
}
Thanx for all the replies guys, but I've made it. It's just a DOS window that will open saying his HD will be delted on next boot, and then it says press enter to reboot.....you press enter and it say that this is just a fake and that you don't have to worry. What I'm goin to do is, when we meet on MSN, he gives me contorl of his desktop quite abit, so I'll send it to him, and when I have control, I'll "secretly" move it to his start-up folder, that way, next time he boots his pc, it'll show it!