Microsoft XNA is a set of tools with a managed runtime environment provided by Microsoft that facilitates video game development and management. XNA attempts to free game developers from writing "repetitive boilerplate code" and to bring different aspects of game production into a single system.

Post tutorial Report article RSS Feed XNA Tutorial - Showing a Message Box (Using the Guide Class)

This is a tutorial for showing a Message Box, in XNA, using the Guide class.

Posted by gamenew09 on Dec 15th, 2012
Intermediate Other.

This tutorial for XNA is showing a Xbox/Windows Default Message Box.

Anyways, to start this off you need XNA. Then create a XNA game project, and then put the following in the game constructor:

public Game1()
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            Components.Add(new GamerServicesComponent(this));

The "Components.Add(new GamerServicesComponent(this));" allows you to access the Guide class which allows you to see if the game is in trial mode or show the message dialog that we're showing.

Now add this where you want to show you're message box:

//This below is required paste it somewhere.
protected static void GetMBResult(IAsyncResult r)
   int? b = Guide.EndShowMessageBox(r);

//Add everything below when you want to show the message box
List<string> MBOPTIONS = new List<string>();
Guide.BeginShowMessageBox("Temp", "Stuff", MBOPTIONS, 0, MessageBoxIcon.None, GetMBResult, null);

It should show the message box when the condition happens.
Thanks for reading!

Post a Comment
click to sign in

You are not logged in, your comment will be anonymous unless you join the community today (totally free - or sign in with your social account on the right) which we encourage all contributors to do.

2000 characters limit; HTML formatting and smileys are not supported - text only

Windows, Mobile, X360
Send Message
Public Domain
Release Date
Released Dec 2006
Engine Watch
Track this engine
Report Abuse
Report article
Related Engines
XNA Public Domain Released Dec 2006
Related Groups
Microsoft Game Studios
Microsoft Game Studios Developer & Publisher with 12 members