How to show error messages with SDL...

This is a discussion on How to show error messages with SDL... within the C++ Programming forums, part of the General Programming Boards category; How can I open windows to show errors while using SDL? I know that with GDI you can simply call ...

  1. #1
    Registered User
    Join Date
    Apr 2007
    Posts
    55

    How to show error messages with SDL...

    How can I open windows to show errors while using SDL? I know that with GDI you can simply call MessageBox(), I want something similar with SDL.

  2. #2
    Registered User
    Join Date
    Apr 2007
    Location
    Sweden
    Posts
    41
    You could always use the Windows API MessageBox() function directly (through windows.h), if you don't care about platform independency. For example:
    Code:
    #include <windows.h>
    #include <SDL.h>
    
    int main(int argc, char* argv[])
    {
        if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_AUDIO) != 0)
        {
            MessageBox(NULL, "Could not initialize SDL.", "Error", MB_OK | MB_ICONERROR);
            return 1;
        }
    
        // code
    
    }
    A portable way would be to use SDL in conjunction with wxWidgets, although I am not certain exactly how you would do that (haven't tried it myself).

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. I can't make bmp image files show up in an SDL window
    By Lucas89 in forum Game Programming
    Replies: 5
    Last Post: 05-25-2009, 01:04 PM
  2. Problems compiling this SDL app
    By Rider in forum C++ Programming
    Replies: 3
    Last Post: 03-27-2007, 12:22 PM
  3. SDL and MinGW Studio
    By Vicious in forum Tech Board
    Replies: 0
    Last Post: 07-30-2004, 09:59 PM
  4. SDL and Windows
    By nickname_changed in forum Windows Programming
    Replies: 14
    Last Post: 10-24-2003, 12:19 AM
  5. sdl in c++
    By Klinerr1 in forum C++ Programming
    Replies: 8
    Last Post: 07-07-2002, 07:46 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21