Thread: Fake Error Message

  1. #1
    Registered User
    Join Date
    Nov 2004
    Posts
    9

    Question Fake Error Message

    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?

  2. #2
    Toaster Zach L.'s Avatar
    Join Date
    Aug 2001
    Posts
    2,686
    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.
    The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.

  3. #3
    Magically delicious LuckY's Avatar
    Join Date
    Oct 2001
    Posts
    856
    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;
    }

  4. #4
    Toaster Zach L.'s Avatar
    Join Date
    Aug 2001
    Posts
    2,686
    Terrible, man... Just terrible...
    Code:
    #include <iostream>
    using namespace std;
    int main() {
      cout << "Uh, oh. Your operating system has been deleted." << endl;
      return 0;
    }
    The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.

  5. #5
    Registered User
    Join Date
    Sep 2004
    Posts
    719
    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
    i seem to have GCC 3.3.4
    But how do i start it?
    I dont have a menu for it or anything.

  6. #6
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,268
    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;
    }

  7. #7
    Magically delicious LuckY's Avatar
    Join Date
    Oct 2001
    Posts
    856
    Quote Originally Posted by Zach L.
    Terrible, man... Just terrible...
    Code:
    #include <iostream>
    using namespace std;
    int main() {
      cout << "Uh, oh. Your operating system has been deleted." << endl;
      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...

  8. #8
    Registered User
    Join Date
    Nov 2004
    Posts
    9
    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.....

  9. #9
    Registered User
    Join Date
    Sep 2004
    Posts
    719
    Quote Originally Posted by RadRacer
    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.....
    i have no problem with it....i think it's pretty funny.....i just might do it to one of my friends.....

    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
    i seem to have GCC 3.3.4
    But how do i start it?
    I dont have a menu for it or anything.

  10. #10
    Registered User
    Join Date
    Nov 2004
    Posts
    9
    Quote Originally Posted by misplaced
    i have no problem with it....i think it's pretty funny.....i just might do it to one of my friends.....

    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
    lol
    that would be hilarious!

  11. #11
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    Quote Originally Posted by misplaced
    i'm going to write a program that keeps setting this picture as his background
    ...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
    Try SystemParametersInfo() with SPI_SETDESKWALLPAPER.

  12. #12
    Registered User
    Join Date
    Sep 2004
    Posts
    719
    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.
    i seem to have GCC 3.3.4
    But how do i start it?
    I dont have a menu for it or anything.

  13. #13
    Registered User
    Join Date
    Sep 2004
    Posts
    719
    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);
    Last edited by misplaced; 11-18-2004 at 01:54 AM.
    i seem to have GCC 3.3.4
    But how do i start it?
    I dont have a menu for it or anything.

  14. #14
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    >>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.

    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;
    }
    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.
    Last edited by Hunter2; 11-18-2004 at 10:24 AM.
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  15. #15
    Registered User
    Join Date
    Nov 2004
    Posts
    9
    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!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Fake keystrokes to another process
    By Nota in forum Windows Programming
    Replies: 20
    Last Post: 01-26-2009, 11:56 PM
  2. Fake spyware
    By hdragon in forum Tech Board
    Replies: 19
    Last Post: 01-12-2006, 11:44 AM
  3. Making a fake soundcard
    By johny145 in forum Windows Programming
    Replies: 3
    Last Post: 11-03-2005, 09:26 AM
  4. Eerie ghost movie (real or fake?)
    By anonytmouse in forum A Brief History of Cprogramming.com
    Replies: 27
    Last Post: 11-11-2004, 09:28 PM
  5. Pass Fake Keystrokes to 3'rd Party Application
    By Jattie in forum Windows Programming
    Replies: 11
    Last Post: 10-31-2002, 06:53 PM