Jump to content

Error Window


Recommended Posts

How can I make an error/alert window in C/++? I'm making a little prank for my friend to use on his parents("WARNING: Error of type: ID-10-T has occured. Please call HP Tech Support immediately!"), whom aren't very smart when it comes to computers. And, I think the guys at TS need a laugh :D.

 

 

 

Google hasn't turned up much... where art god of coding, Markie?

Share this post


Link to post
Share on other sites

MessageBox() is probably suitable for what you need.

 

http://msdn.microsoft.com/library/default..../messagebox.asp

 

If you're unable to understand that, something along the lines of:

 

MessageBox(NULL, "Message Text Here", "Window Title Here", MB_OK | MB_ICONWARNING);

 

Should work..

 

EDIT:

Google hasn't turned up much... where art god of coding, Markie?

 

:lol: just noticed that. I had an "Algorithms and Datastructures" exam yesterday, so I kinda didn't look at the forums much. Got home and played games for the remaineder of my day :)

Share this post


Link to post
Share on other sites

Ok, tried that and it worked using only windows.h for an include :D. However, a DOS window also pops up... any idea on how to get rid of that?

 

#include <windows.h>


bool i = false;

int main()
{
    while(i == false)
    {
    
         MessageBox(NULL, "WARNING! Error of type ID-10-T\nhas occured! Contact HP tech support ASAP!\n", "ERROR", MB_OK | MB_ICONWARNING);
    }    
    return 0;
    
}

Share this post


Link to post
Share on other sites

In old pal Dev-C++ if you go to...

 

Project -> Project Options -> Compiler -> Linker

 

There should be an option there called... "Do not create console window". Try sticking that to "Yes".

Share this post


Link to post
Share on other sites

Yay! Thank you, oh God of coding, the boo of markies!

477802[/snapback]

 

:lol: quite alright old chap, a.k.a you're welcome.

 

By the way, that executable is quite large. Have you got debugging stuff turned on or something??

Share this post


Link to post
Share on other sites

No... I blame windows.h.

477810[/snapback]

 

Nice idea, but... sadly isn't windows.h :P Nothing but MessageBox() and windows.h here is 14k. I reckon you may have debugging turned on somewhere!

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...