-
SDL & Win32 in Vista
Hi
I've done an application using SDL and Win32 which runs fine in Windows XP but when running it in Vista it closes immediately during startup.
Heres the code used to start the application and initialize SDL & Win32:
Code:
try
{
char *msg;
int done;
SDL_Init(SDL_INIT_VIDEO);
TTF_Init();
atexit(SDL_Quit);
screen = SDL_SetVideoMode(800, 600, 32, SDL_SWSURFACE | SDL_HWSURFACE);
cur_hand = init_system_cursor(hand);
cur_orig = SDL_GetCursor();
SDL_SetCursor(cur_orig);
SDL_WM_SetCaption("Gallery Viewer 1.0", NULL);
loadBinaryFile(&dataHeader);
pages = dataHeader.pictures / 8;
if(((float)dataHeader.pictures / 8) > (float)(dataHeader.pictures / 8))
pages ++;
// Load Thumbnails
for(int i = 0; i < dataHeader.pictures; i++)
{
loadImage(i, &dataHeader.thumbs[i], "thumbs.bin");
}
hhkLowLevelKybd = SetWindowsHookEx(WH_KEYBOARD_LL, LowLevelKeyboardProc, hThisInstance, 0);
done = 0;
draw ();
while(!done)
{
SDL_Event event;
while (SDL_PollEvent(&event))
{
switch (event.type)
{
case SDL_MOUSEMOTION:
mouseX = event.motion.x;
mouseY = event.motion.y;
checkHover();
break;
case SDL_MOUSEBUTTONDOWN:
clicked = true;
break;
case SDL_MOUSEBUTTONUP:
if(clicked) checkAreaClick();
clicked = false;
break;
case SDL_QUIT:
done = 1;
break;
default:
break;
}
}
Sleep(50);
}
SDL_Quit();
return 0;
}
catch(std::exception e)
{
exit(0);
}
Any ideas why this code causes problems in Vista?
Thanks
// Lasse
-
Re: SDL & Win32 in Vista
Anyone have any ideas? I really need to fix this problem.
Thanks
// Lasse
-
Re: SDL & Win32 in Vista
Where you able to use debugger and see where it was stopping execution and exiting?
-
Re: SDL & Win32 in Vista
Since I don't have any computer with Vista I can't get the error myself. The person I'm making the application for is running Vista and he was the one that found out that it wasn't working.
He just said that the window just blinked during the startup.
If anyone runs Vista and could debug it for me I would appreciate it.
-
Re: SDL & Win32 in Vista
For start i would comment out the thumbnail stuff and mouse events.
Then i would run it again, too see it runs or not.
If it runs then i would start looking the code i commented out.
What the: atexit(SDL_Quit); does below the TTF_Init() ??
-
Re: SDL & Win32 in Vista
I would do it if I had a computer running Vista. Since it works fine on XP I can't debug it on my own.
atexit(SDL_QUIT); just sets how SDL should handle exit requests.
Thanks
// Lasse
-
Re: SDL & Win32 in Vista
Tell him to start the program as Administrator to rule out UAC problems.
-
Re: SDL & Win32 in Vista
He have tried running it as administrator.
-
Re: SDL & Win32 in Vista
I developed an SDL game without issues on Vista so it's most likely not due to the OS being Vista though I'm not exactly sure what the problem is.
-
Re: SDL & Win32 in Vista
Thanks for the info, will look after something else that may cause the error.
-
Re: SDL & Win32 in Vista
Solved it, it was the free command that caused the problem.
Thanks for all the help
// Lasse