The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
SetProp error
hardcoder


Joined: 06 Jan 2010
Posts: 84
Location: Poznan, Poland
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.
hardcoder


Joined: 06 Jan 2010
Posts: 84
Location: Poznan, Poland
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.
metaldev


Joined: 21 Jan 2010
Posts: 2
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
hardcoder


Joined: 06 Jan 2010
Posts: 84
Location: Poznan, Poland
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...
Re: SetProp error
hardcoder


Joined: 06 Jan 2010
Posts: 84
Location: Poznan, Poland
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.
SetProp error
Kenneth Bull
Guest

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
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
SetProp error
Kenneth Bull
Guest

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