[SDL] Event question

Robert Sadedin serenity at nosubstancesoftware.com
Wed Jul 31 00:00:01 PDT 2002


> > program that does SDL_Initialize()/SDL_Quit() and anything afterward
> > doesn't get executed.  Go figger.
> What version operating system and compiler are you using?  Can you post a
> minimal compilable example that I can use to replicate the problem?

Hi Sam -

Sorry for taking eons to get back to you. I'm using MSVC++ 6.0 (SP2) under
Windows 2000 and XP. Here's a quickie test program. I've found out (after
tracing through it) that the app is *NOT* quitting prematurely, rather my
MessageBox() commands aren't working. Here's the sample app:

#define PROGRAM_TITLE "Test"

int WINAPI WinMain(HINSTANCE eInst,
				   HINSTANCE ePreviousInstance,
				   LPSTR pu8CmdLine,
				   int s32CmdShow)
{
	int iReturn;

	SDL_Init(SDL_INIT_VIDEO);
	iReturn = MessageBox(NULL, (const char *) "After SDL_Init()", PROGRAM_TITLE, MB_ICONSTOP | MB_OK);
	SDL_SetVideoMode(640, 480, 16, SDL_HWSURFACE);
	iReturn = MessageBox(NULL, (const char *) "After SDL_SetVideoMode()", PROGRAM_TITLE, MB_ICONSTOP | MB_OK);
	SDL_QuitSubSystem(SDL_INIT_VIDEO);
	iReturn = MessageBox(NULL, (const char *) "After SDL_QuitSubSystem()", PROGRAM_TITLE, MB_ICONSTOP | MB_OK);
	SDL_Quit();
	iReturn = MessageBox(NULL, (const char *) "After SDL_Quit()", PROGRAM_TITLE, MB_ICONSTOP | MB_OK);
}

I get the message boxes after SDL_Init() and SDL_VideoMode(), however
after I do the SDL_QuitSubSystem(SDL_INIT_VIDEO), the "After
SDL_QuitSubSystem()" message box returns a 1 (IDOK) immediately. It never
displays the message box. Same deal after SDL_Quit(). The above example
uses a windowed display - it makes no difference if it's full screen or
windowed, but I'm running full screen with my game.

It's driving me a bit crazy, because I'd like to be able to get messages
back to my game players/beta testers after I've restored their desktop -
asserts and the like. If I just do a MessageBox() in the middle of the
game, most often the video mode causes it to be off the screen (I'm
running full screen, BTW).

Forgive me if this is Windows idiocy on my part, but I can't figure out
what's going on, or why SQL_QuitSubSystem()/SQL_Quit() causes me to no
longer be able to display message boxes.

Thanks in advance!

-->Neil

-------------------------------------------------------------------------------
Neil Bradley            What are burger lovers saying
Synthcom Systems, Inc.  about the new BK Back Porch Griller?
ICQ #29402898	        "It tastes like it came off the back porch." - Me





More information about the SDL mailing list