SDL Forum Index
SDL
Simple DirectMedia Layer Forums
Reply to topic
SetProp error
hardcoder


Joined: 06 Jan 2010
Posts: 84
Location: Poznan, Poland
Reply with quote
On Windows XP Home SP2, SDL_CreateWindow() returns with error:

SetProp() failed: illegal window entry

this is actually a translation from Dutch, so I am not sure if accurate.
View user's profileSend private message
hardcoder


Joined: 06 Jan 2010
Posts: 84
Location: Poznan, Poland
Reply with quote
I could really use some help here.

This happens on a remote machine and I can't do a real debugging on it.

Error seems to be caused by invalid hwnd passed to SetProp() function. This happens even with simplest possible SDL 1.3 appliaction that only creates a window. The only way to get around it is using SDL_CreateWindowFrom() and passing it a hwnd from explicit CreateWindowEX(). But this does not work correctly: window is created, d3d rendered is initialized correctly but not all textures are drawn.
View user's profileSend private message
metaldev


Joined: 21 Jan 2010
Posts: 2
Reply with quote
I get this too on Vista, but only in release mode...
i am also really stumped with this one.

the error is:

Quote:
Can't create window: SetProp() failed: Invalid window handle.


from the code:
Code:
   window=SDL_CreateWindow("SDL application",
      SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
      WINDOW_WIDTH, WINDOW_HEIGHT,
      SDL_WINDOW_RESIZABLE | SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN);
   if (window==0)
   {
      fprintf(stderr, "Can't create window: %s\n", SDL_GetError());
      Quit(1);
   }


using:
SDL 1.3
GeForce 6800M GT
VS 2008 Pro
Vista Home Basic SP2
View user's profileSend private messageVisit poster's website
hardcoder


Joined: 06 Jan 2010
Posts: 84
Location: Poznan, Poland
Reply with quote
metaldev wrote:
I get this too on Vista, but only in release mode...
i am also really stumped with this one.



Thanks for the info on build differences.

I can't reproduce this error on any of local machines therefore I am not able to properly debug that. Of course my other team member has this on all 3 machines...
View user's profileSend private message
Re: SetProp error
hardcoder


Joined: 06 Jan 2010
Posts: 84
Location: Poznan, Poland
Reply with quote
hardcoder wrote:
On Windows XP Home SP2, SDL_CreateWindow() returns with error:

SetProp() failed: illegal window entry

this is actually a translation from Dutch, so I am not sure if accurate.


This is what I got on Windows 7 64 bit:

Error creating window: SetProp() failed: Invalid window handle.

After a bit of research I discovered that it is this part of code from SDL_Win32Window.c
function WIN_CreateWindow() that changes and breaks hwnd value:

Code:

    /* we're configuring the tablet data. See Wintab reference for more info */
    if (videodata->wintabDLL
        && videodata->WTInfoA(WTI_DEFSYSCTX, 0, &lc) != 0) {
        lc.lcPktData = PACKETDATA;
        lc.lcPktMode = PACKETMODE;
        lc.lcOptions |= CXO_MESSAGES;
        lc.lcOptions |= CXO_SYSTEM;
        lc.lcMoveMask = PACKETDATA;
        lc.lcBtnDnMask = lc.lcBtnUpMask = PACKETDATA;
        videodata->WTInfoA(WTI_DEVICES, DVC_X, &TabX);
        videodata->WTInfoA(WTI_DEVICES, DVC_Y, &TabY);
        lc.lcInOrgX = 0;
        lc.lcInOrgY = 0;
        lc.lcInExtX = TabX.axMax;
        lc.lcInExtY = TabY.axMax;
        lc.lcOutOrgX = 0;
        lc.lcOutOrgY = 0;
        lc.lcOutExtX = GetSystemMetrics(SM_CXSCREEN);
        lc.lcOutExtY = -GetSystemMetrics(SM_CYSCREEN);
        if (window->id > highestId) {
            HCTX *tmp_hctx;
            highestId = window->id;
            tmp_hctx =
                (HCTX *) SDL_realloc(g_hCtx, (highestId + 1) * sizeof(HCTX));
            if (!tmp_hctx) {
                SDL_OutOfMemory();
                DestroyWindow(hwnd);
                return -1;
            }
            g_hCtx = tmp_hctx;
        }
        g_hCtx[window->id] = videodata->WTOpenA(hwnd, &lc, TRUE);
    }



when I commented it application finally works on many more test machines.
View user's profileSend private message
SetProp error
Kenneth Bull
Guest

Reply with quote
only way that would happen is if SDL_realloc() failed... is g_hCtx
initialized prior to running this code? Might it be 0 or an invalid
pointer? could window->id be a negative number?
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Re: SetProp error
hardcoder


Joined: 06 Jan 2010
Posts: 84
Location: Poznan, Poland
Reply with quote
Unfortunately I am not able to give more details atm. On my machine I don't have this problem but my 2 team members can't run my application and are getting this error. I just looked at the SDL code and commented a block I mentioned in previous post to try it if it was the part that changed hwnd value and it helped for them. I will try to provide more data. Any ideas what could be happening on their machines?

Kenneth Bull wrote:
only way that would happen is if SDL_realloc() failed... is g_hCtx
initialized prior to running this code? Might it be 0 or an invalid
pointer? could window->id be a negative number?
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
View user's profileSend private message
SetProp error
Kenneth Bull
Guest

Reply with quote
On 01/06/2010, hardcoder wrote:
Quote:
Unfortunately I am not able to give more details atm. On my machine I don't
have this problem but my 2 team members can't run my application and are
getting this error. I just looked at the SDL code and commented a block I
mentioned in previous post to try it if it was the part that changed hwnd
value and it helped for them. I will try to provide more data. Any ideas
what could be happening on their machines?

It sounds like the window is destroyed (or doesn't exist in the first
place) when SDL tries to add a property to the window. There is an
environment variable that causes SDL to attempt to use an existing
window instead of creating it's own. Maybe that environment variable
has been set on their machines... Look for SDL_WINDOWID. There are
other things that could cause this, but that's the easiest to fix
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
SetProp error
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT  
Page 1 of 1  

  
  
 Reply to topic