-
December 18th, 2007, 02:06 AM
#1
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
-
December 22nd, 2007, 08:10 PM
#2
Re: SDL & Win32 in Vista
Anyone have any ideas? I really need to fix this problem.
Thanks
// Lasse
-
December 22nd, 2007, 10:26 PM
#3
Re: SDL & Win32 in Vista
Where you able to use debugger and see where it was stopping execution and exiting?
-
December 23rd, 2007, 01:43 AM
#4
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.
-
December 23rd, 2007, 04:14 PM
#5
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() ??
Last edited by BytePtr; December 23rd, 2007 at 04:17 PM.
Rate my post if i it was useful!
-
December 23rd, 2007, 08:09 PM
#6
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
-
December 23rd, 2007, 08:33 PM
#7
Re: SDL & Win32 in Vista
Tell him to start the program as Administrator to rule out UAC problems.
-
December 24th, 2007, 05:14 AM
#8
Re: SDL & Win32 in Vista
He have tried running it as administrator.
-
December 24th, 2007, 07:17 AM
#9
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.
-
December 24th, 2007, 09:29 AM
#10
Re: SDL & Win32 in Vista
Thanks for the info, will look after something else that may cause the error.
-
January 8th, 2008, 04:51 AM
#11
Re: SDL & Win32 in Vista
Solved it, it was the free command that caused the problem.
Thanks for all the help
// Lasse
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|